summaryrefslogtreecommitdiff
authoralwin <alwin>2003-12-28 12:57:44 (UTC)
committer alwin <alwin>2003-12-28 12:57:44 (UTC)
commitb41e3eb92eab8bf61fd20db70d0317c816b1c2f0 (patch) (unidiff)
tree5795854d7de75edc4385edc6ee7389809f98f4e1
parentb834b22bade330b2d684c59b7fc1031a8bf650c5 (diff)
downloadopie-b41e3eb92eab8bf61fd20db70d0317c816b1c2f0.zip
opie-b41e3eb92eab8bf61fd20db70d0317c816b1c2f0.tar.gz
opie-b41e3eb92eab8bf61fd20db70d0317c816b1c2f0.tar.bz2
basic folder handling for pop3 accounts
some code dups reduced
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/abstractmail.h2
-rw-r--r--noncore/net/mail/accountview.cpp76
-rw-r--r--noncore/net/mail/accountview.h6
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h2
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp31
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h1
-rw-r--r--noncore/net/mail/pop3wrapper.cpp31
-rw-r--r--noncore/net/mail/pop3wrapper.h1
8 files changed, 106 insertions, 44 deletions
diff --git a/noncore/net/mail/abstractmail.h b/noncore/net/mail/abstractmail.h
index b609aa7..5dc4cab 100644
--- a/noncore/net/mail/abstractmail.h
+++ b/noncore/net/mail/abstractmail.h
@@ -1,51 +1,51 @@
1#ifndef __abstract_mail_ 1#ifndef __abstract_mail_
2#define __abstract_mail_ 2#define __abstract_mail_
3 3
4#include <qobject.h> 4#include <qobject.h>
5#include "settings.h" 5#include "settings.h"
6 6
7class RecMail; 7class RecMail;
8class RecBody; 8class RecBody;
9class RecPart; 9class RecPart;
10class IMAPwrapper; 10class IMAPwrapper;
11class POP3wrapper; 11class POP3wrapper;
12class Folder; 12class Folder;
13class encodedString; 13class encodedString;
14 14
15class AbstractMail:public QObject 15class AbstractMail:public QObject
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18public: 18public:
19 AbstractMail(){}; 19 AbstractMail(){};
20 virtual ~AbstractMail(){} 20 virtual ~AbstractMail(){}
21 virtual QList<Folder>* listFolders()=0; 21 virtual QList<Folder>* listFolders()=0;
22 virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; 22 virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0;
23 virtual RecBody fetchBody(const RecMail&mail)=0; 23 virtual RecBody fetchBody(const RecMail&mail)=0;
24 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; 24 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0;
25 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; 25 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0;
26 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; 26 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0;
27 27
28 virtual void deleteMail(const RecMail&mail)=0; 28 virtual void deleteMail(const RecMail&mail)=0;
29 virtual void answeredMail(const RecMail&mail)=0; 29 virtual void answeredMail(const RecMail&mail)=0;
30 virtual void cleanMimeCache(){}; 30 virtual void cleanMimeCache(){};
31 virtual int deleteAllMail(const Folder*){return 1;} 31 virtual int deleteAllMail(const Folder*){return 1;}
32 virtual int deleteMbox(const Folder*){return 1;}
32 33
33 /* mail box methods */ 34 /* mail box methods */
34 /* parameter is the box to create. 35 /* parameter is the box to create.
35 * if the implementing subclass has prefixes, 36 * if the implementing subclass has prefixes,
36 * them has to be appended automatic. 37 * them has to be appended automatic.
37 */ 38 */
38 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false){return 0;} 39 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false){return 0;}
39 virtual int deleteMbox(const Folder*){return 1;}
40 40
41 static AbstractMail* getWrapper(IMAPaccount *a); 41 static AbstractMail* getWrapper(IMAPaccount *a);
42 static AbstractMail* getWrapper(POP3account *a); 42 static AbstractMail* getWrapper(POP3account *a);
43 /* mbox only! */ 43 /* mbox only! */
44 static AbstractMail* getWrapper(const QString&a); 44 static AbstractMail* getWrapper(const QString&a);
45 45
46protected: 46protected:
47 static encodedString*decode_String(const encodedString*text,const QString&enc); 47 static encodedString*decode_String(const encodedString*text,const QString&enc);
48 static QString convert_String(const char*text); 48 static QString convert_String(const char*text);
49 static QString gen_attachment_id(); 49 static QString gen_attachment_id();
50}; 50};
51#endif 51#endif
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 30765cf..f861c20 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -1,655 +1,667 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include "accountview.h" 2#include "accountview.h"
3#include "mailtypes.h" 3#include "mailtypes.h"
4#include "defines.h" 4#include "defines.h"
5#include "newmaildir.h" 5#include "newmaildir.h"
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7#include <qpopupmenu.h> 7#include <qpopupmenu.h>
8 8
9/** 9/**
10 * POP3 Account stuff 10 * POP3 Account stuff
11 */ 11 */
12POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) 12POP3viewItem::POP3viewItem( POP3account *a, QListView *parent )
13 : AccountViewItem( parent ) 13 : AccountViewItem( parent )
14{ 14{
15 account = a; 15 account = a;
16 wrapper = AbstractMail::getWrapper( account ); 16 wrapper = AbstractMail::getWrapper( account );
17 setPixmap( 0, PIXMAP_POP3FOLDER ); 17 setPixmap( 0, PIXMAP_POP3FOLDER );
18 setText( 0, account->getAccountName() ); 18 setText( 0, account->getAccountName() );
19 setOpen( true ); 19 setOpen( true );
20} 20}
21 21
22POP3viewItem::~POP3viewItem() 22POP3viewItem::~POP3viewItem()
23{ 23{
24 delete wrapper; 24 delete wrapper;
25} 25}
26 26
27AbstractMail *POP3viewItem::getWrapper() 27AbstractMail *POP3viewItem::getWrapper()
28{ 28{
29 return wrapper; 29 return wrapper;
30} 30}
31 31
32void POP3viewItem::refresh( QList<RecMail> & ) 32void POP3viewItem::refresh( QList<RecMail> & )
33{ 33{
34 QList<Folder> *folders = wrapper->listFolders(); 34 QList<Folder> *folders = wrapper->listFolders();
35 QListViewItem *child = firstChild(); 35 QListViewItem *child = firstChild();
36 while ( child ) { 36 while ( child ) {
37 QListViewItem *tmp = child; 37 QListViewItem *tmp = child;
38 child = child->nextSibling(); 38 child = child->nextSibling();
39 delete tmp; 39 delete tmp;
40 } 40 }
41 Folder *it; 41 Folder *it;
42 QListViewItem*item = 0; 42 QListViewItem*item = 0;
43 for ( it = folders->first(); it; it = folders->next() ) { 43 for ( it = folders->first(); it; it = folders->next() ) {
44 item = new POP3folderItem( it, this , item ); 44 item = new POP3folderItem( it, this , item );
45 item->setSelectable(it->may_select()); 45 item->setSelectable(it->may_select());
46 } 46 }
47 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 47 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
48 folders->setAutoDelete(false); 48 folders->setAutoDelete(false);
49 delete folders; 49 delete folders;
50} 50}
51 51
52RecBody POP3viewItem::fetchBody( const RecMail &mail ) 52RecBody POP3viewItem::fetchBody( const RecMail &mail )
53{ 53{
54 qDebug( "POP3 fetchBody" ); 54 qDebug( "POP3 fetchBody" );
55 return wrapper->fetchBody( mail ); 55 return wrapper->fetchBody( mail );
56} 56}
57 57
58POP3folderItem::~POP3folderItem() 58POP3folderItem::~POP3folderItem()
59{ 59{
60 delete folder; 60 delete folder;
61} 61}
62 62
63POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) 63POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after )
64 : AccountViewItem( parent,after ) 64 : AccountViewItem( parent,after )
65{ 65{
66 folder = folderInit; 66 folder = folderInit;
67 pop3 = parent; 67 pop3 = parent;
68 if (folder->getDisplayName().lower()!="inbox") { 68 if (folder->getDisplayName().lower()!="inbox") {
69 setPixmap( 0, PIXMAP_POP3FOLDER ); 69 setPixmap( 0, PIXMAP_POP3FOLDER );
70 } else { 70 } else {
71 setPixmap( 0, PIXMAP_INBOXFOLDER); 71 setPixmap( 0, PIXMAP_INBOXFOLDER);
72 } 72 }
73 setText( 0, folder->getDisplayName() ); 73 setText( 0, folder->getDisplayName() );
74} 74}
75 75
76void POP3folderItem::refresh(QList<RecMail>&target) 76void POP3folderItem::refresh(QList<RecMail>&target)
77{ 77{
78 if (folder->may_select()) 78 if (folder->may_select())
79 pop3->getWrapper()->listMessages( folder->getName(),target ); 79 pop3->getWrapper()->listMessages( folder->getName(),target );
80} 80}
81 81
82RecBody POP3folderItem::fetchBody(const RecMail&aMail) 82RecBody POP3folderItem::fetchBody(const RecMail&aMail)
83{ 83{
84 return pop3->getWrapper()->fetchBody(aMail); 84 return pop3->getWrapper()->fetchBody(aMail);
85} 85}
86 86
87QPopupMenu * POP3folderItem::getContextMenu()
88{
89 QPopupMenu *m = new QPopupMenu(0);
90 if (m) {
91 m->insertItem(QObject::tr("Refresh header list",contextName),0);
92 m->insertItem(QObject::tr("Delete all mails",contextName),1);
93 }
94 return m;
95}
96
97void POP3folderItem::contextMenuSelected(int which)
98{
99 AccountView * view = (AccountView*)listView();
100 switch (which) {
101 case 0:
102 view->refreshCurrent();
103 break;
104 case 1:
105 deleteAllMail(pop3->getWrapper(),folder);
106 break;
107 default:
108 break;
109 }
110}
111
87/** 112/**
88 * IMAP Account stuff 113 * IMAP Account stuff
89 */ 114 */
90IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) 115IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent )
91 : AccountViewItem( parent ) 116 : AccountViewItem( parent )
92{ 117{
93 account = a; 118 account = a;
94 wrapper = AbstractMail::getWrapper( account ); 119 wrapper = AbstractMail::getWrapper( account );
95 setPixmap( 0, PIXMAP_IMAPFOLDER ); 120 setPixmap( 0, PIXMAP_IMAPFOLDER );
96 setText( 0, account->getAccountName() ); 121 setText( 0, account->getAccountName() );
97 setOpen( true ); 122 setOpen( true );
98} 123}
99 124
100IMAPviewItem::~IMAPviewItem() 125IMAPviewItem::~IMAPviewItem()
101{ 126{
102 delete wrapper; 127 delete wrapper;
103} 128}
104 129
105AbstractMail *IMAPviewItem::getWrapper() 130AbstractMail *IMAPviewItem::getWrapper()
106{ 131{
107 return wrapper; 132 return wrapper;
108} 133}
109 134
110IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) 135IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start)
111{ 136{
112 IMAPfolderItem*pitem,*sitem; 137 IMAPfolderItem*pitem,*sitem;
113 if (!start) pitem = (IMAPfolderItem*)firstChild(); 138 if (!start) pitem = (IMAPfolderItem*)firstChild();
114 else pitem = (IMAPfolderItem*)start->firstChild(); 139 else pitem = (IMAPfolderItem*)start->firstChild();
115 while (pitem) { 140 while (pitem) {
116 if (pitem->matchName(path)) { 141 if (pitem->matchName(path)) {
117 break; 142 break;
118 } 143 }
119 if (pitem->childCount()>0) { 144 if (pitem->childCount()>0) {
120 sitem = findSubItem(path,pitem); 145 sitem = findSubItem(path,pitem);
121 if (sitem) { 146 if (sitem) {
122 pitem = sitem; 147 pitem = sitem;
123 break; 148 break;
124 } 149 }
125 } 150 }
126 pitem=(IMAPfolderItem*)pitem->nextSibling(); 151 pitem=(IMAPfolderItem*)pitem->nextSibling();
127 } 152 }
128 return pitem; 153 return pitem;
129} 154}
130 155
131void IMAPviewItem::refresh(QList<RecMail>&) 156void IMAPviewItem::refresh(QList<RecMail>&)
132{ 157{
133 refreshFolders(false); 158 refreshFolders(false);
134} 159}
135 160
136void IMAPviewItem::refreshFolders(bool force) 161void IMAPviewItem::refreshFolders(bool force)
137{ 162{
138 if (childCount()>0 && force==false) return; 163 if (childCount()>0 && force==false) return;
139 QList<Folder> *folders = wrapper->listFolders(); 164 QList<Folder> *folders = wrapper->listFolders();
140 165
141 QListViewItem *child = firstChild(); 166 QListViewItem *child = firstChild();
142 while ( child ) { 167 while ( child ) {
143 QListViewItem *tmp = child; 168 QListViewItem *tmp = child;
144 child = child->nextSibling(); 169 child = child->nextSibling();
145 delete tmp; 170 delete tmp;
146 } 171 }
147 172
148 Folder *it; 173 Folder *it;
149 QListViewItem*item = 0; 174 QListViewItem*item = 0;
150 QListViewItem*titem = 0; 175 QListViewItem*titem = 0;
151 QString fname,del,search; 176 QString fname,del,search;
152 int pos; 177 int pos;
153 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 178 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
154 folders->setAutoDelete(false); 179 folders->setAutoDelete(false);
155 180
156 for ( it = folders->first(); it; it = folders->next() ) { 181 for ( it = folders->first(); it; it = folders->next() ) {
157 if (it->getDisplayName().lower()=="inbox") { 182 if (it->getDisplayName().lower()=="inbox") {
158 item = new IMAPfolderItem( it, this , item ); 183 item = new IMAPfolderItem( it, this , item );
159 folders->remove(it); 184 folders->remove(it);
160 qDebug("inbox found"); 185 qDebug("inbox found");
161 break; 186 break;
162 } 187 }
163 } 188 }
164 for ( it = folders->first(); it; it = folders->next() ) { 189 for ( it = folders->first(); it; it = folders->next() ) {
165 fname = it->getDisplayName(); 190 fname = it->getDisplayName();
166 pos = fname.findRev(it->Separator()); 191 pos = fname.findRev(it->Separator());
167 if (pos != -1) { 192 if (pos != -1) {
168 fname = fname.left(pos); 193 fname = fname.left(pos);
169 } 194 }
170 IMAPfolderItem*pitem = findSubItem(fname); 195 IMAPfolderItem*pitem = findSubItem(fname);
171 if (pitem) { 196 if (pitem) {
172 titem = item; 197 titem = item;
173 item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); 198 item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this);
174 /* setup the short name */ 199 /* setup the short name */
175 item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); 200 item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1));
176 item = titem; 201 item = titem;
177 } else { 202 } else {
178 item = new IMAPfolderItem( it, this , item ); 203 item = new IMAPfolderItem( it, this , item );
179 } 204 }
180 } 205 }
181 delete folders; 206 delete folders;
182} 207}
183 208
184QPopupMenu * IMAPviewItem::getContextMenu() 209QPopupMenu * IMAPviewItem::getContextMenu()
185{ 210{
186 QPopupMenu *m = new QPopupMenu(0); 211 QPopupMenu *m = new QPopupMenu(0);
187 if (m) { 212 if (m) {
188 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 213 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
189 m->insertItem(QObject::tr("Create new folder",contextName),1); 214 m->insertItem(QObject::tr("Create new folder",contextName),1);
190 m->insertSeparator(); 215 m->insertSeparator();
191 m->insertItem(QObject::tr("Disconnect",contextName),2); 216 m->insertItem(QObject::tr("Disconnect",contextName),2);
192 } 217 }
193 return m; 218 return m;
194} 219}
195 220
196void IMAPviewItem::createNewFolder() 221void IMAPviewItem::createNewFolder()
197{ 222{
198 Newmdirdlg ndirdlg; 223 Newmdirdlg ndirdlg;
199 ndirdlg.showMaximized(); 224 ndirdlg.showMaximized();
200 if (ndirdlg.exec()) { 225 if (ndirdlg.exec()) {
201 QString ndir = ndirdlg.Newdir(); 226 QString ndir = ndirdlg.Newdir();
202 bool makesubs = ndirdlg.subpossible(); 227 bool makesubs = ndirdlg.subpossible();
203 QString delemiter = "/"; 228 QString delemiter = "/";
204 IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); 229 IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
205 if (item) { 230 if (item) {
206 delemiter = item->Delemiter(); 231 delemiter = item->Delemiter();
207 } 232 }
208 if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { 233 if (wrapper->createMbox(ndir,0,delemiter,makesubs)) {
209 refreshFolders(true); 234 refreshFolders(true);
210 } 235 }
211 } 236 }
212} 237}
213 238
214void IMAPviewItem::contextMenuSelected(int id) 239void IMAPviewItem::contextMenuSelected(int id)
215{ 240{
216 qDebug("Id selected: %i",id); 241 qDebug("Id selected: %i",id);
217 switch (id) { 242 switch (id) {
218 case 0: 243 case 0:
219 refreshFolders(true); 244 refreshFolders(true);
220 break; 245 break;
221 case 1: 246 case 1:
222 createNewFolder(); 247 createNewFolder();
223 break; 248 break;
224 default: 249 default:
225 break; 250 break;
226 } 251 }
227} 252}
228 253
229RecBody IMAPviewItem::fetchBody(const RecMail&) 254RecBody IMAPviewItem::fetchBody(const RecMail&)
230{ 255{
231 return RecBody(); 256 return RecBody();
232} 257}
233 258
234IMAPfolderItem::~IMAPfolderItem() 259IMAPfolderItem::~IMAPfolderItem()
235{ 260{
236 delete folder; 261 delete folder;
237} 262}
238 263
239IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) 264IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after )
240 : AccountViewItem( parent , after ) 265 : AccountViewItem( parent , after )
241{ 266{
242 folder = folderInit; 267 folder = folderInit;
243 imap = parent; 268 imap = parent;
244 if (folder->getDisplayName().lower()!="inbox") { 269 if (folder->getDisplayName().lower()!="inbox") {
245 setPixmap( 0, PIXMAP_IMAPFOLDER ); 270 setPixmap( 0, PIXMAP_IMAPFOLDER );
246 } else { 271 } else {
247 setPixmap( 0, PIXMAP_INBOXFOLDER); 272 setPixmap( 0, PIXMAP_INBOXFOLDER);
248 } 273 }
249 setText( 0, folder->getDisplayName() ); 274 setText( 0, folder->getDisplayName() );
250} 275}
251 276
252IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) 277IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master )
253 : AccountViewItem( parent,after ) 278 : AccountViewItem( parent,after )
254{ 279{
255 folder = folderInit; 280 folder = folderInit;
256 imap = master; 281 imap = master;
257 if (folder->getDisplayName().lower()!="inbox") { 282 if (folder->getDisplayName().lower()!="inbox") {
258 setPixmap( 0, PIXMAP_IMAPFOLDER ); 283 setPixmap( 0, PIXMAP_IMAPFOLDER );
259 } else { 284 } else {
260 setPixmap( 0, PIXMAP_INBOXFOLDER); 285 setPixmap( 0, PIXMAP_INBOXFOLDER);
261 } 286 }
262 setText( 0, folder->getDisplayName() ); 287 setText( 0, folder->getDisplayName() );
263} 288}
264 289
265const QString& IMAPfolderItem::Delemiter()const 290const QString& IMAPfolderItem::Delemiter()const
266{ 291{
267 return folder->Separator(); 292 return folder->Separator();
268} 293}
269 294
270bool IMAPfolderItem::matchName(const QString&name)const 295bool IMAPfolderItem::matchName(const QString&name)const
271{ 296{
272 return folder->getDisplayName()==name; 297 return folder->getDisplayName()==name;
273} 298}
274 299
275void IMAPfolderItem::refresh(QList<RecMail>&target) 300void IMAPfolderItem::refresh(QList<RecMail>&target)
276{ 301{
277 if (folder->may_select()) { 302 if (folder->may_select()) {
278 imap->getWrapper()->listMessages( folder->getName(),target ); 303 imap->getWrapper()->listMessages( folder->getName(),target );
279 } else { 304 } else {
280 target.clear(); 305 target.clear();
281 } 306 }
282} 307}
283 308
284RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) 309RecBody IMAPfolderItem::fetchBody(const RecMail&aMail)
285{ 310{
286 return imap->getWrapper()->fetchBody(aMail); 311 return imap->getWrapper()->fetchBody(aMail);
287} 312}
288 313
289QPopupMenu * IMAPfolderItem::getContextMenu() 314QPopupMenu * IMAPfolderItem::getContextMenu()
290{ 315{
291 QPopupMenu *m = new QPopupMenu(0); 316 QPopupMenu *m = new QPopupMenu(0);
292 if (m) { 317 if (m) {
293 if (folder->may_select()) { 318 if (folder->may_select()) {
294 m->insertItem(QObject::tr("Refresh header list",contextName),0); 319 m->insertItem(QObject::tr("Refresh header list",contextName),0);
295 m->insertItem(QObject::tr("Delete all mails",contextName),1); 320 m->insertItem(QObject::tr("Delete all mails",contextName),1);
296 } 321 }
297 if (folder->no_inferior()==false) { 322 if (folder->no_inferior()==false) {
298 m->insertItem(QObject::tr("Create new subfolder",contextName),2); 323 m->insertItem(QObject::tr("Create new subfolder",contextName),2);
299 } 324 }
300 if (folder->getDisplayName().lower()!="inbox") { 325 if (folder->getDisplayName().lower()!="inbox") {
301 m->insertItem(QObject::tr("Delete folder",contextName),3); 326 m->insertItem(QObject::tr("Delete folder",contextName),3);
302 } 327 }
303 } 328 }
304 return m; 329 return m;
305} 330}
306 331
307void IMAPfolderItem::deleteAllMails()
308{
309 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
310 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).arg(folder->getDisplayName()),
311 QObject::tr("Yes",contextName),
312 QObject::tr("No",contextName),QString::null,1,1);
313 qDebug("Auswahl: %i",yesno);
314 if (yesno == 0) {
315 if (imap->getWrapper()->deleteAllMail(folder)) {
316 AccountView * view = (AccountView*)listView();
317 if (view) view->refreshCurrent();
318 }
319 }
320}
321
322void IMAPfolderItem::createNewFolder() 332void IMAPfolderItem::createNewFolder()
323{ 333{
324 Newmdirdlg ndirdlg; 334 Newmdirdlg ndirdlg;
325 ndirdlg.showMaximized(); 335 ndirdlg.showMaximized();
326 if (ndirdlg.exec()) { 336 if (ndirdlg.exec()) {
327 QString ndir = ndirdlg.Newdir(); 337 QString ndir = ndirdlg.Newdir();
328 bool makesubs = ndirdlg.subpossible(); 338 bool makesubs = ndirdlg.subpossible();
329 QString delemiter = Delemiter(); 339 QString delemiter = Delemiter();
330 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) { 340 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) {
331 imap->refreshFolders(true); 341 imap->refreshFolders(true);
332 } 342 }
333 } 343 }
334} 344}
335 345
336void IMAPfolderItem::deleteFolder() 346void IMAPfolderItem::deleteFolder()
337{ 347{
338 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 348 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
339 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 349 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
340 QObject::tr("Yes",contextName), 350 QObject::tr("Yes",contextName),
341 QObject::tr("No",contextName),QString::null,1,1); 351 QObject::tr("No",contextName),QString::null,1,1);
342 qDebug("Auswahl: %i",yesno); 352 qDebug("Auswahl: %i",yesno);
343 if (yesno == 0) { 353 if (yesno == 0) {
344 if (imap->getWrapper()->deleteMbox(folder)) { 354 if (imap->getWrapper()->deleteMbox(folder)) {
345 QListView*v=listView(); 355 QListView*v=listView();
346 IMAPviewItem * box = imap; 356 IMAPviewItem * box = imap;
347 /* be carefull - after that this object is destroyd so don't use 357 /* be carefull - after that this object is destroyd so don't use
348 * any member of it after that call!!*/ 358 * any member of it after that call!!*/
349 imap->refreshFolders(true); 359 imap->refreshFolders(true);
350 if (v) { 360 if (v) {
351 v->setSelected(box,true); 361 v->setSelected(box,true);
352 } 362 }
353 } 363 }
354 } 364 }
355} 365}
356 366
357void IMAPfolderItem::contextMenuSelected(int id) 367void IMAPfolderItem::contextMenuSelected(int id)
358{ 368{
359 qDebug("Selected id: %i",id); 369 qDebug("Selected id: %i",id);
360 AccountView * view = (AccountView*)listView(); 370 AccountView * view = (AccountView*)listView();
361 switch(id) { 371 switch(id) {
362 case 0: 372 case 0:
363 view->refreshCurrent(); 373 view->refreshCurrent();
364 break; 374 break;
365 case 1: 375 case 1:
366 deleteAllMails(); 376 deleteAllMail(imap->getWrapper(),folder);
367 break; 377 break;
368 case 2: 378 case 2:
369 createNewFolder(); 379 createNewFolder();
370 break; 380 break;
371 case 3: 381 case 3:
372 deleteFolder(); 382 deleteFolder();
373 break; 383 break;
374 default: 384 default:
375 break; 385 break;
376 } 386 }
377} 387}
378 388
379/** 389/**
380 * Generic stuff 390 * Generic stuff
381 */ 391 */
382 392
383const QString AccountViewItem::contextName="AccountViewItem"; 393const QString AccountViewItem::contextName="AccountViewItem";
384 394
395void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder)
396{
397 if (!wrapper) return;
398 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
399 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).
400 arg((folder?folder->getDisplayName():"")),
401 QObject::tr("Yes",contextName),
402 QObject::tr("No",contextName),QString::null,1,1);
403 qDebug("Auswahl: %i",yesno);
404 if (yesno == 0) {
405 if (wrapper->deleteAllMail(folder)) {
406 AccountView * view = (AccountView*)listView();
407 if (view) view->refreshCurrent();
408 }
409 }
410}
411
385AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) 412AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
386 : QListView( parent, name, flags ) 413 : QListView( parent, name, flags )
387{ 414{
388 connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), 415 connect( this, SIGNAL( selectionChanged( QListViewItem * ) ),
389 SLOT( refresh( QListViewItem * ) ) ); 416 SLOT( refresh( QListViewItem * ) ) );
390 connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, 417 connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this,
391 SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); 418 SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) );
392 419
393 setSorting(0); 420 setSorting(0);
394} 421}
395 422
396void AccountView::slotContextMenu(int id) 423void AccountView::slotContextMenu(int id)
397{ 424{
398 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); 425 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
399 if (!view) return; 426 if (!view) return;
400 view->contextMenuSelected(id); 427 view->contextMenuSelected(id);
401} 428}
402 429
403void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) 430void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
404{ 431{
405 if (button==1) {return;} 432 if (button==1) {return;}
406 if (!item) return; 433 if (!item) return;
407 AccountViewItem *view = static_cast<AccountViewItem *>(item); 434 AccountViewItem *view = static_cast<AccountViewItem *>(item);
408 QPopupMenu*m = view->getContextMenu(); 435 QPopupMenu*m = view->getContextMenu();
409 if (!m) return; 436 if (!m) return;
410 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); 437 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
411 m->setFocus(); 438 m->setFocus();
412 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 439 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
413 delete m; 440 delete m;
414} 441}
415 442
416void AccountView::populate( QList<Account> list ) 443void AccountView::populate( QList<Account> list )
417{ 444{
418 clear(); 445 clear();
419 446
420 QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); 447 QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/");
421 (void) new MBOXviewItem(localfolders,this); 448 (void) new MBOXviewItem(localfolders,this);
422 449
423 Account *it; 450 Account *it;
424 for ( it = list.first(); it; it = list.next() ) { 451 for ( it = list.first(); it; it = list.next() ) {
425 if ( it->getType().compare( "IMAP" ) == 0 ) { 452 if ( it->getType().compare( "IMAP" ) == 0 ) {
426 IMAPaccount *imap = static_cast<IMAPaccount *>(it); 453 IMAPaccount *imap = static_cast<IMAPaccount *>(it);
427 qDebug( "added IMAP " + imap->getAccountName() ); 454 qDebug( "added IMAP " + imap->getAccountName() );
428 (void) new IMAPviewItem( imap, this ); 455 (void) new IMAPviewItem( imap, this );
429 } else if ( it->getType().compare( "POP3" ) == 0 ) { 456 } else if ( it->getType().compare( "POP3" ) == 0 ) {
430 POP3account *pop3 = static_cast<POP3account *>(it); 457 POP3account *pop3 = static_cast<POP3account *>(it);
431 qDebug( "added POP3 " + pop3->getAccountName() ); 458 qDebug( "added POP3 " + pop3->getAccountName() );
432 (void) new POP3viewItem( pop3, this ); 459 (void) new POP3viewItem( pop3, this );
433 } 460 }
434 } 461 }
435} 462}
436 463
437void AccountView::refresh(QListViewItem *item) { 464void AccountView::refresh(QListViewItem *item) {
438 465
439 qDebug("AccountView refresh..."); 466 qDebug("AccountView refresh...");
440 if ( item ) { 467 if ( item ) {
441 m_currentItem = item; 468 m_currentItem = item;
442 QList<RecMail> headerlist; 469 QList<RecMail> headerlist;
443 headerlist.setAutoDelete(true); 470 headerlist.setAutoDelete(true);
444 AccountViewItem *view = static_cast<AccountViewItem *>(item); 471 AccountViewItem *view = static_cast<AccountViewItem *>(item);
445 view->refresh(headerlist); 472 view->refresh(headerlist);
446 emit refreshMailview(&headerlist); 473 emit refreshMailview(&headerlist);
447 } 474 }
448} 475}
449 476
450void AccountView::refreshCurrent() 477void AccountView::refreshCurrent()
451{ 478{
452 m_currentItem = currentItem(); 479 m_currentItem = currentItem();
453 if ( !m_currentItem ) return; 480 if ( !m_currentItem ) return;
454 QList<RecMail> headerlist; 481 QList<RecMail> headerlist;
455 headerlist.setAutoDelete(true); 482 headerlist.setAutoDelete(true);
456 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 483 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
457 view->refresh(headerlist); 484 view->refresh(headerlist);
458 emit refreshMailview(&headerlist); 485 emit refreshMailview(&headerlist);
459} 486}
460 487
461void AccountView::refreshAll() 488void AccountView::refreshAll()
462{ 489{
463 490
464} 491}
465 492
466RecBody AccountView::fetchBody(const RecMail&aMail) 493RecBody AccountView::fetchBody(const RecMail&aMail)
467{ 494{
468 QListViewItem*item = selectedItem (); 495 QListViewItem*item = selectedItem ();
469 if (!item) return RecBody(); 496 if (!item) return RecBody();
470 AccountViewItem *view = static_cast<AccountViewItem *>(item); 497 AccountViewItem *view = static_cast<AccountViewItem *>(item);
471 return view->fetchBody(aMail); 498 return view->fetchBody(aMail);
472} 499}
473 500
474/** 501/**
475 * MBOX Account stuff 502 * MBOX Account stuff
476 */ 503 */
477 504
478MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) 505MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent )
479 : AccountViewItem( parent ) 506 : AccountViewItem( parent )
480{ 507{
481 m_Path = aPath; 508 m_Path = aPath;
482 wrapper = AbstractMail::getWrapper( m_Path ); 509 wrapper = AbstractMail::getWrapper( m_Path );
483 setPixmap( 0, PIXMAP_LOCALFOLDER ); 510 setPixmap( 0, PIXMAP_LOCALFOLDER );
484 setText( 0, " Local Folders" ); 511 setText( 0, " Local Folders" );
485 setOpen( true ); 512 setOpen( true );
486} 513}
487 514
488MBOXviewItem::~MBOXviewItem() 515MBOXviewItem::~MBOXviewItem()
489{ 516{
490 delete wrapper; 517 delete wrapper;
491} 518}
492 519
493AbstractMail *MBOXviewItem::getWrapper() 520AbstractMail *MBOXviewItem::getWrapper()
494{ 521{
495 return wrapper; 522 return wrapper;
496} 523}
497 524
498void MBOXviewItem::refresh( QList<RecMail> & ) 525void MBOXviewItem::refresh( QList<RecMail> & )
499{ 526{
500 refresh(false); 527 refresh(false);
501} 528}
502 529
503void MBOXviewItem::refresh(bool force) 530void MBOXviewItem::refresh(bool force)
504{ 531{
505 if (childCount()>0 && force==false) return; 532 if (childCount()>0 && force==false) return;
506 QList<Folder> *folders = wrapper->listFolders(); 533 QList<Folder> *folders = wrapper->listFolders();
507 QListViewItem *child = firstChild(); 534 QListViewItem *child = firstChild();
508 while ( child ) { 535 while ( child ) {
509 QListViewItem *tmp = child; 536 QListViewItem *tmp = child;
510 child = child->nextSibling(); 537 child = child->nextSibling();
511 delete tmp; 538 delete tmp;
512 } 539 }
513 Folder *it; 540 Folder *it;
514 QListViewItem*item = 0; 541 QListViewItem*item = 0;
515 for ( it = folders->first(); it; it = folders->next() ) { 542 for ( it = folders->first(); it; it = folders->next() ) {
516 item = new MBOXfolderItem( it, this , item ); 543 item = new MBOXfolderItem( it, this , item );
517 item->setSelectable(it->may_select()); 544 item->setSelectable(it->may_select());
518 } 545 }
519 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 546 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
520 folders->setAutoDelete(false); 547 folders->setAutoDelete(false);
521 delete folders; 548 delete folders;
522} 549}
523 550
524RecBody MBOXviewItem::fetchBody( const RecMail &mail ) 551RecBody MBOXviewItem::fetchBody( const RecMail &mail )
525{ 552{
526 qDebug( "MBOX fetchBody" ); 553 qDebug( "MBOX fetchBody" );
527 return wrapper->fetchBody( mail ); 554 return wrapper->fetchBody( mail );
528} 555}
529 556
530QPopupMenu * MBOXviewItem::getContextMenu() 557QPopupMenu * MBOXviewItem::getContextMenu()
531{ 558{
532 QPopupMenu *m = new QPopupMenu(0); 559 QPopupMenu *m = new QPopupMenu(0);
533 if (m) { 560 if (m) {
534 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 561 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
535 m->insertItem(QObject::tr("Create new folder",contextName),1); 562 m->insertItem(QObject::tr("Create new folder",contextName),1);
536 } 563 }
537 return m; 564 return m;
538} 565}
539 566
540void MBOXviewItem::createFolder() 567void MBOXviewItem::createFolder()
541{ 568{
542 Newmdirdlg ndirdlg(0,0,true); 569 Newmdirdlg ndirdlg(0,0,true);
543 ndirdlg.showMaximized(); 570 ndirdlg.showMaximized();
544 if (ndirdlg.exec()) { 571 if (ndirdlg.exec()) {
545 QString ndir = ndirdlg.Newdir(); 572 QString ndir = ndirdlg.Newdir();
546 if (wrapper->createMbox(ndir)) { 573 if (wrapper->createMbox(ndir)) {
547 refresh(true); 574 refresh(true);
548 } 575 }
549 } 576 }
550} 577}
551 578
552void MBOXviewItem::contextMenuSelected(int which) 579void MBOXviewItem::contextMenuSelected(int which)
553{ 580{
554 switch (which) { 581 switch (which) {
555 case 0: 582 case 0:
556 refresh(true); 583 refresh(true);
557 break; 584 break;
558 case 1: 585 case 1:
559 createFolder(); 586 createFolder();
560 break; 587 break;
561 default: 588 default:
562 break; 589 break;
563 } 590 }
564} 591}
565 592
566MBOXfolderItem::~MBOXfolderItem() 593MBOXfolderItem::~MBOXfolderItem()
567{ 594{
568 delete folder; 595 delete folder;
569} 596}
570 597
571MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) 598MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after )
572 : AccountViewItem( parent,after ) 599 : AccountViewItem( parent,after )
573{ 600{
574 folder = folderInit; 601 folder = folderInit;
575 mbox = parent; 602 mbox = parent;
576 if (folder->getDisplayName().lower() == "outgoing") { 603 if (folder->getDisplayName().lower() == "outgoing") {
577 setPixmap( 0, PIXMAP_OUTBOXFOLDER ); 604 setPixmap( 0, PIXMAP_OUTBOXFOLDER );
578 } else if (folder->getDisplayName().lower() == "inbox") { 605 } else if (folder->getDisplayName().lower() == "inbox") {
579 setPixmap( 0, PIXMAP_INBOXFOLDER); 606 setPixmap( 0, PIXMAP_INBOXFOLDER);
580 } else { 607 } else {
581 setPixmap( 0, PIXMAP_MBOXFOLDER ); 608 setPixmap( 0, PIXMAP_MBOXFOLDER );
582 } 609 }
583 setText( 0, folder->getDisplayName() ); 610 setText( 0, folder->getDisplayName() );
584} 611}
585 612
586void MBOXfolderItem::refresh(QList<RecMail>&target) 613void MBOXfolderItem::refresh(QList<RecMail>&target)
587{ 614{
588 if (folder->may_select()) 615 if (folder->may_select())
589 mbox->getWrapper()->listMessages( folder->getName(),target ); 616 mbox->getWrapper()->listMessages( folder->getName(),target );
590} 617}
591 618
592RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) 619RecBody MBOXfolderItem::fetchBody(const RecMail&aMail)
593{ 620{
594 return mbox->getWrapper()->fetchBody(aMail); 621 return mbox->getWrapper()->fetchBody(aMail);
595} 622}
596 623
597void MBOXfolderItem::deleteAllMails()
598{
599 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
600 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).arg(folder->getDisplayName()),
601 QObject::tr("Yes",contextName),
602 QObject::tr("No",contextName),QString::null,1,1);
603 qDebug("Auswahl: %i",yesno);
604 if (yesno == 0) {
605 if (mbox->getWrapper()->deleteAllMail(folder)) {
606 AccountView * view = (AccountView*)listView();
607 if (view) view->refreshCurrent();
608 }
609 }
610}
611
612void MBOXfolderItem::deleteFolder() 624void MBOXfolderItem::deleteFolder()
613{ 625{
614 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 626 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
615 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 627 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
616 QObject::tr("Yes",contextName), 628 QObject::tr("Yes",contextName),
617 QObject::tr("No",contextName),QString::null,1,1); 629 QObject::tr("No",contextName),QString::null,1,1);
618 qDebug("Auswahl: %i",yesno); 630 qDebug("Auswahl: %i",yesno);
619 if (yesno == 0) { 631 if (yesno == 0) {
620 if (mbox->getWrapper()->deleteMbox(folder)) { 632 if (mbox->getWrapper()->deleteMbox(folder)) {
621 QListView*v=listView(); 633 QListView*v=listView();
622 MBOXviewItem * box = mbox; 634 MBOXviewItem * box = mbox;
623 /* be carefull - after that this object is destroyd so don't use 635 /* be carefull - after that this object is destroyd so don't use
624 * any member of it after that call!!*/ 636 * any member of it after that call!!*/
625 mbox->refresh(true); 637 mbox->refresh(true);
626 if (v) { 638 if (v) {
627 v->setSelected(box,true); 639 v->setSelected(box,true);
628 } 640 }
629 } 641 }
630 } 642 }
631} 643}
632 644
633QPopupMenu * MBOXfolderItem::getContextMenu() 645QPopupMenu * MBOXfolderItem::getContextMenu()
634{ 646{
635 QPopupMenu *m = new QPopupMenu(0); 647 QPopupMenu *m = new QPopupMenu(0);
636 if (m) { 648 if (m) {
637 m->insertItem(QObject::tr("Delete all mails",contextName),0); 649 m->insertItem(QObject::tr("Delete all mails",contextName),0);
638 m->insertItem(QObject::tr("Delete folder",contextName),1); 650 m->insertItem(QObject::tr("Delete folder",contextName),1);
639 } 651 }
640 return m; 652 return m;
641} 653}
642 654
643void MBOXfolderItem::contextMenuSelected(int which) 655void MBOXfolderItem::contextMenuSelected(int which)
644{ 656{
645 switch(which) { 657 switch(which) {
646 case 0: 658 case 0:
647 deleteAllMails(); 659 deleteAllMail(mbox->getWrapper(),folder);
648 break; 660 break;
649 case 1: 661 case 1:
650 deleteFolder(); 662 deleteFolder();
651 break; 663 break;
652 default: 664 default:
653 break; 665 break;
654 } 666 }
655} 667}
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 98abf44..361dd86 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -1,173 +1,175 @@
1#ifndef ACCOUNTVIEW_H 1#ifndef ACCOUNTVIEW_H
2#define ACCOUNTVIEW_H 2#define ACCOUNTVIEW_H
3 3
4#include <qlistview.h> 4#include <qlistview.h>
5#include <qlist.h> 5#include <qlist.h>
6 6
7#include "settings.h" 7#include "settings.h"
8#include "mailwrapper.h" 8#include "mailwrapper.h"
9#include "abstractmail.h" 9#include "abstractmail.h"
10 10
11class POP3wrapper; 11class POP3wrapper;
12class RecMail; 12class RecMail;
13class RecBody; 13class RecBody;
14class QPopupMenu; 14class QPopupMenu;
15 15
16class AccountViewItem : public QListViewItem 16class AccountViewItem : public QListViewItem
17{ 17{
18 18
19public: 19public:
20 AccountViewItem( QListView *parent ) : QListViewItem( parent ) {} 20 AccountViewItem( QListView *parent ) : QListViewItem( parent ) {}
21 AccountViewItem( QListViewItem *parent) : QListViewItem( parent) {} 21 AccountViewItem( QListViewItem *parent) : QListViewItem( parent) {}
22 AccountViewItem( QListViewItem *parent , QListViewItem*after ) : QListViewItem( parent,after ) {} 22 AccountViewItem( QListViewItem *parent , QListViewItem*after ) : QListViewItem( parent,after ) {}
23 virtual void refresh(QList<RecMail>&)=0; 23 virtual void refresh(QList<RecMail>&)=0;
24 virtual RecBody fetchBody(const RecMail&)=0; 24 virtual RecBody fetchBody(const RecMail&)=0;
25 virtual QPopupMenu * getContextMenu(){return 0;}; 25 virtual QPopupMenu * getContextMenu(){return 0;};
26 virtual void contextMenuSelected(int){} 26 virtual void contextMenuSelected(int){}
27protected: 27protected:
28 virtual void deleteAllMail(AbstractMail*wrapper,Folder*f);
28 static const QString contextName; 29 static const QString contextName;
29}; 30};
30 31
31class POP3viewItem : public AccountViewItem 32class POP3viewItem : public AccountViewItem
32{ 33{
33 34
34public: 35public:
35 POP3viewItem( POP3account *a, QListView *parent ); 36 POP3viewItem( POP3account *a, QListView *parent );
36 ~POP3viewItem(); 37 ~POP3viewItem();
37 virtual void refresh( QList<RecMail> &target ); 38 virtual void refresh( QList<RecMail> &target );
38 virtual RecBody fetchBody( const RecMail &mail ); 39 virtual RecBody fetchBody( const RecMail &mail );
39 AbstractMail *getWrapper(); 40 AbstractMail *getWrapper();
40private: 41private:
41 POP3account *account; 42 POP3account *account;
42 AbstractMail *wrapper; 43 AbstractMail *wrapper;
43 44
44}; 45};
45 46
46class POP3folderItem : public AccountViewItem 47class POP3folderItem : public AccountViewItem
47{ 48{
48 49
49public: 50public:
50 POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); 51 POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after );
51 ~POP3folderItem(); 52 ~POP3folderItem();
52 virtual void refresh(QList<RecMail>&); 53 virtual void refresh(QList<RecMail>&);
53 virtual RecBody fetchBody(const RecMail&); 54 virtual RecBody fetchBody(const RecMail&);
55 virtual QPopupMenu * getContextMenu();
56 virtual void contextMenuSelected(int);
57
54private: 58private:
55 Folder *folder; 59 Folder *folder;
56 POP3viewItem *pop3; 60 POP3viewItem *pop3;
57}; 61};
58 62
59class IMAPfolderItem; 63class IMAPfolderItem;
60 64
61class IMAPviewItem : public AccountViewItem 65class IMAPviewItem : public AccountViewItem
62{ 66{
63 friend class IMAPfolderItem; 67 friend class IMAPfolderItem;
64public: 68public:
65 IMAPviewItem( IMAPaccount *a, QListView *parent ); 69 IMAPviewItem( IMAPaccount *a, QListView *parent );
66 ~IMAPviewItem(); 70 ~IMAPviewItem();
67 virtual void refresh(QList<RecMail>&); 71 virtual void refresh(QList<RecMail>&);
68 virtual RecBody fetchBody(const RecMail&); 72 virtual RecBody fetchBody(const RecMail&);
69 AbstractMail *getWrapper(); 73 AbstractMail *getWrapper();
70 virtual QPopupMenu * getContextMenu(); 74 virtual QPopupMenu * getContextMenu();
71 virtual void contextMenuSelected(int); 75 virtual void contextMenuSelected(int);
72 76
73protected: 77protected:
74 IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0); 78 IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0);
75 virtual void refreshFolders(bool force=false); 79 virtual void refreshFolders(bool force=false);
76 virtual void createNewFolder(); 80 virtual void createNewFolder();
77 81
78private: 82private:
79 IMAPaccount *account; 83 IMAPaccount *account;
80 AbstractMail *wrapper; 84 AbstractMail *wrapper;
81}; 85};
82 86
83class IMAPfolderItem : public AccountViewItem 87class IMAPfolderItem : public AccountViewItem
84{ 88{
85 89
86public: 90public:
87 IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); 91 IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after );
88 IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); 92 IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master );
89 ~IMAPfolderItem(); 93 ~IMAPfolderItem();
90 virtual void refresh(QList<RecMail>&); 94 virtual void refresh(QList<RecMail>&);
91 virtual RecBody fetchBody(const RecMail&); 95 virtual RecBody fetchBody(const RecMail&);
92 bool matchName(const QString&name)const; 96 bool matchName(const QString&name)const;
93 virtual QPopupMenu * getContextMenu(); 97 virtual QPopupMenu * getContextMenu();
94 virtual void contextMenuSelected(int); 98 virtual void contextMenuSelected(int);
95 virtual const QString& Delemiter()const; 99 virtual const QString& Delemiter()const;
96protected: 100protected:
97 virtual void createNewFolder(); 101 virtual void createNewFolder();
98 virtual void deleteFolder(); 102 virtual void deleteFolder();
99 virtual void deleteAllMails();
100 103
101private: 104private:
102 Folder *folder; 105 Folder *folder;
103 IMAPviewItem *imap; 106 IMAPviewItem *imap;
104}; 107};
105 108
106class MBOXviewItem : public AccountViewItem 109class MBOXviewItem : public AccountViewItem
107{ 110{
108 friend class MBOXfolderItem; 111 friend class MBOXfolderItem;
109 112
110public: 113public:
111// MBOXviewItem( MBOXaccount *a, QListView *parent ); 114// MBOXviewItem( MBOXaccount *a, QListView *parent );
112 MBOXviewItem( const QString&aMboxPath, QListView *parent ); 115 MBOXviewItem( const QString&aMboxPath, QListView *parent );
113 ~MBOXviewItem(); 116 ~MBOXviewItem();
114 virtual void refresh( QList<RecMail> &target ); 117 virtual void refresh( QList<RecMail> &target );
115 virtual RecBody fetchBody( const RecMail &mail ); 118 virtual RecBody fetchBody( const RecMail &mail );
116 AbstractMail *getWrapper(); 119 AbstractMail *getWrapper();
117 virtual QPopupMenu * getContextMenu(); 120 virtual QPopupMenu * getContextMenu();
118 virtual void contextMenuSelected(int); 121 virtual void contextMenuSelected(int);
119 122
120protected: 123protected:
121 virtual void refresh(bool force=false); 124 virtual void refresh(bool force=false);
122 virtual void createFolder(); 125 virtual void createFolder();
123 126
124private: 127private:
125// MBOXaccount *account; 128// MBOXaccount *account;
126 QString m_Path; 129 QString m_Path;
127 AbstractMail *wrapper; 130 AbstractMail *wrapper;
128 131
129}; 132};
130 133
131class MBOXfolderItem : public AccountViewItem 134class MBOXfolderItem : public AccountViewItem
132{ 135{
133 136
134public: 137public:
135 MBOXfolderItem( Folder *folder, MBOXviewItem *parent , QListViewItem*after ); 138 MBOXfolderItem( Folder *folder, MBOXviewItem *parent , QListViewItem*after );
136 ~MBOXfolderItem(); 139 ~MBOXfolderItem();
137 virtual void refresh(QList<RecMail>&); 140 virtual void refresh(QList<RecMail>&);
138 virtual RecBody fetchBody(const RecMail&); 141 virtual RecBody fetchBody(const RecMail&);
139 virtual QPopupMenu * getContextMenu(); 142 virtual QPopupMenu * getContextMenu();
140 virtual void contextMenuSelected(int); 143 virtual void contextMenuSelected(int);
141 144
142protected: 145protected:
143 virtual void deleteAllMails();
144 virtual void deleteFolder(); 146 virtual void deleteFolder();
145private: 147private:
146 Folder *folder; 148 Folder *folder;
147 MBOXviewItem *mbox; 149 MBOXviewItem *mbox;
148}; 150};
149 151
150class AccountView : public QListView 152class AccountView : public QListView
151{ 153{
152 Q_OBJECT 154 Q_OBJECT
153 155
154public: 156public:
155 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 157 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
156 void populate( QList<Account> list ); 158 void populate( QList<Account> list );
157 RecBody fetchBody(const RecMail&aMail); 159 RecBody fetchBody(const RecMail&aMail);
158 160
159public slots: 161public slots:
160 virtual void refreshAll(); 162 virtual void refreshAll();
161 virtual void refresh(QListViewItem *item); 163 virtual void refresh(QListViewItem *item);
162 virtual void refreshCurrent(); 164 virtual void refreshCurrent();
163 virtual void slotHold(int, QListViewItem *,const QPoint&,int); 165 virtual void slotHold(int, QListViewItem *,const QPoint&,int);
164 virtual void slotContextMenu(int id); 166 virtual void slotContextMenu(int id);
165 167
166signals: 168signals:
167 void refreshMailview(QList<RecMail>*); 169 void refreshMailview(QList<RecMail>*);
168 170
169private: 171private:
170 QListViewItem* m_currentItem; 172 QListViewItem* m_currentItem;
171}; 173};
172 174
173#endif 175#endif
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index b609aa7..5dc4cab 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -1,51 +1,51 @@
1#ifndef __abstract_mail_ 1#ifndef __abstract_mail_
2#define __abstract_mail_ 2#define __abstract_mail_
3 3
4#include <qobject.h> 4#include <qobject.h>
5#include "settings.h" 5#include "settings.h"
6 6
7class RecMail; 7class RecMail;
8class RecBody; 8class RecBody;
9class RecPart; 9class RecPart;
10class IMAPwrapper; 10class IMAPwrapper;
11class POP3wrapper; 11class POP3wrapper;
12class Folder; 12class Folder;
13class encodedString; 13class encodedString;
14 14
15class AbstractMail:public QObject 15class AbstractMail:public QObject
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18public: 18public:
19 AbstractMail(){}; 19 AbstractMail(){};
20 virtual ~AbstractMail(){} 20 virtual ~AbstractMail(){}
21 virtual QList<Folder>* listFolders()=0; 21 virtual QList<Folder>* listFolders()=0;
22 virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; 22 virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0;
23 virtual RecBody fetchBody(const RecMail&mail)=0; 23 virtual RecBody fetchBody(const RecMail&mail)=0;
24 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; 24 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0;
25 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; 25 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0;
26 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; 26 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0;
27 27
28 virtual void deleteMail(const RecMail&mail)=0; 28 virtual void deleteMail(const RecMail&mail)=0;
29 virtual void answeredMail(const RecMail&mail)=0; 29 virtual void answeredMail(const RecMail&mail)=0;
30 virtual void cleanMimeCache(){}; 30 virtual void cleanMimeCache(){};
31 virtual int deleteAllMail(const Folder*){return 1;} 31 virtual int deleteAllMail(const Folder*){return 1;}
32 virtual int deleteMbox(const Folder*){return 1;}
32 33
33 /* mail box methods */ 34 /* mail box methods */
34 /* parameter is the box to create. 35 /* parameter is the box to create.
35 * if the implementing subclass has prefixes, 36 * if the implementing subclass has prefixes,
36 * them has to be appended automatic. 37 * them has to be appended automatic.
37 */ 38 */
38 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false){return 0;} 39 virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false){return 0;}
39 virtual int deleteMbox(const Folder*){return 1;}
40 40
41 static AbstractMail* getWrapper(IMAPaccount *a); 41 static AbstractMail* getWrapper(IMAPaccount *a);
42 static AbstractMail* getWrapper(POP3account *a); 42 static AbstractMail* getWrapper(POP3account *a);
43 /* mbox only! */ 43 /* mbox only! */
44 static AbstractMail* getWrapper(const QString&a); 44 static AbstractMail* getWrapper(const QString&a);
45 45
46protected: 46protected:
47 static encodedString*decode_String(const encodedString*text,const QString&enc); 47 static encodedString*decode_String(const encodedString*text,const QString&enc);
48 static QString convert_String(const char*text); 48 static QString convert_String(const char*text);
49 static QString gen_attachment_id(); 49 static QString gen_attachment_id();
50}; 50};
51#endif 51#endif
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index b85fbf6..2e70dee 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -1,231 +1,254 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include "pop3wrapper.h" 2#include "pop3wrapper.h"
3#include "mailtypes.h" 3#include "mailtypes.h"
4#include "logindialog.h" 4#include "logindialog.h"
5#include <libetpan/libetpan.h> 5#include <libetpan/libetpan.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <qfile.h> 7#include <qfile.h>
8 8
9/* we don't fetch messages larger than 5 MB */ 9/* we don't fetch messages larger than 5 MB */
10#define HARD_MSG_SIZE_LIMIT 5242880 10#define HARD_MSG_SIZE_LIMIT 5242880
11 11
12POP3wrapper::POP3wrapper( POP3account *a ) 12POP3wrapper::POP3wrapper( POP3account *a )
13 : Genericwrapper() 13 : Genericwrapper()
14{ 14{
15 account = a; 15 account = a;
16 m_pop3 = NULL; 16 m_pop3 = NULL;
17 msgTempName = a->getFileName()+"_msg_cache"; 17 msgTempName = a->getFileName()+"_msg_cache";
18 last_msg_id = 0; 18 last_msg_id = 0;
19} 19}
20 20
21POP3wrapper::~POP3wrapper() 21POP3wrapper::~POP3wrapper()
22{ 22{
23 logout(); 23 logout();
24 QFile msg_cache(msgTempName); 24 QFile msg_cache(msgTempName);
25 if (msg_cache.exists()) { 25 if (msg_cache.exists()) {
26 msg_cache.remove(); 26 msg_cache.remove();
27 } 27 }
28} 28}
29 29
30void POP3wrapper::pop3_progress( size_t current, size_t maximum ) 30void POP3wrapper::pop3_progress( size_t current, size_t maximum )
31{ 31{
32 //qDebug( "POP3: %i of %i", current, maximum ); 32 //qDebug( "POP3: %i of %i", current, maximum );
33} 33}
34 34
35RecBody POP3wrapper::fetchBody( const RecMail &mail ) 35RecBody POP3wrapper::fetchBody( const RecMail &mail )
36{ 36{
37 int err = MAILPOP3_NO_ERROR; 37 int err = MAILPOP3_NO_ERROR;
38 char *message; 38 char *message;
39 size_t length = 0; 39 size_t length = 0;
40 40
41 login(); 41 login();
42 if ( !m_pop3 ) { 42 if ( !m_pop3 ) {
43 return RecBody(); 43 return RecBody();
44 } 44 }
45 45
46 RecBody body; 46 RecBody body;
47 mailmessage * msg = 0; 47 mailmessage * msg = 0;
48 48
49 QFile msg_cache(msgTempName); 49 QFile msg_cache(msgTempName);
50 50
51 if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { 51 if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) {
52 qDebug("Message to large: %i",mail.Msgsize()); 52 qDebug("Message to large: %i",mail.Msgsize());
53 return body; 53 return body;
54 } 54 }
55 cleanMimeCache(); 55 cleanMimeCache();
56 if (mail.getNumber()!=last_msg_id) { 56 if (mail.getNumber()!=last_msg_id) {
57 if (msg_cache.exists()) { 57 if (msg_cache.exists()) {
58 msg_cache.remove(); 58 msg_cache.remove();
59 } 59 }
60 msg_cache.open(IO_ReadWrite|IO_Truncate); 60 msg_cache.open(IO_ReadWrite|IO_Truncate);
61 last_msg_id = mail.getNumber(); 61 last_msg_id = mail.getNumber();
62 err = mailpop3_retr( m_pop3, mail.getNumber(), &message, &length ); 62 err = mailpop3_retr( m_pop3, mail.getNumber(), &message, &length );
63 if ( err != MAILPOP3_NO_ERROR ) { 63 if ( err != MAILPOP3_NO_ERROR ) {
64 qDebug( "POP3: error retrieving body with index %i", mail.getNumber() ); 64 qDebug( "POP3: error retrieving body with index %i", mail.getNumber() );
65 last_msg_id = 0; 65 last_msg_id = 0;
66 return RecBody(); 66 return RecBody();
67 } 67 }
68 msg_cache.writeBlock(message,length); 68 msg_cache.writeBlock(message,length);
69 } else { 69 } else {
70 QString msg=""; 70 QString msg="";
71 msg_cache.open(IO_ReadOnly); 71 msg_cache.open(IO_ReadOnly);
72 message = new char[4096]; 72 message = new char[4096];
73 memset(message,0,4096); 73 memset(message,0,4096);
74 while (msg_cache.readBlock(message,4095)>0) { 74 while (msg_cache.readBlock(message,4095)>0) {
75 msg+=message; 75 msg+=message;
76 memset(message,0,4096); 76 memset(message,0,4096);
77 } 77 }
78 delete message; 78 delete message;
79 message = (char*)malloc(msg.length()+1*sizeof(char)); 79 message = (char*)malloc(msg.length()+1*sizeof(char));
80 memset(message,0,msg.length()+1); 80 memset(message,0,msg.length()+1);
81 memcpy(message,msg.latin1(),msg.length()); 81 memcpy(message,msg.latin1(),msg.length());
82 } 82 }
83 83
84 /* transform to libetpan stuff */ 84 /* transform to libetpan stuff */
85 msg = mailmessage_new(); 85 msg = mailmessage_new();
86 mailmessage_init(msg, NULL, data_message_driver, 0, strlen(message)); 86 mailmessage_init(msg, NULL, data_message_driver, 0, strlen(message));
87 generic_message_t * msg_data; 87 generic_message_t * msg_data;
88 msg_data = (generic_message_t *)msg->msg_data; 88 msg_data = (generic_message_t *)msg->msg_data;
89 msg_data->msg_fetched = 1; 89 msg_data->msg_fetched = 1;
90 msg_data->msg_message = message; 90 msg_data->msg_message = message;
91 msg_data->msg_length = strlen(message); 91 msg_data->msg_length = strlen(message);
92 92
93 /* parse the mail */ 93 /* parse the mail */
94 body = parseMail(msg); 94 body = parseMail(msg);
95 95
96 /* clean up */ 96 /* clean up */
97 mailmessage_free(msg); 97 mailmessage_free(msg);
98 free(message); 98 free(message);
99 99
100 /* finish */ 100 /* finish */
101 return body; 101 return body;
102} 102}
103 103
104void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) 104void POP3wrapper::listMessages(const QString &, QList<RecMail> &target )
105{ 105{
106 int err = MAILPOP3_NO_ERROR; 106 int err = MAILPOP3_NO_ERROR;
107 char * header = 0; 107 char * header = 0;
108 /* these vars are used recurcive! set it to 0!!!!!!!!!!!!!!!!! */ 108 /* these vars are used recurcive! set it to 0!!!!!!!!!!!!!!!!! */
109 size_t length = 0; 109 size_t length = 0;
110 carray * messages = 0; 110 carray * messages = 0;
111 111
112 login(); 112 login();
113 if (!m_pop3) return; 113 if (!m_pop3) return;
114 114
115 mailpop3_list( m_pop3, &messages ); 115 mailpop3_list( m_pop3, &messages );
116 116
117 for (unsigned int i = 0; i < carray_count(messages);++i) { 117 for (unsigned int i = 0; i < carray_count(messages);++i) {
118 mailpop3_msg_info *info; 118 mailpop3_msg_info *info;
119 err = mailpop3_get_msg_info(m_pop3,i+1,&info); 119 err = mailpop3_get_msg_info(m_pop3,i+1,&info);
120 if (info->msg_deleted) 120 if (info->msg_deleted)
121 continue; 121 continue;
122 err = mailpop3_header( m_pop3, info->msg_index, &header, &length ); 122 err = mailpop3_header( m_pop3, info->msg_index, &header, &length );
123 if ( err != MAILPOP3_NO_ERROR ) { 123 if ( err != MAILPOP3_NO_ERROR ) {
124 qDebug( "POP3: error retrieving header msgid: %i", info->msg_index ); 124 qDebug( "POP3: error retrieving header msgid: %i", info->msg_index );
125 free(header); 125 free(header);
126 return; 126 return;
127 } 127 }
128 RecMail *mail = parseHeader( header ); 128 RecMail *mail = parseHeader( header );
129 mail->setNumber( info->msg_index ); 129 mail->setNumber( info->msg_index );
130 mail->setWrapper(this); 130 mail->setWrapper(this);
131 mail->setMsgsize(info->msg_size); 131 mail->setMsgsize(info->msg_size);
132 target.append( mail ); 132 target.append( mail );
133 free(header); 133 free(header);
134 } 134 }
135 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(carray_count(messages)-m_pop3->pop3_deleted_count)); 135 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(carray_count(messages)-m_pop3->pop3_deleted_count));
136} 136}
137 137
138void POP3wrapper::login() 138void POP3wrapper::login()
139{ 139{
140 /* we'll hold the line */ 140 /* we'll hold the line */
141 if ( m_pop3 != NULL ) return; 141 if ( m_pop3 != NULL ) return;
142 142
143 const char *server, *user, *pass; 143 const char *server, *user, *pass;
144 uint16_t port; 144 uint16_t port;
145 int err = MAILPOP3_NO_ERROR; 145 int err = MAILPOP3_NO_ERROR;
146 146
147 server = account->getServer().latin1(); 147 server = account->getServer().latin1();
148 port = account->getPort().toUInt(); 148 port = account->getPort().toUInt();
149 149
150 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 150 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
151 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 151 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
152 login.show(); 152 login.show();
153 if ( QDialog::Accepted == login.exec() ) { 153 if ( QDialog::Accepted == login.exec() ) {
154 // ok 154 // ok
155 user = strdup( login.getUser().latin1() ); 155 user = strdup( login.getUser().latin1() );
156 pass = strdup( login.getPassword().latin1() ); 156 pass = strdup( login.getPassword().latin1() );
157 } else { 157 } else {
158 // cancel 158 // cancel
159 qDebug( "POP3: Login canceled" ); 159 qDebug( "POP3: Login canceled" );
160 return; 160 return;
161 } 161 }
162 } else { 162 } else {
163 user = account->getUser().latin1(); 163 user = account->getUser().latin1();
164 pass = account->getPassword().latin1(); 164 pass = account->getPassword().latin1();
165 } 165 }
166 166
167 m_pop3 = mailpop3_new( 200, &pop3_progress ); 167 m_pop3 = mailpop3_new( 200, &pop3_progress );
168 168
169 // connect 169 // connect
170 if (account->getSSL()) { 170 if (account->getSSL()) {
171 err = mailpop3_ssl_connect( m_pop3, (char*)server, port ); 171 err = mailpop3_ssl_connect( m_pop3, (char*)server, port );
172 } else { 172 } else {
173 err = mailpop3_socket_connect( m_pop3, (char*)server, port ); 173 err = mailpop3_socket_connect( m_pop3, (char*)server, port );
174 } 174 }
175 175
176 if ( err != MAILPOP3_NO_ERROR ) { 176 if ( err != MAILPOP3_NO_ERROR ) {
177 qDebug( "pop3: error connecting to %s\n reason: %s", server, 177 qDebug( "pop3: error connecting to %s\n reason: %s", server,
178 m_pop3->pop3_response ); 178 m_pop3->pop3_response );
179 mailpop3_free( m_pop3 ); 179 mailpop3_free( m_pop3 );
180 m_pop3 = NULL; 180 m_pop3 = NULL;
181 return; 181 return;
182 } 182 }
183 qDebug( "POP3: connected!" ); 183 qDebug( "POP3: connected!" );
184 184
185 // login 185 // login
186 // TODO: decide if apop or plain login should be used 186 // TODO: decide if apop or plain login should be used
187 err = mailpop3_login( m_pop3, (char *) user, (char *) pass ); 187 err = mailpop3_login( m_pop3, (char *) user, (char *) pass );
188 if ( err != MAILPOP3_NO_ERROR ) { 188 if ( err != MAILPOP3_NO_ERROR ) {
189 qDebug( "pop3: error logging in: %s", m_pop3->pop3_response ); 189 qDebug( "pop3: error logging in: %s", m_pop3->pop3_response );
190 logout(); 190 logout();
191 return; 191 return;
192 } 192 }
193 193
194 qDebug( "POP3: logged in!" ); 194 qDebug( "POP3: logged in!" );
195} 195}
196 196
197void POP3wrapper::logout() 197void POP3wrapper::logout()
198{ 198{
199 int err = MAILPOP3_NO_ERROR; 199 int err = MAILPOP3_NO_ERROR;
200 if ( m_pop3 == NULL ) return; 200 if ( m_pop3 == NULL ) return;
201 err = mailpop3_quit( m_pop3 ); 201 err = mailpop3_quit( m_pop3 );
202 mailpop3_free( m_pop3 ); 202 mailpop3_free( m_pop3 );
203 m_pop3 = NULL; 203 m_pop3 = NULL;
204} 204}
205 205
206 206
207QList<Folder>* POP3wrapper::listFolders() 207QList<Folder>* POP3wrapper::listFolders()
208{ 208{
209 /* TODO: integrate MH directories
210 but not before version 0.1 ;)
211 */
212 QList<Folder> * folders = new QList<Folder>(); 209 QList<Folder> * folders = new QList<Folder>();
213 folders->setAutoDelete( false ); 210 folders->setAutoDelete( false );
214 Folder*inb=new Folder("INBOX","/"); 211 Folder*inb=new Folder("INBOX","/");
215 folders->append(inb); 212 folders->append(inb);
216 return folders; 213 return folders;
217} 214}
218 215
219void POP3wrapper::deleteMail(const RecMail&mail) 216void POP3wrapper::deleteMail(const RecMail&mail)
220{ 217{
221 login(); 218 login();
222 if (!m_pop3) return; 219 if (!m_pop3) return;
223 int err = mailpop3_dele(m_pop3,mail.getNumber()); 220 int err = mailpop3_dele(m_pop3,mail.getNumber());
224 if (err != MAILPOP3_NO_ERROR) { 221 if (err != MAILPOP3_NO_ERROR) {
225 qDebug("error deleting mail"); 222 Global::statusMessage(tr("error deleting mail"));
226 } 223 }
227} 224}
228 225
229void POP3wrapper::answeredMail(const RecMail&) 226void POP3wrapper::answeredMail(const RecMail&)
230{ 227{
231} 228}
229
230int POP3wrapper::deleteAllMail(const Folder*)
231{
232 login();
233 if (!m_pop3) return 0;
234 carray * messages = 0;
235
236 /* if connected this info is cached! */
237 int err = 0;
238 mailpop3_list( m_pop3, &messages );
239
240 int res = 1;
241 for (unsigned int i = 0; messages!=0 && i < carray_count(messages);++i) {
242 mailpop3_msg_info *info;
243 err = mailpop3_get_msg_info(m_pop3,i+1,&info);
244 if (info->msg_deleted)
245 continue;
246 err = mailpop3_dele(m_pop3,i+1);
247 if (err != MAILPOP3_NO_ERROR) {
248 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
249 res = 0;
250 break;
251 }
252 }
253 return res;
254}
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index 7502720..2efffdd 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -1,33 +1,34 @@
1#ifndef __POP3WRAPPER 1#ifndef __POP3WRAPPER
2#define __POP3WRAPPER 2#define __POP3WRAPPER
3 3
4#include "mailwrapper.h" 4#include "mailwrapper.h"
5#include "genericwrapper.h" 5#include "genericwrapper.h"
6#include <qstring.h> 6#include <qstring.h>
7 7
8 8
9class POP3wrapper : public Genericwrapper 9class POP3wrapper : public Genericwrapper
10{ 10{
11 Q_OBJECT 11 Q_OBJECT
12 12
13public: 13public:
14 POP3wrapper( POP3account *a ); 14 POP3wrapper( POP3account *a );
15 virtual ~POP3wrapper(); 15 virtual ~POP3wrapper();
16 /* mailbox will be ignored */ 16 /* mailbox will be ignored */
17 virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); 17 virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
18 virtual QList<Folder>* listFolders(); 18 virtual QList<Folder>* listFolders();
19 19
20 virtual void deleteMail(const RecMail&mail); 20 virtual void deleteMail(const RecMail&mail);
21 virtual void answeredMail(const RecMail&mail); 21 virtual void answeredMail(const RecMail&mail);
22 virtual int deleteAllMail(const Folder*);
22 23
23 virtual RecBody fetchBody( const RecMail &mail ); 24 virtual RecBody fetchBody( const RecMail &mail );
24 static void pop3_progress( size_t current, size_t maximum ); 25 static void pop3_progress( size_t current, size_t maximum );
25 26
26protected: 27protected:
27 void login(); 28 void login();
28 void logout(); 29 void logout();
29 POP3account *account; 30 POP3account *account;
30 mailpop3 *m_pop3; 31 mailpop3 *m_pop3;
31}; 32};
32 33
33#endif 34#endif
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp
index b85fbf6..2e70dee 100644
--- a/noncore/net/mail/pop3wrapper.cpp
+++ b/noncore/net/mail/pop3wrapper.cpp
@@ -1,231 +1,254 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include "pop3wrapper.h" 2#include "pop3wrapper.h"
3#include "mailtypes.h" 3#include "mailtypes.h"
4#include "logindialog.h" 4#include "logindialog.h"
5#include <libetpan/libetpan.h> 5#include <libetpan/libetpan.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <qfile.h> 7#include <qfile.h>
8 8
9/* we don't fetch messages larger than 5 MB */ 9/* we don't fetch messages larger than 5 MB */
10#define HARD_MSG_SIZE_LIMIT 5242880 10#define HARD_MSG_SIZE_LIMIT 5242880
11 11
12POP3wrapper::POP3wrapper( POP3account *a ) 12POP3wrapper::POP3wrapper( POP3account *a )
13 : Genericwrapper() 13 : Genericwrapper()
14{ 14{
15 account = a; 15 account = a;
16 m_pop3 = NULL; 16 m_pop3 = NULL;
17 msgTempName = a->getFileName()+"_msg_cache"; 17 msgTempName = a->getFileName()+"_msg_cache";
18 last_msg_id = 0; 18 last_msg_id = 0;
19} 19}
20 20
21POP3wrapper::~POP3wrapper() 21POP3wrapper::~POP3wrapper()
22{ 22{
23 logout(); 23 logout();
24 QFile msg_cache(msgTempName); 24 QFile msg_cache(msgTempName);
25 if (msg_cache.exists()) { 25 if (msg_cache.exists()) {
26 msg_cache.remove(); 26 msg_cache.remove();
27 } 27 }
28} 28}
29 29
30void POP3wrapper::pop3_progress( size_t current, size_t maximum ) 30void POP3wrapper::pop3_progress( size_t current, size_t maximum )
31{ 31{
32 //qDebug( "POP3: %i of %i", current, maximum ); 32 //qDebug( "POP3: %i of %i", current, maximum );
33} 33}
34 34
35RecBody POP3wrapper::fetchBody( const RecMail &mail ) 35RecBody POP3wrapper::fetchBody( const RecMail &mail )
36{ 36{
37 int err = MAILPOP3_NO_ERROR; 37 int err = MAILPOP3_NO_ERROR;
38 char *message; 38 char *message;
39 size_t length = 0; 39 size_t length = 0;
40 40
41 login(); 41 login();
42 if ( !m_pop3 ) { 42 if ( !m_pop3 ) {
43 return RecBody(); 43 return RecBody();
44 } 44 }
45 45
46 RecBody body; 46 RecBody body;
47 mailmessage * msg = 0; 47 mailmessage * msg = 0;
48 48
49 QFile msg_cache(msgTempName); 49 QFile msg_cache(msgTempName);
50 50
51 if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { 51 if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) {
52 qDebug("Message to large: %i",mail.Msgsize()); 52 qDebug("Message to large: %i",mail.Msgsize());
53 return body; 53 return body;
54 } 54 }
55 cleanMimeCache(); 55 cleanMimeCache();
56 if (mail.getNumber()!=last_msg_id) { 56 if (mail.getNumber()!=last_msg_id) {
57 if (msg_cache.exists()) { 57 if (msg_cache.exists()) {
58 msg_cache.remove(); 58 msg_cache.remove();
59 } 59 }
60 msg_cache.open(IO_ReadWrite|IO_Truncate); 60 msg_cache.open(IO_ReadWrite|IO_Truncate);
61 last_msg_id = mail.getNumber(); 61 last_msg_id = mail.getNumber();
62 err = mailpop3_retr( m_pop3, mail.getNumber(), &message, &length ); 62 err = mailpop3_retr( m_pop3, mail.getNumber(), &message, &length );
63 if ( err != MAILPOP3_NO_ERROR ) { 63 if ( err != MAILPOP3_NO_ERROR ) {
64 qDebug( "POP3: error retrieving body with index %i", mail.getNumber() ); 64 qDebug( "POP3: error retrieving body with index %i", mail.getNumber() );
65 last_msg_id = 0; 65 last_msg_id = 0;
66 return RecBody(); 66 return RecBody();
67 } 67 }
68 msg_cache.writeBlock(message,length); 68 msg_cache.writeBlock(message,length);
69 } else { 69 } else {
70 QString msg=""; 70 QString msg="";
71 msg_cache.open(IO_ReadOnly); 71 msg_cache.open(IO_ReadOnly);
72 message = new char[4096]; 72 message = new char[4096];
73 memset(message,0,4096); 73 memset(message,0,4096);
74 while (msg_cache.readBlock(message,4095)>0) { 74 while (msg_cache.readBlock(message,4095)>0) {
75 msg+=message; 75 msg+=message;
76 memset(message,0,4096); 76 memset(message,0,4096);
77 } 77 }
78 delete message; 78 delete message;
79 message = (char*)malloc(msg.length()+1*sizeof(char)); 79 message = (char*)malloc(msg.length()+1*sizeof(char));
80 memset(message,0,msg.length()+1); 80 memset(message,0,msg.length()+1);
81 memcpy(message,msg.latin1(),msg.length()); 81 memcpy(message,msg.latin1(),msg.length());
82 } 82 }
83 83
84 /* transform to libetpan stuff */ 84 /* transform to libetpan stuff */
85 msg = mailmessage_new(); 85 msg = mailmessage_new();
86 mailmessage_init(msg, NULL, data_message_driver, 0, strlen(message)); 86 mailmessage_init(msg, NULL, data_message_driver, 0, strlen(message));
87 generic_message_t * msg_data; 87 generic_message_t * msg_data;
88 msg_data = (generic_message_t *)msg->msg_data; 88 msg_data = (generic_message_t *)msg->msg_data;
89 msg_data->msg_fetched = 1; 89 msg_data->msg_fetched = 1;
90 msg_data->msg_message = message; 90 msg_data->msg_message = message;
91 msg_data->msg_length = strlen(message); 91 msg_data->msg_length = strlen(message);
92 92
93 /* parse the mail */ 93 /* parse the mail */
94 body = parseMail(msg); 94 body = parseMail(msg);
95 95
96 /* clean up */ 96 /* clean up */
97 mailmessage_free(msg); 97 mailmessage_free(msg);
98 free(message); 98 free(message);
99 99
100 /* finish */ 100 /* finish */
101 return body; 101 return body;
102} 102}
103 103
104void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) 104void POP3wrapper::listMessages(const QString &, QList<RecMail> &target )
105{ 105{
106 int err = MAILPOP3_NO_ERROR; 106 int err = MAILPOP3_NO_ERROR;
107 char * header = 0; 107 char * header = 0;
108 /* these vars are used recurcive! set it to 0!!!!!!!!!!!!!!!!! */ 108 /* these vars are used recurcive! set it to 0!!!!!!!!!!!!!!!!! */
109 size_t length = 0; 109 size_t length = 0;
110 carray * messages = 0; 110 carray * messages = 0;
111 111
112 login(); 112 login();
113 if (!m_pop3) return; 113 if (!m_pop3) return;
114 114
115 mailpop3_list( m_pop3, &messages ); 115 mailpop3_list( m_pop3, &messages );
116 116
117 for (unsigned int i = 0; i < carray_count(messages);++i) { 117 for (unsigned int i = 0; i < carray_count(messages);++i) {
118 mailpop3_msg_info *info; 118 mailpop3_msg_info *info;
119 err = mailpop3_get_msg_info(m_pop3,i+1,&info); 119 err = mailpop3_get_msg_info(m_pop3,i+1,&info);
120 if (info->msg_deleted) 120 if (info->msg_deleted)
121 continue; 121 continue;
122 err = mailpop3_header( m_pop3, info->msg_index, &header, &length ); 122 err = mailpop3_header( m_pop3, info->msg_index, &header, &length );
123 if ( err != MAILPOP3_NO_ERROR ) { 123 if ( err != MAILPOP3_NO_ERROR ) {
124 qDebug( "POP3: error retrieving header msgid: %i", info->msg_index ); 124 qDebug( "POP3: error retrieving header msgid: %i", info->msg_index );
125 free(header); 125 free(header);
126 return; 126 return;
127 } 127 }
128 RecMail *mail = parseHeader( header ); 128 RecMail *mail = parseHeader( header );
129 mail->setNumber( info->msg_index ); 129 mail->setNumber( info->msg_index );
130 mail->setWrapper(this); 130 mail->setWrapper(this);
131 mail->setMsgsize(info->msg_size); 131 mail->setMsgsize(info->msg_size);
132 target.append( mail ); 132 target.append( mail );
133 free(header); 133 free(header);
134 } 134 }
135 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(carray_count(messages)-m_pop3->pop3_deleted_count)); 135 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(carray_count(messages)-m_pop3->pop3_deleted_count));
136} 136}
137 137
138void POP3wrapper::login() 138void POP3wrapper::login()
139{ 139{
140 /* we'll hold the line */ 140 /* we'll hold the line */
141 if ( m_pop3 != NULL ) return; 141 if ( m_pop3 != NULL ) return;
142 142
143 const char *server, *user, *pass; 143 const char *server, *user, *pass;
144 uint16_t port; 144 uint16_t port;
145 int err = MAILPOP3_NO_ERROR; 145 int err = MAILPOP3_NO_ERROR;
146 146
147 server = account->getServer().latin1(); 147 server = account->getServer().latin1();
148 port = account->getPort().toUInt(); 148 port = account->getPort().toUInt();
149 149
150 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 150 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
151 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 151 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
152 login.show(); 152 login.show();
153 if ( QDialog::Accepted == login.exec() ) { 153 if ( QDialog::Accepted == login.exec() ) {
154 // ok 154 // ok
155 user = strdup( login.getUser().latin1() ); 155 user = strdup( login.getUser().latin1() );
156 pass = strdup( login.getPassword().latin1() ); 156 pass = strdup( login.getPassword().latin1() );
157 } else { 157 } else {
158 // cancel 158 // cancel
159 qDebug( "POP3: Login canceled" ); 159 qDebug( "POP3: Login canceled" );
160 return; 160 return;
161 } 161 }
162 } else { 162 } else {
163 user = account->getUser().latin1(); 163 user = account->getUser().latin1();
164 pass = account->getPassword().latin1(); 164 pass = account->getPassword().latin1();
165 } 165 }
166 166
167 m_pop3 = mailpop3_new( 200, &pop3_progress ); 167 m_pop3 = mailpop3_new( 200, &pop3_progress );
168 168
169 // connect 169 // connect
170 if (account->getSSL()) { 170 if (account->getSSL()) {
171 err = mailpop3_ssl_connect( m_pop3, (char*)server, port ); 171 err = mailpop3_ssl_connect( m_pop3, (char*)server, port );
172 } else { 172 } else {
173 err = mailpop3_socket_connect( m_pop3, (char*)server, port ); 173 err = mailpop3_socket_connect( m_pop3, (char*)server, port );
174 } 174 }
175 175
176 if ( err != MAILPOP3_NO_ERROR ) { 176 if ( err != MAILPOP3_NO_ERROR ) {
177 qDebug( "pop3: error connecting to %s\n reason: %s", server, 177 qDebug( "pop3: error connecting to %s\n reason: %s", server,
178 m_pop3->pop3_response ); 178 m_pop3->pop3_response );
179 mailpop3_free( m_pop3 ); 179 mailpop3_free( m_pop3 );
180 m_pop3 = NULL; 180 m_pop3 = NULL;
181 return; 181 return;
182 } 182 }
183 qDebug( "POP3: connected!" ); 183 qDebug( "POP3: connected!" );
184 184
185 // login 185 // login
186 // TODO: decide if apop or plain login should be used 186 // TODO: decide if apop or plain login should be used
187 err = mailpop3_login( m_pop3, (char *) user, (char *) pass ); 187 err = mailpop3_login( m_pop3, (char *) user, (char *) pass );
188 if ( err != MAILPOP3_NO_ERROR ) { 188 if ( err != MAILPOP3_NO_ERROR ) {
189 qDebug( "pop3: error logging in: %s", m_pop3->pop3_response ); 189 qDebug( "pop3: error logging in: %s", m_pop3->pop3_response );
190 logout(); 190 logout();
191 return; 191 return;
192 } 192 }
193 193
194 qDebug( "POP3: logged in!" ); 194 qDebug( "POP3: logged in!" );
195} 195}
196 196
197void POP3wrapper::logout() 197void POP3wrapper::logout()
198{ 198{
199 int err = MAILPOP3_NO_ERROR; 199 int err = MAILPOP3_NO_ERROR;
200 if ( m_pop3 == NULL ) return; 200 if ( m_pop3 == NULL ) return;
201 err = mailpop3_quit( m_pop3 ); 201 err = mailpop3_quit( m_pop3 );
202 mailpop3_free( m_pop3 ); 202 mailpop3_free( m_pop3 );
203 m_pop3 = NULL; 203 m_pop3 = NULL;
204} 204}
205 205
206 206
207QList<Folder>* POP3wrapper::listFolders() 207QList<Folder>* POP3wrapper::listFolders()
208{ 208{
209 /* TODO: integrate MH directories
210 but not before version 0.1 ;)
211 */
212 QList<Folder> * folders = new QList<Folder>(); 209 QList<Folder> * folders = new QList<Folder>();
213 folders->setAutoDelete( false ); 210 folders->setAutoDelete( false );
214 Folder*inb=new Folder("INBOX","/"); 211 Folder*inb=new Folder("INBOX","/");
215 folders->append(inb); 212 folders->append(inb);
216 return folders; 213 return folders;
217} 214}
218 215
219void POP3wrapper::deleteMail(const RecMail&mail) 216void POP3wrapper::deleteMail(const RecMail&mail)
220{ 217{
221 login(); 218 login();
222 if (!m_pop3) return; 219 if (!m_pop3) return;
223 int err = mailpop3_dele(m_pop3,mail.getNumber()); 220 int err = mailpop3_dele(m_pop3,mail.getNumber());
224 if (err != MAILPOP3_NO_ERROR) { 221 if (err != MAILPOP3_NO_ERROR) {
225 qDebug("error deleting mail"); 222 Global::statusMessage(tr("error deleting mail"));
226 } 223 }
227} 224}
228 225
229void POP3wrapper::answeredMail(const RecMail&) 226void POP3wrapper::answeredMail(const RecMail&)
230{ 227{
231} 228}
229
230int POP3wrapper::deleteAllMail(const Folder*)
231{
232 login();
233 if (!m_pop3) return 0;
234 carray * messages = 0;
235
236 /* if connected this info is cached! */
237 int err = 0;
238 mailpop3_list( m_pop3, &messages );
239
240 int res = 1;
241 for (unsigned int i = 0; messages!=0 && i < carray_count(messages);++i) {
242 mailpop3_msg_info *info;
243 err = mailpop3_get_msg_info(m_pop3,i+1,&info);
244 if (info->msg_deleted)
245 continue;
246 err = mailpop3_dele(m_pop3,i+1);
247 if (err != MAILPOP3_NO_ERROR) {
248 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
249 res = 0;
250 break;
251 }
252 }
253 return res;
254}
diff --git a/noncore/net/mail/pop3wrapper.h b/noncore/net/mail/pop3wrapper.h
index 7502720..2efffdd 100644
--- a/noncore/net/mail/pop3wrapper.h
+++ b/noncore/net/mail/pop3wrapper.h
@@ -1,33 +1,34 @@
1#ifndef __POP3WRAPPER 1#ifndef __POP3WRAPPER
2#define __POP3WRAPPER 2#define __POP3WRAPPER
3 3
4#include "mailwrapper.h" 4#include "mailwrapper.h"
5#include "genericwrapper.h" 5#include "genericwrapper.h"
6#include <qstring.h> 6#include <qstring.h>
7 7
8 8
9class POP3wrapper : public Genericwrapper 9class POP3wrapper : public Genericwrapper
10{ 10{
11 Q_OBJECT 11 Q_OBJECT
12 12
13public: 13public:
14 POP3wrapper( POP3account *a ); 14 POP3wrapper( POP3account *a );
15 virtual ~POP3wrapper(); 15 virtual ~POP3wrapper();
16 /* mailbox will be ignored */ 16 /* mailbox will be ignored */
17 virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); 17 virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
18 virtual QList<Folder>* listFolders(); 18 virtual QList<Folder>* listFolders();
19 19
20 virtual void deleteMail(const RecMail&mail); 20 virtual void deleteMail(const RecMail&mail);
21 virtual void answeredMail(const RecMail&mail); 21 virtual void answeredMail(const RecMail&mail);
22 virtual int deleteAllMail(const Folder*);
22 23
23 virtual RecBody fetchBody( const RecMail &mail ); 24 virtual RecBody fetchBody( const RecMail &mail );
24 static void pop3_progress( size_t current, size_t maximum ); 25 static void pop3_progress( size_t current, size_t maximum );
25 26
26protected: 27protected:
27 void login(); 28 void login();
28 void logout(); 29 void logout();
29 POP3account *account; 30 POP3account *account;
30 mailpop3 *m_pop3; 31 mailpop3 *m_pop3;
31}; 32};
32 33
33#endif 34#endif