summaryrefslogtreecommitdiffabout
path: root/kmicromail/accountitem.cpp
authorzautrix <zautrix>2004-09-11 15:41:30 (UTC)
committer zautrix <zautrix>2004-09-11 15:41:30 (UTC)
commit32f9963a39236d08718a36d5adad2a0c5c4e2602 (patch) (unidiff)
tree8856a90d505df8dc3afa0d72541f27cb68913a0d /kmicromail/accountitem.cpp
parentd7a273f40838f56205c1377ed0bcc5457bd46ea3 (diff)
downloadkdepimpi-32f9963a39236d08718a36d5adad2a0c5c4e2602.zip
kdepimpi-32f9963a39236d08718a36d5adad2a0c5c4e2602.tar.gz
kdepimpi-32f9963a39236d08718a36d5adad2a0c5c4e2602.tar.bz2
Mail enhancements
Diffstat (limited to 'kmicromail/accountitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index 1698b40..7b9b881 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -79,37 +79,38 @@ void POP3viewItem::refresh()
79 79
80RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) 80RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
81{ 81{
82 82
83 return wrapper->fetchBody( mail ); 83 return wrapper->fetchBody( mail );
84} 84}
85 85
86QPopupMenu * POP3viewItem::getContextMenu() 86QPopupMenu * POP3viewItem::getContextMenu()
87{ 87{
88 QPopupMenu *m = new QPopupMenu(0); 88 QPopupMenu *m = new QPopupMenu(0);
89 if (m) 89 if (m)
90 { 90 {
91 if (!account->getOffline()) 91 if (!account->getOffline())
92 { 92 {
93 m->insertItem(QObject::tr("Disconnect",contextName),0); 93 m->insertItem(QObject::tr("Disconnect",contextName),0);
94 m->insertItem(QObject::tr("Set offline",contextName),1); 94 m->insertItem(QObject::tr("Set offline",contextName),1);
95 m->insertItem(QObject::tr("Download messages",contextName),2); 95 m->insertItem(QObject::tr("Download new INBOX messages",contextName),2);
96 } 96 }
97 else 97 else
98 { 98 {
99 m->insertItem(QObject::tr("Set online",contextName),1); 99 m->insertItem(QObject::tr("Set online",contextName),1);
100 m->insertItem(QObject::tr("Download new INBOX messages",contextName),2);
100 } 101 }
101 } 102 }
102 return m; 103 return m;
103} 104}
104 105
105void POP3viewItem::disconnect() 106void POP3viewItem::disconnect()
106{ 107{
107 QListViewItem *child = firstChild(); 108 QListViewItem *child = firstChild();
108 while ( child ) 109 while ( child )
109 { 110 {
110 QListViewItem *tmp = child; 111 QListViewItem *tmp = child;
111 child = child->nextSibling(); 112 child = child->nextSibling();
112 delete tmp; 113 delete tmp;
113 } 114 }
114 wrapper->logout(); 115 wrapper->logout();
115} 116}
@@ -124,32 +125,34 @@ void POP3viewItem::setOnOffline()
124 account->save(); 125 account->save();
125 SETPIX(PIXMAP_POP3FOLDER); 126 SETPIX(PIXMAP_POP3FOLDER);
126 refresh(); 127 refresh();
127} 128}
128 129
129void POP3viewItem::contextMenuSelected(int which) 130void POP3viewItem::contextMenuSelected(int which)
130{ 131{
131 switch (which) 132 switch (which)
132 { 133 {
133 case 0: 134 case 0:
134 disconnect(); 135 disconnect();
135 break; 136 break;
136 case 1: 137 case 1:
137 setOnOffline(); 138 setOnOffline();
138 break; 139 break;
139 case 2: // daunlood 140 case 2: // daunlood
141 if (account->getOffline())
142 setOnOffline();
140 AccountView*bl = accountView(); 143 AccountView*bl = accountView();
141 if (!bl) return; 144 if (!bl) return;
142 AccountViewItem* in = findSubItem( "inbox" , 0); 145 AccountViewItem* in = findSubItem( "inbox" , 0);
143 if ( ! in ) 146 if ( ! in )
144 return; 147 return;
145 bl->downloadMailsInbox(in->getFolder() ,getWrapper()); 148 bl->downloadMailsInbox(in->getFolder() ,getWrapper());
146 setOnOffline(); 149 setOnOffline();
147 break; 150 break;
148 } 151 }
149} 152}
150 153
151POP3folderItem::~POP3folderItem() 154POP3folderItem::~POP3folderItem()
152{} 155{}
153 156
154POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) 157POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after )
155 : AccountViewItem(folderInit,parent,after ) 158 : AccountViewItem(folderInit,parent,after )
@@ -500,36 +503,40 @@ void IMAPviewItem::refreshFolders(bool force)
500 } 503 }
501 delete folders; 504 delete folders;
502} 505}
503 506
504QPopupMenu * IMAPviewItem::getContextMenu() 507QPopupMenu * IMAPviewItem::getContextMenu()
505{ 508{
506 QPopupMenu *m = new QPopupMenu(0); 509 QPopupMenu *m = new QPopupMenu(0);
507 if (m) 510 if (m)
508 { 511 {
509 if (!account->getOffline()) 512 if (!account->getOffline())
510 { 513 {
511 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 514 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
512 m->insertItem(QObject::tr("Create new folder",contextName),1); 515 m->insertItem(QObject::tr("Create new folder",contextName),1);
513 m->insertSeparator(); 516 m->insertSeparator();
514 m->insertItem(QObject::tr("Disconnect",contextName),2); 517 m->insertItem(QObject::tr("Disconnect",contextName),2);
515 m->insertItem(QObject::tr("Set offline",contextName),3); 518 m->insertItem(QObject::tr("Set offline",contextName),3);
519 m->insertSeparator();
520 m->insertItem(QObject::tr("Download new INBOX messages",contextName),4);
516 } 521 }
517 else 522 else
518 { 523 {
519 m->insertItem(QObject::tr("Set online",contextName),3); 524 m->insertItem(QObject::tr("Set online",contextName),3);
525 m->insertSeparator();
526 m->insertItem(QObject::tr("Download new INBOX messages",contextName),4);
520 } 527 }
521 } 528 }
522 return m; 529 return m;
523} 530}
524 531
525void IMAPviewItem::createNewFolder() 532void IMAPviewItem::createNewFolder()
526{ 533{
527 Newmdirdlg ndirdlg; 534 Newmdirdlg ndirdlg;
528 535
529 ndirdlg.showMaximized(); 536 ndirdlg.showMaximized();
530 if ( ndirdlg.exec() ) 537 if ( ndirdlg.exec() )
531 { 538 {
532 QString ndir = ndirdlg.Newdir(); 539 QString ndir = ndirdlg.Newdir();
533 bool makesubs = ndirdlg.subpossible(); 540 bool makesubs = ndirdlg.subpossible();
534 QString delemiter = "/"; 541 QString delemiter = "/";
535 IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); 542 IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
@@ -557,32 +564,45 @@ void IMAPviewItem::contextMenuSelected(int id)
557 break; 564 break;
558 case 2: 565 case 2:
559 removeChilds(); 566 removeChilds();
560 wrapper->logout(); 567 wrapper->logout();
561 break; 568 break;
562 case 3: 569 case 3:
563 if (account->getOffline()==false) 570 if (account->getOffline()==false)
564 { 571 {
565 removeChilds(); 572 removeChilds();
566 wrapper->logout(); 573 wrapper->logout();
567 } 574 }
568 account->setOffline(!account->getOffline()); 575 account->setOffline(!account->getOffline());
569 account->save(); 576 account->save();
570 SETPIX(PIXMAP_IMAPFOLDER); 577 SETPIX(PIXMAP_IMAPFOLDER);
571 refreshFolders(false); 578 refreshFolders(false);
572 break; 579 break;
580 case 4: // daunlood
581 {
582 if (account->getOffline()) {
583 contextMenuSelected( 3 );
584 }
585 AccountView*bl = accountView();
586 if (!bl) return;
587 AccountViewItem* in = findSubItem( "inbox" , 0);
588 if ( ! in )
589 return;
590 bl->downloadMailsInbox(in->getFolder(),getWrapper());
591 }
592 break;
573 default: 593 default:
574 break; 594 break;
575 } 595 }
576} 596}
577 597
578RECBODYP IMAPviewItem::fetchBody(const RecMailP&) 598RECBODYP IMAPviewItem::fetchBody(const RecMailP&)
579{ 599{
580 return new RecBody(); 600 return new RecBody();
581} 601}
582 602
583bool IMAPviewItem::offline() 603bool IMAPviewItem::offline()
584{ 604{
585 return account->getOffline(); 605 return account->getOffline();
586} 606}
587 607
588IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) 608IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after )