-rw-r--r-- | noncore/net/mail/accountview.cpp | 143 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 18 | ||||
-rw-r--r-- | noncore/net/mail/genericwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 126 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.h | 8 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/mboxwrapper.cpp | 126 | ||||
-rw-r--r-- | noncore/net/mail/mboxwrapper.h | 8 | ||||
-rw-r--r-- | noncore/net/mail/newmaildir.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/newmaildir.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.h | 3 |
14 files changed, 375 insertions, 86 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 8aac14b..30765cf 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -186,8 +186,8 @@ QPopupMenu * IMAPviewItem::getContextMenu() | |||
186 | QPopupMenu *m = new QPopupMenu(0); | 186 | QPopupMenu *m = new QPopupMenu(0); |
187 | if (m) { | 187 | if (m) { |
188 | m->insertItem(QObject::tr("Refresh folder list","IMAPviewItem"),0); | 188 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
189 | m->insertItem(QObject::tr("Create new folder","IMAPviewItem"),1); | 189 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
190 | m->insertSeparator(); | 190 | m->insertSeparator(); |
191 | m->insertItem(QObject::tr("Disconnect","IMAPviewItem"),2); | 191 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
192 | } | 192 | } |
193 | return m; | 193 | return m; |
@@ -292,12 +292,12 @@ QPopupMenu * IMAPfolderItem::getContextMenu() | |||
292 | if (m) { | 292 | if (m) { |
293 | if (folder->may_select()) { | 293 | if (folder->may_select()) { |
294 | m->insertItem(QObject::tr("Refresh header list","IMAPfolderItem"),0); | 294 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
295 | m->insertItem(QObject::tr("Delete all mails","IMAPfolderItem"),1); | 295 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
296 | } | 296 | } |
297 | if (folder->no_inferior()==false) { | 297 | if (folder->no_inferior()==false) { |
298 | m->insertItem(QObject::tr("Create new subfolder","IMAPfolderItem"),2); | 298 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
299 | } | 299 | } |
300 | if (folder->getDisplayName().lower()!="inbox") { | 300 | if (folder->getDisplayName().lower()!="inbox") { |
301 | m->insertItem(QObject::tr("Delete folder","IMAPfolderItem"),3); | 301 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
302 | } | 302 | } |
303 | } | 303 | } |
@@ -307,8 +307,8 @@ QPopupMenu * IMAPfolderItem::getContextMenu() | |||
307 | void IMAPfolderItem::deleteAllMails() | 307 | void IMAPfolderItem::deleteAllMails() |
308 | { | 308 | { |
309 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails","IMAPfolderItem"), | 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>","IMAPfolderItem").arg(folder->getDisplayName()), | 310 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).arg(folder->getDisplayName()), |
311 | QObject::tr("Yes","IMAPfolderItem"), | 311 | QObject::tr("Yes",contextName), |
312 | QObject::tr("No","IMAPfolderItem"),QString::null,1,1); | 312 | QObject::tr("No",contextName),QString::null,1,1); |
313 | qDebug("Auswahl: %i",yesno); | 313 | qDebug("Auswahl: %i",yesno); |
314 | if (yesno == 0) { | 314 | if (yesno == 0) { |
@@ -336,14 +336,19 @@ void IMAPfolderItem::createNewFolder() | |||
336 | void IMAPfolderItem::deleteFolder() | 336 | void IMAPfolderItem::deleteFolder() |
337 | { | 337 | { |
338 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder","IMAPfolderItem"), | 338 | 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>","IMAPfolderItem").arg(folder->getDisplayName()), | 339 | 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","IMAPfolderItem"), | 340 | QObject::tr("Yes",contextName), |
341 | QObject::tr("No","IMAPfolderItem"),QString::null,1,1); | 341 | QObject::tr("No",contextName),QString::null,1,1); |
342 | qDebug("Auswahl: %i",yesno); | 342 | qDebug("Auswahl: %i",yesno); |
343 | if (yesno == 0) { | 343 | if (yesno == 0) { |
344 | if (imap->getWrapper()->deleteMbox(folder)) { | 344 | if (imap->getWrapper()->deleteMbox(folder)) { |
345 | /* be carefull - after that this object is destroyd so don't call | 345 | QListView*v=listView(); |
346 | IMAPviewItem * box = imap; | ||
347 | /* be carefull - after that this object is destroyd so don't use | ||
346 | * any member of it after that call!!*/ | 348 | * any member of it after that call!!*/ |
347 | imap->refreshFolders(true); | 349 | imap->refreshFolders(true); |
350 | if (v) { | ||
351 | v->setSelected(box,true); | ||
352 | } | ||
348 | } | 353 | } |
349 | } | 354 | } |
@@ -376,4 +381,6 @@ void IMAPfolderItem::contextMenuSelected(int id) | |||
376 | */ | 381 | */ |
377 | 382 | ||
383 | const QString AccountViewItem::contextName="AccountViewItem"; | ||
384 | |||
378 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 385 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
379 | : QListView( parent, name, flags ) | 386 | : QListView( parent, name, flags ) |
@@ -491,4 +498,10 @@ AbstractMail *MBOXviewItem::getWrapper() | |||
491 | void MBOXviewItem::refresh( QList<RecMail> & ) | 498 | void MBOXviewItem::refresh( QList<RecMail> & ) |
492 | { | 499 | { |
500 | refresh(false); | ||
501 | } | ||
502 | |||
503 | void MBOXviewItem::refresh(bool force) | ||
504 | { | ||
505 | if (childCount()>0 && force==false) return; | ||
493 | QList<Folder> *folders = wrapper->listFolders(); | 506 | QList<Folder> *folders = wrapper->listFolders(); |
494 | QListViewItem *child = firstChild(); | 507 | QListViewItem *child = firstChild(); |
@@ -511,8 +524,44 @@ void MBOXviewItem::refresh( QList<RecMail> & ) | |||
511 | RecBody MBOXviewItem::fetchBody( const RecMail &mail ) | 524 | RecBody MBOXviewItem::fetchBody( const RecMail &mail ) |
512 | { | 525 | { |
513 | qDebug( "POP3 fetchBody" ); | 526 | qDebug( "MBOX fetchBody" ); |
514 | return wrapper->fetchBody( mail ); | 527 | return wrapper->fetchBody( mail ); |
515 | } | 528 | } |
516 | 529 | ||
530 | QPopupMenu * MBOXviewItem::getContextMenu() | ||
531 | { | ||
532 | QPopupMenu *m = new QPopupMenu(0); | ||
533 | if (m) { | ||
534 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | ||
535 | m->insertItem(QObject::tr("Create new folder",contextName),1); | ||
536 | } | ||
537 | return m; | ||
538 | } | ||
539 | |||
540 | void MBOXviewItem::createFolder() | ||
541 | { | ||
542 | Newmdirdlg ndirdlg(0,0,true); | ||
543 | ndirdlg.showMaximized(); | ||
544 | if (ndirdlg.exec()) { | ||
545 | QString ndir = ndirdlg.Newdir(); | ||
546 | if (wrapper->createMbox(ndir)) { | ||
547 | refresh(true); | ||
548 | } | ||
549 | } | ||
550 | } | ||
551 | |||
552 | void MBOXviewItem::contextMenuSelected(int which) | ||
553 | { | ||
554 | switch (which) { | ||
555 | case 0: | ||
556 | refresh(true); | ||
557 | break; | ||
558 | case 1: | ||
559 | createFolder(); | ||
560 | break; | ||
561 | default: | ||
562 | break; | ||
563 | } | ||
564 | } | ||
565 | |||
517 | MBOXfolderItem::~MBOXfolderItem() | 566 | MBOXfolderItem::~MBOXfolderItem() |
518 | { | 567 | { |
@@ -545,2 +594,62 @@ RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) | |||
545 | return mbox->getWrapper()->fetchBody(aMail); | 594 | return mbox->getWrapper()->fetchBody(aMail); |
546 | } | 595 | } |
596 | |||
597 | void 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 | |||
612 | void MBOXfolderItem::deleteFolder() | ||
613 | { | ||
614 | 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()), | ||
616 | QObject::tr("Yes",contextName), | ||
617 | QObject::tr("No",contextName),QString::null,1,1); | ||
618 | qDebug("Auswahl: %i",yesno); | ||
619 | if (yesno == 0) { | ||
620 | if (mbox->getWrapper()->deleteMbox(folder)) { | ||
621 | QListView*v=listView(); | ||
622 | MBOXviewItem * box = mbox; | ||
623 | /* be carefull - after that this object is destroyd so don't use | ||
624 | * any member of it after that call!!*/ | ||
625 | mbox->refresh(true); | ||
626 | if (v) { | ||
627 | v->setSelected(box,true); | ||
628 | } | ||
629 | } | ||
630 | } | ||
631 | } | ||
632 | |||
633 | QPopupMenu * MBOXfolderItem::getContextMenu() | ||
634 | { | ||
635 | QPopupMenu *m = new QPopupMenu(0); | ||
636 | if (m) { | ||
637 | m->insertItem(QObject::tr("Delete all mails",contextName),0); | ||
638 | m->insertItem(QObject::tr("Delete folder",contextName),1); | ||
639 | } | ||
640 | return m; | ||
641 | } | ||
642 | |||
643 | void MBOXfolderItem::contextMenuSelected(int which) | ||
644 | { | ||
645 | switch(which) { | ||
646 | case 0: | ||
647 | deleteAllMails(); | ||
648 | break; | ||
649 | case 1: | ||
650 | deleteFolder(); | ||
651 | break; | ||
652 | default: | ||
653 | break; | ||
654 | } | ||
655 | } | ||
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index e7fe038..98abf44 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -25,4 +25,6 @@ public: | |||
25 | virtual QPopupMenu * getContextMenu(){return 0;}; | 25 | virtual QPopupMenu * getContextMenu(){return 0;}; |
26 | virtual void contextMenuSelected(int){} | 26 | virtual void contextMenuSelected(int){} |
27 | protected: | ||
28 | static const QString contextName; | ||
27 | }; | 29 | }; |
28 | 30 | ||
@@ -89,5 +91,4 @@ public: | |||
89 | virtual RecBody fetchBody(const RecMail&); | 91 | virtual RecBody fetchBody(const RecMail&); |
90 | bool matchName(const QString&name)const; | 92 | bool matchName(const QString&name)const; |
91 | virtual void deleteAllMails(); | ||
92 | virtual QPopupMenu * getContextMenu(); | 93 | virtual QPopupMenu * getContextMenu(); |
93 | virtual void contextMenuSelected(int); | 94 | virtual void contextMenuSelected(int); |
@@ -96,4 +97,5 @@ protected: | |||
96 | virtual void createNewFolder(); | 97 | virtual void createNewFolder(); |
97 | virtual void deleteFolder(); | 98 | virtual void deleteFolder(); |
99 | virtual void deleteAllMails(); | ||
98 | 100 | ||
99 | private: | 101 | private: |
@@ -104,4 +106,5 @@ private: | |||
104 | class MBOXviewItem : public AccountViewItem | 106 | class MBOXviewItem : public AccountViewItem |
105 | { | 107 | { |
108 | friend class MBOXfolderItem; | ||
106 | 109 | ||
107 | public: | 110 | public: |
@@ -112,4 +115,11 @@ public: | |||
112 | virtual RecBody fetchBody( const RecMail &mail ); | 115 | virtual RecBody fetchBody( const RecMail &mail ); |
113 | AbstractMail *getWrapper(); | 116 | AbstractMail *getWrapper(); |
117 | virtual QPopupMenu * getContextMenu(); | ||
118 | virtual void contextMenuSelected(int); | ||
119 | |||
120 | protected: | ||
121 | virtual void refresh(bool force=false); | ||
122 | virtual void createFolder(); | ||
123 | |||
114 | private: | 124 | private: |
115 | // MBOXaccount *account; | 125 | // MBOXaccount *account; |
@@ -127,4 +137,10 @@ public: | |||
127 | virtual void refresh(QList<RecMail>&); | 137 | virtual void refresh(QList<RecMail>&); |
128 | virtual RecBody fetchBody(const RecMail&); | 138 | virtual RecBody fetchBody(const RecMail&); |
139 | virtual QPopupMenu * getContextMenu(); | ||
140 | virtual void contextMenuSelected(int); | ||
141 | |||
142 | protected: | ||
143 | virtual void deleteAllMails(); | ||
144 | virtual void deleteFolder(); | ||
129 | private: | 145 | private: |
130 | Folder *folder; | 146 | Folder *folder; |
diff --git a/noncore/net/mail/genericwrapper.h b/noncore/net/mail/genericwrapper.h index 12f6928..90c4b50 100644 --- a/noncore/net/mail/genericwrapper.h +++ b/noncore/net/mail/genericwrapper.h | |||
@@ -50,6 +50,4 @@ protected: | |||
50 | static QString getencoding(mailmime_mechanism*aEnc); | 50 | static QString getencoding(mailmime_mechanism*aEnc); |
51 | 51 | ||
52 | POP3account *account; | ||
53 | mailpop3 *m_pop3; | ||
54 | QString msgTempName; | 52 | QString msgTempName; |
55 | unsigned int last_msg_id; | 53 | unsigned int last_msg_id; |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index 12f6928..90c4b50 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h | |||
@@ -50,6 +50,4 @@ protected: | |||
50 | static QString getencoding(mailmime_mechanism*aEnc); | 50 | static QString getencoding(mailmime_mechanism*aEnc); |
51 | 51 | ||
52 | POP3account *account; | ||
53 | mailpop3 *m_pop3; | ||
54 | QString msgTempName; | 52 | QString msgTempName; |
55 | unsigned int last_msg_id; | 53 | unsigned int last_msg_id; |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 6d69263..162a0c9 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -3,7 +3,7 @@ | |||
3 | #include "mailwrapper.h" | 3 | #include "mailwrapper.h" |
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | #include <libetpan/mailstorage.h> | ||
6 | #include <qdir.h> | 5 | #include <qdir.h> |
7 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include <qpe/global.h> | ||
8 | 8 | ||
9 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) | 9 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) |
@@ -25,11 +25,8 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
25 | QString p = MBOXPath+"/"; | 25 | QString p = MBOXPath+"/"; |
26 | p+=mailbox; | 26 | p+=mailbox; |
27 | char*fname = 0; | 27 | |
28 | 28 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | |
29 | fname = strdup(p.latin1()); | ||
30 | |||
31 | int r = mbox_mailstorage_init(storage,fname,0,0,0); | ||
32 | mailfolder*folder; | 29 | mailfolder*folder; |
33 | folder = mailfolder_new( storage,fname,NULL); | 30 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
34 | r = mailfolder_connect(folder); | 31 | r = mailfolder_connect(folder); |
35 | if (r != MAIL_NO_ERROR) { | 32 | if (r != MAIL_NO_ERROR) { |
@@ -37,5 +34,4 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
37 | mailfolder_free(folder); | 34 | mailfolder_free(folder); |
38 | mailstorage_free(storage); | 35 | mailstorage_free(storage); |
39 | free(fname); | ||
40 | return; | 36 | return; |
41 | } | 37 | } |
@@ -46,5 +42,4 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
46 | mailfolder_free(folder); | 42 | mailfolder_free(folder); |
47 | mailstorage_free(storage); | 43 | mailstorage_free(storage); |
48 | free(fname); | ||
49 | return; | 44 | return; |
50 | } | 45 | } |
@@ -57,10 +52,10 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
57 | mailfolder_free(folder); | 52 | mailfolder_free(folder); |
58 | mailstorage_free(storage); | 53 | mailstorage_free(storage); |
59 | free(fname); | ||
60 | return; | 54 | return; |
61 | } | 55 | } |
62 | mailimf_references * refs; | 56 | mailimf_references * refs; |
63 | 57 | ||
64 | for(int i = 0 ; i < carray_count(env_list->msg_tab) ; ++i) { | 58 | uint32_t i = 0; |
59 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | ||
65 | mailmessage * msg; | 60 | mailmessage * msg; |
66 | QBitArray mFlags(7); | 61 | QBitArray mFlags(7); |
@@ -111,5 +106,5 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
111 | mailfolder_free(folder); | 106 | mailfolder_free(folder); |
112 | mailstorage_free(storage); | 107 | mailstorage_free(storage); |
113 | free(fname); | 108 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(i)); |
114 | } | 109 | } |
115 | 110 | ||
@@ -135,8 +130,7 @@ void MBOXwrapper::deleteMail(const RecMail&mail) | |||
135 | QString p = MBOXPath+"/"; | 130 | QString p = MBOXPath+"/"; |
136 | p+=mail.getMbox(); | 131 | p+=mail.getMbox(); |
137 | mailmessage * msg; | 132 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
138 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | ||
139 | mailfolder*folder; | 133 | mailfolder*folder; |
140 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | 134 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
141 | r = mailfolder_connect(folder); | 135 | r = mailfolder_connect(folder); |
142 | if (r != MAIL_NO_ERROR) { | 136 | if (r != MAIL_NO_ERROR) { |
@@ -168,7 +162,7 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) | |||
168 | size_t size; | 162 | size_t size; |
169 | 163 | ||
170 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | 164 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
171 | mailfolder*folder; | 165 | mailfolder*folder; |
172 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | 166 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
173 | r = mailfolder_connect(folder); | 167 | r = mailfolder_connect(folder); |
174 | if (r != MAIL_NO_ERROR) { | 168 | if (r != MAIL_NO_ERROR) { |
@@ -206,6 +200,20 @@ void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) | |||
206 | } | 200 | } |
207 | 201 | ||
208 | void MBOXwrapper::createFolder(const QString&) | 202 | int MBOXwrapper::createMbox(const QString&folder,const Folder*,const QString&,bool ) |
209 | { | 203 | { |
204 | QString p = MBOXPath+"/"; | ||
205 | p+=folder; | ||
206 | QFileInfo fi(p); | ||
207 | if (fi.exists()) { | ||
208 | Global::statusMessage(tr("Mailbox exists.")); | ||
209 | return 0; | ||
210 | } | ||
211 | mailmbox_folder*f = 0; | ||
212 | if (mailmbox_init(p.latin1(),0,1,0,&f) != MAIL_NO_ERROR) { | ||
213 | Global::statusMessage(tr("Error init folder")); | ||
214 | return 0; | ||
215 | } | ||
216 | if (f) mailmbox_done(f); | ||
217 | return 1; | ||
210 | } | 218 | } |
211 | 219 | ||
@@ -217,10 +225,10 @@ void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folde | |||
217 | int r = mailmbox_init(p.latin1(),0,1,0,&f); | 225 | int r = mailmbox_init(p.latin1(),0,1,0,&f); |
218 | if (r != MAIL_NO_ERROR) { | 226 | if (r != MAIL_NO_ERROR) { |
219 | qDebug("Error init folder"); | 227 | Global::statusMessage(tr("Error init folder")); |
220 | return; | 228 | return; |
221 | } | 229 | } |
222 | r = mailmbox_append_message(f,msg,length); | 230 | r = mailmbox_append_message(f,msg,length); |
223 | if (r != MAIL_NO_ERROR) { | 231 | if (r != MAIL_NO_ERROR) { |
224 | qDebug("Error writing message folder"); | 232 | Global::statusMessage(tr("Error writing to message folder")); |
225 | } | 233 | } |
226 | mailmbox_done(f); | 234 | mailmbox_done(f); |
@@ -237,10 +245,10 @@ void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | |||
237 | size_t size; | 245 | size_t size; |
238 | 246 | ||
239 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | 247 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
240 | mailfolder*folder; | 248 | mailfolder*folder; |
241 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | 249 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
242 | r = mailfolder_connect(folder); | 250 | r = mailfolder_connect(folder); |
243 | if (r != MAIL_NO_ERROR) { | 251 | if (r != MAIL_NO_ERROR) { |
244 | qDebug("Error initializing mbox"); | 252 | Global::statusMessage(tr("Error initializing mbox")); |
245 | mailfolder_free(folder); | 253 | mailfolder_free(folder); |
246 | mailstorage_free(storage); | 254 | mailstorage_free(storage); |
@@ -249,5 +257,5 @@ void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | |||
249 | r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); | 257 | r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); |
250 | if (r != MAIL_NO_ERROR) { | 258 | if (r != MAIL_NO_ERROR) { |
251 | qDebug("Error fetching mail %i",mail.getNumber()); | 259 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); |
252 | mailfolder_free(folder); | 260 | mailfolder_free(folder); |
253 | mailstorage_free(storage); | 261 | mailstorage_free(storage); |
@@ -256,5 +264,5 @@ void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | |||
256 | r = mailmessage_fetch(msg,&data,&size); | 264 | r = mailmessage_fetch(msg,&data,&size); |
257 | if (r != MAIL_NO_ERROR) { | 265 | if (r != MAIL_NO_ERROR) { |
258 | qDebug("Error fetching mail %i",mail.getNumber()); | 266 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); |
259 | mailfolder_free(folder); | 267 | mailfolder_free(folder); |
260 | mailstorage_free(storage); | 268 | mailstorage_free(storage); |
@@ -279,4 +287,12 @@ void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) | |||
279 | return; | 287 | return; |
280 | } | 288 | } |
289 | deleteMails(f,target); | ||
290 | mailmbox_done(f); | ||
291 | } | ||
292 | |||
293 | void MBOXwrapper::deleteMails(mailmbox_folder*f,QList<RecMail> &target) | ||
294 | { | ||
295 | if (!f) return; | ||
296 | int r; | ||
281 | for (unsigned int i=0; i < target.count();++i) { | 297 | for (unsigned int i=0; i < target.count();++i) { |
282 | r = mailmbox_delete_msg(f,target.at(i)->getNumber()); | 298 | r = mailmbox_delete_msg(f,target.at(i)->getNumber()); |
@@ -289,5 +305,63 @@ void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) | |||
289 | qDebug("error expunge mailbox"); | 305 | qDebug("error expunge mailbox"); |
290 | } | 306 | } |
291 | mailmbox_done(f); | 307 | } |
308 | |||
309 | int MBOXwrapper::deleteAllMail(const Folder*tfolder) | ||
310 | { | ||
311 | if (!tfolder) return 0; | ||
312 | QString p = MBOXPath+tfolder->getDisplayName(); | ||
313 | int res = 1; | ||
314 | |||
315 | mailfolder*folder = 0; | ||
316 | mailmessage_list*l=0; | ||
317 | mailstorage*storage = mailstorage_new(NULL); | ||
318 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | ||
319 | if (r != MAIL_NO_ERROR) { | ||
320 | Global::statusMessage(tr("Error initializing mbox")); | ||
321 | res = 0; | ||
322 | } | ||
323 | if (res) { | ||
324 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | ||
325 | r = mailfolder_connect(folder); | ||
326 | if (r != MAIL_NO_ERROR) { | ||
327 | Global::statusMessage(tr("Error initializing mbox")); | ||
328 | res = 0; | ||
329 | } | ||
330 | } | ||
331 | if (res) { | ||
332 | r = mailsession_get_messages_list(folder->fld_session,&l); | ||
333 | if (r != MAIL_NO_ERROR) { | ||
334 | qDebug("Error message list"); | ||
335 | res=0; | ||
336 | } | ||
337 | } | ||
338 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { | ||
339 | r = mailsession_remove_message(folder->fld_session,i+1); | ||
340 | if (r != MAIL_NO_ERROR) { | ||
341 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | ||
342 | res = 0; | ||
343 | break; | ||
344 | } | ||
345 | } | ||
346 | if (l) mailmessage_list_free(l); | ||
347 | if (folder) mailfolder_free(folder); | ||
348 | if (storage) mailstorage_free(storage); | ||
349 | return res; | ||
350 | } | ||
351 | |||
352 | int MBOXwrapper::deleteMbox(const Folder*tfolder) | ||
353 | { | ||
354 | if (!tfolder) return 0; | ||
355 | QString p = MBOXPath+tfolder->getDisplayName(); | ||
356 | QFile fi(p); | ||
357 | if (!fi.exists()) { | ||
358 | Global::statusMessage(tr("Mailbox doesn't exist.")); | ||
359 | return 0; | ||
360 | } | ||
361 | if (!fi.remove()) { | ||
362 | Global::statusMessage(tr("Error deleting Mailbox.")); | ||
363 | return 0; | ||
364 | } | ||
365 | return 1; | ||
292 | } | 366 | } |
293 | 367 | ||
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index f64ad52..226a544 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h | |||
@@ -7,4 +7,5 @@ | |||
7 | class RecMail; | 7 | class RecMail; |
8 | class RecBody; | 8 | class RecBody; |
9 | struct mailmbox_folder; | ||
9 | 10 | ||
10 | class MBOXwrapper : public Genericwrapper | 11 | class MBOXwrapper : public Genericwrapper |
@@ -20,5 +21,8 @@ public: | |||
20 | virtual void deleteMail(const RecMail&mail); | 21 | virtual void deleteMail(const RecMail&mail); |
21 | virtual void answeredMail(const RecMail&mail); | 22 | virtual void answeredMail(const RecMail&mail); |
22 | virtual void createFolder(const QString&aFolder); | 23 | |
24 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); | ||
25 | virtual int deleteMbox(const Folder*); | ||
26 | |||
23 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 27 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
24 | 28 | ||
@@ -28,6 +32,8 @@ public: | |||
28 | virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); | 32 | virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); |
29 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); | 33 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); |
34 | virtual int deleteAllMail(const Folder*); | ||
30 | 35 | ||
31 | protected: | 36 | protected: |
37 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); | ||
32 | QString MBOXPath; | 38 | QString MBOXPath; |
33 | }; | 39 | }; |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index efd83ba..b85fbf6 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -3,7 +3,6 @@ | |||
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
4 | #include "logindialog.h" | 4 | #include "logindialog.h" |
5 | #include <libetpan/mailpop3.h> | 5 | #include <libetpan/libetpan.h> |
6 | #include <libetpan/mailmime.h> | 6 | #include <qpe/global.h> |
7 | #include <libetpan/data_message_driver.h> | ||
8 | #include <qfile.h> | 7 | #include <qfile.h> |
9 | 8 | ||
@@ -113,4 +112,5 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | |||
113 | login(); | 112 | login(); |
114 | if (!m_pop3) return; | 113 | if (!m_pop3) return; |
114 | |||
115 | mailpop3_list( m_pop3, &messages ); | 115 | mailpop3_list( m_pop3, &messages ); |
116 | 116 | ||
@@ -133,4 +133,5 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | |||
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 | } | 136 | } |
136 | 137 | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index b738cca..7502720 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -27,5 +27,6 @@ protected: | |||
27 | void login(); | 27 | void login(); |
28 | void logout(); | 28 | void logout(); |
29 | 29 | POP3account *account; | |
30 | mailpop3 *m_pop3; | ||
30 | }; | 31 | }; |
31 | 32 | ||
diff --git a/noncore/net/mail/mboxwrapper.cpp b/noncore/net/mail/mboxwrapper.cpp index 6d69263..162a0c9 100644 --- a/noncore/net/mail/mboxwrapper.cpp +++ b/noncore/net/mail/mboxwrapper.cpp | |||
@@ -3,7 +3,7 @@ | |||
3 | #include "mailwrapper.h" | 3 | #include "mailwrapper.h" |
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | #include <libetpan/mailstorage.h> | ||
6 | #include <qdir.h> | 5 | #include <qdir.h> |
7 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include <qpe/global.h> | ||
8 | 8 | ||
9 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) | 9 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) |
@@ -25,11 +25,8 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
25 | QString p = MBOXPath+"/"; | 25 | QString p = MBOXPath+"/"; |
26 | p+=mailbox; | 26 | p+=mailbox; |
27 | char*fname = 0; | 27 | |
28 | 28 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | |
29 | fname = strdup(p.latin1()); | ||
30 | |||
31 | int r = mbox_mailstorage_init(storage,fname,0,0,0); | ||
32 | mailfolder*folder; | 29 | mailfolder*folder; |
33 | folder = mailfolder_new( storage,fname,NULL); | 30 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
34 | r = mailfolder_connect(folder); | 31 | r = mailfolder_connect(folder); |
35 | if (r != MAIL_NO_ERROR) { | 32 | if (r != MAIL_NO_ERROR) { |
@@ -37,5 +34,4 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
37 | mailfolder_free(folder); | 34 | mailfolder_free(folder); |
38 | mailstorage_free(storage); | 35 | mailstorage_free(storage); |
39 | free(fname); | ||
40 | return; | 36 | return; |
41 | } | 37 | } |
@@ -46,5 +42,4 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
46 | mailfolder_free(folder); | 42 | mailfolder_free(folder); |
47 | mailstorage_free(storage); | 43 | mailstorage_free(storage); |
48 | free(fname); | ||
49 | return; | 44 | return; |
50 | } | 45 | } |
@@ -57,10 +52,10 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
57 | mailfolder_free(folder); | 52 | mailfolder_free(folder); |
58 | mailstorage_free(storage); | 53 | mailstorage_free(storage); |
59 | free(fname); | ||
60 | return; | 54 | return; |
61 | } | 55 | } |
62 | mailimf_references * refs; | 56 | mailimf_references * refs; |
63 | 57 | ||
64 | for(int i = 0 ; i < carray_count(env_list->msg_tab) ; ++i) { | 58 | uint32_t i = 0; |
59 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | ||
65 | mailmessage * msg; | 60 | mailmessage * msg; |
66 | QBitArray mFlags(7); | 61 | QBitArray mFlags(7); |
@@ -111,5 +106,5 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
111 | mailfolder_free(folder); | 106 | mailfolder_free(folder); |
112 | mailstorage_free(storage); | 107 | mailstorage_free(storage); |
113 | free(fname); | 108 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(i)); |
114 | } | 109 | } |
115 | 110 | ||
@@ -135,8 +130,7 @@ void MBOXwrapper::deleteMail(const RecMail&mail) | |||
135 | QString p = MBOXPath+"/"; | 130 | QString p = MBOXPath+"/"; |
136 | p+=mail.getMbox(); | 131 | p+=mail.getMbox(); |
137 | mailmessage * msg; | 132 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
138 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | ||
139 | mailfolder*folder; | 133 | mailfolder*folder; |
140 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | 134 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
141 | r = mailfolder_connect(folder); | 135 | r = mailfolder_connect(folder); |
142 | if (r != MAIL_NO_ERROR) { | 136 | if (r != MAIL_NO_ERROR) { |
@@ -168,7 +162,7 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) | |||
168 | size_t size; | 162 | size_t size; |
169 | 163 | ||
170 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | 164 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
171 | mailfolder*folder; | 165 | mailfolder*folder; |
172 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | 166 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
173 | r = mailfolder_connect(folder); | 167 | r = mailfolder_connect(folder); |
174 | if (r != MAIL_NO_ERROR) { | 168 | if (r != MAIL_NO_ERROR) { |
@@ -206,6 +200,20 @@ void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) | |||
206 | } | 200 | } |
207 | 201 | ||
208 | void MBOXwrapper::createFolder(const QString&) | 202 | int MBOXwrapper::createMbox(const QString&folder,const Folder*,const QString&,bool ) |
209 | { | 203 | { |
204 | QString p = MBOXPath+"/"; | ||
205 | p+=folder; | ||
206 | QFileInfo fi(p); | ||
207 | if (fi.exists()) { | ||
208 | Global::statusMessage(tr("Mailbox exists.")); | ||
209 | return 0; | ||
210 | } | ||
211 | mailmbox_folder*f = 0; | ||
212 | if (mailmbox_init(p.latin1(),0,1,0,&f) != MAIL_NO_ERROR) { | ||
213 | Global::statusMessage(tr("Error init folder")); | ||
214 | return 0; | ||
215 | } | ||
216 | if (f) mailmbox_done(f); | ||
217 | return 1; | ||
210 | } | 218 | } |
211 | 219 | ||
@@ -217,10 +225,10 @@ void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folde | |||
217 | int r = mailmbox_init(p.latin1(),0,1,0,&f); | 225 | int r = mailmbox_init(p.latin1(),0,1,0,&f); |
218 | if (r != MAIL_NO_ERROR) { | 226 | if (r != MAIL_NO_ERROR) { |
219 | qDebug("Error init folder"); | 227 | Global::statusMessage(tr("Error init folder")); |
220 | return; | 228 | return; |
221 | } | 229 | } |
222 | r = mailmbox_append_message(f,msg,length); | 230 | r = mailmbox_append_message(f,msg,length); |
223 | if (r != MAIL_NO_ERROR) { | 231 | if (r != MAIL_NO_ERROR) { |
224 | qDebug("Error writing message folder"); | 232 | Global::statusMessage(tr("Error writing to message folder")); |
225 | } | 233 | } |
226 | mailmbox_done(f); | 234 | mailmbox_done(f); |
@@ -237,10 +245,10 @@ void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | |||
237 | size_t size; | 245 | size_t size; |
238 | 246 | ||
239 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | 247 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
240 | mailfolder*folder; | 248 | mailfolder*folder; |
241 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | 249 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
242 | r = mailfolder_connect(folder); | 250 | r = mailfolder_connect(folder); |
243 | if (r != MAIL_NO_ERROR) { | 251 | if (r != MAIL_NO_ERROR) { |
244 | qDebug("Error initializing mbox"); | 252 | Global::statusMessage(tr("Error initializing mbox")); |
245 | mailfolder_free(folder); | 253 | mailfolder_free(folder); |
246 | mailstorage_free(storage); | 254 | mailstorage_free(storage); |
@@ -249,5 +257,5 @@ void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | |||
249 | r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); | 257 | r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); |
250 | if (r != MAIL_NO_ERROR) { | 258 | if (r != MAIL_NO_ERROR) { |
251 | qDebug("Error fetching mail %i",mail.getNumber()); | 259 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); |
252 | mailfolder_free(folder); | 260 | mailfolder_free(folder); |
253 | mailstorage_free(storage); | 261 | mailstorage_free(storage); |
@@ -256,5 +264,5 @@ void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | |||
256 | r = mailmessage_fetch(msg,&data,&size); | 264 | r = mailmessage_fetch(msg,&data,&size); |
257 | if (r != MAIL_NO_ERROR) { | 265 | if (r != MAIL_NO_ERROR) { |
258 | qDebug("Error fetching mail %i",mail.getNumber()); | 266 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); |
259 | mailfolder_free(folder); | 267 | mailfolder_free(folder); |
260 | mailstorage_free(storage); | 268 | mailstorage_free(storage); |
@@ -279,4 +287,12 @@ void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) | |||
279 | return; | 287 | return; |
280 | } | 288 | } |
289 | deleteMails(f,target); | ||
290 | mailmbox_done(f); | ||
291 | } | ||
292 | |||
293 | void MBOXwrapper::deleteMails(mailmbox_folder*f,QList<RecMail> &target) | ||
294 | { | ||
295 | if (!f) return; | ||
296 | int r; | ||
281 | for (unsigned int i=0; i < target.count();++i) { | 297 | for (unsigned int i=0; i < target.count();++i) { |
282 | r = mailmbox_delete_msg(f,target.at(i)->getNumber()); | 298 | r = mailmbox_delete_msg(f,target.at(i)->getNumber()); |
@@ -289,5 +305,63 @@ void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) | |||
289 | qDebug("error expunge mailbox"); | 305 | qDebug("error expunge mailbox"); |
290 | } | 306 | } |
291 | mailmbox_done(f); | 307 | } |
308 | |||
309 | int MBOXwrapper::deleteAllMail(const Folder*tfolder) | ||
310 | { | ||
311 | if (!tfolder) return 0; | ||
312 | QString p = MBOXPath+tfolder->getDisplayName(); | ||
313 | int res = 1; | ||
314 | |||
315 | mailfolder*folder = 0; | ||
316 | mailmessage_list*l=0; | ||
317 | mailstorage*storage = mailstorage_new(NULL); | ||
318 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | ||
319 | if (r != MAIL_NO_ERROR) { | ||
320 | Global::statusMessage(tr("Error initializing mbox")); | ||
321 | res = 0; | ||
322 | } | ||
323 | if (res) { | ||
324 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | ||
325 | r = mailfolder_connect(folder); | ||
326 | if (r != MAIL_NO_ERROR) { | ||
327 | Global::statusMessage(tr("Error initializing mbox")); | ||
328 | res = 0; | ||
329 | } | ||
330 | } | ||
331 | if (res) { | ||
332 | r = mailsession_get_messages_list(folder->fld_session,&l); | ||
333 | if (r != MAIL_NO_ERROR) { | ||
334 | qDebug("Error message list"); | ||
335 | res=0; | ||
336 | } | ||
337 | } | ||
338 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { | ||
339 | r = mailsession_remove_message(folder->fld_session,i+1); | ||
340 | if (r != MAIL_NO_ERROR) { | ||
341 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | ||
342 | res = 0; | ||
343 | break; | ||
344 | } | ||
345 | } | ||
346 | if (l) mailmessage_list_free(l); | ||
347 | if (folder) mailfolder_free(folder); | ||
348 | if (storage) mailstorage_free(storage); | ||
349 | return res; | ||
350 | } | ||
351 | |||
352 | int MBOXwrapper::deleteMbox(const Folder*tfolder) | ||
353 | { | ||
354 | if (!tfolder) return 0; | ||
355 | QString p = MBOXPath+tfolder->getDisplayName(); | ||
356 | QFile fi(p); | ||
357 | if (!fi.exists()) { | ||
358 | Global::statusMessage(tr("Mailbox doesn't exist.")); | ||
359 | return 0; | ||
360 | } | ||
361 | if (!fi.remove()) { | ||
362 | Global::statusMessage(tr("Error deleting Mailbox.")); | ||
363 | return 0; | ||
364 | } | ||
365 | return 1; | ||
292 | } | 366 | } |
293 | 367 | ||
diff --git a/noncore/net/mail/mboxwrapper.h b/noncore/net/mail/mboxwrapper.h index f64ad52..226a544 100644 --- a/noncore/net/mail/mboxwrapper.h +++ b/noncore/net/mail/mboxwrapper.h | |||
@@ -7,4 +7,5 @@ | |||
7 | class RecMail; | 7 | class RecMail; |
8 | class RecBody; | 8 | class RecBody; |
9 | struct mailmbox_folder; | ||
9 | 10 | ||
10 | class MBOXwrapper : public Genericwrapper | 11 | class MBOXwrapper : public Genericwrapper |
@@ -20,5 +21,8 @@ public: | |||
20 | virtual void deleteMail(const RecMail&mail); | 21 | virtual void deleteMail(const RecMail&mail); |
21 | virtual void answeredMail(const RecMail&mail); | 22 | virtual void answeredMail(const RecMail&mail); |
22 | virtual void createFolder(const QString&aFolder); | 23 | |
24 | virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); | ||
25 | virtual int deleteMbox(const Folder*); | ||
26 | |||
23 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 27 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
24 | 28 | ||
@@ -28,6 +32,8 @@ public: | |||
28 | virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); | 32 | virtual void fetchRawBody(const RecMail&mail,char**target,size_t*length); |
29 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); | 33 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); |
34 | virtual int deleteAllMail(const Folder*); | ||
30 | 35 | ||
31 | protected: | 36 | protected: |
37 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); | ||
32 | QString MBOXPath; | 38 | QString MBOXPath; |
33 | }; | 39 | }; |
diff --git a/noncore/net/mail/newmaildir.cpp b/noncore/net/mail/newmaildir.cpp index 3fc66f4..ab0d4e3 100644 --- a/noncore/net/mail/newmaildir.cpp +++ b/noncore/net/mail/newmaildir.cpp | |||
@@ -5,7 +5,11 @@ | |||
5 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
6 | 6 | ||
7 | Newmdirdlg::Newmdirdlg( QWidget* parent, const char* name) | 7 | Newmdirdlg::Newmdirdlg( QWidget* parent, const char* name,bool no_sub) |
8 | : Newmdirdlgui(parent,name,true),ndir(""),possible_subs(false) | 8 | : Newmdirdlgui(parent,name,true),ndir(""),possible_subs(false) |
9 | { | 9 | { |
10 | if (no_sub) { | ||
11 | subdirsPossibleBox->setChecked(false); | ||
12 | subdirsPossibleBox->hide(); | ||
13 | } | ||
10 | } | 14 | } |
11 | 15 | ||
diff --git a/noncore/net/mail/newmaildir.h b/noncore/net/mail/newmaildir.h index 1eb904e..496eaf4 100644 --- a/noncore/net/mail/newmaildir.h +++ b/noncore/net/mail/newmaildir.h | |||
@@ -6,5 +6,5 @@ class Newmdirdlg : public Newmdirdlgui | |||
6 | Q_OBJECT | 6 | Q_OBJECT |
7 | public: | 7 | public: |
8 | Newmdirdlg( QWidget* parent = 0, const char* name = 0); | 8 | Newmdirdlg( QWidget* parent = 0, const char* name = 0,bool no_sub=false); |
9 | ~Newmdirdlg(); | 9 | ~Newmdirdlg(); |
10 | 10 | ||
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp index efd83ba..b85fbf6 100644 --- a/noncore/net/mail/pop3wrapper.cpp +++ b/noncore/net/mail/pop3wrapper.cpp | |||
@@ -3,7 +3,6 @@ | |||
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
4 | #include "logindialog.h" | 4 | #include "logindialog.h" |
5 | #include <libetpan/mailpop3.h> | 5 | #include <libetpan/libetpan.h> |
6 | #include <libetpan/mailmime.h> | 6 | #include <qpe/global.h> |
7 | #include <libetpan/data_message_driver.h> | ||
8 | #include <qfile.h> | 7 | #include <qfile.h> |
9 | 8 | ||
@@ -113,4 +112,5 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | |||
113 | login(); | 112 | login(); |
114 | if (!m_pop3) return; | 113 | if (!m_pop3) return; |
114 | |||
115 | mailpop3_list( m_pop3, &messages ); | 115 | mailpop3_list( m_pop3, &messages ); |
116 | 116 | ||
@@ -133,4 +133,5 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | |||
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 | } | 136 | } |
136 | 137 | ||
diff --git a/noncore/net/mail/pop3wrapper.h b/noncore/net/mail/pop3wrapper.h index b738cca..7502720 100644 --- a/noncore/net/mail/pop3wrapper.h +++ b/noncore/net/mail/pop3wrapper.h | |||
@@ -27,5 +27,6 @@ protected: | |||
27 | void login(); | 27 | void login(); |
28 | void logout(); | 28 | void logout(); |
29 | 29 | POP3account *account; | |
30 | mailpop3 *m_pop3; | ||
30 | }; | 31 | }; |
31 | 32 | ||