-rw-r--r-- | kmicromail/composemail.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 5945b7f..2dcbc75 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -32,39 +32,39 @@ | |||
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 | ||
@@ -152,45 +152,45 @@ void ComposeMail::fillSettings() | |||
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>")); |
@@ -395,56 +395,56 @@ void ComposeMail::accept() | |||
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 | ||
@@ -470,34 +470,34 @@ void ComposeMail::reject() | |||
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 | ||