author | zautrix <zautrix> | 2004-10-31 12:28:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-31 12:28:03 (UTC) |
commit | bed831cc1a38d38a4c5b9329bf37b1c663142c23 (patch) (unidiff) | |
tree | db12b81ea6cee0cac347c801798d759dfe24acfb /kmicromail/composemail.cpp | |
parent | 553bd9acf9879a77c5fa925155f73afbe8a9af41 (diff) | |
download | kdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.zip kdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.tar.gz kdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.tar.bz2 |
ompi utf8 fixes
-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 | |||
@@ -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 | ||