-rw-r--r-- | kmicromail/opiemail.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index f68467c..197f7ec 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -114,90 +114,92 @@ void OpieMail::message(const QCString &msg, const QByteArray &data) | |||
114 | } | 114 | } |
115 | void OpieMail::slotExtAppHandler() | 115 | void OpieMail::slotExtAppHandler() |
116 | { | 116 | { |
117 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); | 117 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); |
118 | } | 118 | } |
119 | void OpieMail::slotwriteMail2(const QString& namemail ) | 119 | void OpieMail::slotwriteMail2(const QString& namemail ) |
120 | { | 120 | { |
121 | //qDebug("OpieMail::slotwriteMail2 "); | 121 | //qDebug("OpieMail::slotwriteMail2 "); |
122 | //qApp->processEvents(); | 122 | //qApp->processEvents(); |
123 | ComposeMail compose( settings, this, 0, true ); | 123 | ComposeMail compose( settings, this, 0, true ); |
124 | if ( !namemail.isEmpty() ) { | 124 | if ( !namemail.isEmpty() ) { |
125 | QString to = namemail; | 125 | QString to = namemail; |
126 | if ( namemail.find( " <") > 1 ) { | 126 | if ( namemail.find( " <") > 1 ) { |
127 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 127 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
128 | } else | 128 | } else |
129 | if ( namemail.find( "<") > 1 ) { | 129 | if ( namemail.find( "<") > 1 ) { |
130 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 130 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
131 | } | 131 | } |
132 | int sub = to.find( ">:"); | 132 | int sub = to.find( ">:"); |
133 | if ( sub > 0 ) { | 133 | if ( sub > 0 ) { |
134 | compose.setTo( to.left(sub+1) ); | 134 | compose.setTo( to.left(sub+1) ); |
135 | compose.setSubject( to.mid(sub+2) ); | 135 | compose.setSubject( to.mid(sub+2) ); |
136 | } else | 136 | } else |
137 | compose.setTo( to ); | 137 | compose.setTo( to ); |
138 | } | 138 | } |
139 | compose.slotAdjustColumns(); | 139 | compose.slotAdjustColumns(); |
140 | #ifndef DESKTOP_VERSION | 140 | #ifndef DESKTOP_VERSION |
141 | compose.showMaximized(); | 141 | compose.showMaximized(); |
142 | #endif | 142 | #endif |
143 | mCurrentComposer = &compose; | 143 | mCurrentComposer = &compose; |
144 | compose.exec(); | 144 | compose.exec(); |
145 | mCurrentComposer = 0; | 145 | mCurrentComposer = 0; |
146 | folderView->refreshOutgoing(); | ||
146 | raise(); | 147 | raise(); |
147 | //qDebug("retttich "); | 148 | //qDebug("retttich "); |
148 | } | 149 | } |
149 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 150 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
150 | { | 151 | { |
151 | // qDebug("OpieMail::slotwriteMail "); | 152 | // qDebug("OpieMail::slotwriteMail "); |
152 | ComposeMail compose( settings, this, 0, true ); | 153 | ComposeMail compose( settings, this, 0, true ); |
153 | if (!email.isEmpty()) | 154 | if (!email.isEmpty()) |
154 | { | 155 | { |
155 | if (!name.isEmpty()) | 156 | if (!name.isEmpty()) |
156 | { | 157 | { |
157 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 158 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
158 | } | 159 | } |
159 | else | 160 | else |
160 | { | 161 | { |
161 | compose.setTo(email); | 162 | compose.setTo(email); |
162 | } | 163 | } |
163 | } | 164 | } |
164 | compose.slotAdjustColumns(); | 165 | compose.slotAdjustColumns(); |
165 | #ifndef DESKTOP_VERSION | 166 | #ifndef DESKTOP_VERSION |
166 | compose.showMaximized(); | 167 | compose.showMaximized(); |
167 | #endif | 168 | #endif |
168 | 169 | ||
169 | mCurrentComposer = &compose; | 170 | mCurrentComposer = &compose; |
170 | compose.exec(); | 171 | compose.exec(); |
171 | mCurrentComposer = 0; | 172 | mCurrentComposer = 0; |
173 | folderView->refreshOutgoing(); | ||
172 | raise(); | 174 | raise(); |
173 | } | 175 | } |
174 | 176 | ||
175 | void OpieMail::slotComposeMail() | 177 | void OpieMail::slotComposeMail() |
176 | { | 178 | { |
177 | if ( mPendingEmail == QString::null && mPendingName == QString::null) | 179 | if ( mPendingEmail == QString::null && mPendingName == QString::null) |
178 | slotwriteMail2( QString () ); | 180 | slotwriteMail2( QString () ); |
179 | else { | 181 | else { |
180 | if ( mPendingEmail == QString::null ) | 182 | if ( mPendingEmail == QString::null ) |
181 | slotwriteMail2( mPendingName ); | 183 | slotwriteMail2( mPendingName ); |
182 | else | 184 | else |
183 | slotwriteMail( mPendingName, mPendingEmail ); | 185 | slotwriteMail( mPendingName, mPendingEmail ); |
184 | } | 186 | } |
185 | //slotwriteMail(0l,0l); | 187 | //slotwriteMail(0l,0l); |
186 | } | 188 | } |
187 | 189 | ||
188 | void OpieMail::slotSendQueued() | 190 | void OpieMail::slotSendQueued() |
189 | { | 191 | { |
190 | SMTPaccount *smtp = 0; | 192 | SMTPaccount *smtp = 0; |
191 | 193 | ||
192 | QList<Account> list = settings->getAccounts(); | 194 | QList<Account> list = settings->getAccounts(); |
193 | QList<SMTPaccount> smtpList; | 195 | QList<SMTPaccount> smtpList; |
194 | smtpList.setAutoDelete(false); | 196 | smtpList.setAutoDelete(false); |
195 | Account *it; | 197 | Account *it; |
196 | for ( it = list.first(); it; it = list.next() ) | 198 | for ( it = list.first(); it; it = list.next() ) |
197 | { | 199 | { |
198 | if ( it->getType() == MAILLIB::A_SMTP ) | 200 | if ( it->getType() == MAILLIB::A_SMTP ) |
199 | { | 201 | { |
200 | smtp = static_cast<SMTPaccount *>(it); | 202 | smtp = static_cast<SMTPaccount *>(it); |
201 | smtpList.append(smtp); | 203 | smtpList.append(smtp); |
202 | } | 204 | } |
203 | } | 205 | } |
@@ -285,64 +287,65 @@ void OpieMail::replyMail() | |||
285 | 287 | ||
286 | QString text = body->Bodytext(); | 288 | QString text = body->Bodytext(); |
287 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 289 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
288 | QStringList::Iterator it; | 290 | QStringList::Iterator it; |
289 | for (it = lines.begin(); it != lines.end(); it++) | 291 | for (it = lines.begin(); it != lines.end(); it++) |
290 | { | 292 | { |
291 | rtext += "> " + *it + "\n"; | 293 | rtext += "> " + *it + "\n"; |
292 | } | 294 | } |
293 | rtext += "\n"; | 295 | rtext += "\n"; |
294 | 296 | ||
295 | QString prefix; | 297 | QString prefix; |
296 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 298 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
297 | else prefix = "Re: "; // no i18n on purpose | 299 | else prefix = "Re: "; // no i18n on purpose |
298 | 300 | ||
299 | Settings *settings = new Settings(); | 301 | Settings *settings = new Settings(); |
300 | ComposeMail composer( settings ,this, 0, true); | 302 | ComposeMail composer( settings ,this, 0, true); |
301 | if (mail->Replyto().isEmpty()) { | 303 | if (mail->Replyto().isEmpty()) { |
302 | composer.setTo( mail->getFrom()); | 304 | composer.setTo( mail->getFrom()); |
303 | } else { | 305 | } else { |
304 | composer.setTo( mail->Replyto()); | 306 | composer.setTo( mail->Replyto()); |
305 | } | 307 | } |
306 | composer.setSubject( prefix + mail->getSubject()); | 308 | composer.setSubject( prefix + mail->getSubject()); |
307 | composer.setMessage( rtext ); | 309 | composer.setMessage( rtext ); |
308 | composer.setInReplyTo( mail->Msgid()); | 310 | composer.setInReplyTo( mail->Msgid()); |
309 | composer.setCharset( body->getCharset() ); | 311 | composer.setCharset( body->getCharset() ); |
310 | 312 | ||
311 | mCurrentComposer = &composer; | 313 | mCurrentComposer = &composer; |
312 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 314 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
313 | { | 315 | { |
314 | mail->Wrapper()->answeredMail(mail); | 316 | mail->Wrapper()->answeredMail(mail); |
315 | } | 317 | } |
316 | mCurrentComposer = 0; | 318 | mCurrentComposer = 0; |
319 | folderView->refreshOutgoing(); | ||
317 | delete settings; | 320 | delete settings; |
318 | 321 | ||
319 | } | 322 | } |
320 | void OpieMail::closeViewMail(ViewMail * vm) | 323 | void OpieMail::closeViewMail(ViewMail * vm) |
321 | { | 324 | { |
322 | vm->hide(); | 325 | vm->hide(); |
323 | } | 326 | } |
324 | 327 | ||
325 | void OpieMail::slotDownloadMail( ) | 328 | void OpieMail::slotDownloadMail( ) |
326 | { | 329 | { |
327 | QListViewItem*item = mailView->currentItem(); | 330 | QListViewItem*item = mailView->currentItem(); |
328 | if (!item ) { | 331 | if (!item ) { |
329 | Global::statusMessage("Error: No item slected!"); | 332 | Global::statusMessage("Error: No item slected!"); |
330 | return; | 333 | return; |
331 | } | 334 | } |
332 | RecMailP mail = ((MailListViewItem*)item)->data(); | 335 | RecMailP mail = ((MailListViewItem*)item)->data(); |
333 | Account * acc = mail->Wrapper()->getAccount(); | 336 | Account * acc = mail->Wrapper()->getAccount(); |
334 | if ( !acc ) { | 337 | if ( !acc ) { |
335 | Global::statusMessage("Mail is already stored locally!"); | 338 | Global::statusMessage("Mail is already stored locally!"); |
336 | return; | 339 | return; |
337 | } | 340 | } |
338 | QString lfName = acc->getLocalFolder(); | 341 | QString lfName = acc->getLocalFolder(); |
339 | //qDebug("local folder " + lfName ); | 342 | //qDebug("local folder " + lfName ); |
340 | if ( lfName.isEmpty() ) | 343 | if ( lfName.isEmpty() ) |
341 | lfName = acc->getAccountName(); | 344 | lfName = acc->getAccountName(); |
342 | AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); | 345 | AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); |
343 | //qDebug("target %d %d ",targetMail,mail->Wrapper() ); | 346 | //qDebug("target %d %d ",targetMail,mail->Wrapper() ); |
344 | if ( targetMail == mail->Wrapper() ) { | 347 | if ( targetMail == mail->Wrapper() ) { |
345 | Global::statusMessage("Mail is already locally stored!"); | 348 | Global::statusMessage("Mail is already locally stored!"); |
346 | return; | 349 | return; |
347 | } | 350 | } |
348 | if ( !targetMail->createMbox(lfName)) { | 351 | if ( !targetMail->createMbox(lfName)) { |
@@ -620,53 +623,55 @@ void OpieMail::slotMoveCopyAllMail() | |||
620 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 623 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
621 | targetFolder.isEmpty()) | 624 | targetFolder.isEmpty()) |
622 | { | 625 | { |
623 | return; | 626 | return; |
624 | } | 627 | } |
625 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 628 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
626 | { | 629 | { |
627 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 630 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
628 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 631 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
629 | return; | 632 | return; |
630 | } | 633 | } |
631 | sels.hide(); | 634 | sels.hide(); |
632 | qApp->processEvents(); | 635 | qApp->processEvents(); |
633 | //qDebug("hiding sels "); | 636 | //qDebug("hiding sels "); |
634 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); | 637 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); |
635 | folderView->refreshCurrent(); | 638 | folderView->refreshCurrent(); |
636 | } | 639 | } |
637 | 640 | ||
638 | void OpieMail::reEditMail() | 641 | void OpieMail::reEditMail() |
639 | { | 642 | { |
640 | if (!mailView->currentItem()) return; | 643 | if (!mailView->currentItem()) return; |
641 | 644 | ||
642 | ComposeMail compose( settings, this, 0, true ); | 645 | ComposeMail compose( settings, this, 0, true ); |
643 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 646 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
644 | compose.slotAdjustColumns(); | 647 | compose.slotAdjustColumns(); |
645 | #ifndef DESKTOP_VERSION | 648 | #ifndef DESKTOP_VERSION |
646 | compose.showMaximized(); | 649 | compose.showMaximized(); |
647 | #else | 650 | #else |
648 | compose.resize(640,480); | 651 | compose.resize(640,480); |
649 | #endif | 652 | #endif |
650 | mCurrentComposer = &compose; | 653 | mCurrentComposer = &compose; |
651 | compose.exec(); | 654 | compose.exec(); |
655 | folderView->refreshOutgoing(); | ||
652 | mCurrentComposer = 0; | 656 | mCurrentComposer = 0; |
653 | } | 657 | } |
654 | 658 | ||
655 | void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 659 | void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
656 | { | 660 | { |
657 | 661 | ||
658 | if ( mCurrentComposer ) { | 662 | if ( mCurrentComposer ) { |
659 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); | 663 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); |
660 | } else { | 664 | } else { |
661 | ComposeMail compose( settings, this, 0, true ); | 665 | ComposeMail compose( settings, this, 0, true ); |
662 | compose.slotAdjustColumns(); | 666 | compose.slotAdjustColumns(); |
663 | #ifndef DESKTOP_VERSION | 667 | #ifndef DESKTOP_VERSION |
664 | compose.showMaximized(); | 668 | compose.showMaximized(); |
665 | #endif | 669 | #endif |
666 | mCurrentComposer = &compose; | 670 | mCurrentComposer = &compose; |
667 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); | 671 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); |
668 | compose.exec(); | 672 | compose.exec(); |
669 | mCurrentComposer = 0; | 673 | mCurrentComposer = 0; |
674 | folderView->refreshOutgoing(); | ||
670 | raise(); | 675 | raise(); |
671 | } | 676 | } |
672 | } | 677 | } |