summaryrefslogtreecommitdiffabout
path: root/kmicromail/composemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 4bc4441..81d7b52 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -9,72 +9,72 @@
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 <qicon.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 <q3multilineedit.h>
46#include <qlabel.h> 46#include <qlabel.h>
47#include <qtabwidget.h> 47#include <qtabwidget.h>
48#include <qlistview.h> 48#include <q3listview.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 topLevelWidget()->setCaption( i18n("Compose mail - Click OK to send ->") );
57 mPickLineEdit = 0; 57 mPickLineEdit = 0;
58 mEncoding = KOPrefs::instance()->mCurrentCodeName; 58 mEncoding = KOPrefs::instance()->mCurrentCodeName;
59 //managed from opiemail now 59 //managed from opiemail now
60 //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&)),
61 // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 61 // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
62 settings = sett; 62 settings = sett;
63 m_replyid = ""; 63 m_replyid = "";
64 if ( KOPrefs::instance()->mUseKapi) { 64 if ( KOPrefs::instance()->mUseKapi) {
65 KConfig config( locateLocal("config", "kabcrc") ); 65 KConfig config( locateLocal("config", "kabcrc") );
66 config.setGroup( "General" ); 66 config.setGroup( "General" );
67 QString whoami_uid = config.readEntry( "WhoAmI" ); 67 QString whoami_uid = config.readEntry( "WhoAmI" );
68 68
69 if ( whoami_uid.isEmpty() ) { 69 if ( whoami_uid.isEmpty() ) {
70 QMessageBox::information( 0, i18n( "Hint" ), 70 QMessageBox::information( 0, i18n( "Hint" ),
71 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" ),
72 i18n( "Ok" ) ); 72 i18n( "Ok" ) );
73 73
74 74
75 fillSettings(); 75 fillSettings();
76 } else 76 } else
77 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 77 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
78 78
79 79
80#ifdef DESKTOP_VERSION 80#ifdef DESKTOP_VERSION
@@ -96,81 +96,81 @@ ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, boo
96 } 96 }
97 senderNameEdit->setText(con.formattedName()); 97 senderNameEdit->setText(con.formattedName());
98#endif 98#endif
99 99
100 } else { 100 } else {
101 fillSettings(); 101 fillSettings();
102 } 102 }
103 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); 103 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
104 104
105 attList->addColumn( i18n( "Name" ) ); 105 attList->addColumn( i18n( "Name" ) );
106 attList->addColumn( i18n( "Size" ) ); 106 attList->addColumn( i18n( "Size" ) );
107 QList<Account> accounts = settings->getAccounts(); 107 QList<Account> accounts = settings->getAccounts();
108 108
109 if ( QApplication::desktop()->width() < 320 ) 109 if ( QApplication::desktop()->width() < 320 )
110 smtpAccountBox->setMaximumWidth( 80 ); 110 smtpAccountBox->setMaximumWidth( 80 );
111 Account *it; 111 Account *it;
112 for ( it = accounts.first(); it; it = accounts.next() ) { 112 for ( it = accounts.first(); it; it = accounts.next() ) {
113 if ( it->getType()==MAILLIB::A_SMTP ) { 113 if ( it->getType()==MAILLIB::A_SMTP ) {
114 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 114 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
115 smtpAccountBox->insertItem( smtp->getAccountName() ); 115 smtpAccountBox->insertItem( smtp->getAccountName() );
116 smtpAccounts.append( smtp ); 116 smtpAccounts.append( smtp );
117 } 117 }
118 } 118 }
119 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 119 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
120 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 120 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
121 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 121 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
122 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 122 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
123 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 123 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
124 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 124 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
125 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 125 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
126 mMail = 0; 126 mMail = 0;
127 warnAttach = true; 127 warnAttach = true;
128 QIconSet icon; 128 QIcon icon;
129 //icon = SmallIcon("fileexport"); 129 //icon = SmallIcon("fileexport");
130 icon = SmallIcon("filesave"); 130 icon = SmallIcon("filesave");
131 SaveButton->setIconSet (icon ) ; 131 SaveButton->setIconSet (icon ) ;
132 if ( QApplication::desktop()->width() < 320 ) { 132 if ( QApplication::desktop()->width() < 320 ) {
133 SaveButton->setText ("") ; 133 SaveButton->setText ("") ;
134 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; 134 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ;
135 } 135 }
136 else 136 else
137 SaveButton->setText (i18n("Save")); 137 SaveButton->setText (i18n("Save"));
138#ifndef DESKTOP_VERSION 138#ifndef DESKTOP_VERSION
139 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); 139 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
140 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); 140 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold );
141 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); 141 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold );
142#endif 142#endif
143 message->setFont ( KOPrefs::instance()->mComposeFont ); 143 message->setFont ( KOPrefs::instance()->mComposeFont );
144 message->setWordWrap (QMultiLineEdit::WidgetWidth); 144 message->setWordWrap (Q3MultiLineEdit::WidgetWidth);
145 if ( smtpAccounts.count() > 0 ) { 145 if ( smtpAccounts.count() > 0 ) {
146 fillValues( smtpAccountBox->currentItem() ); 146 fillValues( smtpAccountBox->currentItem() );
147 } else { 147 } else {
148 QMessageBox::information( 0, i18n( "Problem" ), 148 QMessageBox::information( 0, i18n( "Problem" ),
149 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), 149 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ),
150 i18n( "Ok" ) ); 150 i18n( "Ok" ) );
151 return; 151 return;
152 } 152 }
153 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 153 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
154 connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) ); 154 connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) );
155 if ( smtpAccountBox->count()) 155 if ( smtpAccountBox->count())
156 fillValues(0); 156 fillValues(0);
157#ifdef DESKTOP_VERSION 157#ifdef DESKTOP_VERSION
158 if ( QApplication::desktop()->width() <= 800 ) { 158 if ( QApplication::desktop()->width() <= 800 ) {
159 resize( QApplication::desktop()->size() ); 159 resize( QApplication::desktop()->size() );
160 } else 160 } else
161 resize( 800, 600 ); 161 resize( 800, 600 );
162 if ( QApplication::desktop()->width() >= 640 ) 162 if ( QApplication::desktop()->width() >= 640 )
163 senderNameEdit->setFixedWidth( 200 ); 163 senderNameEdit->setFixedWidth( 200 );
164#endif 164#endif
165} 165}
166 166
167void ComposeMail::fillSettings() 167void ComposeMail::fillSettings()
168{ 168{
169 if ( QApplication::desktop()->width() < 320 ) 169 if ( QApplication::desktop()->width() < 320 )
170 fromBox->setMaximumWidth( 100 ); 170 fromBox->setMaximumWidth( 100 );
171 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); 171 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
172 QStringList::ConstIterator sit = mailList.begin(); 172 QStringList::ConstIterator sit = mailList.begin();
173 int pref = 0; 173 int pref = 0;
174 for (;sit!=mailList.end();++sit) { 174 for (;sit!=mailList.end();++sit) {
175 fromBox->insertItem((*sit)); 175 fromBox->insertItem((*sit));
176 } 176 }
@@ -505,42 +505,42 @@ void ComposeMail::reject()
505 } 505 }
506 if (yesno == 2) { 506 if (yesno == 2) {
507 qDebug("return "); 507 qDebug("return ");
508 return; 508 return;
509 } 509 }
510 QDialog::reject(); 510 QDialog::reject();
511} 511}
512 512
513void ComposeMail::setCharset(const QString& charset) 513void ComposeMail::setCharset(const QString& charset)
514{ 514{
515 if ( !charset.isEmpty() ) 515 if ( !charset.isEmpty() )
516 mEncoding = charset; 516 mEncoding = charset;
517 qDebug("ComposeMail::setCharset %s ", mEncoding.latin1()); 517 qDebug("ComposeMail::setCharset %s ", mEncoding.latin1());
518} 518}
519ComposeMail::~ComposeMail() 519ComposeMail::~ComposeMail()
520{ 520{
521} 521}
522 522
523void ComposeMail::reEditMail(const RecMailP&current) 523void ComposeMail::reEditMail(const RecMailP&current)
524{ 524{
525 RecMailP data = current; 525 RecMailP data = current;
526 RecBodyP body = data->Wrapper()->fetchBody(current); 526 RecBodyP body = data->Wrapper()->fetchBody(current);
527 527
528 message->setText(body->Bodytext()); 528 message->setText(body->Bodytext());
529 subjectLine->setText( data->getSubject()); 529 subjectLine->setText( data->getSubject());
530 toLine->setText(data->To().join(",")); 530 toLine->setText(data->To().join(","));
531 ccLine->setText(data->CC().join(",")); 531 ccLine->setText(data->CC().join(","));
532 bccLine->setText(data->Bcc().join(",")); 532 bccLine->setText(data->Bcc().join(","));
533 replyLine->setText(data->Replyto()); 533 replyLine->setText(data->Replyto());
534 setCharset(body->getCharset()); 534 setCharset(body->getCharset());
535} 535}
536 536
537AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 537AttachViewItem::AttachViewItem( Q3ListView *parent, Attachment *att )
538 : QListViewItem( parent ) 538 : Q3ListViewItem( parent )
539{ 539{
540 attachment = att; 540 attachment = att;
541 if ( !attachment->getPixmap().isNull() ) 541 if ( !attachment->getPixmap().isNull() )
542 setPixmap( 0,attachment->getPixmap() ); 542 setPixmap( 0,attachment->getPixmap() );
543 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 543 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
544 setText( 1, QString::number( att->getSize() ) ); 544 setText( 1, QString::number( att->getSize() ) );
545} 545}
546 546