summaryrefslogtreecommitdiffabout
path: root/kmicromail/composemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 7b609fc..4bc4441 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,119 +1,120 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3 3
4#ifdef DESKTOP_VERSION 4#ifdef DESKTOP_VERSION
5#include <qapplication.h> 5#include <qapplication.h>
6#include <kabc/addresseedialog.h> 6#include <kabc/addresseedialog.h>
7#include <kabc/stdaddressbook.h> 7#include <kabc/stdaddressbook.h>
8#include <kabc/addressee.h> 8#include <kabc/addressee.h>
9#else 9#else
10#include <qpe/qpeapplication.h> 10#include <qpe/qpeapplication.h>
11#endif //DESKTOP_VERSION 11#endif //DESKTOP_VERSION
12#include <libkdepim/externalapphandler.h> 12#include <libkdepim/externalapphandler.h>
13 13
14#include "koprefs.h" 14#include "koprefs.h"
15#include <klocale.h> 15#include <klocale.h>
16#include <kglobal.h> 16#include <kglobal.h>
17 17
18#ifdef MINIKDE_KDIALOG_H 18#ifdef MINIKDE_KDIALOG_H
19#undef MINIKDE_KDIALOG_H 19#undef MINIKDE_KDIALOG_H
20#endif 20#endif
21 21
22 22
23#include "composemail.h" 23#include "composemail.h"
24 24
25#include <libmailwrapper/smtpwrapper.h> 25#include <libmailwrapper/smtpwrapper.h>
26#include <libmailwrapper/storemail.h> 26#include <libmailwrapper/storemail.h>
27#include <libmailwrapper/abstractmail.h> 27#include <libmailwrapper/abstractmail.h>
28#include <libmailwrapper/mailtypes.h> 28#include <libmailwrapper/mailtypes.h>
29 29
30/* OPIE */ 30/* OPIE */
31//#include <opie2/ofiledialog.h> 31//#include <opie2/ofiledialog.h>
32//#include <opie2/odebug.h> 32//#include <opie2/odebug.h>
33#include <kfiledialog.h> 33#include <kfiledialog.h>
34//#include <qpe/resource.h> 34//#include <qpe/resource.h>
35#include <qpe/global.h> 35#include <qpe/global.h>
36//#include <qpe/contact.h> 36//#include <qpe/contact.h>
37 37
38 38
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qiconset.h> 41#include <qiconset.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qmultilineedit.h> 45#include <qmultilineedit.h>
46#include <qlabel.h> 46#include <qlabel.h>
47#include <qtabwidget.h> 47#include <qtabwidget.h>
48#include <qlistview.h> 48#include <qlistview.h>
49 49
50//using namespace Opie::Core; 50//using namespace Opie::Core;
51//using namespace Opie::Ui; 51//using namespace Opie::Ui;
52ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) 52ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal )
53 : ComposeMailUI( parent, name, modal ) 53 : ComposeMailUI( parent, name, modal )
54{ 54{
55 55
56 topLevelWidget()->setCaption( i18n("Compose mail - Click OK to send ->") );
56 mPickLineEdit = 0; 57 mPickLineEdit = 0;
57 mEncoding = KOPrefs::instance()->mCurrentCodeName; 58 mEncoding = KOPrefs::instance()->mCurrentCodeName;
58 //managed from opiemail now 59 //managed from opiemail now
59 //connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 60 //connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
60 // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 61 // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
61 settings = sett; 62 settings = sett;
62 m_replyid = ""; 63 m_replyid = "";
63 if ( KOPrefs::instance()->mUseKapi) { 64 if ( KOPrefs::instance()->mUseKapi) {
64 KConfig config( locateLocal("config", "kabcrc") ); 65 KConfig config( locateLocal("config", "kabcrc") );
65 config.setGroup( "General" ); 66 config.setGroup( "General" );
66 QString whoami_uid = config.readEntry( "WhoAmI" ); 67 QString whoami_uid = config.readEntry( "WhoAmI" );
67 68
68 if ( whoami_uid.isEmpty() ) { 69 if ( whoami_uid.isEmpty() ) {
69 QMessageBox::information( 0, i18n( "Hint" ), 70 QMessageBox::information( 0, i18n( "Hint" ),
70 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 71 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
71 i18n( "Ok" ) ); 72 i18n( "Ok" ) );
72 73
73 74
74 fillSettings(); 75 fillSettings();
75 } else 76 } else
76 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 77 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
77 78
78 79
79#ifdef DESKTOP_VERSION 80#ifdef DESKTOP_VERSION
80 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 81 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
81 QStringList mails = con.emails(); 82 QStringList mails = con.emails();
82 QString defmail = con.preferredEmail(); 83 QString defmail = con.preferredEmail();
83 if ( mails.count() == 0) 84 if ( mails.count() == 0)
84 QMessageBox::information( 0, i18n( "Hint" ), 85 QMessageBox::information( 0, i18n( "Hint" ),
85 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 86 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
86 i18n( "Ok" ) ); 87 i18n( "Ok" ) );
87 if (defmail.length()!=0) { 88 if (defmail.length()!=0) {
88 fromBox->insertItem(defmail); 89 fromBox->insertItem(defmail);
89 } 90 }
90 QStringList::ConstIterator sit = mails.begin(); 91 QStringList::ConstIterator sit = mails.begin();
91 for (;sit!=mails.end();++sit) { 92 for (;sit!=mails.end();++sit) {
92 if ( (*sit)==defmail) 93 if ( (*sit)==defmail)
93 continue; 94 continue;
94 fromBox->insertItem((*sit)); 95 fromBox->insertItem((*sit));
95 } 96 }
96 senderNameEdit->setText(con.formattedName()); 97 senderNameEdit->setText(con.formattedName());
97#endif 98#endif
98 99
99 } else { 100 } else {
100 fillSettings(); 101 fillSettings();
101 } 102 }
102 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); 103 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
103 104
104 attList->addColumn( i18n( "Name" ) ); 105 attList->addColumn( i18n( "Name" ) );
105 attList->addColumn( i18n( "Size" ) ); 106 attList->addColumn( i18n( "Size" ) );
106 QList<Account> accounts = settings->getAccounts(); 107 QList<Account> accounts = settings->getAccounts();
107 108
108 if ( QApplication::desktop()->width() < 320 ) 109 if ( QApplication::desktop()->width() < 320 )
109 smtpAccountBox->setMaximumWidth( 80 ); 110 smtpAccountBox->setMaximumWidth( 80 );
110 Account *it; 111 Account *it;
111 for ( it = accounts.first(); it; it = accounts.next() ) { 112 for ( it = accounts.first(); it; it = accounts.next() ) {
112 if ( it->getType()==MAILLIB::A_SMTP ) { 113 if ( it->getType()==MAILLIB::A_SMTP ) {
113 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 114 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
114 smtpAccountBox->insertItem( smtp->getAccountName() ); 115 smtpAccountBox->insertItem( smtp->getAccountName() );
115 smtpAccounts.append( smtp ); 116 smtpAccounts.append( smtp );
116 } 117 }
117 } 118 }
118 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 119 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
119 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 120 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
@@ -162,129 +163,129 @@ ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, boo
162 senderNameEdit->setFixedWidth( 200 ); 163 senderNameEdit->setFixedWidth( 200 );
163#endif 164#endif
164} 165}
165 166
166void ComposeMail::fillSettings() 167void ComposeMail::fillSettings()
167{ 168{
168 if ( QApplication::desktop()->width() < 320 ) 169 if ( QApplication::desktop()->width() < 320 )
169 fromBox->setMaximumWidth( 100 ); 170 fromBox->setMaximumWidth( 100 );
170 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); 171 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
171 QStringList::ConstIterator sit = mailList.begin(); 172 QStringList::ConstIterator sit = mailList.begin();
172 int pref = 0; 173 int pref = 0;
173 for (;sit!=mailList.end();++sit) { 174 for (;sit!=mailList.end();++sit) {
174 fromBox->insertItem((*sit)); 175 fromBox->insertItem((*sit));
175 } 176 }
176 senderNameEdit->setText(KOPrefs::instance()->mName); 177 senderNameEdit->setText(KOPrefs::instance()->mName);
177} 178}
178void ComposeMail::saveSig() 179void ComposeMail::saveSig()
179{ 180{
180 if ( smtpAccountBox->count()) { 181 if ( smtpAccountBox->count()) {
181 int cur = smtpAccountBox->currentItem (); 182 int cur = smtpAccountBox->currentItem ();
182 SMTPaccount *smtp = smtpAccounts.at( cur ); 183 SMTPaccount *smtp = smtpAccounts.at( cur );
183 if ( smtp ) 184 if ( smtp )
184 smtp->setSignature( sigMultiLine->text()); 185 smtp->setSignature( sigMultiLine->text());
185 } 186 }
186} 187}
187void ComposeMail::saveAsDraft() 188void ComposeMail::saveAsDraft()
188{ 189{
189 190
190 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 191 Opie::Core::OSmartPointer<Mail> mail= new Mail();
191 mail->setMail(fromBox->currentText()); 192 mail->setMail(fromBox->currentText());
192 mail->setTo( toLine->text() ); 193 mail->setTo( toLine->text() );
193 mail->setName(senderNameEdit->text()); 194 mail->setName(senderNameEdit->text());
194 mail->setCC( ccLine->text() ); 195 mail->setCC( ccLine->text() );
195 mail->setBCC( bccLine->text() ); 196 mail->setBCC( bccLine->text() );
196 mail->setReply( replyLine->text() ); 197 mail->setReply( replyLine->text() );
197 mail->setSubject( subjectLine->text() ); 198 mail->setSubject( subjectLine->text() );
198 if (!m_replyid.isEmpty()) { 199 if (!m_replyid.isEmpty()) {
199 QStringList ids; 200 QStringList ids;
200 ids.append(m_replyid); 201 ids.append(m_replyid);
201 mail->setInreply(ids); 202 mail->setInreply(ids);
202 } 203 }
203 QString txt = message->text(); 204 QString txt = message->text();
204 if ( !sigMultiLine->text().isEmpty() ) { 205 if ( !sigMultiLine->text().isEmpty() ) {
205 txt.append( "\n--\n" ); 206 txt.append( "\n--\n" );
206 txt.append( sigMultiLine->text() ); 207 txt.append( sigMultiLine->text() );
207 } 208 }
208 mail->setMessage( txt ); 209 mail->setMessage( txt );
209 mail->setCharset (mEncoding); 210 mail->setCharset (mEncoding);
210 /* only use the default drafts folder name! */ 211 /* only use the default drafts folder name! */
211 Storemail wrapper(AbstractMail::draftFolder()); 212 Storemail wrapper(AbstractMail::draftFolder());
212 wrapper.storeMail(mail); 213 wrapper.storeMail(mail);
213 214
214 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 215 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
215 /* attachments we will ignore! */ 216 /* attachments we will ignore! */
216 if ( it != 0 ) { 217 if ( it != 0 ) {
217 if ( warnAttach ) 218 if ( warnAttach )
218 QMessageBox::warning(0,i18n("Store message"), 219 QMessageBox::warning(0,i18n("Store message"),
219 i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); 220 i18n("<center>Attachments will not be stored in \"Draft\" folder</center>"));
220 warnAttach = false; 221 warnAttach = false;
221 } 222 }
222 setStatus( i18n("Mail saved as draft!") ); 223 setStatus( i18n("Mail saved as draft!") );
223} 224}
224void ComposeMail::clearStatus() 225void ComposeMail::clearStatus()
225{ 226{
226 topLevelWidget()->setCaption( i18n("Compose mail") ); 227 topLevelWidget()->setCaption( i18n("Compose mail - Click OK to send ->") );
227} 228}
228void ComposeMail::setStatus( QString status ) 229void ComposeMail::setStatus( QString status )
229{ 230{
230 topLevelWidget()->setCaption( status ); 231 topLevelWidget()->setCaption( status );
231 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; 232 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
232} 233}
233void ComposeMail::pickAddress( ) 234void ComposeMail::pickAddress( )
234{ 235{
235 236
236 QLineEdit *line = mPickLineEdit; 237 QLineEdit *line = mPickLineEdit;
237 if ( line == 0 ) 238 if ( line == 0 )
238 return; 239 return;
239#ifdef DESKTOP_VERSION 240#ifdef DESKTOP_VERSION
240 //qDebug(" ComposeMail::pickAddress "); 241 //qDebug(" ComposeMail::pickAddress ");
241 QString names ;//= AddressPicker::getNames(); 242 QString names ;//= AddressPicker::getNames();
242 243
243 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 244 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
244 uint i=0; 245 uint i=0;
245 for (i=0; i < list.count(); i++) { 246 for (i=0; i < list.count(); i++) {
246 if ( !list[i].preferredEmail().isEmpty()) { 247 if ( !list[i].preferredEmail().isEmpty()) {
247 if ( ! names.isEmpty() ) 248 if ( ! names.isEmpty() )
248 names+= ","; 249 names+= ",";
249 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 250 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
250 251
251 } 252 }
252 } 253 }
253 254
254 255
255 if ( line->text().isEmpty() ) { 256 if ( line->text().isEmpty() ) {
256 line->setText( names ); 257 line->setText( names );
257 } else if ( !names.isEmpty() ) { 258 } else if ( !names.isEmpty() ) {
258 line->setText( line->text() + ", " + names ); 259 line->setText( line->text() + ", " + names );
259 } 260 }
260#else 261#else
261 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); 262 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
262 // the result should now arrive through method insertAttendees 263 // the result should now arrive through method insertAttendees
263#endif 264#endif
264} 265}
265//the map includes name/email pairs, that comes from Ka/Pi 266//the map includes name/email pairs, that comes from Ka/Pi
266void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 267void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
267{ 268{
268 //qDebug("ComposeMail::insertAttendees "); 269 //qDebug("ComposeMail::insertAttendees ");
269 raise(); 270 raise();
270 271
271 QString UID = uid; 272 QString UID = uid;
272 if ( uid.left( 18 ) == (this->name() +QString("pick2")) ) { 273 if ( uid.left( 18 ) == (this->name() +QString("pick2")) ) {
273 mPickLineEdit = toLine; 274 mPickLineEdit = toLine;
274 UID = this->name(); 275 UID = this->name();
275 subjectLine->setText( uid.mid( 18 ) ); 276 subjectLine->setText( uid.mid( 18 ) );
276 } 277 }
277 //qDebug("ccc %s %s ", uid.latin1(), this->name()); 278 //qDebug("ccc %s %s ", uid.latin1(), this->name());
278 if ( mPickLineEdit == 0 ) { //whoami received 279 if ( mPickLineEdit == 0 ) { //whoami received
279 QString defmail = uidList[0]; 280 QString defmail = uidList[0];
280 if ( emailList.count() == 0 ) 281 if ( emailList.count() == 0 )
281 QMessageBox::information( 0, i18n( "Hint" ), 282 QMessageBox::information( 0, i18n( "Hint" ),
282 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 283 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
283 i18n( "Ok" ) ); 284 i18n( "Ok" ) );
284 if (defmail.length()!=0) { 285 if (defmail.length()!=0) {
285 fromBox->insertItem(defmail); 286 fromBox->insertItem(defmail);
286 } 287 }
287 QStringList::ConstIterator sit = emailList.begin(); 288 QStringList::ConstIterator sit = emailList.begin();
288 int pref = 0; 289 int pref = 0;
289 for (;sit!=emailList.end();++sit) { 290 for (;sit!=emailList.end();++sit) {
290 if ( (*sit)==defmail) 291 if ( (*sit)==defmail)
@@ -363,129 +364,129 @@ void ComposeMail::pickAddressReply()
363} 364}
364 365
365void ComposeMail::fillValues( int current ) 366void ComposeMail::fillValues( int current )
366{ 367{
367#if 0 368#if 0
368 SMTPaccount *smtp = smtpAccounts.at( current ); 369 SMTPaccount *smtp = smtpAccounts.at( current );
369 ccLine->clear(); 370 ccLine->clear();
370 if ( smtp->getUseCC() ) { 371 if ( smtp->getUseCC() ) {
371 ccLine->setText( smtp->getCC() ); 372 ccLine->setText( smtp->getCC() );
372 } 373 }
373 bccLine->clear(); 374 bccLine->clear();
374 if ( smtp->getUseBCC() ) { 375 if ( smtp->getUseBCC() ) {
375 bccLine->setText( smtp->getBCC() ); 376 bccLine->setText( smtp->getBCC() );
376 } 377 }
377 replyLine->clear(); 378 replyLine->clear();
378 if ( smtp->getUseReply() ) { 379 if ( smtp->getUseReply() ) {
379 replyLine->setText( smtp->getReply() ); 380 replyLine->setText( smtp->getReply() );
380 } 381 }
381#endif 382#endif
382 SMTPaccount *smtp = smtpAccounts.at( current ); 383 SMTPaccount *smtp = smtpAccounts.at( current );
383 if ( smtp ) 384 if ( smtp )
384 sigMultiLine->setText( smtp->getSignature() ); 385 sigMultiLine->setText( smtp->getSignature() );
385} 386}
386 387
387void ComposeMail::slotAdjustColumns() 388void ComposeMail::slotAdjustColumns()
388{ 389{
389 int currPage = tabWidget->currentPageIndex(); 390 int currPage = tabWidget->currentPageIndex();
390 391
391 tabWidget->showPage( attachTab ); 392 tabWidget->showPage( attachTab );
392 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 393 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
393 attList->setColumnWidth( 1, 80 ); 394 attList->setColumnWidth( 1, 80 );
394 395
395 tabWidget->setCurrentPage( currPage ); 396 tabWidget->setCurrentPage( currPage );
396} 397}
397 398
398void ComposeMail::addAttachment() 399void ComposeMail::addAttachment()
399{ 400{
400 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); 401 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this );
401 if ( !lnk.isEmpty() ) { 402 if ( !lnk.isEmpty() ) {
402 Attachment *att = new Attachment( lnk ); 403 Attachment *att = new Attachment( lnk );
403 (void) new AttachViewItem( attList, att ); 404 (void) new AttachViewItem( attList, att );
404 } 405 }
405} 406}
406 407
407void ComposeMail::removeAttachment() 408void ComposeMail::removeAttachment()
408{ 409{
409 if ( !attList->currentItem() ) { 410 if ( !attList->currentItem() ) {
410 QMessageBox::information( this, i18n( "Error" ), 411 QMessageBox::information( this, i18n( "Error" ),
411 i18n( "<p>Please select a File.</p>" ), 412 i18n( "<p>Please select a File.</p>" ),
412 i18n( "Ok" ) ); 413 i18n( "Ok" ) );
413 } else { 414 } else {
414 attList->takeItem( attList->currentItem() ); 415 attList->takeItem( attList->currentItem() );
415 } 416 }
416} 417}
417 418
418void ComposeMail::accept() 419void ComposeMail::accept()
419{ 420{
420 if ( smtpAccountBox->count() == 0 ) { 421 if ( smtpAccountBox->count() == 0 ) {
421 422
422 reject(); 423 reject();
423 return; 424 return;
424 } 425 }
425 426
426 if (! checkBoxLater->isChecked() ) { 427 if (! checkBoxLater->isChecked() ) {
427 int yesno = QMessageBox::warning(0,i18n("Stop editing message"), 428 int yesno = QMessageBox::warning(0, subjectLine->text().left ( 25 ),
428 i18n("Send this message?"), 429 i18n("Send this message?"),
429 i18n("Yes"), 430 i18n("Yes"),
430 i18n("Cancel")); 431 i18n("Cancel"));
431 432
432 if (yesno == 1) { 433 if (yesno == 1) {
433 return; 434 return;
434 } 435 }
435 } 436 }
436#if 0 437#if 0
437 odebug << "Sending Mail with " 438 odebug << "Sending Mail with "
438 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; 439 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
439#endif 440#endif
440 Opie::Core::OSmartPointer<Mail> mail=new Mail; 441 Opie::Core::OSmartPointer<Mail> mail=new Mail;
441 442
442 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 443 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
443 mail->setMail(fromBox->currentText()); 444 mail->setMail(fromBox->currentText());
444 445
445 if ( !toLine->text().isEmpty() ) { 446 if ( !toLine->text().isEmpty() ) {
446 mail->setTo( toLine->text() ); 447 mail->setTo( toLine->text() );
447 } else { 448 } else {
448 QMessageBox::warning(0,i18n("Sending mail"), 449 QMessageBox::warning(0,i18n("Sending mail"),
449 i18n("No Receiver spezified" ) ); 450 i18n("No Receiver spezified" ) );
450 return; 451 return;
451 } 452 }
452 453
453 mail->setName(senderNameEdit->text()); 454 mail->setName(senderNameEdit->text());
454 mail->setCC( ccLine->text() ); 455 mail->setCC( ccLine->text() );
455 mail->setBCC( bccLine->text() ); 456 mail->setBCC( bccLine->text() );
456 mail->setReply( replyLine->text() ); 457 mail->setReply( replyLine->text() );
457 mail->setSubject( subjectLine->text() ); 458 mail->setSubject( subjectLine->text() );
458 if (!m_replyid.isEmpty()) { 459 if (!m_replyid.isEmpty()) {
459 QStringList ids; 460 QStringList ids;
460 ids.append(m_replyid); 461 ids.append(m_replyid);
461 mail->setInreply(ids); 462 mail->setInreply(ids);
462 } 463 }
463 QString txt = message->text(); 464 QString txt = message->text();
464 if ( !sigMultiLine->text().isEmpty() ) { 465 if ( !sigMultiLine->text().isEmpty() ) {
465 txt.append( "\n--\n" ); 466 txt.append( "\n--\n" );
466 txt.append( sigMultiLine->text() ); 467 txt.append( sigMultiLine->text() );
467 } 468 }
468 mail->setMessage( txt ); 469 mail->setMessage( txt );
469 mail->setCharset (mEncoding); 470 mail->setCharset (mEncoding);
470 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 471 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
471 while ( it != 0 ) { 472 while ( it != 0 ) {
472 mail->addAttachment( it->getAttachment() ); 473 mail->addAttachment( it->getAttachment() );
473 it = (AttachViewItem *) it->nextSibling(); 474 it = (AttachViewItem *) it->nextSibling();
474 } 475 }
475 476
476 SMTPwrapper wrapper( smtp ); 477 SMTPwrapper wrapper( smtp );
477 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) 478 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
478 setStatus( tr ("Mail sent")); 479 setStatus( tr ("Mail sent"));
479 else { 480 else {
480 setStatus( tr ("Error: Something went wrong. Nothing sent")); 481 setStatus( tr ("Error: Something went wrong. Nothing sent"));
481 return; 482 return;
482 } 483 }
483 484
484 485
485 QDialog::accept(); 486 QDialog::accept();
486} 487}
487 488
488void ComposeMail::reject() 489void ComposeMail::reject()
489{ 490{
490 //qDebug("ComposeMail::reject() "); 491 //qDebug("ComposeMail::reject() ");
491 int yesno = QMessageBox::warning(0,i18n("Store message?"), 492 int yesno = QMessageBox::warning(0,i18n("Store message?"),