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
@@ -32,48 +32,49 @@
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
@@ -202,49 +203,49 @@ void ComposeMail::saveAsDraft()
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
@@ -403,49 +404,49 @@ void ComposeMail::addAttachment()
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 }