summaryrefslogtreecommitdiffabout
path: root/kmicromail/accountitem.cpp
authorzautrix <zautrix>2004-09-11 16:44:49 (UTC)
committer zautrix <zautrix>2004-09-11 16:44:49 (UTC)
commit06be094df4e34cc41db113d8c0e78eccde5365b5 (patch) (unidiff)
treeb99317f9c83886d05b83cdb49e066f414e0fde25 /kmicromail/accountitem.cpp
parent53e10fa5e66620ff1eba1c9d17738103ad511c91 (diff)
downloadkdepimpi-06be094df4e34cc41db113d8c0e78eccde5365b5.zip
kdepimpi-06be094df4e34cc41db113d8c0e78eccde5365b5.tar.gz
kdepimpi-06be094df4e34cc41db113d8c0e78eccde5365b5.tar.bz2
Mail more useful
Diffstat (limited to 'kmicromail/accountitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index 7b9b881..59c8abb 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -3,32 +3,34 @@
3#include "accountview.h" 3#include "accountview.h"
4#include "newmaildir.h" 4#include "newmaildir.h"
5#include "nntpgroupsdlg.h" 5#include "nntpgroupsdlg.h"
6#include "defines.h" 6#include "defines.h"
7 7
8#include <libmailwrapper/mailtypes.h> 8#include <libmailwrapper/mailtypes.h>
9#include <libmailwrapper/abstractmail.h> 9#include <libmailwrapper/abstractmail.h>
10#include <libmailwrapper/mailwrapper.h> 10#include <libmailwrapper/mailwrapper.h>
11/* OPIE */ 11/* OPIE */
12//#include <qpe/qpeapplication.h> 12//#include <qpe/qpeapplication.h>
13 13
14/* QT */ 14/* QT */
15#include <qpopupmenu.h> 15#include <qpopupmenu.h>
16#include <qmessagebox.h> 16#include <qmessagebox.h>
17#include <kiconloader.h> 17#include <kiconloader.h>
18 18
19#define GET_NEW_MAILS 101
20
19using namespace Opie::Core; 21using namespace Opie::Core;
20#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} 22#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
21/** 23/**
22 * POP3 Account stuff 24 * POP3 Account stuff
23 */ 25 */
24POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) 26POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
25 : AccountViewItem( parent ) 27 : AccountViewItem( parent )
26{ 28{
27 account = a; 29 account = a;
28 wrapper = AbstractMail::getWrapper( account ); 30 wrapper = AbstractMail::getWrapper( account );
29 SETPIX(PIXMAP_POP3FOLDER); 31 SETPIX(PIXMAP_POP3FOLDER);
30#if 0 32#if 0
31 if (!account->getOffline()) 33 if (!account->getOffline())
32 { 34 {
33 setPixmap( 0, ); 35 setPixmap( 0, );
34 } 36 }
@@ -79,38 +81,38 @@ void POP3viewItem::refresh()
79 81
80RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) 82RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
81{ 83{
82 84
83 return wrapper->fetchBody( mail ); 85 return wrapper->fetchBody( mail );
84} 86}
85 87
86QPopupMenu * POP3viewItem::getContextMenu() 88QPopupMenu * POP3viewItem::getContextMenu()
87{ 89{
88 QPopupMenu *m = new QPopupMenu(0); 90 QPopupMenu *m = new QPopupMenu(0);
89 if (m) 91 if (m)
90 { 92 {
91 if (!account->getOffline()) 93 if (!account->getOffline())
92 { 94 {
93 m->insertItem(QObject::tr("Disconnect",contextName),0); 95 m->insertItem(QObject::tr("Disconnect",contextName),0);
94 m->insertItem(QObject::tr("Set offline",contextName),1); 96 m->insertItem(QObject::tr("Set offline",contextName),1);
95 m->insertItem(QObject::tr("Download new INBOX messages",contextName),2); 97 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
96 } 98 }
97 else 99 else
98 { 100 {
99 m->insertItem(QObject::tr("Set online",contextName),1); 101 m->insertItem(QObject::tr("Set online",contextName),1);
100 m->insertItem(QObject::tr("Download new INBOX messages",contextName),2); 102 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
101 } 103 }
102 } 104 }
103 return m; 105 return m;
104} 106}
105 107
106void POP3viewItem::disconnect() 108void POP3viewItem::disconnect()
107{ 109{
108 QListViewItem *child = firstChild(); 110 QListViewItem *child = firstChild();
109 while ( child ) 111 while ( child )
110 { 112 {
111 QListViewItem *tmp = child; 113 QListViewItem *tmp = child;
112 child = child->nextSibling(); 114 child = child->nextSibling();
113 delete tmp; 115 delete tmp;
114 } 116 }
115 wrapper->logout(); 117 wrapper->logout();
116} 118}
@@ -124,33 +126,33 @@ void POP3viewItem::setOnOffline()
124 account->setOffline(!account->getOffline()); 126 account->setOffline(!account->getOffline());
125 account->save(); 127 account->save();
126 SETPIX(PIXMAP_POP3FOLDER); 128 SETPIX(PIXMAP_POP3FOLDER);
127 refresh(); 129 refresh();
128} 130}
129 131
130void POP3viewItem::contextMenuSelected(int which) 132void POP3viewItem::contextMenuSelected(int which)
131{ 133{
132 switch (which) 134 switch (which)
133 { 135 {
134 case 0: 136 case 0:
135 disconnect(); 137 disconnect();
136 break; 138 break;
137 case 1: 139 case 1:
138 setOnOffline(); 140 setOnOffline();
139 break; 141 break;
140 case 2: // daunlood 142 case GET_NEW_MAILS: // daunlood
141 if (account->getOffline()) 143 if (account->getOffline())
142 setOnOffline(); 144 setOnOffline();
143 AccountView*bl = accountView(); 145 AccountView*bl = accountView();
144 if (!bl) return; 146 if (!bl) return;
145 AccountViewItem* in = findSubItem( "inbox" , 0); 147 AccountViewItem* in = findSubItem( "inbox" , 0);
146 if ( ! in ) 148 if ( ! in )
147 return; 149 return;
148 bl->downloadMailsInbox(in->getFolder() ,getWrapper()); 150 bl->downloadMailsInbox(in->getFolder() ,getWrapper());
149 setOnOffline(); 151 setOnOffline();
150 break; 152 break;
151 } 153 }
152} 154}
153 155
154POP3folderItem::~POP3folderItem() 156POP3folderItem::~POP3folderItem()
155{} 157{}
156 158
@@ -504,39 +506,39 @@ void IMAPviewItem::refreshFolders(bool force)
504 delete folders; 506 delete folders;
505} 507}
506 508
507QPopupMenu * IMAPviewItem::getContextMenu() 509QPopupMenu * IMAPviewItem::getContextMenu()
508{ 510{
509 QPopupMenu *m = new QPopupMenu(0); 511 QPopupMenu *m = new QPopupMenu(0);
510 if (m) 512 if (m)
511 { 513 {
512 if (!account->getOffline()) 514 if (!account->getOffline())
513 { 515 {
514 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 516 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
515 m->insertItem(QObject::tr("Create new folder",contextName),1); 517 m->insertItem(QObject::tr("Create new folder",contextName),1);
516 m->insertSeparator(); 518 m->insertSeparator();
517 m->insertItem(QObject::tr("Disconnect",contextName),2); 519 m->insertItem(QObject::tr("Disconnect",contextName),2);
518 m->insertItem(QObject::tr("Set offline",contextName),3); 520 m->insertItem(QObject::tr("Set offline",contextName),3);
519 m->insertSeparator(); 521 m->insertSeparator();
520 m->insertItem(QObject::tr("Download new INBOX messages",contextName),4); 522 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
521 } 523 }
522 else 524 else
523 { 525 {
524 m->insertItem(QObject::tr("Set online",contextName),3); 526 m->insertItem(QObject::tr("Set online",contextName),3);
525 m->insertSeparator(); 527 m->insertSeparator();
526 m->insertItem(QObject::tr("Download new INBOX messages",contextName),4); 528 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
527 } 529 }
528 } 530 }
529 return m; 531 return m;
530} 532}
531 533
532void IMAPviewItem::createNewFolder() 534void IMAPviewItem::createNewFolder()
533{ 535{
534 Newmdirdlg ndirdlg; 536 Newmdirdlg ndirdlg;
535 537
536 ndirdlg.showMaximized(); 538 ndirdlg.showMaximized();
537 if ( ndirdlg.exec() ) 539 if ( ndirdlg.exec() )
538 { 540 {
539 QString ndir = ndirdlg.Newdir(); 541 QString ndir = ndirdlg.Newdir();
540 bool makesubs = ndirdlg.subpossible(); 542 bool makesubs = ndirdlg.subpossible();
541 QString delemiter = "/"; 543 QString delemiter = "/";
542 IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); 544 IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
@@ -564,33 +566,33 @@ void IMAPviewItem::contextMenuSelected(int id)
564 break; 566 break;
565 case 2: 567 case 2:
566 removeChilds(); 568 removeChilds();
567 wrapper->logout(); 569 wrapper->logout();
568 break; 570 break;
569 case 3: 571 case 3:
570 if (account->getOffline()==false) 572 if (account->getOffline()==false)
571 { 573 {
572 removeChilds(); 574 removeChilds();
573 wrapper->logout(); 575 wrapper->logout();
574 } 576 }
575 account->setOffline(!account->getOffline()); 577 account->setOffline(!account->getOffline());
576 account->save(); 578 account->save();
577 SETPIX(PIXMAP_IMAPFOLDER); 579 SETPIX(PIXMAP_IMAPFOLDER);
578 refreshFolders(false); 580 refreshFolders(false);
579 break; 581 break;
580 case 4: // daunlood 582 case GET_NEW_MAILS: // daunlood
581 { 583 {
582 if (account->getOffline()) { 584 if (account->getOffline()) {
583 contextMenuSelected( 3 ); 585 contextMenuSelected( 3 );
584 } 586 }
585 AccountView*bl = accountView(); 587 AccountView*bl = accountView();
586 if (!bl) return; 588 if (!bl) return;
587 AccountViewItem* in = findSubItem( "inbox" , 0); 589 AccountViewItem* in = findSubItem( "inbox" , 0);
588 if ( ! in ) 590 if ( ! in )
589 return; 591 return;
590 bl->downloadMailsInbox(in->getFolder(),getWrapper()); 592 bl->downloadMailsInbox(in->getFolder(),getWrapper());
591 } 593 }
592 break; 594 break;
593 default: 595 default:
594 break; 596 break;
595 } 597 }
596} 598}