-rw-r--r-- | kdepim-desktop.pro | 6 | ||||
-rw-r--r-- | kmicromail/composemail.cpp | 52 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.h | 1 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 4 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 6 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 46 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 1 | ||||
-rw-r--r-- | kmicromail/qpe/global.cpp | 6 | ||||
-rw-r--r-- | kmicromail/qpe/qdialog.h | 4 | ||||
-rw-r--r-- | kmicromail/qpe/qdialog_hacked.cpp | 6 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 35 |
13 files changed, 107 insertions, 62 deletions
diff --git a/kdepim-desktop.pro b/kdepim-desktop.pro index 6d04a45..b0d60b7 100644 --- a/kdepim-desktop.pro +++ b/kdepim-desktop.pro | |||
@@ -1,6 +1,8 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | TEMPLATE = subdirs | 3 | TEMPLATE = subdirs |
4 | SUBDIRS = libical libkcal kabc libkdepim microkde kmicromail/libetpan kmicromail/libmailwrapper kmicromail korganizer kaddressbook kabc/plugins/file kabc/plugins/dir kabc/plugins/file kabc/plugins/qtopia gammu/emb/common gammu/emb/gammu pwmanager/libcrypt/cipher pwmanager/libcrypt/error pwmanager/libcrypt/mpi pwmanager/libcrypt/zlib pwmanager/pwmanager | 4 | SUBDIRS = libical libkcal kabc libkdepim microkde korganizer kaddressbook kabc/plugins/file kabc/plugins/dir kabc/plugins/file kabc/plugins/qtopia gammu/emb/common gammu/emb/gammu |
5 | #kalarmd | 5 | unix:{ |
6 | SUBDIRS += kmicromail/libetpan kmicromail/libmailwrapper kmicromail pwmanager/libcrypt/cipher pwmanager/libcrypt/error pwmanager/libcrypt/mpi pwmanager/libcrypt/zlib pwmanager/pwmanager | ||
7 | } | ||
6 | 8 | ||
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 5945b7f..2dcbc75 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,102 +1,102 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | #include <kabc/addresseedialog.h> | 3 | #include <kabc/addresseedialog.h> |
4 | #include <kabc/stdaddressbook.h> | 4 | #include <kabc/stdaddressbook.h> |
5 | #include <kabc/addressee.h> | 5 | #include <kabc/addressee.h> |
6 | #ifdef DESKTOP_VERSION | 6 | #ifdef DESKTOP_VERSION |
7 | #include <qapplication.h> | 7 | #include <qapplication.h> |
8 | #include <kabc/addresseedialog.h> | 8 | #include <kabc/addresseedialog.h> |
9 | #endif //DESKTOP_VERSION | 9 | #endif //DESKTOP_VERSION |
10 | #include <libkdepim/externalapphandler.h> | 10 | #include <libkdepim/externalapphandler.h> |
11 | 11 | ||
12 | #include "koprefs.h" | 12 | #include "koprefs.h" |
13 | 13 | ||
14 | #ifdef MINIKDE_KDIALOG_H | 14 | #ifdef MINIKDE_KDIALOG_H |
15 | #undef MINIKDE_KDIALOG_H | 15 | #undef MINIKDE_KDIALOG_H |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | 18 | ||
19 | #include "composemail.h" | 19 | #include "composemail.h" |
20 | 20 | ||
21 | #include <libmailwrapper/smtpwrapper.h> | 21 | #include <libmailwrapper/smtpwrapper.h> |
22 | #include <libmailwrapper/storemail.h> | 22 | #include <libmailwrapper/storemail.h> |
23 | #include <libmailwrapper/abstractmail.h> | 23 | #include <libmailwrapper/abstractmail.h> |
24 | #include <libmailwrapper/mailtypes.h> | 24 | #include <libmailwrapper/mailtypes.h> |
25 | 25 | ||
26 | /* OPIE */ | 26 | /* OPIE */ |
27 | //#include <opie2/ofiledialog.h> | 27 | //#include <opie2/ofiledialog.h> |
28 | //#include <opie2/odebug.h> | 28 | //#include <opie2/odebug.h> |
29 | #include <kfiledialog.h> | 29 | #include <kfiledialog.h> |
30 | //#include <qpe/resource.h> | 30 | //#include <qpe/resource.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | //#include <qpe/contact.h> | 32 | //#include <qpe/contact.h> |
33 | 33 | ||
34 | 34 | ||
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
37 | #include <qiconset.h> | 37 | #include <qiconset.h> |
38 | #include <qtimer.h> | 38 | #include <qtimer.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qtabwidget.h> | 43 | #include <qtabwidget.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | 45 | ||
46 | //using namespace Opie::Core; | 46 | //using namespace Opie::Core; |
47 | //using namespace Opie::Ui; | 47 | //using namespace Opie::Ui; |
48 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) | 48 | ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) |
49 | : ComposeMailUI( parent, name, modal ) | 49 | : ComposeMailUI( parent, name, modal ) |
50 | { | 50 | { |
51 | mPickLineEdit = 0; | 51 | mPickLineEdit = 0; |
52 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 52 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
53 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 53 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
54 | settings = s; | 54 | settings = sett; |
55 | m_replyid = ""; | 55 | m_replyid = ""; |
56 | if ( KOPrefs::instance()->mUseKapi) { | 56 | if ( KOPrefs::instance()->mUseKapi) { |
57 | KConfig config( locateLocal("config", "kabcrc") ); | 57 | KConfig config( locateLocal("config", "kabcrc") ); |
58 | config.setGroup( "General" ); | 58 | config.setGroup( "General" ); |
59 | QString whoami_uid = config.readEntry( "WhoAmI" ); | 59 | QString whoami_uid = config.readEntry( "WhoAmI" ); |
60 | 60 | ||
61 | if ( whoami_uid.isEmpty() ) { | 61 | if ( whoami_uid.isEmpty() ) { |
62 | QMessageBox::information( 0, i18n( "Hint" ), | 62 | QMessageBox::information( 0, i18n( "Hint" ), |
63 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 63 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
64 | i18n( "Ok" ) ); | 64 | i18n( "Ok" ) ); |
65 | 65 | ||
66 | 66 | ||
67 | fillSettings(); | 67 | fillSettings(); |
68 | } else | 68 | } else |
69 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | 69 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); |
70 | 70 | ||
71 | 71 | ||
72 | #ifdef DESKTOP_VERSION | 72 | #ifdef DESKTOP_VERSION |
73 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 73 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
74 | QStringList mails = con.emails(); | 74 | QStringList mails = con.emails(); |
75 | QString defmail = con.preferredEmail(); | 75 | QString defmail = con.preferredEmail(); |
76 | if ( mails.count() == 0) | 76 | if ( mails.count() == 0) |
77 | QMessageBox::information( 0, i18n( "Hint" ), | 77 | QMessageBox::information( 0, i18n( "Hint" ), |
78 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 78 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
79 | i18n( "Ok" ) ); | 79 | i18n( "Ok" ) ); |
80 | if (defmail.length()!=0) { | 80 | if (defmail.length()!=0) { |
81 | fromBox->insertItem(defmail); | 81 | fromBox->insertItem(defmail); |
82 | } | 82 | } |
83 | QStringList::ConstIterator sit = mails.begin(); | 83 | QStringList::ConstIterator sit = mails.begin(); |
84 | for (;sit!=mails.end();++sit) { | 84 | for (;sit!=mails.end();++sit) { |
85 | if ( (*sit)==defmail) | 85 | if ( (*sit)==defmail) |
86 | continue; | 86 | continue; |
87 | fromBox->insertItem((*sit)); | 87 | fromBox->insertItem((*sit)); |
88 | } | 88 | } |
89 | senderNameEdit->setText(con.formattedName()); | 89 | senderNameEdit->setText(con.formattedName()); |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | } else { | 92 | } else { |
93 | fillSettings(); | 93 | fillSettings(); |
94 | } | 94 | } |
95 | checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); | 95 | checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); |
96 | 96 | ||
97 | attList->addColumn( i18n( "Name" ) ); | 97 | attList->addColumn( i18n( "Name" ) ); |
98 | attList->addColumn( i18n( "Size" ) ); | 98 | attList->addColumn( i18n( "Size" ) ); |
99 | QList<Account> accounts = settings->getAccounts(); | 99 | QList<Account> accounts = settings->getAccounts(); |
100 | 100 | ||
101 | if ( QApplication::desktop()->width() < 320 ) | 101 | if ( QApplication::desktop()->width() < 320 ) |
102 | smtpAccountBox->setMaximumWidth( 80 ); | 102 | smtpAccountBox->setMaximumWidth( 80 ); |
@@ -120,109 +120,109 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m | |||
120 | QIconSet icon; | 120 | QIconSet icon; |
121 | //icon = SmallIcon("fileexport"); | 121 | //icon = SmallIcon("fileexport"); |
122 | icon = SmallIcon("filesave"); | 122 | icon = SmallIcon("filesave"); |
123 | SaveButton->setIconSet (icon ) ; | 123 | SaveButton->setIconSet (icon ) ; |
124 | if ( QApplication::desktop()->width() < 320 ) { | 124 | if ( QApplication::desktop()->width() < 320 ) { |
125 | SaveButton->setText ("") ; | 125 | SaveButton->setText ("") ; |
126 | SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; | 126 | SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; |
127 | } | 127 | } |
128 | else | 128 | else |
129 | SaveButton->setText (i18n("Save")); | 129 | SaveButton->setText (i18n("Save")); |
130 | #ifndef DESKTOP_VERSION | 130 | #ifndef DESKTOP_VERSION |
131 | QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); | 131 | QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); |
132 | QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); | 132 | QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); |
133 | QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); | 133 | QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); |
134 | #endif | 134 | #endif |
135 | message->setFont ( KOPrefs::instance()->mComposeFont ); | 135 | message->setFont ( KOPrefs::instance()->mComposeFont ); |
136 | message->setWordWrap (QMultiLineEdit::WidgetWidth); | 136 | message->setWordWrap (QMultiLineEdit::WidgetWidth); |
137 | if ( smtpAccounts.count() > 0 ) { | 137 | if ( smtpAccounts.count() > 0 ) { |
138 | fillValues( smtpAccountBox->currentItem() ); | 138 | fillValues( smtpAccountBox->currentItem() ); |
139 | } else { | 139 | } else { |
140 | QMessageBox::information( 0, i18n( "Problem" ), | 140 | QMessageBox::information( 0, i18n( "Problem" ), |
141 | i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), | 141 | i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), |
142 | i18n( "Ok" ) ); | 142 | i18n( "Ok" ) ); |
143 | return; | 143 | return; |
144 | } | 144 | } |
145 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 145 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
146 | 146 | ||
147 | 147 | ||
148 | } | 148 | } |
149 | 149 | ||
150 | void ComposeMail::fillSettings() | 150 | void ComposeMail::fillSettings() |
151 | { | 151 | { |
152 | if ( QApplication::desktop()->width() < 320 ) | 152 | if ( QApplication::desktop()->width() < 320 ) |
153 | fromBox->setMaximumWidth( 100 ); | 153 | fromBox->setMaximumWidth( 100 ); |
154 | QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); | 154 | QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); |
155 | QStringList::ConstIterator sit = mailList.begin(); | 155 | QStringList::ConstIterator sit = mailList.begin(); |
156 | int pref = 0; | 156 | int pref = 0; |
157 | for (;sit!=mailList.end();++sit) { | 157 | for (;sit!=mailList.end();++sit) { |
158 | fromBox->insertItem((*sit)); | 158 | fromBox->insertItem((*sit)); |
159 | } | 159 | } |
160 | senderNameEdit->setText(KOPrefs::instance()->mName); | 160 | senderNameEdit->setText(KOPrefs::instance()->mName); |
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | void ComposeMail::saveAsDraft() | 164 | void ComposeMail::saveAsDraft() |
165 | { | 165 | { |
166 | 166 | ||
167 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 167 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
168 | mail->setMail(fromBox->currentText()); | 168 | mail->setMail(fromBox->currentText().utf8 ()); |
169 | mail->setTo( toLine->text() ); | 169 | mail->setTo( toLine->text().utf8 () ); |
170 | mail->setName(senderNameEdit->text()); | 170 | mail->setName(senderNameEdit->text().utf8 ()); |
171 | mail->setCC( ccLine->text() ); | 171 | mail->setCC( ccLine->text().utf8 () ); |
172 | mail->setBCC( bccLine->text() ); | 172 | mail->setBCC( bccLine->text().utf8 () ); |
173 | mail->setReply( replyLine->text() ); | 173 | mail->setReply( replyLine->text().utf8 () ); |
174 | mail->setSubject( subjectLine->text() ); | 174 | mail->setSubject( subjectLine->text().utf8 () ); |
175 | if (!m_replyid.isEmpty()) { | 175 | if (!m_replyid.isEmpty()) { |
176 | QStringList ids; | 176 | QStringList ids; |
177 | ids.append(m_replyid); | 177 | ids.append(m_replyid); |
178 | mail->setInreply(ids); | 178 | mail->setInreply(ids); |
179 | } | 179 | } |
180 | QString txt = message->text(); | 180 | QString txt = message->text().utf8 (); |
181 | if ( !sigMultiLine->text().isEmpty() ) { | 181 | if ( !sigMultiLine->text().isEmpty() ) { |
182 | txt.append( "\n--\n" ); | 182 | txt.append( "\n--\n" ); |
183 | txt.append( sigMultiLine->text() ); | 183 | txt.append( sigMultiLine->text() ); |
184 | } | 184 | } |
185 | mail->setMessage( txt ); | 185 | mail->setMessage( txt ); |
186 | 186 | ||
187 | /* only use the default drafts folder name! */ | 187 | /* only use the default drafts folder name! */ |
188 | Storemail wrapper(AbstractMail::draftFolder()); | 188 | Storemail wrapper(AbstractMail::draftFolder()); |
189 | wrapper.storeMail(mail); | 189 | wrapper.storeMail(mail); |
190 | 190 | ||
191 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 191 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
192 | /* attachments we will ignore! */ | 192 | /* attachments we will ignore! */ |
193 | if ( it != 0 ) { | 193 | if ( it != 0 ) { |
194 | if ( warnAttach ) | 194 | if ( warnAttach ) |
195 | QMessageBox::warning(0,i18n("Store message"), | 195 | QMessageBox::warning(0,i18n("Store message"), |
196 | i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 196 | i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
197 | warnAttach = false; | 197 | warnAttach = false; |
198 | } | 198 | } |
199 | setStatus( i18n("Mail saved as draft!") ); | 199 | setStatus( i18n("Mail saved as draft!") ); |
200 | } | 200 | } |
201 | void ComposeMail::clearStatus() | 201 | void ComposeMail::clearStatus() |
202 | { | 202 | { |
203 | topLevelWidget()->setCaption( i18n("Compose mail") ); | 203 | topLevelWidget()->setCaption( i18n("Compose mail") ); |
204 | } | 204 | } |
205 | void ComposeMail::setStatus( QString status ) | 205 | void ComposeMail::setStatus( QString status ) |
206 | { | 206 | { |
207 | topLevelWidget()->setCaption( status ); | 207 | topLevelWidget()->setCaption( status ); |
208 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; | 208 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; |
209 | } | 209 | } |
210 | void ComposeMail::pickAddress( ) | 210 | void ComposeMail::pickAddress( ) |
211 | { | 211 | { |
212 | 212 | ||
213 | QLineEdit *line = mPickLineEdit; | 213 | QLineEdit *line = mPickLineEdit; |
214 | if ( line == 0 ) | 214 | if ( line == 0 ) |
215 | return; | 215 | return; |
216 | #ifdef DESKTOP_VERSION | 216 | #ifdef DESKTOP_VERSION |
217 | //qDebug(" ComposeMail::pickAddress "); | 217 | //qDebug(" ComposeMail::pickAddress "); |
218 | QString names ;//= AddressPicker::getNames(); | 218 | QString names ;//= AddressPicker::getNames(); |
219 | 219 | ||
220 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 220 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
221 | uint i=0; | 221 | uint i=0; |
222 | for (i=0; i < list.count(); i++) { | 222 | for (i=0; i < list.count(); i++) { |
223 | if ( !list[i].preferredEmail().isEmpty()) { | 223 | if ( !list[i].preferredEmail().isEmpty()) { |
224 | if ( ! names.isEmpty() ) | 224 | if ( ! names.isEmpty() ) |
225 | names+= ","; | 225 | names+= ","; |
226 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | 226 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; |
227 | 227 | ||
228 | } | 228 | } |
@@ -363,141 +363,141 @@ void ComposeMail::slotAdjustColumns() | |||
363 | tabWidget->setCurrentPage( currPage ); | 363 | tabWidget->setCurrentPage( currPage ); |
364 | } | 364 | } |
365 | 365 | ||
366 | void ComposeMail::addAttachment() | 366 | void ComposeMail::addAttachment() |
367 | { | 367 | { |
368 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); | 368 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); |
369 | if ( !lnk.isEmpty() ) { | 369 | if ( !lnk.isEmpty() ) { |
370 | Attachment *att = new Attachment( lnk ); | 370 | Attachment *att = new Attachment( lnk ); |
371 | (void) new AttachViewItem( attList, att ); | 371 | (void) new AttachViewItem( attList, att ); |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
375 | void ComposeMail::removeAttachment() | 375 | void ComposeMail::removeAttachment() |
376 | { | 376 | { |
377 | if ( !attList->currentItem() ) { | 377 | if ( !attList->currentItem() ) { |
378 | QMessageBox::information( this, i18n( "Error" ), | 378 | QMessageBox::information( this, i18n( "Error" ), |
379 | i18n( "<p>Please select a File.</p>" ), | 379 | i18n( "<p>Please select a File.</p>" ), |
380 | i18n( "Ok" ) ); | 380 | i18n( "Ok" ) ); |
381 | } else { | 381 | } else { |
382 | attList->takeItem( attList->currentItem() ); | 382 | attList->takeItem( attList->currentItem() ); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
386 | void ComposeMail::accept() | 386 | void ComposeMail::accept() |
387 | { | 387 | { |
388 | if ( smtpAccountBox->count() == 0 ) { | 388 | if ( smtpAccountBox->count() == 0 ) { |
389 | 389 | ||
390 | reject(); | 390 | reject(); |
391 | return; | 391 | return; |
392 | } | 392 | } |
393 | 393 | ||
394 | if (! checkBoxLater->isChecked() ) { | 394 | if (! checkBoxLater->isChecked() ) { |
395 | int yesno = QMessageBox::warning(0,i18n("Stop editing message"), | 395 | int yesno = QMessageBox::warning(0,i18n("Stop editing message"), |
396 | i18n("Send this message?"), | 396 | i18n("Send this message?"), |
397 | i18n("Yes"), | 397 | i18n("Yes"), |
398 | i18n("Cancel")); | 398 | i18n("Cancel")); |
399 | 399 | ||
400 | if (yesno == 1) { | 400 | if (yesno == 1) { |
401 | return; | 401 | return; |
402 | } | 402 | } |
403 | } | 403 | } |
404 | #if 0 | 404 | #if 0 |
405 | odebug << "Sending Mail with " | 405 | odebug << "Sending Mail with " |
406 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; | 406 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
407 | #endif | 407 | #endif |
408 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 408 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
409 | 409 | ||
410 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 410 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
411 | mail->setMail(fromBox->currentText()); | 411 | mail->setMail(fromBox->currentText().utf8 ()); |
412 | 412 | ||
413 | if ( !toLine->text().isEmpty() ) { | 413 | if ( !toLine->text().isEmpty() ) { |
414 | mail->setTo( toLine->text() ); | 414 | mail->setTo( toLine->text().utf8 () ); |
415 | } else { | 415 | } else { |
416 | QMessageBox::warning(0,i18n("Sending mail"), | 416 | QMessageBox::warning(0,i18n("Sending mail"), |
417 | i18n("No Receiver spezified" ) ); | 417 | i18n("No Receiver spezified" ) ); |
418 | return; | 418 | return; |
419 | } | 419 | } |
420 | 420 | ||
421 | mail->setName(senderNameEdit->text()); | 421 | mail->setName(senderNameEdit->text().utf8 ()); |
422 | mail->setCC( ccLine->text() ); | 422 | mail->setCC( ccLine->text().utf8 () ); |
423 | mail->setBCC( bccLine->text() ); | 423 | mail->setBCC( bccLine->text().utf8 () ); |
424 | mail->setReply( replyLine->text() ); | 424 | mail->setReply( replyLine->text().utf8 () ); |
425 | mail->setSubject( subjectLine->text() ); | 425 | mail->setSubject( subjectLine->text().utf8 () ); |
426 | if (!m_replyid.isEmpty()) { | 426 | if (!m_replyid.isEmpty()) { |
427 | QStringList ids; | 427 | QStringList ids; |
428 | ids.append(m_replyid); | 428 | ids.append(m_replyid.utf8 ()); |
429 | mail->setInreply(ids); | 429 | mail->setInreply(ids); |
430 | } | 430 | } |
431 | QString txt = message->text(); | 431 | QString txt = message->text().utf8 (); |
432 | if ( !sigMultiLine->text().isEmpty() ) { | 432 | if ( !sigMultiLine->text().isEmpty() ) { |
433 | txt.append( "\n--\n" ); | 433 | txt.append( "\n--\n" ); |
434 | txt.append( sigMultiLine->text() ); | 434 | txt.append( sigMultiLine->text().utf8 () ); |
435 | } | 435 | } |
436 | mail->setMessage( txt ); | 436 | mail->setMessage( txt ); |
437 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 437 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
438 | while ( it != 0 ) { | 438 | while ( it != 0 ) { |
439 | mail->addAttachment( it->getAttachment() ); | 439 | mail->addAttachment( it->getAttachment() ); |
440 | it = (AttachViewItem *) it->nextSibling(); | 440 | it = (AttachViewItem *) it->nextSibling(); |
441 | } | 441 | } |
442 | 442 | ||
443 | SMTPwrapper wrapper( smtp ); | 443 | SMTPwrapper wrapper( smtp ); |
444 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) | 444 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) |
445 | setStatus( tr ("Mail sent")); | 445 | setStatus( tr ("Mail sent")); |
446 | else { | 446 | else { |
447 | setStatus( tr ("Error: Something went wrong. Nothing sent")); | 447 | setStatus( tr ("Error: Something went wrong. Nothing sent")); |
448 | return; | 448 | return; |
449 | } | 449 | } |
450 | 450 | ||
451 | 451 | ||
452 | QDialog::accept(); | 452 | QDialog::accept(); |
453 | } | 453 | } |
454 | 454 | ||
455 | void ComposeMail::reject() | 455 | void ComposeMail::reject() |
456 | { | 456 | { |
457 | //qDebug("ComposeMail::reject() "); | 457 | //qDebug("ComposeMail::reject() "); |
458 | int yesno = QMessageBox::warning(0,i18n("Store message?"), | 458 | int yesno = QMessageBox::warning(0,i18n("Store message?"), |
459 | i18n("Store message into drafts?\n"), | 459 | i18n("Store message into drafts?\n"), |
460 | i18n("Yes"), | 460 | i18n("Yes"), |
461 | i18n("No")); | 461 | i18n("No")); |
462 | 462 | ||
463 | //qDebug("button %d ", yesno); | 463 | //qDebug("button %d ", yesno); |
464 | if (yesno == 0) { | 464 | if (yesno == 0) { |
465 | if ( toLine->text().isEmpty() ) { | 465 | if ( toLine->text().isEmpty() ) { |
466 | QMessageBox::warning(0,i18n("Sending mail"), | 466 | QMessageBox::warning(0,i18n("Sending mail"), |
467 | i18n("No Receiver spezified" ) ); | 467 | i18n("No Receiver spezified" ) ); |
468 | return; | 468 | return; |
469 | } | 469 | } |
470 | saveAsDraft(); | 470 | saveAsDraft(); |
471 | } | 471 | } |
472 | if (yesno == 2) { | 472 | if (yesno == 2) { |
473 | qDebug("return "); | 473 | qDebug("return "); |
474 | return; | 474 | return; |
475 | } | 475 | } |
476 | QDialog::reject(); | 476 | QDialog::reject(); |
477 | } | 477 | } |
478 | 478 | ||
479 | ComposeMail::~ComposeMail() | 479 | ComposeMail::~ComposeMail() |
480 | { | 480 | { |
481 | } | 481 | } |
482 | 482 | ||
483 | void ComposeMail::reEditMail(const RecMailP¤t) | 483 | void ComposeMail::reEditMail(const RecMailP¤t) |
484 | { | 484 | { |
485 | RecMailP data = current; | 485 | RecMailP data = current; |
486 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); | 486 | message->setText(QString::fromUtf8( data->Wrapper()->fetchBody(current)->Bodytext().latin1() )); |
487 | subjectLine->setText( data->getSubject()); | 487 | subjectLine->setText( QString::fromUtf8( data->getSubject().latin1() )); |
488 | toLine->setText(data->To().join(",")); | 488 | toLine->setText(QString::fromUtf8( data->To().join(",").latin1() )); |
489 | ccLine->setText(data->CC().join(",")); | 489 | ccLine->setText(QString::fromUtf8( data->CC().join(",").latin1() )); |
490 | bccLine->setText(data->Bcc().join(",")); | 490 | bccLine->setText(QString::fromUtf8( data->Bcc().join(",").latin1() )); |
491 | replyLine->setText(data->Replyto()); | 491 | replyLine->setText(QString::fromUtf8( data->Replyto().latin1() )); |
492 | } | 492 | } |
493 | 493 | ||
494 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 494 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
495 | : QListViewItem( parent ) | 495 | : QListViewItem( parent ) |
496 | { | 496 | { |
497 | attachment = att; | 497 | attachment = att; |
498 | if ( !attachment->getPixmap().isNull() ) | 498 | if ( !attachment->getPixmap().isNull() ) |
499 | setPixmap( 0,attachment->getPixmap() ); | 499 | setPixmap( 0,attachment->getPixmap() ); |
500 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 500 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
501 | setText( 1, QString::number( att->getSize() ) ); | 501 | setText( 1, QString::number( att->getSize() ) ); |
502 | } | 502 | } |
503 | 503 | ||
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 110583f..ae667ec 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -706,96 +706,97 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int | |||
706 | msg_att = (mailimap_msg_att*)current->data; | 706 | msg_att = (mailimap_msg_att*)current->data; |
707 | mailimap_msg_att_item*msg_att_item; | 707 | mailimap_msg_att_item*msg_att_item; |
708 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { | 708 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { |
709 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | 709 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); |
710 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | 710 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { |
711 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | 711 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { |
712 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 712 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
713 | /* detach - we take over the content */ | 713 | /* detach - we take over the content */ |
714 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 714 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
715 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); | 715 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); |
716 | } | 716 | } |
717 | } | 717 | } |
718 | } | 718 | } |
719 | } else { | 719 | } else { |
720 | ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; | 720 | ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; |
721 | } | 721 | } |
722 | if (result) mailimap_fetch_list_free(result); | 722 | if (result) mailimap_fetch_list_free(result); |
723 | return res; | 723 | return res; |
724 | } | 724 | } |
725 | 725 | ||
726 | /* current_recursion is for recursive calls. | 726 | /* current_recursion is for recursive calls. |
727 | current_count means the position inside the internal loop! */ | 727 | current_count means the position inside the internal loop! */ |
728 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, | 728 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, |
729 | int current_recursion,QValueList<int>recList,int current_count) | 729 | int current_recursion,QValueList<int>recList,int current_count) |
730 | { | 730 | { |
731 | if (!body || current_recursion>=10) { | 731 | if (!body || current_recursion>=10) { |
732 | return; | 732 | return; |
733 | } | 733 | } |
734 | switch (body->bd_type) { | 734 | switch (body->bd_type) { |
735 | case MAILIMAP_BODY_1PART: | 735 | case MAILIMAP_BODY_1PART: |
736 | { | 736 | { |
737 | QValueList<int>countlist = recList; | 737 | QValueList<int>countlist = recList; |
738 | countlist.append(current_count); | 738 | countlist.append(current_count); |
739 | RecPartP currentPart = new RecPart(); | 739 | RecPartP currentPart = new RecPart(); |
740 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; | 740 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; |
741 | QString id(""); | 741 | QString id(""); |
742 | currentPart->setPositionlist(countlist); | 742 | currentPart->setPositionlist(countlist); |
743 | for (unsigned int j = 0; j < countlist.count();++j) { | 743 | for (unsigned int j = 0; j < countlist.count();++j) { |
744 | id+=(j>0?" ":""); | 744 | id+=(j>0?" ":""); |
745 | id+=QString("%1").arg(countlist[j]); | 745 | id+=QString("%1").arg(countlist[j]); |
746 | } | 746 | } |
747 | //odebug << "ID = " << id.latin1() << "" << oendl; | 747 | //odebug << "ID = " << id.latin1() << "" << oendl; |
748 | currentPart->setIdentifier(id); | 748 | currentPart->setIdentifier(id); |
749 | fillSinglePart(currentPart,part1); | 749 | fillSinglePart(currentPart,part1); |
750 | /* important: Check for is NULL 'cause a body can be empty! | 750 | /* important: Check for is NULL 'cause a body can be empty! |
751 | And we put it only into the mail if it is the FIRST part */ | 751 | And we put it only into the mail if it is the FIRST part */ |
752 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { | 752 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { |
753 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); | 753 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); |
754 | //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); | ||
754 | target_body->setDescription(currentPart); | 755 | target_body->setDescription(currentPart); |
755 | target_body->setBodytext(body_text); | 756 | target_body->setBodytext(body_text); |
756 | if (countlist.count()>1) { | 757 | if (countlist.count()>1) { |
757 | target_body->addPart(currentPart); | 758 | target_body->addPart(currentPart); |
758 | } | 759 | } |
759 | } else { | 760 | } else { |
760 | target_body->addPart(currentPart); | 761 | target_body->addPart(currentPart); |
761 | } | 762 | } |
762 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { | 763 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { |
763 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); | 764 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); |
764 | } | 765 | } |
765 | } | 766 | } |
766 | break; | 767 | break; |
767 | case MAILIMAP_BODY_MPART: | 768 | case MAILIMAP_BODY_MPART: |
768 | { | 769 | { |
769 | QValueList<int>countlist = recList; | 770 | QValueList<int>countlist = recList; |
770 | clistcell*current=0; | 771 | clistcell*current=0; |
771 | mailimap_body*current_body=0; | 772 | mailimap_body*current_body=0; |
772 | unsigned int ccount = 1; | 773 | unsigned int ccount = 1; |
773 | mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; | 774 | mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; |
774 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | 775 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { |
775 | current_body = (mailimap_body*)current->data; | 776 | current_body = (mailimap_body*)current->data; |
776 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 777 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
777 | RecPartP targetPart = new RecPart(); | 778 | RecPartP targetPart = new RecPart(); |
778 | targetPart->setType("multipart"); | 779 | targetPart->setType("multipart"); |
779 | fillMultiPart(targetPart,mailDescription); | 780 | fillMultiPart(targetPart,mailDescription); |
780 | countlist.append(current_count); | 781 | countlist.append(current_count); |
781 | targetPart->setPositionlist(countlist); | 782 | targetPart->setPositionlist(countlist); |
782 | target_body->addPart(targetPart); | 783 | target_body->addPart(targetPart); |
783 | QString id(""); | 784 | QString id(""); |
784 | for (unsigned int j = 0; j < countlist.count();++j) { | 785 | for (unsigned int j = 0; j < countlist.count();++j) { |
785 | id+=(j>0?" ":""); | 786 | id+=(j>0?" ":""); |
786 | id+=QString("%1").arg(countlist[j]); | 787 | id+=QString("%1").arg(countlist[j]); |
787 | } | 788 | } |
788 | // odebug << "ID(mpart) = " << id.latin1() << "" << oendl; | 789 | // odebug << "ID(mpart) = " << id.latin1() << "" << oendl; |
789 | } | 790 | } |
790 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); | 791 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); |
791 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 792 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
792 | countlist = recList; | 793 | countlist = recList; |
793 | } | 794 | } |
794 | ++ccount; | 795 | ++ccount; |
795 | } | 796 | } |
796 | } | 797 | } |
797 | break; | 798 | break; |
798 | default: | 799 | default: |
799 | break; | 800 | break; |
800 | } | 801 | } |
801 | } | 802 | } |
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index 40b5591..5d2c0ad 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp | |||
@@ -1,72 +1,73 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | 3 | ||
4 | //#include <opie2/odebug.h> | 4 | //#include <opie2/odebug.h> |
5 | #include <kconfig.h> | 5 | #include <kconfig.h> |
6 | 6 | ||
7 | #include <kstandarddirs.h> | 7 | #include <kstandarddirs.h> |
8 | #include "settings.h" | 8 | #include "settings.h" |
9 | //#include "defines.h" | 9 | //#include "defines.h" |
10 | 10 | ||
11 | #define IMAP_PORT "143" | 11 | #define IMAP_PORT "143" |
12 | #define IMAP_SSL_PORT "993" | 12 | #define IMAP_SSL_PORT "993" |
13 | #define SMTP_PORT "25" | 13 | #define SMTP_PORT "25" |
14 | #define SMTP_SSL_PORT "465" | 14 | #define SMTP_SSL_PORT "465" |
15 | #define POP3_PORT "110" | 15 | #define POP3_PORT "110" |
16 | #define POP3_SSL_PORT "995" | 16 | #define POP3_SSL_PORT "995" |
17 | #define NNTP_PORT "119" | 17 | #define NNTP_PORT "119" |
18 | #define NNTP_SSL_PORT "563" | 18 | #define NNTP_SSL_PORT "563" |
19 | 19 | ||
20 | 20 | ||
21 | Settings::Settings() | 21 | Settings::Settings() |
22 | : QObject() | 22 | : QObject() |
23 | { | 23 | { |
24 | updateAccounts(); | 24 | updateAccounts(); |
25 | //qDebug("++++++++++++++++++new settings "); | ||
25 | } | 26 | } |
26 | 27 | ||
27 | void Settings::checkDirectory() | 28 | void Settings::checkDirectory() |
28 | { | 29 | { |
29 | return; | 30 | return; |
30 | locateLocal("data", "kopiemail" ); | 31 | locateLocal("data", "kopiemail" ); |
31 | /* | 32 | /* |
32 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { | 33 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { |
33 | system( "mkdir -p $HOME/Applications/opiemail" ); | 34 | system( "mkdir -p $HOME/Applications/opiemail" ); |
34 | qDebug("$HOME/Applications/opiemail created "); | 35 | qDebug("$HOME/Applications/opiemail created "); |
35 | } | 36 | } |
36 | */ | 37 | */ |
37 | } | 38 | } |
38 | 39 | ||
39 | QList<Account> Settings::getAccounts() | 40 | QList<Account> Settings::getAccounts() |
40 | { | 41 | { |
41 | return accounts; | 42 | return accounts; |
42 | } | 43 | } |
43 | 44 | ||
44 | void Settings::addAccount( Account *account ) | 45 | void Settings::addAccount( Account *account ) |
45 | { | 46 | { |
46 | accounts.append( account ); | 47 | accounts.append( account ); |
47 | } | 48 | } |
48 | 49 | ||
49 | void Settings::delAccount( Account *account ) | 50 | void Settings::delAccount( Account *account ) |
50 | { | 51 | { |
51 | accounts.remove( account ); | 52 | accounts.remove( account ); |
52 | account->remove(); | 53 | account->remove(); |
53 | } | 54 | } |
54 | 55 | ||
55 | void Settings::updateAccounts() | 56 | void Settings::updateAccounts() |
56 | { | 57 | { |
57 | accounts.clear(); | 58 | accounts.clear(); |
58 | QDir dir( locateLocal("data", "kopiemail" ) ); | 59 | QDir dir( locateLocal("data", "kopiemail" ) ); |
59 | QStringList::Iterator it; | 60 | QStringList::Iterator it; |
60 | 61 | ||
61 | QStringList imap = dir.entryList( "imap-*" ); | 62 | QStringList imap = dir.entryList( "imap-*" ); |
62 | for ( it = imap.begin(); it != imap.end(); it++ ) { | 63 | for ( it = imap.begin(); it != imap.end(); it++ ) { |
63 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); | 64 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); |
64 | accounts.append( account ); | 65 | accounts.append( account ); |
65 | } | 66 | } |
66 | 67 | ||
67 | QStringList pop3 = dir.entryList( "pop3-*" ); | 68 | QStringList pop3 = dir.entryList( "pop3-*" ); |
68 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { | 69 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { |
69 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); | 70 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); |
70 | accounts.append( account ); | 71 | accounts.append( account ); |
71 | } | 72 | } |
72 | 73 | ||
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h index 79567ef..c996fe0 100644 --- a/kmicromail/libmailwrapper/settings.h +++ b/kmicromail/libmailwrapper/settings.h | |||
@@ -120,62 +120,63 @@ public: | |||
120 | 120 | ||
121 | static QString getUniqueFileName(); | 121 | static QString getUniqueFileName(); |
122 | 122 | ||
123 | virtual void read(); | 123 | virtual void read(); |
124 | virtual void save(); | 124 | virtual void save(); |
125 | virtual QString getFileName(); | 125 | virtual QString getFileName(); |
126 | 126 | ||
127 | void setLogin( bool b ) { login = b; } | 127 | void setLogin( bool b ) { login = b; } |
128 | bool getLogin() { return login; } | 128 | bool getLogin() { return login; } |
129 | 129 | ||
130 | private: | 130 | private: |
131 | QString file, name, mail, org, cc, bcc, reply, signature; | 131 | QString file, name, mail, org, cc, bcc, reply, signature; |
132 | bool useCC, useBCC, useReply, login; | 132 | bool useCC, useBCC, useReply, login; |
133 | 133 | ||
134 | }; | 134 | }; |
135 | 135 | ||
136 | class NNTPaccount : public Account | 136 | class NNTPaccount : public Account |
137 | { | 137 | { |
138 | 138 | ||
139 | public: | 139 | public: |
140 | NNTPaccount(); | 140 | NNTPaccount(); |
141 | NNTPaccount( QString filename ); | 141 | NNTPaccount( QString filename ); |
142 | 142 | ||
143 | static QString getUniqueFileName(); | 143 | static QString getUniqueFileName(); |
144 | 144 | ||
145 | virtual void read(); | 145 | virtual void read(); |
146 | virtual void save(); | 146 | virtual void save(); |
147 | virtual QString getFileName(); | 147 | virtual QString getFileName(); |
148 | 148 | ||
149 | void setLogin( bool b ) { login = b; } | 149 | void setLogin( bool b ) { login = b; } |
150 | bool getLogin() { return login; } | 150 | bool getLogin() { return login; } |
151 | 151 | ||
152 | void setGroups( QStringList list ) { subscribedGroups = list; } | 152 | void setGroups( QStringList list ) { subscribedGroups = list; } |
153 | QStringList getGroups() { return subscribedGroups; } | 153 | QStringList getGroups() { return subscribedGroups; } |
154 | 154 | ||
155 | private: | 155 | private: |
156 | QString file; | 156 | QString file; |
157 | bool login; | 157 | bool login; |
158 | QStringList subscribedGroups; | 158 | QStringList subscribedGroups; |
159 | 159 | ||
160 | }; | 160 | }; |
161 | 161 | ||
162 | class Settings : public QObject | 162 | class Settings : public QObject |
163 | { | 163 | { |
164 | Q_OBJECT | 164 | Q_OBJECT |
165 | 165 | ||
166 | public: | 166 | public: |
167 | Settings(); | 167 | Settings(); |
168 | //~Settings(){qDebug("-------------------settings "); }; | ||
168 | QList<Account> getAccounts(); | 169 | QList<Account> getAccounts(); |
169 | void addAccount(Account *account); | 170 | void addAccount(Account *account); |
170 | void delAccount(Account *account); | 171 | void delAccount(Account *account); |
171 | void saveAccounts(); | 172 | void saveAccounts(); |
172 | void readAccounts(); | 173 | void readAccounts(); |
173 | static void checkDirectory(); | 174 | static void checkDirectory(); |
174 | 175 | ||
175 | private: | 176 | private: |
176 | void updateAccounts(); | 177 | void updateAccounts(); |
177 | QList<Account> accounts; | 178 | QList<Account> accounts; |
178 | 179 | ||
179 | }; | 180 | }; |
180 | 181 | ||
181 | #endif | 182 | #endif |
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 484a635..5ef5b6a 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -10,98 +10,98 @@ MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | |||
10 | { | 10 | { |
11 | } | 11 | } |
12 | 12 | ||
13 | void MailListViewItem::showEntry() | 13 | void MailListViewItem::showEntry() |
14 | { | 14 | { |
15 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { | 15 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { |
16 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); | 16 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); |
17 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { | 17 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { |
18 | /* I think it looks nicer if there are not such a log of icons but only on mails | 18 | /* I think it looks nicer if there are not such a log of icons but only on mails |
19 | replied or new - Alwin*/ | 19 | replied or new - Alwin*/ |
20 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); | 20 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); |
21 | } else { | 21 | } else { |
22 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); | 22 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); |
23 | } | 23 | } |
24 | double s = mail_data->Msgsize(); | 24 | double s = mail_data->Msgsize(); |
25 | int w = 0; | 25 | int w = 0; |
26 | s/=1024; | 26 | s/=1024; |
27 | if (s>999.0) { | 27 | if (s>999.0) { |
28 | s/=1024.0; | 28 | s/=1024.0; |
29 | ++w; | 29 | ++w; |
30 | } | 30 | } |
31 | QString fsort; | 31 | QString fsort; |
32 | fsort.sprintf( "%.2f", s ); | 32 | fsort.sprintf( "%.2f", s ); |
33 | QString fsize = QString::number( s, 'f', 2 ); | 33 | QString fsize = QString::number( s, 'f', 2 ); |
34 | // 1.23 | 34 | // 1.23 |
35 | // 11.23 | 35 | // 11.23 |
36 | // 111.23 | 36 | // 111.23 |
37 | // 999.23 maxlen | 37 | // 999.23 maxlen |
38 | switch(fsize.length() ) { | 38 | switch(fsize.length() ) { |
39 | case 4: | 39 | case 4: |
40 | fsort = "00" + fsize ; | 40 | fsort = "00" + fsize ; |
41 | break; | 41 | break; |
42 | case 5: | 42 | case 5: |
43 | fsort = "0" + fsize ; | 43 | fsort = "0" + fsize ; |
44 | break; | 44 | break; |
45 | default: | 45 | default: |
46 | fsort = fsize ; | 46 | fsort = fsize ; |
47 | break; | 47 | break; |
48 | 48 | ||
49 | } | 49 | } |
50 | if ( w == 0 ) { | 50 | if ( w == 0 ) { |
51 | setText(3, fsize + "kB" ); | 51 | setText(3, fsize + "kB" ); |
52 | mKeyMap.insert(3, "k" + fsort); | 52 | mKeyMap.insert(3, "k" + fsort); |
53 | //setText(3, "kB" + fsort ); // test only | 53 | //setText(3, "kB" + fsort ); // test only |
54 | } else { | 54 | } else { |
55 | //setText(3, fsize + "MB"); | 55 | //setText(3, fsize + "MB"); |
56 | mKeyMap.insert(3, "M" +fsort ); | 56 | mKeyMap.insert(3, "M" +fsort ); |
57 | } | 57 | } |
58 | setText(1,mail_data->getSubject()); | 58 | setText(1,QString::fromUtf8( mail_data->getSubject().latin1())); |
59 | setText(2,mail_data->getFrom()); | 59 | setText(2,QString::fromUtf8( mail_data->getFrom().latin1())); |
60 | #if 0 | 60 | #if 0 |
61 | QString date = mail_data->getDate(); | 61 | QString date = mail_data->getDate(); |
62 | 62 | ||
63 | int kom = date.find( ",")+2; | 63 | int kom = date.find( ",")+2; |
64 | if ( kom == 1 ) | 64 | if ( kom == 1 ) |
65 | kom = 0; | 65 | kom = 0; |
66 | if ( date.mid(kom,1) == " ") | 66 | if ( date.mid(kom,1) == " ") |
67 | ++kom; | 67 | ++kom; |
68 | if ( date.mid(kom+1,1) == " " ) | 68 | if ( date.mid(kom+1,1) == " " ) |
69 | date = "0" + date.mid( kom ); | 69 | date = "0" + date.mid( kom ); |
70 | else if ( kom ) | 70 | else if ( kom ) |
71 | date = date.mid( kom ); | 71 | date = date.mid( kom ); |
72 | if ( kom || date.mid(2,1 ) == " ") { | 72 | if ( kom || date.mid(2,1 ) == " ") { |
73 | QString mon = date.mid(3,3); | 73 | QString mon = date.mid(3,3); |
74 | QString so = 00; | 74 | QString so = 00; |
75 | if ( mon == "Jan" ) | 75 | if ( mon == "Jan" ) |
76 | so = "01"; | 76 | so = "01"; |
77 | else if ( mon == "Feb" ) | 77 | else if ( mon == "Feb" ) |
78 | so = "02"; | 78 | so = "02"; |
79 | else if ( mon == "Mar" ) | 79 | else if ( mon == "Mar" ) |
80 | so = "03"; | 80 | so = "03"; |
81 | else if ( mon == "Apr" ) | 81 | else if ( mon == "Apr" ) |
82 | so = "04"; | 82 | so = "04"; |
83 | else if ( mon == "May" ) | 83 | else if ( mon == "May" ) |
84 | so = "05"; | 84 | so = "05"; |
85 | else if ( mon == "Jun" ) | 85 | else if ( mon == "Jun" ) |
86 | so = "06"; | 86 | so = "06"; |
87 | else if ( mon == "Jul" ) | 87 | else if ( mon == "Jul" ) |
88 | so = "07"; | 88 | so = "07"; |
89 | else if ( mon == "Aug" ) | 89 | else if ( mon == "Aug" ) |
90 | so = "08"; | 90 | so = "08"; |
91 | else if ( mon == "Sep" ) | 91 | else if ( mon == "Sep" ) |
92 | so = "09"; | 92 | so = "09"; |
93 | else if ( mon == "Oct" ) | 93 | else if ( mon == "Oct" ) |
94 | so = "10"; | 94 | so = "10"; |
95 | else if ( mon == "Nov" ) | 95 | else if ( mon == "Nov" ) |
96 | so = "11"; | 96 | so = "11"; |
97 | else if ( mon == "Dec" ) | 97 | else if ( mon == "Dec" ) |
98 | so = "12"; | 98 | so = "12"; |
99 | date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); | 99 | date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); |
100 | } | 100 | } |
101 | //qDebug("insert Date %s ", date.latin1()); | 101 | //qDebug("insert Date %s ", date.latin1()); |
102 | // if ( date.left(1) != "1" || date.left(1) != "2" ) | 102 | // if ( date.left(1) != "1" || date.left(1) != "2" ) |
103 | // date = date.mid(5); | 103 | // date = date.mid(5); |
104 | mKeyMap.insert(4,date); | 104 | mKeyMap.insert(4,date); |
105 | #endif | 105 | #endif |
106 | mKeyMap.insert(4,mail_data->getIsoDate()); | 106 | mKeyMap.insert(4,mail_data->getIsoDate()); |
107 | setText(4,mail_data->getDate()); | 107 | setText(4,mail_data->getDate()); |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 4115276..98eb9a5 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,74 +1,78 @@ | |||
1 | 1 | ||
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qvbox.h> | 4 | #include <qvbox.h> |
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | //#include <kdialog.h> | 8 | //#include <kdialog.h> |
9 | #include <kiconloader.h> | 9 | #include <kiconloader.h> |
10 | #include <kapplication.h> | 10 | #include <kapplication.h> |
11 | 11 | ||
12 | #ifdef DESKTOP_VERSION | 12 | #ifdef DESKTOP_VERSION |
13 | #include <qapplication.h> | 13 | #include <qapplication.h> |
14 | #include <qstatusbar.h> | ||
15 | extern QStatusBar* globalSstatusBarMainWindow; | ||
14 | #else | 16 | #else |
15 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
16 | #endif | 18 | #endif |
17 | #include "defines.h" | 19 | #include "defines.h" |
18 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
19 | #include <KDGanttMinimizeSplitter.h> | 21 | #include <KDGanttMinimizeSplitter.h> |
20 | 22 | ||
21 | |||
22 | #include <kabc/stdaddressbook.h> | 23 | #include <kabc/stdaddressbook.h> |
23 | 24 | ||
24 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 25 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
25 | : QMainWindow( parent, name ) //, flags ) | 26 | : QMainWindow( parent, name ) //, flags ) |
26 | { | 27 | { |
28 | #ifdef DESKTOP_VERSION | ||
29 | globalSstatusBarMainWindow = statusBar(); | ||
30 | #endif | ||
27 | setCaption( i18n( "KOpieMail/Pi" ) ); | 31 | setCaption( i18n( "KOpieMail/Pi" ) ); |
28 | setToolBarsMovable( false ); | 32 | setToolBarsMovable( false ); |
29 | //KABC::StdAddressBook::self(); | 33 | //KABC::StdAddressBook::self(); |
30 | toolBar = new QToolBar( this ); | 34 | toolBar = new QToolBar( this ); |
31 | menuBar = new QPEMenuBar( toolBar ); | 35 | menuBar = new QPEMenuBar( toolBar ); |
32 | mailMenu = new QPopupMenu( menuBar ); | 36 | mailMenu = new QPopupMenu( menuBar ); |
33 | menuBar->insertItem( i18n( "Mail" ), mailMenu ); | 37 | menuBar->insertItem( i18n( "Mail" ), mailMenu ); |
34 | settingsMenu = new QPopupMenu( menuBar ); | 38 | settingsMenu = new QPopupMenu( menuBar ); |
35 | menuBar->insertItem( i18n( "Settings" ), settingsMenu ); | 39 | menuBar->insertItem( i18n( "Settings" ), settingsMenu ); |
36 | 40 | ||
37 | addToolBar( toolBar ); | 41 | addToolBar( toolBar ); |
38 | toolBar->setHorizontalStretchable( true ); | 42 | toolBar->setHorizontalStretchable( true ); |
39 | QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), | 43 | QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), |
40 | 0, 0, this ); | 44 | 0, 0, this ); |
41 | connect(getMail, SIGNAL( activated() ), | 45 | connect(getMail, SIGNAL( activated() ), |
42 | SLOT( slotGetAllMail() ) ); | 46 | SLOT( slotGetAllMail() ) ); |
43 | getMail->addTo( mailMenu ); | 47 | getMail->addTo( mailMenu ); |
44 | 48 | ||
45 | getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), | 49 | getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), |
46 | 0, 0, this ); | 50 | 0, 0, this ); |
47 | getMail->addTo( toolBar ); | 51 | getMail->addTo( toolBar ); |
48 | getMail->addTo( mailMenu ); | 52 | getMail->addTo( mailMenu ); |
49 | connect(getMail, SIGNAL( activated() ), | 53 | connect(getMail, SIGNAL( activated() ), |
50 | SLOT( slotGetMail() ) ); | 54 | SLOT( slotGetMail() ) ); |
51 | 55 | ||
52 | composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), | 56 | composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), |
53 | 0, 0, this ); | 57 | 0, 0, this ); |
54 | composeMail->addTo( toolBar ); | 58 | composeMail->addTo( toolBar ); |
55 | composeMail->addTo( mailMenu ); | 59 | composeMail->addTo( mailMenu ); |
56 | 60 | ||
57 | sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , | 61 | sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , |
58 | 0, 0, this ); | 62 | 0, 0, this ); |
59 | sendQueued->addTo( toolBar ); | 63 | sendQueued->addTo( toolBar ); |
60 | sendQueued->addTo( mailMenu ); | 64 | sendQueued->addTo( mailMenu ); |
61 | 65 | ||
62 | /* | 66 | /* |
63 | syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, | 67 | syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, |
64 | 0, 0, this ); | 68 | 0, 0, this ); |
65 | syncFolders->addTo( toolBar ); | 69 | syncFolders->addTo( toolBar ); |
66 | syncFolders->addTo( mailMenu ); | 70 | syncFolders->addTo( mailMenu ); |
67 | */ | 71 | */ |
68 | 72 | ||
69 | showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , | 73 | showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , |
70 | 0, 0, this, 0, true ); | 74 | 0, 0, this, 0, true ); |
71 | showFolders->addTo( toolBar ); | 75 | showFolders->addTo( toolBar ); |
72 | showFolders->addTo( mailMenu ); | 76 | showFolders->addTo( mailMenu ); |
73 | showFolders->setOn( true ); | 77 | showFolders->setOn( true ); |
74 | connect(showFolders, SIGNAL( toggled(bool) ), | 78 | connect(showFolders, SIGNAL( toggled(bool) ), |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index ca3faaf..fe9df87 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,90 +1,91 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | 3 | ||
4 | #include "koprefsdialog.h" | 4 | #include "koprefsdialog.h" |
5 | #include <kapplication.h> | 5 | #include <kapplication.h> |
6 | #include <libkdepim/externalapphandler.h> | 6 | #include <libkdepim/externalapphandler.h> |
7 | #include <libkdepim/kpimglobalprefs.h> | 7 | #include <libkdepim/kpimglobalprefs.h> |
8 | #ifdef MINIKDE_KDIALOG_H | 8 | #ifdef MINIKDE_KDIALOG_H |
9 | #undef MINIKDE_KDIALOG_H | 9 | #undef MINIKDE_KDIALOG_H |
10 | #endif | 10 | #endif |
11 | #include "settingsdialog.h" | 11 | #include "settingsdialog.h" |
12 | #include "opiemail.h" | 12 | #include "opiemail.h" |
13 | #include "editaccounts.h" | 13 | #include "editaccounts.h" |
14 | #include "composemail.h" | 14 | #include "composemail.h" |
15 | #include "mailistviewitem.h" | 15 | #include "mailistviewitem.h" |
16 | #include "viewmail.h" | 16 | #include "viewmail.h" |
17 | #include "selectstore.h" | 17 | #include "selectstore.h" |
18 | #include "selectsmtp.h" | 18 | #include "selectsmtp.h" |
19 | #include "accountitem.h" | 19 | #include "accountitem.h" |
20 | #include "klocale.h" | 20 | #include "klocale.h" |
21 | 21 | ||
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | #include <qregexp.h> | 25 | #include <qregexp.h> |
26 | 26 | ||
27 | #ifdef DESKTOP_VERSION | 27 | #ifdef DESKTOP_VERSION |
28 | #include <qapplication.h> | 28 | #include <qapplication.h> |
29 | #else | 29 | #else |
30 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
31 | #endif | 31 | #endif |
32 | #include <libmailwrapper/smtpwrapper.h> | 32 | #include <libmailwrapper/smtpwrapper.h> |
33 | #include <libmailwrapper/mailtypes.h> | 33 | #include <libmailwrapper/mailtypes.h> |
34 | #include <libmailwrapper/abstractmail.h> | 34 | #include <libmailwrapper/abstractmail.h> |
35 | 35 | ||
36 | //using namespace Opie::Core; | 36 | //using namespace Opie::Core; |
37 | 37 | ||
38 | OpieMail::OpieMail( QWidget *parent, const char *name ) | 38 | OpieMail::OpieMail( QWidget *parent, const char *name ) |
39 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 39 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
40 | { | 40 | { |
41 | settings = new Settings(); | 41 | settings = new Settings(); |
42 | 42 | ||
43 | setIcon(SmallIcon( "kmicromail" ) ); | ||
43 | folderView->populate( settings->getAccounts() ); | 44 | folderView->populate( settings->getAccounts() ); |
44 | 45 | ||
45 | } | 46 | } |
46 | 47 | ||
47 | OpieMail::~OpieMail() | 48 | OpieMail::~OpieMail() |
48 | { | 49 | { |
49 | if (settings) delete settings; | 50 | if (settings) delete settings; |
50 | } | 51 | } |
51 | 52 | ||
52 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 53 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
53 | { | 54 | { |
54 | 55 | ||
55 | } | 56 | } |
56 | #include <stdlib.h> | 57 | #include <stdlib.h> |
57 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 58 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
58 | { | 59 | { |
59 | // copied from old mail2 | 60 | // copied from old mail2 |
60 | static int ii = 0; | 61 | static int ii = 0; |
61 | //qDebug("QCOP CALL ############################# %d ", ii); | 62 | //qDebug("QCOP CALL ############################# %d ", ii); |
62 | //QString mess ( msg ); | 63 | //QString mess ( msg ); |
63 | //qDebug("Message = %s ",mess.latin1()); | 64 | //qDebug("Message = %s ",mess.latin1()); |
64 | ++ii; | 65 | ++ii; |
65 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 66 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
66 | 67 | ||
67 | mPendingEmail = QString::null; | 68 | mPendingEmail = QString::null; |
68 | mPendingName = QString::null; | 69 | mPendingName = QString::null; |
69 | if (msg == "writeMail(QString,QString)") | 70 | if (msg == "writeMail(QString,QString)") |
70 | { | 71 | { |
71 | //qDebug("writeMail(QString,QString) "); | 72 | //qDebug("writeMail(QString,QString) "); |
72 | QDataStream stream(data,IO_ReadOnly); | 73 | QDataStream stream(data,IO_ReadOnly); |
73 | stream >> mPendingName >> mPendingEmail; | 74 | stream >> mPendingName >> mPendingEmail; |
74 | // removing the whitespaces at beginning and end is needed! | 75 | // removing the whitespaces at beginning and end is needed! |
75 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 76 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
76 | } | 77 | } |
77 | else if (msg == "newMail()") | 78 | else if (msg == "newMail()") |
78 | { | 79 | { |
79 | //qDebug("slotComposeMail() "); | 80 | //qDebug("slotComposeMail() "); |
80 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call | 81 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call |
81 | // and a QCOP call does not like a processevents in his execution | 82 | // and a QCOP call does not like a processevents in his execution |
82 | // with the Qtimer we call slotComposeMail() after we reached the main event loop | 83 | // with the Qtimer we call slotComposeMail() after we reached the main event loop |
83 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 84 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
84 | // slotComposeMail(); | 85 | // slotComposeMail(); |
85 | } | 86 | } |
86 | else if (msg == "newMail(QString)") | 87 | else if (msg == "newMail(QString)") |
87 | { | 88 | { |
88 | //qDebug(" newMail(QString)"); | 89 | //qDebug(" newMail(QString)"); |
89 | QDataStream stream(data,IO_ReadOnly); | 90 | QDataStream stream(data,IO_ReadOnly); |
90 | stream >> mPendingName; | 91 | stream >> mPendingName; |
@@ -195,97 +196,140 @@ void OpieMail::slotSendQueued() | |||
195 | selsmtp.setSelectionlist(&smtpList); | 196 | selsmtp.setSelectionlist(&smtpList); |
196 | selsmtp.showMaximized(); | 197 | selsmtp.showMaximized(); |
197 | if ( selsmtp.exec() == QDialog::Accepted ) | 198 | if ( selsmtp.exec() == QDialog::Accepted ) |
198 | { | 199 | { |
199 | smtp = selsmtp.selected_smtp(); | 200 | smtp = selsmtp.selected_smtp(); |
200 | } | 201 | } |
201 | } | 202 | } |
202 | if (smtp) | 203 | if (smtp) |
203 | { | 204 | { |
204 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 205 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
205 | if ( wrap->flushOutbox() ) | 206 | if ( wrap->flushOutbox() ) |
206 | { | 207 | { |
207 | QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed")); | 208 | QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed")); |
208 | } | 209 | } |
209 | delete wrap; | 210 | delete wrap; |
210 | } | 211 | } |
211 | } | 212 | } |
212 | 213 | ||
213 | void OpieMail::slotSearchMails() | 214 | void OpieMail::slotSearchMails() |
214 | { | 215 | { |
215 | qDebug("OpieMail::slotSearchMails():not implemented "); | 216 | qDebug("OpieMail::slotSearchMails():not implemented "); |
216 | } | 217 | } |
217 | 218 | ||
218 | void OpieMail::slotEditSettings() | 219 | void OpieMail::slotEditSettings() |
219 | { | 220 | { |
220 | 221 | ||
221 | KOPrefsDialog settingsDialog( this, "koprefs", true ); | 222 | KOPrefsDialog settingsDialog( this, "koprefs", true ); |
222 | #ifndef DESKTOP_VERSION | 223 | #ifndef DESKTOP_VERSION |
223 | settingsDialog.showMaximized(); | 224 | settingsDialog.showMaximized(); |
224 | #endif | 225 | #endif |
225 | settingsDialog.exec(); | 226 | settingsDialog.exec(); |
226 | 227 | ||
227 | // KApplication::execDialog(settingsDialog); | 228 | // KApplication::execDialog(settingsDialog); |
228 | } | 229 | } |
229 | 230 | ||
230 | void OpieMail::slotEditAccounts() | 231 | void OpieMail::slotEditAccounts() |
231 | { | 232 | { |
232 | EditAccounts eaDialog( settings, this, 0, true ); | 233 | EditAccounts eaDialog( settings, this, 0, true ); |
233 | eaDialog.slotAdjustColumns(); | 234 | eaDialog.slotAdjustColumns(); |
234 | #ifndef DESKTOP_VERSION | 235 | #ifndef DESKTOP_VERSION |
235 | eaDialog.showMaximized(); | 236 | eaDialog.showMaximized(); |
236 | #endif | 237 | #endif |
237 | eaDialog.exec(); | 238 | eaDialog.exec(); |
238 | if ( settings ) delete settings; | 239 | if ( settings ) delete settings; |
239 | settings = new Settings(); | 240 | settings = new Settings(); |
240 | 241 | ||
241 | folderView->populate( settings->getAccounts() ); | 242 | folderView->populate( settings->getAccounts() ); |
242 | } | 243 | } |
244 | void OpieMail::replyMail() | ||
245 | { | ||
246 | |||
247 | QListViewItem*item = mailView->currentItem(); | ||
248 | if (!item) return; | ||
249 | RecMailP mail = ((MailListViewItem*)item)->data(); | ||
250 | RecBodyP body = folderView->fetchBody(mail); | ||
251 | |||
252 | QString rtext; | ||
253 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | ||
254 | .arg( QString::fromUtf8( mail->getFrom().latin1())) | ||
255 | .arg( QString::fromUtf8( mail->getDate().latin1() )); | ||
256 | |||
257 | QString text = QString::fromUtf8( body->Bodytext().latin1() ); | ||
258 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | ||
259 | QStringList::Iterator it; | ||
260 | for (it = lines.begin(); it != lines.end(); it++) | ||
261 | { | ||
262 | rtext += "> " + *it + "\n"; | ||
263 | } | ||
264 | rtext += "\n"; | ||
243 | 265 | ||
266 | QString prefix; | ||
267 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; | ||
268 | else prefix = "Re: "; // no i18n on purpose | ||
269 | |||
270 | Settings *settings = new Settings(); | ||
271 | ComposeMail composer( settings ,this, 0, true); | ||
272 | if (mail->Replyto().isEmpty()) { | ||
273 | composer.setTo( QString::fromUtf8( mail->getFrom().latin1())); | ||
274 | } else { | ||
275 | composer.setTo( QString::fromUtf8(mail->Replyto().latin1())); | ||
276 | } | ||
277 | composer.setSubject( prefix + QString::fromUtf8( mail->getSubject().latin1() ) ); | ||
278 | composer.setMessage( rtext ); | ||
279 | composer.setInReplyTo( QString::fromUtf8(mail->Msgid().latin1())); | ||
280 | |||
281 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | ||
282 | { | ||
283 | mail->Wrapper()->answeredMail(mail); | ||
284 | } | ||
285 | delete settings; | ||
286 | |||
287 | } | ||
244 | void OpieMail::displayMail() | 288 | void OpieMail::displayMail() |
245 | { | 289 | { |
246 | QListViewItem*item = mailView->currentItem(); | 290 | QListViewItem*item = mailView->currentItem(); |
247 | if (!item) return; | 291 | if (!item) return; |
248 | RecMailP mail = ((MailListViewItem*)item)->data(); | 292 | RecMailP mail = ((MailListViewItem*)item)->data(); |
249 | RecBodyP body = folderView->fetchBody(mail); | 293 | RecBodyP body = folderView->fetchBody(mail); |
250 | ViewMail readMail( this,"", Qt::WType_Modal ); | 294 | ViewMail readMail( this,"", Qt::WType_Modal ); |
251 | readMail.setBody( body ); | 295 | readMail.setBody( body ); |
252 | readMail.setMail( mail ); | 296 | readMail.setMail( mail ); |
253 | #ifndef DESKTOP_VERSION | 297 | #ifndef DESKTOP_VERSION |
254 | readMail.showMaximized(); | 298 | readMail.showMaximized(); |
255 | #else | 299 | #else |
256 | readMail.resize( 640, 480); | 300 | readMail.resize( 640, 480); |
257 | #endif | 301 | #endif |
258 | readMail.exec(); | 302 | readMail.exec(); |
259 | 303 | ||
260 | if ( readMail.deleted ) | 304 | if ( readMail.deleted ) |
261 | { | 305 | { |
262 | folderView->refreshCurrent(); | 306 | folderView->refreshCurrent(); |
263 | } | 307 | } |
264 | else | 308 | else |
265 | { | 309 | { |
266 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 310 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
267 | } | 311 | } |
268 | } | 312 | } |
269 | void OpieMail::slotGetAllMail() | 313 | void OpieMail::slotGetAllMail() |
270 | { | 314 | { |
271 | QListViewItem * item = folderView->firstChild(); | 315 | QListViewItem * item = folderView->firstChild(); |
272 | while ( item ){ | 316 | while ( item ){ |
273 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 317 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
274 | item = item->nextSibling (); | 318 | item = item->nextSibling (); |
275 | } | 319 | } |
276 | } | 320 | } |
277 | void OpieMail::slotGetMail() | 321 | void OpieMail::slotGetMail() |
278 | { | 322 | { |
279 | QListViewItem * item = folderView->currentItem(); | 323 | QListViewItem * item = folderView->currentItem(); |
280 | if ( ! item ) return; | 324 | if ( ! item ) return; |
281 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 325 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
282 | } | 326 | } |
283 | void OpieMail::slotDeleteMail() | 327 | void OpieMail::slotDeleteMail() |
284 | { | 328 | { |
285 | if (!mailView->currentItem()) return; | 329 | if (!mailView->currentItem()) return; |
286 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 330 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
287 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 331 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
288 | { | 332 | { |
289 | mail->Wrapper()->deleteMail( mail ); | 333 | mail->Wrapper()->deleteMail( mail ); |
290 | folderView->refreshCurrent(); | 334 | folderView->refreshCurrent(); |
291 | } | 335 | } |
@@ -295,96 +339,98 @@ void OpieMail::slotDeleteAllMail() | |||
295 | 339 | ||
296 | QValueList<RecMailP> t; | 340 | QValueList<RecMailP> t; |
297 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 341 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
298 | { | 342 | { |
299 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 343 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
300 | while ( item ) { | 344 | while ( item ) { |
301 | if ( item->isSelected() ) { | 345 | if ( item->isSelected() ) { |
302 | t.append( item->data() ); | 346 | t.append( item->data() ); |
303 | } | 347 | } |
304 | item = (MailListViewItem*)item->nextSibling(); | 348 | item = (MailListViewItem*)item->nextSibling(); |
305 | } | 349 | } |
306 | } | 350 | } |
307 | else | 351 | else |
308 | return; | 352 | return; |
309 | if ( t.count() == 0 ) | 353 | if ( t.count() == 0 ) |
310 | return; | 354 | return; |
311 | RecMailP mail = t.first(); | 355 | RecMailP mail = t.first(); |
312 | mail->Wrapper()->deleteMailList(t); | 356 | mail->Wrapper()->deleteMailList(t); |
313 | folderView->refreshCurrent(); | 357 | folderView->refreshCurrent(); |
314 | 358 | ||
315 | 359 | ||
316 | } | 360 | } |
317 | void OpieMail::clearSelection() | 361 | void OpieMail::clearSelection() |
318 | { | 362 | { |
319 | mailView->clearSelection(); | 363 | mailView->clearSelection(); |
320 | 364 | ||
321 | } | 365 | } |
322 | 366 | ||
323 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 367 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
324 | { | 368 | { |
325 | if (!mailView->currentItem()) return; | 369 | if (!mailView->currentItem()) return; |
326 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 370 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
327 | /* just the RIGHT button - or hold on pda */ | 371 | /* just the RIGHT button - or hold on pda */ |
328 | if (button!=2) {return;} | 372 | if (button!=2) {return;} |
329 | if (!item) return; | 373 | if (!item) return; |
330 | QPopupMenu *m = new QPopupMenu(0); | 374 | QPopupMenu *m = new QPopupMenu(0); |
331 | if (m) | 375 | if (m) |
332 | { | 376 | { |
333 | if (mailtype==MAILLIB::A_NNTP) { | 377 | if (mailtype==MAILLIB::A_NNTP) { |
334 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); | 378 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); |
335 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 379 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
336 | m->insertSeparator(); | 380 | m->insertSeparator(); |
337 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); | 381 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); |
338 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 382 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
339 | } else { | 383 | } else { |
340 | if (folderView->currentisDraft()) { | 384 | if (folderView->currentisDraft()) { |
341 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); | 385 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); |
342 | } | 386 | } |
387 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); | ||
388 | m->insertSeparator(); | ||
343 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); | 389 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); |
344 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 390 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
345 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); | 391 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); |
346 | m->insertSeparator(); | 392 | m->insertSeparator(); |
347 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 393 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
348 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 394 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
349 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 395 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
350 | } | 396 | } |
351 | m->setFocus(); | 397 | m->setFocus(); |
352 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 398 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
353 | delete m; | 399 | delete m; |
354 | } | 400 | } |
355 | } | 401 | } |
356 | 402 | ||
357 | void OpieMail::slotShowFolders( bool show ) | 403 | void OpieMail::slotShowFolders( bool show ) |
358 | { | 404 | { |
359 | if ( show && folderView->isHidden() ) | 405 | if ( show && folderView->isHidden() ) |
360 | { | 406 | { |
361 | folderView->show(); | 407 | folderView->show(); |
362 | } | 408 | } |
363 | else if ( !show && !folderView->isHidden() ) | 409 | else if ( !show && !folderView->isHidden() ) |
364 | { | 410 | { |
365 | folderView->hide(); | 411 | folderView->hide(); |
366 | } | 412 | } |
367 | } | 413 | } |
368 | 414 | ||
369 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 415 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
370 | { | 416 | { |
371 | MailListViewItem*item = 0; | 417 | MailListViewItem*item = 0; |
372 | mailView->clear(); | 418 | mailView->clear(); |
373 | 419 | ||
374 | QValueList<RecMailP>::ConstIterator it; | 420 | QValueList<RecMailP>::ConstIterator it; |
375 | for (it = list.begin(); it != list.end();++it) | 421 | for (it = list.begin(); it != list.end();++it) |
376 | { | 422 | { |
377 | item = new MailListViewItem(mailView,item); | 423 | item = new MailListViewItem(mailView,item); |
378 | item->storeData((*it)); | 424 | item->storeData((*it)); |
379 | item->showEntry(); | 425 | item->showEntry(); |
380 | } | 426 | } |
381 | } | 427 | } |
382 | 428 | ||
383 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 429 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
384 | { | 430 | { |
385 | mailView->clearSelection(); | 431 | mailView->clearSelection(); |
386 | /* just LEFT button - or tap with stylus on pda */ | 432 | /* just LEFT button - or tap with stylus on pda */ |
387 | //if (button!=1) return; | 433 | //if (button!=1) return; |
388 | if (!item) return; | 434 | if (!item) return; |
389 | if (folderView->currentisDraft()) { | 435 | if (folderView->currentisDraft()) { |
390 | reEditMail(); | 436 | reEditMail(); |
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index 9de95f8..44ab1ec 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h | |||
@@ -1,55 +1,56 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef OPIEMAIL_H | 2 | #ifndef OPIEMAIL_H |
3 | #define OPIEMAIL_H | 3 | #define OPIEMAIL_H |
4 | 4 | ||
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | 7 | ||
8 | #include <opie2/osmartpointer.h> | 8 | #include <opie2/osmartpointer.h> |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | 10 | ||
11 | class OpieMail : public MainWindow | 11 | class OpieMail : public MainWindow |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); | 16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); |
17 | virtual ~OpieMail(); | 17 | virtual ~OpieMail(); |
18 | static QString appName() { return QString::fromLatin1("kopiemail"); } | 18 | static QString appName() { return QString::fromLatin1("kopiemail"); } |
19 | 19 | ||
20 | public slots: | 20 | public slots: |
21 | virtual void slotwriteMail(const QString&name,const QString&email); | 21 | virtual void slotwriteMail(const QString&name,const QString&email); |
22 | virtual void slotwriteMail2(const QString&nameemail); | 22 | virtual void slotwriteMail2(const QString&nameemail); |
23 | virtual void slotComposeMail(); | 23 | virtual void slotComposeMail(); |
24 | virtual void slotExtAppHandler(); | 24 | virtual void slotExtAppHandler(); |
25 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 25 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
26 | virtual void message(const QCString &msg, const QByteArray &data); | 26 | virtual void message(const QCString &msg, const QByteArray &data); |
27 | protected slots: | 27 | protected slots: |
28 | virtual void slotSendQueued(); | 28 | virtual void slotSendQueued(); |
29 | virtual void slotSearchMails(); | 29 | virtual void slotSearchMails(); |
30 | virtual void slotEditSettings(); | 30 | virtual void slotEditSettings(); |
31 | virtual void slotEditAccounts(); | 31 | virtual void slotEditAccounts(); |
32 | virtual void displayMail(); | 32 | virtual void displayMail(); |
33 | virtual void replyMail(); | ||
33 | virtual void slotDeleteMail(); | 34 | virtual void slotDeleteMail(); |
34 | virtual void slotGetMail(); | 35 | virtual void slotGetMail(); |
35 | virtual void slotGetAllMail(); | 36 | virtual void slotGetAllMail(); |
36 | virtual void slotDeleteAllMail(); | 37 | virtual void slotDeleteAllMail(); |
37 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 38 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
38 | virtual void slotShowFolders( bool show ); | 39 | virtual void slotShowFolders( bool show ); |
39 | virtual void refreshMailView(const QValueList<RecMailP>&); | 40 | virtual void refreshMailView(const QValueList<RecMailP>&); |
40 | virtual void mailLeftClicked( QListViewItem * ); | 41 | virtual void mailLeftClicked( QListViewItem * ); |
41 | virtual void slotMoveCopyMail(); | 42 | virtual void slotMoveCopyMail(); |
42 | virtual void slotMoveCopyAllMail(); | 43 | virtual void slotMoveCopyAllMail(); |
43 | virtual void reEditMail(); | 44 | virtual void reEditMail(); |
44 | void clearSelection(); | 45 | void clearSelection(); |
45 | 46 | ||
46 | private: | 47 | private: |
47 | QString mPendingEmail; | 48 | QString mPendingEmail; |
48 | QString mPendingName; | 49 | QString mPendingName; |
49 | QByteArray mPendingData; | 50 | QByteArray mPendingData; |
50 | QCString mPendingMessage; | 51 | QCString mPendingMessage; |
51 | Settings *settings; | 52 | Settings *settings; |
52 | 53 | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | #endif | 56 | #endif |
diff --git a/kmicromail/qpe/global.cpp b/kmicromail/qpe/global.cpp index f4c6f60..8314f23 100644 --- a/kmicromail/qpe/global.cpp +++ b/kmicromail/qpe/global.cpp | |||
@@ -1,12 +1,14 @@ | |||
1 | 1 | ||
2 | #include "global.h" | 2 | #include "global.h" |
3 | 3 | #include <qstatusbar.h> | |
4 | QStatusBar* globalSstatusBarMainWindow = 0; | ||
4 | namespace Global{ | 5 | namespace Global{ |
5 | 6 | ||
6 | void statusMessage(QString message) | 7 | void statusMessage(QString message) |
7 | { | 8 | { |
8 | 9 | if ( globalSstatusBarMainWindow ) | |
10 | globalSstatusBarMainWindow->message( message,15000 ); | ||
9 | qDebug("statusMessage %s ", message.latin1()); | 11 | qDebug("statusMessage %s ", message.latin1()); |
10 | } | 12 | } |
11 | } | 13 | } |
12 | 14 | ||
diff --git a/kmicromail/qpe/qdialog.h b/kmicromail/qpe/qdialog.h index aafdf80..c63133d 100644 --- a/kmicromail/qpe/qdialog.h +++ b/kmicromail/qpe/qdialog.h | |||
@@ -1,33 +1,29 @@ | |||
1 | 1 | ||
2 | #ifndef MINIKDE_KDIALOG_H | 2 | #ifndef MINIKDE_KDIALOG_H |
3 | 3 | ||
4 | #ifndef DEFINE_QDIALOG_HACK | 4 | #ifndef DEFINE_QDIALOG_HACK |
5 | #define DEFINE_QDIALOG_HACK | 5 | #define DEFINE_QDIALOG_HACK |
6 | #warning call of include <qdialog.h> | 6 | #warning call of include <qdialog.h> |
7 | #warning including /usr/local/qt/include/qdialog.h | 7 | #warning including /usr/local/qt/include/qdialog.h |
8 | #warning if you get a compiling error | 8 | #warning if you get a compiling error |
9 | #warning please adjust your path here! | 9 | #warning please adjust your path here! |
10 | 10 | ||
11 | #include "/usr/local/qt/include/qdialog.h" | 11 | #include "/usr/local/qt/include/qdialog.h" |
12 | class QDialog_hacked : public QDialog | 12 | class QDialog_hacked : public QDialog |
13 | { | 13 | { |
14 | //Q__OBJECT | 14 | //Q__OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | QDialog_hacked ( QWidget * parent=0, const char * name=0, bool modal=true, WFlags f=0 ); | 17 | QDialog_hacked ( QWidget * parent=0, const char * name=0, bool modal=true, WFlags f=0 ); |
18 | 18 | ||
19 | }; | 19 | }; |
20 | 20 | ||
21 | #define QDialog QDialog_hacked | 21 | #define QDialog QDialog_hacked |
22 | 22 | ||
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #else | 25 | #else |
26 | #warning ****************************************** | ||
27 | #warning ****************************************** | ||
28 | #warning ****************************************** | ||
29 | #warning ****************************************** | ||
30 | #warning "/usr/local/qt/include/qdialog.h" for KDialog | 26 | #warning "/usr/local/qt/include/qdialog.h" for KDialog |
31 | #include "/usr/local/qt/include/qdialog.h" | 27 | #include "/usr/local/qt/include/qdialog.h" |
32 | 28 | ||
33 | #endif | 29 | #endif |
diff --git a/kmicromail/qpe/qdialog_hacked.cpp b/kmicromail/qpe/qdialog_hacked.cpp index 3669312..0a34cec 100644 --- a/kmicromail/qpe/qdialog_hacked.cpp +++ b/kmicromail/qpe/qdialog_hacked.cpp | |||
@@ -1,31 +1,27 @@ | |||
1 | 1 | ||
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include <qhbox.h> | 3 | #include <qhbox.h> |
4 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
5 | #include <klocale.h> | 5 | #include <klocale.h> |
6 | #ifdef QDialog | 6 | #ifdef QDialog |
7 | #undef QDialog | 7 | #undef QDialog |
8 | #endif | 8 | #endif |
9 | QDialog_hacked::QDialog_hacked ( QWidget * parent, const char * name, bool modal, WFlags f ) | 9 | QDialog_hacked::QDialog_hacked ( QWidget * parent, const char * name, bool modal, WFlags f ) |
10 | : QDialog( parent,name,modal, f) | 10 | : QDialog( parent,name,modal, f) |
11 | { | 11 | { |
12 | qDebug("******************** "); | 12 | qDebug("New hacked QDialog for ompi desktop"); |
13 | qDebug("******************** "); | ||
14 | qDebug("******************** "); | ||
15 | qDebug("******************** "); | ||
16 | qDebug("New hacked QDialog for ompi "); | ||
17 | //QTimer::singleShot( 1, this,SLOT(addaddbuttons()) ); | 13 | //QTimer::singleShot( 1, this,SLOT(addaddbuttons()) ); |
18 | 14 | ||
19 | setOrientation ( Vertical ); | 15 | setOrientation ( Vertical ); |
20 | QHBox * hb = new QHBox ( this ); | 16 | QHBox * hb = new QHBox ( this ); |
21 | QPushButton *ok = new QPushButton( i18n("OK"), hb ); | 17 | QPushButton *ok = new QPushButton( i18n("OK"), hb ); |
22 | QPushButton *cancel = new QPushButton( i18n("Cancel"), hb ); | 18 | QPushButton *cancel = new QPushButton( i18n("Cancel"), hb ); |
23 | setExtension ( hb ); | 19 | setExtension ( hb ); |
24 | showExtension ( true ); | 20 | showExtension ( true ); |
25 | connect ( ok, SIGNAL ( clicked()),this, SLOT (accept() ) ); | 21 | connect ( ok, SIGNAL ( clicked()),this, SLOT (accept() ) ); |
26 | connect ( cancel, SIGNAL ( clicked()),this, SLOT (reject() ) ); | 22 | connect ( cancel, SIGNAL ( clicked()),this, SLOT (reject() ) ); |
27 | //setWFlags(WStyle_MinMax ); | 23 | //setWFlags(WStyle_MinMax ); |
28 | 24 | ||
29 | } | 25 | } |
30 | 26 | ||
31 | 27 | ||
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index f1e0225..2093678 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -53,97 +53,98 @@ AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QStrin | |||
53 | _path=path; | 53 | _path=path; |
54 | setText(0, mime); | 54 | setText(0, mime); |
55 | setText(1, desc); | 55 | setText(1, desc); |
56 | setText(2, file); | 56 | setText(2, file); |
57 | setText(3, fsize); | 57 | setText(3, fsize); |
58 | } | 58 | } |
59 | 59 | ||
60 | bool AttachItem::isParentof(const QValueList<int>&path) | 60 | bool AttachItem::isParentof(const QValueList<int>&path) |
61 | { | 61 | { |
62 | /* if not set, then no parent */ | 62 | /* if not set, then no parent */ |
63 | if (path.count()==0||_path.count()==0) return false; | 63 | if (path.count()==0||_path.count()==0) return false; |
64 | /* the parent must have one digit less then a child */ | 64 | /* the parent must have one digit less then a child */ |
65 | if (path.count()!=_path.count()+1) return false; | 65 | if (path.count()!=_path.count()+1) return false; |
66 | for (unsigned int i=0; i < _path.count();++i) | 66 | for (unsigned int i=0; i < _path.count();++i) |
67 | { | 67 | { |
68 | if (_path[i]!=path[i]) return false; | 68 | if (_path[i]!=path[i]) return false; |
69 | } | 69 | } |
70 | return true; | 70 | return true; |
71 | } | 71 | } |
72 | 72 | ||
73 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) | 73 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) |
74 | { | 74 | { |
75 | QListViewItemIterator it( attachments ); | 75 | QListViewItemIterator it( attachments ); |
76 | for ( ; it.current(); ++it ) | 76 | for ( ; it.current(); ++it ) |
77 | { | 77 | { |
78 | AttachItem*ati = (AttachItem*)it.current(); | 78 | AttachItem*ati = (AttachItem*)it.current(); |
79 | if (ati->isParentof(path)) return ati; | 79 | if (ati->isParentof(path)) return ati; |
80 | } | 80 | } |
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | 83 | ||
84 | AttachItem* ViewMail::lastChild(AttachItem*parent) | 84 | AttachItem* ViewMail::lastChild(AttachItem*parent) |
85 | { | 85 | { |
86 | if (!parent) return 0; | 86 | if (!parent) return 0; |
87 | AttachItem* item = (AttachItem*)parent->firstChild(); | 87 | AttachItem* item = (AttachItem*)parent->firstChild(); |
88 | if (!item) return item; | 88 | if (!item) return item; |
89 | AttachItem*temp=0; | 89 | AttachItem*temp=0; |
90 | while( (temp=(AttachItem*)item->nextSibling())) | 90 | while( (temp=(AttachItem*)item->nextSibling())) |
91 | { | 91 | { |
92 | item = temp; | 92 | item = temp; |
93 | } | 93 | } |
94 | return item; | 94 | return item; |
95 | } | 95 | } |
96 | 96 | ||
97 | void ViewMail::setBody(const RecBodyP&body ) | 97 | void ViewMail::setBody(const RecBodyP&body ) |
98 | { | 98 | { |
99 | 99 | ||
100 | m_body = body; | 100 | m_body = body; |
101 | m_mail[2] = body->Bodytext(); | 101 | m_mail[2] = QString::fromUtf8( body->Bodytext().latin1() ); |
102 | // qDebug("********text %s ",m_mail[2].latin1() ); | ||
102 | attachbutton->setEnabled(body->Parts().count()>0); | 103 | attachbutton->setEnabled(body->Parts().count()>0); |
103 | attachments->setEnabled(body->Parts().count()>0); | 104 | attachments->setEnabled(body->Parts().count()>0); |
104 | if (body->Parts().count()==0) | 105 | if (body->Parts().count()==0) |
105 | { | 106 | { |
106 | return; | 107 | return; |
107 | } | 108 | } |
108 | AttachItem * curItem=0; | 109 | AttachItem * curItem=0; |
109 | AttachItem * parentItem = 0; | 110 | AttachItem * parentItem = 0; |
110 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); | 111 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); |
111 | QString desc,fsize; | 112 | QString desc,fsize; |
112 | double s = body->Description()->Size(); | 113 | double s = body->Description()->Size(); |
113 | int w; | 114 | int w; |
114 | w=0; | 115 | w=0; |
115 | 116 | ||
116 | while (s>1024) | 117 | while (s>1024) |
117 | { | 118 | { |
118 | s/=1024; | 119 | s/=1024; |
119 | ++w; | 120 | ++w; |
120 | if (w>=2) break; | 121 | if (w>=2) break; |
121 | } | 122 | } |
122 | 123 | ||
123 | QString q=""; | 124 | QString q=""; |
124 | switch(w) | 125 | switch(w) |
125 | { | 126 | { |
126 | case 1: | 127 | case 1: |
127 | q="k"; | 128 | q="k"; |
128 | break; | 129 | break; |
129 | case 2: | 130 | case 2: |
130 | q="M"; | 131 | q="M"; |
131 | break; | 132 | break; |
132 | default: | 133 | default: |
133 | break; | 134 | break; |
134 | } | 135 | } |
135 | 136 | ||
136 | { | 137 | { |
137 | /* I did not found a method to make a CONTENT reset on a QTextStream | 138 | /* I did not found a method to make a CONTENT reset on a QTextStream |
138 | so I use this construct that the stream will re-constructed in each | 139 | so I use this construct that the stream will re-constructed in each |
139 | loop. To let it work, the textstream is packed into a own area of | 140 | loop. To let it work, the textstream is packed into a own area of |
140 | code is it will be destructed after finishing its small job. | 141 | code is it will be destructed after finishing its small job. |
141 | */ | 142 | */ |
142 | QTextOStream o(&fsize); | 143 | QTextOStream o(&fsize); |
143 | if (w>0) o.precision(2); else o.precision(0); | 144 | if (w>0) o.precision(2); else o.precision(0); |
144 | o.setf(QTextStream::fixed); | 145 | o.setf(QTextStream::fixed); |
145 | o << s << " " << q << "Byte"; | 146 | o << s << " " << q << "Byte"; |
146 | } | 147 | } |
147 | 148 | ||
148 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); | 149 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); |
149 | QString filename = ""; | 150 | QString filename = ""; |
@@ -255,266 +256,260 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
255 | } | 256 | } |
256 | } | 257 | } |
257 | break ; | 258 | break ; |
258 | 259 | ||
259 | case 2: | 260 | case 2: |
260 | { | 261 | { |
261 | #ifdef DESKTOP_VERSION | 262 | #ifdef DESKTOP_VERSION |
262 | QString tmpfile = locateLocal( "tmp", "opiemail-image"); | 263 | QString tmpfile = locateLocal( "tmp", "opiemail-image"); |
263 | #else | 264 | #else |
264 | QString tmpfile = "/tmp/opiemail-image"; | 265 | QString tmpfile = "/tmp/opiemail-image"; |
265 | #endif | 266 | #endif |
266 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 267 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
267 | if (content) { | 268 | if (content) { |
268 | QFile output(tmpfile); | 269 | QFile output(tmpfile); |
269 | output.open(IO_WriteOnly); | 270 | output.open(IO_WriteOnly); |
270 | output.writeBlock(content->Content(),content->Length()); | 271 | output.writeBlock(content->Content(),content->Length()); |
271 | output.close(); | 272 | output.close(); |
272 | delete content; | 273 | delete content; |
273 | MailImageDlg iview(""); | 274 | MailImageDlg iview(""); |
274 | iview.setName(tmpfile); | 275 | iview.setName(tmpfile); |
275 | KApplication::execDialog(&iview); | 276 | KApplication::execDialog(&iview); |
276 | output.remove(); | 277 | output.remove(); |
277 | } | 278 | } |
278 | } | 279 | } |
279 | break; | 280 | break; |
280 | case 1: | 281 | case 1: |
281 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 282 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
282 | { | 283 | { |
283 | setText(); | 284 | setText(); |
284 | } | 285 | } |
285 | else | 286 | else |
286 | { | 287 | { |
287 | if ( m_recMail->Wrapper() != 0l ) | 288 | if ( m_recMail->Wrapper() != 0l ) |
288 | { // make sure that there is a wrapper , even after delete or simular actions | 289 | { // make sure that there is a wrapper , even after delete or simular actions |
289 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 290 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
290 | } | 291 | } |
291 | } | 292 | } |
292 | break; | 293 | break; |
293 | } | 294 | } |
294 | delete menu; | 295 | delete menu; |
295 | } | 296 | } |
296 | 297 | ||
297 | 298 | ||
298 | void ViewMail::setMail(const RecMailP&mail ) | 299 | void ViewMail::setMail(const RecMailP&mail ) |
299 | { | 300 | { |
300 | 301 | ||
301 | m_recMail = mail; | 302 | m_recMail = mail; |
302 | 303 | ||
303 | m_mail[0] = mail->getFrom(); | 304 | m_mail[0] = QString::fromUtf8( mail->getFrom().latin1() ); |
304 | m_mail[1] = mail->getSubject(); | 305 | m_mail[1] = QString::fromUtf8( mail->getSubject().latin1() ); |
305 | m_mail[3] = mail->getDate(); | 306 | m_mail[3] = QString::fromUtf8( mail->getDate().latin1() ); |
306 | m_mail[4] = mail->Msgid(); | 307 | m_mail[4] = QString::fromUtf8( mail->Msgid().latin1() ); |
307 | 308 | ||
308 | m_mail2[0] = mail->To(); | 309 | m_mail2[0] = mail->To(); |
309 | m_mail2[1] = mail->CC(); | 310 | m_mail2[1] = mail->CC(); |
310 | m_mail2[2] = mail->Bcc(); | 311 | m_mail2[2] = mail->Bcc(); |
311 | 312 | ||
312 | setText(); | 313 | setText(); |
313 | } | 314 | } |
314 | 315 | ||
315 | 316 | ||
316 | 317 | ||
317 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 318 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
318 | : ViewMailBase(parent, name, fl), _inLoop(false) | 319 | : ViewMailBase(parent, name, fl), _inLoop(false) |
319 | { | 320 | { |
320 | m_gotBody = false; | 321 | m_gotBody = false; |
321 | deleted = false; | 322 | deleted = false; |
322 | 323 | ||
323 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); | 324 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); |
324 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); | 325 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); |
325 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); | 326 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); |
326 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); | 327 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); |
327 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 328 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
328 | 329 | ||
329 | attachments->setEnabled(m_gotBody); | 330 | attachments->setEnabled(m_gotBody); |
330 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); | 331 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); |
331 | 332 | ||
332 | readConfig(); | 333 | readConfig(); |
333 | attachments->setSorting(-1); | 334 | attachments->setSorting(-1); |
334 | } | 335 | } |
335 | 336 | ||
336 | void ViewMail::readConfig() | 337 | void ViewMail::readConfig() |
337 | { | 338 | { |
338 | 339 | ||
339 | setFont ( KOPrefs::instance()->mReadFont ); | 340 | setFont ( KOPrefs::instance()->mReadFont ); |
340 | m_showHtml = KOPrefs::instance()->mViewAsHtml; | 341 | m_showHtml = KOPrefs::instance()->mViewAsHtml; |
341 | showHtml->setOn( m_showHtml ); | 342 | showHtml->setOn( m_showHtml ); |
342 | } | 343 | } |
343 | 344 | ||
344 | void ViewMail::setText() | 345 | void ViewMail::setText() |
345 | { | 346 | { |
346 | 347 | ||
347 | QString toString; | 348 | QString toString; |
348 | QString ccString; | 349 | QString ccString; |
349 | QString bccString; | 350 | QString bccString; |
350 | 351 | ||
351 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) | 352 | |
352 | { | 353 | toString = QString::fromUtf8(m_mail2[0].join(",").latin1()); |
353 | toString += (*it); | 354 | ccString = QString::fromUtf8(m_mail2[1].join(",").latin1()); |
354 | } | 355 | bccString = QString::fromUtf8(m_mail2[2].join(",").latin1()); |
355 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) | 356 | |
356 | { | ||
357 | ccString += (*it); | ||
358 | } | ||
359 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) | ||
360 | { | ||
361 | bccString += (*it); | ||
362 | } | ||
363 | 357 | ||
364 | setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); | 358 | setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); |
365 | 359 | ||
366 | m_mailHtml = "<html><body>" | 360 | m_mailHtml = "<html><body>" |
367 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" | 361 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" |
368 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" | 362 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" |
369 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" | 363 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" |
370 | "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" | 364 | "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" |
371 | "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + | 365 | "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + |
372 | i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" | 366 | i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" |
373 | "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + | 367 | "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + |
374 | "</td></tr></table><font>"; | 368 | "</td></tr></table><font>"; |
375 | 369 | ||
376 | if ( !m_showHtml ) | 370 | if ( !m_showHtml ) |
377 | { | 371 | { |
378 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); | 372 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); |
379 | } | 373 | } |
380 | else | 374 | else |
381 | { | 375 | { |
382 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | 376 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); |
383 | } | 377 | } |
384 | // remove later in favor of a real handling | 378 | // remove later in favor of a real handling |
385 | m_gotBody = true; | 379 | m_gotBody = true; |
386 | } | 380 | } |
387 | 381 | ||
388 | 382 | ||
389 | ViewMail::~ViewMail() | 383 | ViewMail::~ViewMail() |
390 | { | 384 | { |
391 | m_recMail->Wrapper()->cleanMimeCache(); | 385 | m_recMail->Wrapper()->cleanMimeCache(); |
392 | hide(); | 386 | hide(); |
393 | } | 387 | } |
394 | 388 | ||
395 | void ViewMail::hide() | 389 | void ViewMail::hide() |
396 | { | 390 | { |
397 | QWidget::hide(); | 391 | QWidget::hide(); |
398 | 392 | ||
399 | if (_inLoop) | 393 | if (_inLoop) |
400 | { | 394 | { |
401 | _inLoop = false; | 395 | _inLoop = false; |
402 | qApp->exit_loop(); | 396 | qApp->exit_loop(); |
403 | 397 | ||
404 | } | 398 | } |
405 | 399 | ||
406 | } | 400 | } |
407 | 401 | ||
408 | void ViewMail::exec() | 402 | void ViewMail::exec() |
409 | { | 403 | { |
410 | show(); | 404 | show(); |
411 | 405 | ||
412 | if (!_inLoop) | 406 | if (!_inLoop) |
413 | { | 407 | { |
414 | _inLoop = true; | 408 | _inLoop = true; |
415 | qApp->enter_loop(); | 409 | qApp->enter_loop(); |
416 | } | 410 | } |
417 | 411 | ||
418 | } | 412 | } |
419 | 413 | ||
420 | QString ViewMail::deHtml(const QString &string) | 414 | QString ViewMail::deHtml(const QString &string) |
421 | { | 415 | { |
422 | QString string_ = string; | 416 | QString string_ = string; |
423 | string_.replace(QRegExp("&"), "&"); | 417 | string_.replace(QRegExp("&"), "&"); |
424 | string_.replace(QRegExp("<"), "<"); | 418 | string_.replace(QRegExp("<"), "<"); |
425 | string_.replace(QRegExp(">"), ">"); | 419 | string_.replace(QRegExp(">"), ">"); |
426 | string_.replace(QRegExp("\\n"), "<br>"); | 420 | string_.replace(QRegExp("\\n"), "<br>"); |
427 | return string_; | 421 | return string_; |
428 | } | 422 | } |
429 | 423 | ||
430 | void ViewMail::slotReply() | 424 | void ViewMail::slotReply() |
431 | { | 425 | { |
432 | if (!m_gotBody) | 426 | if (!m_gotBody) |
433 | { | 427 | { |
434 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); | 428 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); |
435 | return; | 429 | return; |
436 | } | 430 | } |
437 | 431 | ||
438 | QString rtext; | 432 | QString rtext; |
439 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 433 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
440 | .arg( m_mail[0] ) | 434 | .arg( m_mail[0] ) |
441 | .arg( m_mail[3] ); | 435 | .arg( m_mail[3] ); |
442 | 436 | ||
443 | QString text = m_mail[2]; | 437 | QString text = m_mail[2]; |
444 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 438 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
445 | QStringList::Iterator it; | 439 | QStringList::Iterator it; |
446 | for (it = lines.begin(); it != lines.end(); it++) | 440 | for (it = lines.begin(); it != lines.end(); it++) |
447 | { | 441 | { |
448 | rtext += "> " + *it + "\n"; | 442 | rtext += "> " + *it + "\n"; |
449 | } | 443 | } |
450 | rtext += "\n"; | 444 | rtext += "\n"; |
451 | 445 | ||
452 | QString prefix; | 446 | QString prefix; |
453 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 447 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
454 | else prefix = "Re: "; // no i18n on purpose | 448 | else prefix = "Re: "; // no i18n on purpose |
455 | 449 | ||
456 | Settings *settings = new Settings(); | 450 | Settings *settings = new Settings(); |
457 | ComposeMail composer( settings ,this, 0, true); | 451 | ComposeMail composer( settings ,this, 0, true); |
458 | if (m_recMail->Replyto().isEmpty()) { | 452 | if (m_recMail->Replyto().isEmpty()) { |
459 | composer.setTo( m_recMail->getFrom()); | 453 | composer.setTo( QString::fromUtf8( m_recMail->getFrom().latin1())); |
460 | } else { | 454 | } else { |
461 | composer.setTo( m_recMail->Replyto()); | 455 | composer.setTo( QString::fromUtf8( m_recMail->Replyto().latin1())); |
462 | } | 456 | } |
463 | composer.setSubject( prefix + m_mail[1] ); | 457 | composer.setSubject( prefix + m_mail[1] ); |
464 | composer.setMessage( rtext ); | 458 | composer.setMessage( rtext ); |
465 | composer.setInReplyTo(m_recMail->Msgid()); | 459 | composer.setInReplyTo(m_recMail->Msgid()); |
466 | 460 | ||
467 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 461 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
468 | { | 462 | { |
469 | m_recMail->Wrapper()->answeredMail(m_recMail); | 463 | m_recMail->Wrapper()->answeredMail(m_recMail); |
470 | } | 464 | } |
465 | delete settings; | ||
471 | } | 466 | } |
472 | 467 | ||
473 | void ViewMail::slotForward() | 468 | void ViewMail::slotForward() |
474 | { | 469 | { |
475 | if (!m_gotBody) | 470 | if (!m_gotBody) |
476 | { | 471 | { |
477 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); | 472 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); |
478 | return; | 473 | return; |
479 | } | 474 | } |
480 | 475 | ||
481 | QString ftext; | 476 | QString ftext; |
482 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") | 477 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") |
483 | .arg( m_mail[0] ); | 478 | .arg( m_mail[0] ); |
484 | if (!m_mail[3].isNull()) | 479 | if (!m_mail[3].isNull()) |
485 | ftext += QString("Date: %1\n") | 480 | ftext += QString("Date: %1\n") |
486 | .arg( m_mail[3] ); | 481 | .arg( m_mail[3] ); |
487 | if (!m_mail[0].isNull()) | 482 | if (!m_mail[0].isNull()) |
488 | ftext += QString("From: %1\n") | 483 | ftext += QString("From: %1\n") |
489 | .arg( m_mail[0] ); | 484 | .arg( m_mail[0] ); |
490 | if (!m_mail[1].isNull()) | 485 | if (!m_mail[1].isNull()) |
491 | ftext += QString("Subject: %1\n") | 486 | ftext += QString("Subject: %1\n") |
492 | .arg( m_mail[1] ); | 487 | .arg( m_mail[1] ); |
493 | 488 | ||
494 | ftext += QString("\n%1\n") | 489 | ftext += QString("\n%1\n") |
495 | .arg( m_mail[2]); | 490 | .arg( m_mail[2]); |
496 | 491 | ||
497 | ftext += QString("----- End forwarded message -----\n"); | 492 | ftext += QString("----- End forwarded message -----\n"); |
498 | 493 | ||
499 | Settings *settings = new Settings(); | 494 | Settings *settings = new Settings(); |
500 | ComposeMail composer( settings ,this, 0, true); | 495 | ComposeMail composer( settings ,this, 0, true); |
501 | composer.setSubject( "Fwd: " + m_mail[1] ); | 496 | composer.setSubject( "Fwd: " + m_mail[1] ); |
502 | composer.setMessage( ftext ); | 497 | composer.setMessage( ftext ); |
503 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) | 498 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) |
504 | { | 499 | { |
505 | } | 500 | } |
506 | } | 501 | } |
507 | 502 | ||
508 | void ViewMail::slotDeleteMail( ) | 503 | void ViewMail::slotDeleteMail( ) |
509 | { | 504 | { |
510 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 505 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
511 | { | 506 | { |
512 | m_recMail->Wrapper()->deleteMail( m_recMail ); | 507 | m_recMail->Wrapper()->deleteMail( m_recMail ); |
513 | hide(); | 508 | hide(); |
514 | deleted = true; | 509 | deleted = true; |
515 | } | 510 | } |
516 | } | 511 | } |
517 | 512 | ||
518 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) | 513 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) |
519 | : QDialog(parent,name,modal) | 514 | : QDialog(parent,name,modal) |
520 | { | 515 | { |