summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp9
-rw-r--r--kmicromail/opiemail.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 8ac3451..e296d9c 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -397,222 +397,231 @@ void OpieMail::displayNextMail(ViewMail * vm)
397 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 397 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
398 item = item->itemBelow(); 398 item = item->itemBelow();
399 if (!item) { 399 if (!item) {
400 vm->setCaption(i18n("End of List" )); 400 vm->setCaption(i18n("End of List" ));
401 return; 401 return;
402 } 402 }
403 mailView->setCurrentItem(item); 403 mailView->setCurrentItem(item);
404 RecMailP mail = ((MailListViewItem*)item)->data(); 404 RecMailP mail = ((MailListViewItem*)item)->data();
405 RecBodyP body = folderView->fetchBody(mail); 405 RecBodyP body = folderView->fetchBody(mail);
406 vm->setBody( body ); 406 vm->setBody( body );
407 vm->setMail( mail ); 407 vm->setMail( mail );
408} 408}
409void OpieMail::displayMail() 409void OpieMail::displayMail()
410{ 410{
411 QListViewItem*item = mailView->currentItem(); 411 QListViewItem*item = mailView->currentItem();
412 if (!item) return; 412 if (!item) return;
413 RecMailP mail = ((MailListViewItem*)item)->data(); 413 RecMailP mail = ((MailListViewItem*)item)->data();
414 RecBodyP body = folderView->fetchBody(mail); 414 RecBodyP body = folderView->fetchBody(mail);
415 ViewMail readMail( this,"", Qt::WType_Modal ); 415 ViewMail readMail( this,"", Qt::WType_Modal );
416 readMail.setBody( body ); 416 readMail.setBody( body );
417 readMail.setMail( mail ); 417 readMail.setMail( mail );
418#ifndef DESKTOP_VERSION 418#ifndef DESKTOP_VERSION
419 readMail.showMaximized(); 419 readMail.showMaximized();
420#else 420#else
421 readMail.resize( 640, 480); 421 readMail.resize( 640, 480);
422#endif 422#endif
423 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); 423 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
424 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); 424 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
425 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); 425 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
426 426
427 readMail.exec(); 427 readMail.exec();
428 428
429 if ( readMail.deleted ) 429 if ( readMail.deleted )
430 { 430 {
431 folderView->refreshCurrent(); 431 folderView->refreshCurrent();
432 } 432 }
433 else 433 else
434 { 434 {
435 QListViewItem*item = mailView->currentItem(); 435 QListViewItem*item = mailView->currentItem();
436 if (item) 436 if (item)
437 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 437 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
438 } 438 }
439} 439}
440void OpieMail::slotGetAllMail() 440void OpieMail::slotGetAllMail()
441{ 441{
442 QListViewItem * item = folderView->firstChild(); 442 QListViewItem * item = folderView->firstChild();
443 while ( item ){ 443 while ( item ){
444 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 444 ((AccountViewItem *)item)->contextMenuSelected( 101 );
445 item = item->nextSibling (); 445 item = item->nextSibling ();
446 } 446 }
447} 447}
448void OpieMail::slotGetMail() 448void OpieMail::slotGetMail()
449{ 449{
450 QListViewItem * item = folderView->currentItem(); 450 QListViewItem * item = folderView->currentItem();
451 if ( ! item ) return; 451 if ( ! item ) return;
452 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 452 ((AccountViewItem *)item)->contextMenuSelected( 101 );
453} 453}
454void OpieMail::slotDeleteMail() 454void OpieMail::slotDeleteMail()
455{ 455{
456 if (!mailView->currentItem()) return; 456 if (!mailView->currentItem()) return;
457 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 457 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
458 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 458 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
459 { 459 {
460 mail->Wrapper()->deleteMail( mail ); 460 mail->Wrapper()->deleteMail( mail );
461 folderView->refreshCurrent(); 461 folderView->refreshCurrent();
462 } 462 }
463} 463}
464void OpieMail::slotDeleteAllMail() 464void OpieMail::slotDeleteAllMail()
465{ 465{
466 466
467 QValueList<RecMailP> t; 467 QValueList<RecMailP> t;
468 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 468 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
469 { 469 {
470 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 470 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
471 while ( item ) { 471 while ( item ) {
472 if ( item->isSelected() ) { 472 if ( item->isSelected() ) {
473 t.append( item->data() ); 473 t.append( item->data() );
474 } 474 }
475 item = (MailListViewItem*)item->nextSibling(); 475 item = (MailListViewItem*)item->nextSibling();
476 } 476 }
477 } 477 }
478 else 478 else
479 return; 479 return;
480 if ( t.count() == 0 ) 480 if ( t.count() == 0 )
481 return; 481 return;
482 RecMailP mail = t.first(); 482 RecMailP mail = t.first();
483 mail->Wrapper()->deleteMailList(t); 483 mail->Wrapper()->deleteMailList(t);
484 folderView->refreshCurrent(); 484 folderView->refreshCurrent();
485 485
486 486
487} 487}
488void OpieMail::clearSelection() 488void OpieMail::clearSelection()
489{ 489{
490 mailView->clearSelection(); 490 mailView->clearSelection();
491 491
492} 492}
493void OpieMail::selectAll()
494{
495 QListViewItem* item = mailView->firstChild ();
496 while ( item ) {
497 mailView->setSelected ( item, true );
498 item = item->nextSibling();
499 }
500}
493 501
494void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 502void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
495{ 503{
496 if (!mailView->currentItem()) return; 504 if (!mailView->currentItem()) return;
497 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 505 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
498 /* just the RIGHT button - or hold on pda */ 506 /* just the RIGHT button - or hold on pda */
499 if (button!=2) {return;} 507 if (button!=2) {return;}
500 if (!item) return; 508 if (!item) return;
501 QPopupMenu *m = new QPopupMenu(0); 509 QPopupMenu *m = new QPopupMenu(0);
502 if (m) 510 if (m)
503 { 511 {
504 if (mailtype==MAILLIB::A_NNTP) { 512 if (mailtype==MAILLIB::A_NNTP) {
505 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); 513 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
506 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); 514 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
507 m->insertSeparator(); 515 m->insertSeparator();
508 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 516 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
509 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 517 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
510 } else { 518 } else {
511 if (folderView->currentisDraft()) { 519 if (folderView->currentisDraft()) {
512 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); 520 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
513 } 521 }
514 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); 522 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
515 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); 523 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
516 m->insertSeparator(); 524 m->insertSeparator();
517 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 525 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
518 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); 526 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
519 m->insertSeparator(); 527 m->insertSeparator();
520 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 528 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
521 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 529 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
522 m->insertSeparator(); 530 m->insertSeparator();
531 m->insertItem(i18n("Select all"),this,SLOT(selectAll()));
523 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 532 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
524 } 533 }
525 m->setFocus(); 534 m->setFocus();
526 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 535 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
527 delete m; 536 delete m;
528 } 537 }
529} 538}
530 539
531void OpieMail::slotShowFolders( bool show ) 540void OpieMail::slotShowFolders( bool show )
532{ 541{
533 if ( show && folderView->isHidden() ) 542 if ( show && folderView->isHidden() )
534 { 543 {
535 folderView->show(); 544 folderView->show();
536 } 545 }
537 else if ( !show && !folderView->isHidden() ) 546 else if ( !show && !folderView->isHidden() )
538 { 547 {
539 folderView->hide(); 548 folderView->hide();
540 } 549 }
541} 550}
542 551
543void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 552void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
544{ 553{
545 MailListViewItem*item = 0; 554 MailListViewItem*item = 0;
546 mailView->clear(); 555 mailView->clear();
547 556
548 QValueList<RecMailP>::ConstIterator it; 557 QValueList<RecMailP>::ConstIterator it;
549 for (it = list.begin(); it != list.end();++it) 558 for (it = list.begin(); it != list.end();++it)
550 { 559 {
551 item = new MailListViewItem(mailView,item); 560 item = new MailListViewItem(mailView,item);
552 item->storeData((*it)); 561 item->storeData((*it));
553 item->showEntry(); 562 item->showEntry();
554 } 563 }
555 mailView->setSorting ( 4, false ); 564 mailView->setSorting ( 4, false );
556} 565}
557 566
558void OpieMail::mailLeftClicked( QListViewItem *item ) 567void OpieMail::mailLeftClicked( QListViewItem *item )
559{ 568{
560 mailView->clearSelection(); 569 mailView->clearSelection();
561 /* just LEFT button - or tap with stylus on pda */ 570 /* just LEFT button - or tap with stylus on pda */
562 //if (button!=1) return; 571 //if (button!=1) return;
563 if (!item) return; 572 if (!item) return;
564 if (folderView->currentisDraft()) { 573 if (folderView->currentisDraft()) {
565 reEditMail(); 574 reEditMail();
566 } else { 575 } else {
567 displayMail(); 576 displayMail();
568 } 577 }
569} 578}
570 579
571void OpieMail::slotMoveCopyMail() 580void OpieMail::slotMoveCopyMail()
572{ 581{
573 if (!mailView->currentItem()) return; 582 if (!mailView->currentItem()) return;
574 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 583 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
575 AbstractMail*targetMail = 0; 584 AbstractMail*targetMail = 0;
576 QString targetFolder = ""; 585 QString targetFolder = "";
577 Selectstore sels; 586 Selectstore sels;
578 folderView->setupFolderselect(&sels); 587 folderView->setupFolderselect(&sels);
579 if (!sels.exec()) return; 588 if (!sels.exec()) return;
580 targetMail = sels.currentMail(); 589 targetMail = sels.currentMail();
581 targetFolder = sels.currentFolder(); 590 targetFolder = sels.currentFolder();
582 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 591 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
583 targetFolder.isEmpty()) 592 targetFolder.isEmpty())
584 { 593 {
585 return; 594 return;
586 } 595 }
587 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 596 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
588 { 597 {
589 QMessageBox::critical(0,i18n("Error creating new Folder"), 598 QMessageBox::critical(0,i18n("Error creating new Folder"),
590 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 599 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
591 return; 600 return;
592 } 601 }
593 sels.hide(); 602 sels.hide();
594 qApp->processEvents(); 603 qApp->processEvents();
595 // qDebug("hiding sels "); 604 // qDebug("hiding sels ");
596 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 605 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
597 folderView->refreshCurrent(); 606 folderView->refreshCurrent();
598} 607}
599 608
600void OpieMail::slotMoveCopyAllMail() 609void OpieMail::slotMoveCopyAllMail()
601{ 610{
602 611
603 if (!mailView->currentItem()) return; 612 if (!mailView->currentItem()) return;
604 QValueList<RecMailP> t; 613 QValueList<RecMailP> t;
605 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 614 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
606 { 615 {
607 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 616 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
608 while ( item ) { 617 while ( item ) {
609 if ( item->isSelected() ) { 618 if ( item->isSelected() ) {
610 t.append( item->data() ); 619 t.append( item->data() );
611 } 620 }
612 item = (MailListViewItem*)item->nextSibling(); 621 item = (MailListViewItem*)item->nextSibling();
613 } 622 }
614 } 623 }
615 // else 624 // else
616 // return; 625 // return;
617 if ( t.count() == 0 ) 626 if ( t.count() == 0 )
618 return; 627 return;
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index 48c5dda..bdd9058 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -1,67 +1,68 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#ifndef OPIEMAIL_H 2#ifndef OPIEMAIL_H
3#define OPIEMAIL_H 3#define OPIEMAIL_H
4 4
5#include "mainwindow.h" 5#include "mainwindow.h"
6#include <libmailwrapper/settings.h> 6#include <libmailwrapper/settings.h>
7 7
8#include <opie2/osmartpointer.h> 8#include <opie2/osmartpointer.h>
9#include <libmailwrapper/mailtypes.h> 9#include <libmailwrapper/mailtypes.h>
10#include <viewmail.h> 10#include <viewmail.h>
11#include <qstringlist.h> 11#include <qstringlist.h>
12 12
13class ComposeMail; 13class ComposeMail;
14 14
15class OpieMail : public MainWindow 15class OpieMail : public MainWindow
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18 18
19public: 19public:
20 OpieMail( QWidget *parent = 0, const char *name = 0 ); 20 OpieMail( QWidget *parent = 0, const char *name = 0 );
21 virtual ~OpieMail(); 21 virtual ~OpieMail();
22 static QString appName() { return QString::fromLatin1("kopiemail"); } 22 static QString appName() { return QString::fromLatin1("kopiemail"); }
23 23
24public slots: 24public slots:
25 virtual void slotwriteMail(const QString&name,const QString&email); 25 virtual void slotwriteMail(const QString&name,const QString&email);
26 virtual void slotwriteMail2(const QString&nameemail); 26 virtual void slotwriteMail2(const QString&nameemail);
27 virtual void slotComposeMail(); 27 virtual void slotComposeMail();
28 virtual void slotExtAppHandler(); 28 virtual void slotExtAppHandler();
29 virtual void appMessage(const QCString &msg, const QByteArray &data); 29 virtual void appMessage(const QCString &msg, const QByteArray &data);
30 virtual void message(const QCString &msg, const QByteArray &data); 30 virtual void message(const QCString &msg, const QByteArray &data);
31 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); 31 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
32protected slots: 32protected slots:
33 virtual void deleteAndDisplayNextMail(ViewMail * vm); 33 virtual void deleteAndDisplayNextMail(ViewMail * vm);
34 virtual void displayNextMail(ViewMail * vm); 34 virtual void displayNextMail(ViewMail * vm);
35 virtual void slotSendQueued(); 35 virtual void slotSendQueued();
36 virtual void slotSearchMails(); 36 virtual void slotSearchMails();
37 virtual void slotEditSettings(); 37 virtual void slotEditSettings();
38 virtual void slotEditGlobalSettings(); 38 virtual void slotEditGlobalSettings();
39 virtual void slotEditAccounts(); 39 virtual void slotEditAccounts();
40 virtual void displayMail(); 40 virtual void displayMail();
41 virtual void replyMail(); 41 virtual void replyMail();
42 virtual void slotDeleteMail(); 42 virtual void slotDeleteMail();
43 virtual void slotGetMail(); 43 virtual void slotGetMail();
44 virtual void slotGetAllMail(); 44 virtual void slotGetAllMail();
45 virtual void slotDeleteAllMail(); 45 virtual void slotDeleteAllMail();
46 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 46 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
47 virtual void slotShowFolders( bool show ); 47 virtual void slotShowFolders( bool show );
48 virtual void refreshMailView(const QValueList<RecMailP>&); 48 virtual void refreshMailView(const QValueList<RecMailP>&);
49 virtual void mailLeftClicked( QListViewItem * ); 49 virtual void mailLeftClicked( QListViewItem * );
50 virtual void slotMoveCopyMail(); 50 virtual void slotMoveCopyMail();
51 virtual void slotMoveCopyAllMail(); 51 virtual void slotMoveCopyAllMail();
52 virtual void reEditMail(); 52 virtual void reEditMail();
53 void clearSelection(); 53 void clearSelection();
54 void selectAll();
54 void slotDownloadMail(); 55 void slotDownloadMail();
55private: 56private:
56 ComposeMail* mCurrentComposer; 57 ComposeMail* mCurrentComposer;
57 void closeViewMail(ViewMail * vm); 58 void closeViewMail(ViewMail * vm);
58 QString mPendingEmail; 59 QString mPendingEmail;
59 QString mPendingName; 60 QString mPendingName;
60 QByteArray mPendingData; 61 QByteArray mPendingData;
61 QCString mPendingMessage; 62 QCString mPendingMessage;
62 Settings *settings; 63 Settings *settings;
63 QTextBrowser * tb; 64 QTextBrowser * tb;
64 65
65}; 66};
66 67
67#endif 68#endif