summaryrefslogtreecommitdiffabout
path: root/kmicromail/composemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 2dcbc75..f44100b 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -230,274 +230,274 @@ void ComposeMail::pickAddress( )
230 230
231 231
232 if ( line->text().isEmpty() ) { 232 if ( line->text().isEmpty() ) {
233 line->setText( names ); 233 line->setText( names );
234 } else if ( !names.isEmpty() ) { 234 } else if ( !names.isEmpty() ) {
235 line->setText( line->text() + ", " + names ); 235 line->setText( line->text() + ", " + names );
236 } 236 }
237#else 237#else
238 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); 238 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
239 // the result should now arrive through method insertAttendees 239 // the result should now arrive through method insertAttendees
240#endif 240#endif
241} 241}
242//the map includes name/email pairs, that comes from Ka/Pi 242//the map includes name/email pairs, that comes from Ka/Pi
243void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 243void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
244{ 244{
245 //qDebug("ComposeMail::insertAttendees "); 245 //qDebug("ComposeMail::insertAttendees ");
246 raise(); 246 raise();
247 247
248 if ( mPickLineEdit == 0 ) { //whoami received 248 if ( mPickLineEdit == 0 ) { //whoami received
249 QString defmail = uidList[0]; 249 QString defmail = uidList[0];
250 if ( emailList.count() == 0 ) 250 if ( emailList.count() == 0 )
251 QMessageBox::information( 0, i18n( "Hint" ), 251 QMessageBox::information( 0, i18n( "Hint" ),
252 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 252 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
253 i18n( "Ok" ) ); 253 i18n( "Ok" ) );
254 if (defmail.length()!=0) { 254 if (defmail.length()!=0) {
255 fromBox->insertItem(defmail); 255 fromBox->insertItem(defmail);
256 } 256 }
257 QStringList::ConstIterator sit = emailList.begin(); 257 QStringList::ConstIterator sit = emailList.begin();
258 int pref = 0; 258 int pref = 0;
259 for (;sit!=emailList.end();++sit) { 259 for (;sit!=emailList.end();++sit) {
260 if ( (*sit)==defmail) 260 if ( (*sit)==defmail)
261 continue; 261 continue;
262 fromBox->insertItem((*sit)); 262 fromBox->insertItem((*sit));
263 } 263 }
264 senderNameEdit->setText(nameList[0]); 264 senderNameEdit->setText(nameList[0]);
265 return; 265 return;
266 } 266 }
267 QString names ; 267 QString names ;
268 QLineEdit *line = mPickLineEdit; 268 QLineEdit *line = mPickLineEdit;
269 if (uid == this->name()) 269 if (uid == this->name())
270 { 270 {
271 for ( int i = 0; i < nameList.count(); i++) 271 for ( int i = 0; i < nameList.count(); i++)
272 { 272 {
273 QString _name = nameList[i]; 273 QString _name = nameList[i];
274 QString _email = emailList[i]; 274 QString _email = emailList[i];
275 QString _uid = uidList[i]; 275 QString _uid = uidList[i];
276 if ( ! _email.isEmpty() ) { 276 if ( ! _email.isEmpty() ) {
277 if ( ! names.isEmpty() ) 277 if ( ! names.isEmpty() )
278 names+= ","; 278 names+= ",";
279 names+= "\""+_name +"\"<" +_email +">"; 279 names+= "\""+_name +"\"<" +_email +">";
280 } 280 }
281 } 281 }
282 } 282 }
283 if ( line->text().isEmpty() ) { 283 if ( line->text().isEmpty() ) {
284 line->setText( names ); 284 line->setText( names );
285 } else if ( !names.isEmpty() ) { 285 } else if ( !names.isEmpty() ) {
286 line->setText( line->text() + ", " + names ); 286 line->setText( line->text() + ", " + names );
287 } 287 }
288} 288}
289 289
290void ComposeMail::setTo( const QString & to ) 290void ComposeMail::setTo( const QString & to )
291{ 291{
292 toLine->setText( to ); 292 toLine->setText( to );
293} 293}
294 294
295void ComposeMail::setSubject( const QString & subject ) 295void ComposeMail::setSubject( const QString & subject )
296{ 296{
297 subjectLine->setText( subject ); 297 subjectLine->setText( subject );
298} 298}
299 299
300void ComposeMail::setInReplyTo( const QString & messageId ) 300void ComposeMail::setInReplyTo( const QString & messageId )
301{ 301{
302 m_replyid = messageId; 302 m_replyid = messageId;
303} 303}
304 304
305void ComposeMail::setMessage( const QString & text ) 305void ComposeMail::setMessage( const QString & text )
306{ 306{
307 message->setText( text ); 307 message->setText( text );
308} 308}
309 309
310 310
311void ComposeMail::pickAddressTo() 311void ComposeMail::pickAddressTo()
312{ 312{
313 mPickLineEdit = toLine; 313 mPickLineEdit = toLine;
314 pickAddress( ); 314 pickAddress( );
315} 315}
316 316
317void ComposeMail::pickAddressCC() 317void ComposeMail::pickAddressCC()
318{ 318{
319 mPickLineEdit = ccLine; 319 mPickLineEdit = ccLine;
320 pickAddress( ); 320 pickAddress( );
321} 321}
322 322
323void ComposeMail::pickAddressBCC() 323void ComposeMail::pickAddressBCC()
324{ 324{
325 mPickLineEdit = bccLine; 325 mPickLineEdit = bccLine;
326 pickAddress( ); 326 pickAddress( );
327} 327}
328 328
329void ComposeMail::pickAddressReply() 329void ComposeMail::pickAddressReply()
330{ 330{
331 mPickLineEdit = replyLine; 331 mPickLineEdit = replyLine;
332 pickAddress( ); 332 pickAddress( );
333} 333}
334 334
335void ComposeMail::fillValues( int ) 335void ComposeMail::fillValues( int )
336{ 336{
337#if 0 337#if 0
338 SMTPaccount *smtp = smtpAccounts.at( current ); 338 SMTPaccount *smtp = smtpAccounts.at( current );
339 ccLine->clear(); 339 ccLine->clear();
340 if ( smtp->getUseCC() ) { 340 if ( smtp->getUseCC() ) {
341 ccLine->setText( smtp->getCC() ); 341 ccLine->setText( smtp->getCC() );
342 } 342 }
343 bccLine->clear(); 343 bccLine->clear();
344 if ( smtp->getUseBCC() ) { 344 if ( smtp->getUseBCC() ) {
345 bccLine->setText( smtp->getBCC() ); 345 bccLine->setText( smtp->getBCC() );
346 } 346 }
347 replyLine->clear(); 347 replyLine->clear();
348 if ( smtp->getUseReply() ) { 348 if ( smtp->getUseReply() ) {
349 replyLine->setText( smtp->getReply() ); 349 replyLine->setText( smtp->getReply() );
350 } 350 }
351 sigMultiLine->setText( smtp->getSignature() ); 351 sigMultiLine->setText( smtp->getSignature() );
352#endif 352#endif
353} 353}
354 354
355void ComposeMail::slotAdjustColumns() 355void ComposeMail::slotAdjustColumns()
356{ 356{
357 int currPage = tabWidget->currentPageIndex(); 357 int currPage = tabWidget->currentPageIndex();
358 358
359 tabWidget->showPage( attachTab ); 359 tabWidget->showPage( attachTab );
360 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 360 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
361 attList->setColumnWidth( 1, 80 ); 361 attList->setColumnWidth( 1, 80 );
362 362
363 tabWidget->setCurrentPage( currPage ); 363 tabWidget->setCurrentPage( currPage );
364} 364}
365 365
366void ComposeMail::addAttachment() 366void 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
375void ComposeMail::removeAttachment() 375void 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
386void ComposeMail::accept() 386void 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().utf8 ()); 411 mail->setMail(fromBox->currentText().utf8 ());
412 412
413 if ( !toLine->text().isEmpty() ) { 413 if ( !toLine->text().isEmpty() ) {
414 mail->setTo( toLine->text().utf8 () ); 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().utf8 ()); 421 mail->setName(senderNameEdit->text().utf8 ());
422 mail->setCC( ccLine->text().utf8 () ); 422 mail->setCC( ccLine->text().utf8 () );
423 mail->setBCC( bccLine->text().utf8 () ); 423 mail->setBCC( bccLine->text().utf8 () );
424 mail->setReply( replyLine->text().utf8 () ); 424 mail->setReply( replyLine->text().utf8 () );
425 mail->setSubject( subjectLine->text().utf8 () ); 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.utf8 ()); 428 ids.append(m_replyid.utf8 ());
429 mail->setInreply(ids); 429 mail->setInreply(ids);
430 } 430 }
431 QString txt = message->text().utf8 (); 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().utf8 () ); 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
455void ComposeMail::reject() 455void 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
479ComposeMail::~ComposeMail() 479ComposeMail::~ComposeMail()
480{ 480{
481} 481}
482 482
483void ComposeMail::reEditMail(const RecMailP&current) 483void ComposeMail::reEditMail(const RecMailP&current)
484{ 484{
485 RecMailP data = current; 485 RecMailP data = current;
486 message->setText(QString::fromUtf8( data->Wrapper()->fetchBody(current)->Bodytext().latin1() )); 486 message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
487 subjectLine->setText( QString::fromUtf8( data->getSubject().latin1() )); 487 subjectLine->setText( data->getSubject());
488 toLine->setText(QString::fromUtf8( data->To().join(",").latin1() )); 488 toLine->setText(data->To().join(","));
489 ccLine->setText(QString::fromUtf8( data->CC().join(",").latin1() )); 489 ccLine->setText(data->CC().join(","));
490 bccLine->setText(QString::fromUtf8( data->Bcc().join(",").latin1() )); 490 bccLine->setText(data->Bcc().join(","));
491 replyLine->setText(QString::fromUtf8( data->Replyto().latin1() )); 491 replyLine->setText(data->Replyto());
492} 492}
493 493
494AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 494AttachViewItem::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