summaryrefslogtreecommitdiffabout
path: root/kmicromail/composemail.cpp
authorzautrix <zautrix>2004-09-15 06:15:59 (UTC)
committer zautrix <zautrix>2004-09-15 06:15:59 (UTC)
commit35b8948c6c203473866c74f1d13185a848454e04 (patch) (unidiff)
treeb6d8eca9863cbca8e24d474d8c895065faa17458 /kmicromail/composemail.cpp
parentf1f43030eefa765950cb501aece6cc71fb4e9859 (diff)
downloadkdepimpi-35b8948c6c203473866c74f1d13185a848454e04.zip
kdepimpi-35b8948c6c203473866c74f1d13185a848454e04.tar.gz
kdepimpi-35b8948c6c203473866c74f1d13185a848454e04.tar.bz2
Mail config added
Diffstat (limited to 'kmicromail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 9b799b3..e6f7daa 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,374 +1,392 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3#include "composemail.h" 3#include "composemail.h"
4 4
5#include <libmailwrapper/smtpwrapper.h> 5#include <libmailwrapper/smtpwrapper.h>
6#include <libmailwrapper/storemail.h> 6#include <libmailwrapper/storemail.h>
7#include <libmailwrapper/abstractmail.h> 7#include <libmailwrapper/abstractmail.h>
8#include <libmailwrapper/mailtypes.h> 8#include <libmailwrapper/mailtypes.h>
9 9
10/* OPIE */ 10/* OPIE */
11//#include <opie2/ofiledialog.h> 11//#include <opie2/ofiledialog.h>
12//#include <opie2/odebug.h> 12//#include <opie2/odebug.h>
13#include <kfiledialog.h> 13#include <kfiledialog.h>
14//#include <qpe/resource.h> 14//#include <qpe/resource.h>
15#include <qpe/config.h>
16#include <qpe/global.h> 15#include <qpe/global.h>
17//#include <qpe/contact.h> 16//#include <qpe/contact.h>
18 17
19 18
20#include <qcombobox.h> 19#include <qcombobox.h>
21#include <qcheckbox.h> 20#include <qcheckbox.h>
22#include <qtimer.h> 21#include <qtimer.h>
23#include <qmessagebox.h> 22#include <qmessagebox.h>
24#include <qpushbutton.h> 23#include <qpushbutton.h>
25#include <qmultilineedit.h> 24#include <qmultilineedit.h>
26#include <qlabel.h> 25#include <qlabel.h>
27#include <qtabwidget.h> 26#include <qtabwidget.h>
28#include <qlistview.h> 27#include <qlistview.h>
29#include <kabc/addresseedialog.h> 28#include <kabc/addresseedialog.h>
30#include <kabc/stdaddressbook.h> 29#include <kabc/stdaddressbook.h>
31#include <kabc/addressee.h> 30#include <kabc/addressee.h>
32#ifdef DESKTOP_VERSION 31#ifdef DESKTOP_VERSION
33#include <kabc/addresseedialog.h> 32#include <kabc/addresseedialog.h>
34#else //DESKTOP_VERSION 33#else //DESKTOP_VERSION
35#include <libkdepim/externalapphandler.h> 34#include <libkdepim/externalapphandler.h>
36#endif //DESKTOP_VERSION 35#endif //DESKTOP_VERSION
37 36
37#include "koprefs.h"
38 38
39//using namespace Opie::Core; 39//using namespace Opie::Core;
40//using namespace Opie::Ui; 40//using namespace Opie::Ui;
41ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) 41ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal )
42 : ComposeMailUI( parent, name, modal ) 42 : ComposeMailUI( parent, name, modal )
43{ 43{
44
45 mPickLineEdit = 0; 44 mPickLineEdit = 0;
46 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 45 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
47 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 46 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
48 settings = s; 47 settings = s;
49 m_replyid = ""; 48 m_replyid = "";
49 if ( KOPrefs::instance()->mUseKapi) {
50 KConfig config( locateLocal("config", "kabcrc") ); 50 KConfig config( locateLocal("config", "kabcrc") );
51 config.setGroup( "General" ); 51 config.setGroup( "General" );
52 QString whoami_uid = config.readEntry( "WhoAmI" ); 52 QString whoami_uid = config.readEntry( "WhoAmI" );
53 53
54 if ( whoami_uid.isEmpty() ) { 54 if ( whoami_uid.isEmpty() ) {
55 QMessageBox::information( 0, tr( "Hint" ), 55 QMessageBox::information( 0, tr( "Hint" ),
56 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 56 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
57 tr( "Ok" ) ); 57 tr( "Ok" ) );
58 58
59
60 fillSettings();
59 } else 61 } else
60 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 62 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
61 63
62 64
63#ifdef DESKTOP_VERSION 65#ifdef DESKTOP_VERSION
64 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 66 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
65 QStringList mails = con.emails(); 67 QStringList mails = con.emails();
66 QString defmail = con.preferredEmail(); 68 QString defmail = con.preferredEmail();
67 if ( mails.count() == 0) 69 if ( mails.count() == 0)
68 QMessageBox::information( 0, tr( "Hint" ), 70 QMessageBox::information( 0, tr( "Hint" ),
69 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 71 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
70 tr( "Ok" ) ); 72 tr( "Ok" ) );
71 if (defmail.length()!=0) { 73 if (defmail.length()!=0) {
72 fromBox->insertItem(defmail); 74 fromBox->insertItem(defmail);
73 } 75 }
74 QStringList::ConstIterator sit = mails.begin(); 76 QStringList::ConstIterator sit = mails.begin();
75 for (;sit!=mails.end();++sit) { 77 for (;sit!=mails.end();++sit) {
76 if ( (*sit)==defmail) 78 if ( (*sit)==defmail)
77 continue; 79 continue;
78 fromBox->insertItem((*sit)); 80 fromBox->insertItem((*sit));
79 } 81 }
80 senderNameEdit->setText(con.formattedName()); 82 senderNameEdit->setText(con.formattedName());
81#endif 83#endif
82 Config cfg( "mail" ); 84
83 cfg.setGroup( "Compose" ); 85 } else {
84 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 86 fillSettings();
87 }
88 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
85 89
86 attList->addColumn( tr( "Name" ) ); 90 attList->addColumn( tr( "Name" ) );
87 attList->addColumn( tr( "Size" ) ); 91 attList->addColumn( tr( "Size" ) );
88 QList<Account> accounts = settings->getAccounts(); 92 QList<Account> accounts = settings->getAccounts();
89 93
94 if ( QApplication::desktop()->width() < 320 )
95 smtpAccountBox->setMaximumWidth( 80 );
90 Account *it; 96 Account *it;
91 for ( it = accounts.first(); it; it = accounts.next() ) { 97 for ( it = accounts.first(); it; it = accounts.next() ) {
92 if ( it->getType()==MAILLIB::A_SMTP ) { 98 if ( it->getType()==MAILLIB::A_SMTP ) {
93 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 99 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
94 smtpAccountBox->insertItem( smtp->getAccountName() ); 100 smtpAccountBox->insertItem( smtp->getAccountName() );
95 smtpAccounts.append( smtp ); 101 smtpAccounts.append( smtp );
96 } 102 }
97 } 103 }
98 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 104 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
99 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 105 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
100 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 106 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
101 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 107 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
102 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 108 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
103 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 109 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
104 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 110 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
105 mMail = 0; 111 mMail = 0;
106 warnAttach = true; 112 warnAttach = true;
107 if ( smtpAccounts.count() > 0 ) { 113 if ( smtpAccounts.count() > 0 ) {
108 fillValues( smtpAccountBox->currentItem() ); 114 fillValues( smtpAccountBox->currentItem() );
109 } else { 115 } else {
110 QMessageBox::information( 0, tr( "Problem" ), 116 QMessageBox::information( 0, tr( "Problem" ),
111 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), 117 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
112 tr( "Ok" ) ); 118 tr( "Ok" ) );
113 return; 119 return;
114 } 120 }
115 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 121 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
116 122 message->setFont ( KOPrefs::instance()->mComposeFont );
117} 123}
118 124
125void ComposeMail::fillSettings()
126{
127 if ( QApplication::desktop()->width() < 320 )
128 fromBox->setMaximumWidth( 100 );
129 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
130 QStringList::ConstIterator sit = mailList.begin();
131 int pref = 0;
132 for (;sit!=mailList.end();++sit) {
133 fromBox->insertItem((*sit));
134 }
135 senderNameEdit->setText(KOPrefs::instance()->mName);
136}
119 137
120 138
121void ComposeMail::saveAsDraft() 139void ComposeMail::saveAsDraft()
122{ 140{
123 141
124 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 142 Opie::Core::OSmartPointer<Mail> mail= new Mail();
125 mail->setMail(fromBox->currentText()); 143 mail->setMail(fromBox->currentText());
126 mail->setTo( toLine->text() ); 144 mail->setTo( toLine->text() );
127 mail->setName(senderNameEdit->text()); 145 mail->setName(senderNameEdit->text());
128 mail->setCC( ccLine->text() ); 146 mail->setCC( ccLine->text() );
129 mail->setBCC( bccLine->text() ); 147 mail->setBCC( bccLine->text() );
130 mail->setReply( replyLine->text() ); 148 mail->setReply( replyLine->text() );
131 mail->setSubject( subjectLine->text() ); 149 mail->setSubject( subjectLine->text() );
132 if (!m_replyid.isEmpty()) { 150 if (!m_replyid.isEmpty()) {
133 QStringList ids; 151 QStringList ids;
134 ids.append(m_replyid); 152 ids.append(m_replyid);
135 mail->setInreply(ids); 153 mail->setInreply(ids);
136 } 154 }
137 QString txt = message->text(); 155 QString txt = message->text();
138 if ( !sigMultiLine->text().isEmpty() ) { 156 if ( !sigMultiLine->text().isEmpty() ) {
139 txt.append( "\n--\n" ); 157 txt.append( "\n--\n" );
140 txt.append( sigMultiLine->text() ); 158 txt.append( sigMultiLine->text() );
141 } 159 }
142 mail->setMessage( txt ); 160 mail->setMessage( txt );
143 161
144 /* only use the default drafts folder name! */ 162 /* only use the default drafts folder name! */
145 Storemail wrapper(AbstractMail::draftFolder()); 163 Storemail wrapper(AbstractMail::draftFolder());
146 wrapper.storeMail(mail); 164 wrapper.storeMail(mail);
147 165
148 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 166 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
149 /* attachments we will ignore! */ 167 /* attachments we will ignore! */
150 if ( it != 0 ) { 168 if ( it != 0 ) {
151 if ( warnAttach ) 169 if ( warnAttach )
152 QMessageBox::warning(0,tr("Store message"), 170 QMessageBox::warning(0,tr("Store message"),
153 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 171 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
154 warnAttach = false; 172 warnAttach = false;
155 } 173 }
156 setStatus( tr("Mail saved as draft!") ); 174 setStatus( tr("Mail saved as draft!") );
157} 175}
158void ComposeMail::clearStatus() 176void ComposeMail::clearStatus()
159{ 177{
160 topLevelWidget()->setCaption( tr("Compose mail") ); 178 topLevelWidget()->setCaption( tr("Compose mail") );
161} 179}
162void ComposeMail::setStatus( QString status ) 180void ComposeMail::setStatus( QString status )
163{ 181{
164 topLevelWidget()->setCaption( status ); 182 topLevelWidget()->setCaption( status );
165 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; 183 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
166} 184}
167void ComposeMail::pickAddress( ) 185void ComposeMail::pickAddress( )
168{ 186{
169 187
170 QLineEdit *line = mPickLineEdit; 188 QLineEdit *line = mPickLineEdit;
171 if ( line == 0 ) 189 if ( line == 0 )
172 return; 190 return;
173#ifdef DESKTOP_VERSION 191#ifdef DESKTOP_VERSION
174 //qDebug(" ComposeMail::pickAddress "); 192 //qDebug(" ComposeMail::pickAddress ");
175 QString names ;//= AddressPicker::getNames(); 193 QString names ;//= AddressPicker::getNames();
176 194
177 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 195 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
178 uint i=0; 196 uint i=0;
179 for (i=0; i < list.count(); i++) { 197 for (i=0; i < list.count(); i++) {
180 if ( !list[i].preferredEmail().isEmpty()) { 198 if ( !list[i].preferredEmail().isEmpty()) {
181 if ( ! names.isEmpty() ) 199 if ( ! names.isEmpty() )
182 names+= ","; 200 names+= ",";
183 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 201 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
184 202
185 } 203 }
186 } 204 }
187 205
188 206
189 if ( line->text().isEmpty() ) { 207 if ( line->text().isEmpty() ) {
190 line->setText( names ); 208 line->setText( names );
191 } else if ( !names.isEmpty() ) { 209 } else if ( !names.isEmpty() ) {
192 line->setText( line->text() + ", " + names ); 210 line->setText( line->text() + ", " + names );
193 } 211 }
194#else 212#else
195 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); 213 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
196 // the result should now arrive through method insertAttendees 214 // the result should now arrive through method insertAttendees
197#endif 215#endif
198} 216}
199//the map includes name/email pairs, that comes from Ka/Pi 217//the map includes name/email pairs, that comes from Ka/Pi
200void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 218void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
201{ 219{
202 //qDebug("ComposeMail::insertAttendees "); 220 //qDebug("ComposeMail::insertAttendees ");
203 raise(); 221 raise();
204 222
205 if ( mPickLineEdit == 0 ) { //whoami received 223 if ( mPickLineEdit == 0 ) { //whoami received
206 QString defmail = uidList[0]; 224 QString defmail = uidList[0];
207 if ( emailList.count() == 0 ) 225 if ( emailList.count() == 0 )
208 QMessageBox::information( 0, tr( "Hint" ), 226 QMessageBox::information( 0, tr( "Hint" ),
209 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 227 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
210 tr( "Ok" ) ); 228 tr( "Ok" ) );
211 if (defmail.length()!=0) { 229 if (defmail.length()!=0) {
212 fromBox->insertItem(defmail); 230 fromBox->insertItem(defmail);
213 } 231 }
214 QStringList::ConstIterator sit = emailList.begin(); 232 QStringList::ConstIterator sit = emailList.begin();
215 int pref = 0; 233 int pref = 0;
216 for (;sit!=emailList.end();++sit) { 234 for (;sit!=emailList.end();++sit) {
217 if ( (*sit)==defmail) 235 if ( (*sit)==defmail)
218 continue; 236 continue;
219 fromBox->insertItem((*sit)); 237 fromBox->insertItem((*sit));
220 } 238 }
221 senderNameEdit->setText(nameList[0]); 239 senderNameEdit->setText(nameList[0]);
222 return; 240 return;
223 } 241 }
224 QString names ; 242 QString names ;
225 QLineEdit *line = mPickLineEdit; 243 QLineEdit *line = mPickLineEdit;
226 if (uid == this->name()) 244 if (uid == this->name())
227 { 245 {
228 for ( int i = 0; i < nameList.count(); i++) 246 for ( int i = 0; i < nameList.count(); i++)
229 { 247 {
230 QString _name = nameList[i]; 248 QString _name = nameList[i];
231 QString _email = emailList[i]; 249 QString _email = emailList[i];
232 QString _uid = uidList[i]; 250 QString _uid = uidList[i];
233 if ( ! _email.isEmpty() ) { 251 if ( ! _email.isEmpty() ) {
234 if ( ! names.isEmpty() ) 252 if ( ! names.isEmpty() )
235 names+= ","; 253 names+= ",";
236 names+= "\""+_name +"\"<" +_email +">"; 254 names+= "\""+_name +"\"<" +_email +">";
237 } 255 }
238 } 256 }
239 } 257 }
240 if ( line->text().isEmpty() ) { 258 if ( line->text().isEmpty() ) {
241 line->setText( names ); 259 line->setText( names );
242 } else if ( !names.isEmpty() ) { 260 } else if ( !names.isEmpty() ) {
243 line->setText( line->text() + ", " + names ); 261 line->setText( line->text() + ", " + names );
244 } 262 }
245} 263}
246 264
247void ComposeMail::setTo( const QString & to ) 265void ComposeMail::setTo( const QString & to )
248{ 266{
249 toLine->setText( to ); 267 toLine->setText( to );
250} 268}
251 269
252void ComposeMail::setSubject( const QString & subject ) 270void ComposeMail::setSubject( const QString & subject )
253{ 271{
254 subjectLine->setText( subject ); 272 subjectLine->setText( subject );
255} 273}
256 274
257void ComposeMail::setInReplyTo( const QString & messageId ) 275void ComposeMail::setInReplyTo( const QString & messageId )
258{ 276{
259 m_replyid = messageId; 277 m_replyid = messageId;
260} 278}
261 279
262void ComposeMail::setMessage( const QString & text ) 280void ComposeMail::setMessage( const QString & text )
263{ 281{
264 message->setText( text ); 282 message->setText( text );
265} 283}
266 284
267 285
268void ComposeMail::pickAddressTo() 286void ComposeMail::pickAddressTo()
269{ 287{
270 mPickLineEdit = toLine; 288 mPickLineEdit = toLine;
271 pickAddress( ); 289 pickAddress( );
272} 290}
273 291
274void ComposeMail::pickAddressCC() 292void ComposeMail::pickAddressCC()
275{ 293{
276 mPickLineEdit = ccLine; 294 mPickLineEdit = ccLine;
277 pickAddress( ); 295 pickAddress( );
278} 296}
279 297
280void ComposeMail::pickAddressBCC() 298void ComposeMail::pickAddressBCC()
281{ 299{
282 mPickLineEdit = bccLine; 300 mPickLineEdit = bccLine;
283 pickAddress( ); 301 pickAddress( );
284} 302}
285 303
286void ComposeMail::pickAddressReply() 304void ComposeMail::pickAddressReply()
287{ 305{
288 mPickLineEdit = replyLine; 306 mPickLineEdit = replyLine;
289 pickAddress( ); 307 pickAddress( );
290} 308}
291 309
292void ComposeMail::fillValues( int ) 310void ComposeMail::fillValues( int )
293{ 311{
294#if 0 312#if 0
295 SMTPaccount *smtp = smtpAccounts.at( current ); 313 SMTPaccount *smtp = smtpAccounts.at( current );
296 ccLine->clear(); 314 ccLine->clear();
297 if ( smtp->getUseCC() ) { 315 if ( smtp->getUseCC() ) {
298 ccLine->setText( smtp->getCC() ); 316 ccLine->setText( smtp->getCC() );
299 } 317 }
300 bccLine->clear(); 318 bccLine->clear();
301 if ( smtp->getUseBCC() ) { 319 if ( smtp->getUseBCC() ) {
302 bccLine->setText( smtp->getBCC() ); 320 bccLine->setText( smtp->getBCC() );
303 } 321 }
304 replyLine->clear(); 322 replyLine->clear();
305 if ( smtp->getUseReply() ) { 323 if ( smtp->getUseReply() ) {
306 replyLine->setText( smtp->getReply() ); 324 replyLine->setText( smtp->getReply() );
307 } 325 }
308 sigMultiLine->setText( smtp->getSignature() ); 326 sigMultiLine->setText( smtp->getSignature() );
309#endif 327#endif
310} 328}
311 329
312void ComposeMail::slotAdjustColumns() 330void ComposeMail::slotAdjustColumns()
313{ 331{
314 int currPage = tabWidget->currentPageIndex(); 332 int currPage = tabWidget->currentPageIndex();
315 333
316 tabWidget->showPage( attachTab ); 334 tabWidget->showPage( attachTab );
317 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 335 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
318 attList->setColumnWidth( 1, 80 ); 336 attList->setColumnWidth( 1, 80 );
319 337
320 tabWidget->setCurrentPage( currPage ); 338 tabWidget->setCurrentPage( currPage );
321} 339}
322 340
323void ComposeMail::addAttachment() 341void ComposeMail::addAttachment()
324{ 342{
325 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); 343 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this );
326 if ( !lnk.isEmpty() ) { 344 if ( !lnk.isEmpty() ) {
327 Attachment *att = new Attachment( lnk ); 345 Attachment *att = new Attachment( lnk );
328 (void) new AttachViewItem( attList, att ); 346 (void) new AttachViewItem( attList, att );
329 } 347 }
330} 348}
331 349
332void ComposeMail::removeAttachment() 350void ComposeMail::removeAttachment()
333{ 351{
334 if ( !attList->currentItem() ) { 352 if ( !attList->currentItem() ) {
335 QMessageBox::information( this, tr( "Error" ), 353 QMessageBox::information( this, tr( "Error" ),
336 tr( "<p>Please select a File.</p>" ), 354 tr( "<p>Please select a File.</p>" ),
337 tr( "Ok" ) ); 355 tr( "Ok" ) );
338 } else { 356 } else {
339 attList->takeItem( attList->currentItem() ); 357 attList->takeItem( attList->currentItem() );
340 } 358 }
341} 359}
342 360
343void ComposeMail::accept() 361void ComposeMail::accept()
344{ 362{
345 if ( smtpAccountBox->count() == 0 ) { 363 if ( smtpAccountBox->count() == 0 ) {
346 364
347 reject(); 365 reject();
348 return; 366 return;
349 } 367 }
350 368
351 if (! checkBoxLater->isChecked() ) { 369 if (! checkBoxLater->isChecked() ) {
352 int yesno = QMessageBox::warning(0,tr("Stop editing message"), 370 int yesno = QMessageBox::warning(0,tr("Stop editing message"),
353 tr("Send this message?"), 371 tr("Send this message?"),
354 tr("Yes"), 372 tr("Yes"),
355 tr("Cancel")); 373 tr("Cancel"));
356 374
357 if (yesno == 1) { 375 if (yesno == 1) {
358 return; 376 return;
359 } 377 }
360 } 378 }
361#if 0 379#if 0
362 odebug << "Sending Mail with " 380 odebug << "Sending Mail with "
363 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; 381 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
364#endif 382#endif
365 Opie::Core::OSmartPointer<Mail> mail=new Mail; 383 Opie::Core::OSmartPointer<Mail> mail=new Mail;
366 384
367 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 385 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
368 mail->setMail(fromBox->currentText()); 386 mail->setMail(fromBox->currentText());
369 387
370 if ( !toLine->text().isEmpty() ) { 388 if ( !toLine->text().isEmpty() ) {
371 mail->setTo( toLine->text() ); 389 mail->setTo( toLine->text() );
372 } else { 390 } else {
373 QMessageBox::warning(0,tr("Sending mail"), 391 QMessageBox::warning(0,tr("Sending mail"),
374 tr("No Receiver spezified" ) ); 392 tr("No Receiver spezified" ) );