-rw-r--r-- | noncore/net/mail/accountview.cpp | 212 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 69 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 9 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 9 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.h | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 10 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/selectstore.cpp | 53 | ||||
-rw-r--r-- | noncore/net/mail/selectstore.h | 18 | ||||
-rw-r--r-- | noncore/net/mail/selectstoreui.ui | 43 |
17 files changed, 403 insertions, 66 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index faa6982..eea021f 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -11,5 +11,5 @@ | |||
11 | * POP3 Account stuff | 11 | * POP3 Account stuff |
12 | */ | 12 | */ |
13 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) | 13 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) |
14 | : AccountViewItem( parent ) | 14 | : AccountViewItem( parent ) |
15 | { | 15 | { |
@@ -33,4 +33,5 @@ AbstractMail *POP3viewItem::getWrapper() | |||
33 | void POP3viewItem::refresh( QList<RecMail> & ) | 33 | void POP3viewItem::refresh( QList<RecMail> & ) |
34 | { | 34 | { |
35 | if (account->getOffline()) return; | ||
35 | QList<Folder> *folders = wrapper->listFolders(); | 36 | QList<Folder> *folders = wrapper->listFolders(); |
36 | QListViewItem *child = firstChild(); | 37 | QListViewItem *child = firstChild(); |
@@ -57,4 +58,50 @@ RecBody POP3viewItem::fetchBody( const RecMail &mail ) | |||
57 | } | 58 | } |
58 | 59 | ||
60 | QPopupMenu * POP3viewItem::getContextMenu() | ||
61 | { | ||
62 | QPopupMenu *m = new QPopupMenu(0); | ||
63 | if (m) { | ||
64 | if (!account->getOffline()) { | ||
65 | m->insertItem(QObject::tr("Disconnect",contextName),0); | ||
66 | m->insertItem(QObject::tr("Set offline",contextName),1); | ||
67 | } else { | ||
68 | m->insertItem(QObject::tr("Set online",contextName),1); | ||
69 | } | ||
70 | } | ||
71 | return m; | ||
72 | } | ||
73 | |||
74 | void POP3viewItem::disconnect() | ||
75 | { | ||
76 | QListViewItem *child = firstChild(); | ||
77 | while ( child ) { | ||
78 | QListViewItem *tmp = child; | ||
79 | child = child->nextSibling(); | ||
80 | delete tmp; | ||
81 | } | ||
82 | wrapper->logout(); | ||
83 | } | ||
84 | |||
85 | void POP3viewItem::setOnOffline() | ||
86 | { | ||
87 | if (!account->getOffline()) { | ||
88 | disconnect(); | ||
89 | } | ||
90 | account->setOffline(!account->getOffline()); | ||
91 | account->save(); | ||
92 | } | ||
93 | |||
94 | void POP3viewItem::contextMenuSelected(int which) | ||
95 | { | ||
96 | switch (which) { | ||
97 | case 0: | ||
98 | disconnect(); | ||
99 | break; | ||
100 | case 1: | ||
101 | setOnOffline(); | ||
102 | break; | ||
103 | } | ||
104 | } | ||
105 | |||
59 | POP3folderItem::~POP3folderItem() | 106 | POP3folderItem::~POP3folderItem() |
60 | { | 107 | { |
@@ -92,5 +139,5 @@ QPopupMenu * POP3folderItem::getContextMenu() | |||
92 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 139 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
93 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 140 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
94 | m->insertItem(QObject::tr("Download all mails",contextName),2); | 141 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
95 | } | 142 | } |
96 | return m; | 143 | return m; |
@@ -99,7 +146,7 @@ QPopupMenu * POP3folderItem::getContextMenu() | |||
99 | void POP3folderItem::downloadMails() | 146 | void POP3folderItem::downloadMails() |
100 | { | 147 | { |
101 | Selectstore sels; | 148 | AccountView*bl = pop3->accountView(); |
102 | sels.showMaximized(); | 149 | if (!bl) return; |
103 | sels.exec(); | 150 | bl->downloadMails(folder,pop3->getWrapper()); |
104 | } | 151 | } |
105 | 152 | ||
@@ -127,5 +174,5 @@ void POP3folderItem::contextMenuSelected(int which) | |||
127 | * IMAP Account stuff | 174 | * IMAP Account stuff |
128 | */ | 175 | */ |
129 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) | 176 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) |
130 | : AccountViewItem( parent ) | 177 | : AccountViewItem( parent ) |
131 | { | 178 | { |
@@ -184,10 +231,16 @@ void IMAPviewItem::removeChilds() | |||
184 | } | 231 | } |
185 | 232 | ||
233 | const QStringList&IMAPviewItem::subFolders() | ||
234 | { | ||
235 | return currentFolders; | ||
236 | } | ||
237 | |||
186 | void IMAPviewItem::refreshFolders(bool force) | 238 | void IMAPviewItem::refreshFolders(bool force) |
187 | { | 239 | { |
188 | if (childCount()>0 && force==false) return; | 240 | if (childCount()>0 && force==false) return; |
241 | if (account->getOffline()) return; | ||
189 | 242 | ||
190 | removeChilds(); | 243 | removeChilds(); |
191 | 244 | currentFolders.clear(); | |
192 | QList<Folder> *folders = wrapper->listFolders(); | 245 | QList<Folder> *folders = wrapper->listFolders(); |
193 | 246 | ||
@@ -210,4 +263,5 @@ void IMAPviewItem::refreshFolders(bool force) | |||
210 | for ( it = folders->first(); it; it = folders->next() ) { | 263 | for ( it = folders->first(); it; it = folders->next() ) { |
211 | fname = it->getDisplayName(); | 264 | fname = it->getDisplayName(); |
265 | currentFolders.append(it->getName()); | ||
212 | pos = fname.findRev(it->Separator()); | 266 | pos = fname.findRev(it->Separator()); |
213 | if (pos != -1) { | 267 | if (pos != -1) { |
@@ -232,8 +286,13 @@ QPopupMenu * IMAPviewItem::getContextMenu() | |||
232 | QPopupMenu *m = new QPopupMenu(0); | 286 | QPopupMenu *m = new QPopupMenu(0); |
233 | if (m) { | 287 | if (m) { |
288 | if (!account->getOffline()) { | ||
234 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 289 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
235 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 290 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
236 | m->insertSeparator(); | 291 | m->insertSeparator(); |
237 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 292 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
293 | m->insertItem(QObject::tr("Set offline",contextName),3); | ||
294 | } else { | ||
295 | m->insertItem(QObject::tr("Set online",contextName),3); | ||
296 | } | ||
238 | } | 297 | } |
239 | return m; | 298 | return m; |
@@ -272,4 +331,13 @@ void IMAPviewItem::contextMenuSelected(int id) | |||
272 | wrapper->logout(); | 331 | wrapper->logout(); |
273 | break; | 332 | break; |
333 | case 3: | ||
334 | if (account->getOffline()==false) { | ||
335 | removeChilds(); | ||
336 | wrapper->logout(); | ||
337 | } | ||
338 | account->setOffline(!account->getOffline()); | ||
339 | account->save(); | ||
340 | refreshFolders(false); | ||
341 | break; | ||
274 | default: | 342 | default: |
275 | break; | 343 | break; |
@@ -282,7 +350,7 @@ RecBody IMAPviewItem::fetchBody(const RecMail&) | |||
282 | } | 350 | } |
283 | 351 | ||
284 | IMAPfolderItem::~IMAPfolderItem() | 352 | bool IMAPviewItem::offline() |
285 | { | 353 | { |
286 | delete folder; | 354 | return account->getOffline(); |
287 | } | 355 | } |
288 | 356 | ||
@@ -313,4 +381,9 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QLi | |||
313 | } | 381 | } |
314 | 382 | ||
383 | IMAPfolderItem::~IMAPfolderItem() | ||
384 | { | ||
385 | delete folder; | ||
386 | } | ||
387 | |||
315 | const QString& IMAPfolderItem::Delemiter()const | 388 | const QString& IMAPfolderItem::Delemiter()const |
316 | { | 389 | { |
@@ -343,4 +416,5 @@ QPopupMenu * IMAPfolderItem::getContextMenu() | |||
343 | if (folder->may_select()) { | 416 | if (folder->may_select()) { |
344 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 417 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
418 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | ||
345 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 419 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
346 | } | 420 | } |
@@ -390,4 +464,11 @@ void IMAPfolderItem::deleteFolder() | |||
390 | } | 464 | } |
391 | 465 | ||
466 | void IMAPfolderItem::downloadMails() | ||
467 | { | ||
468 | AccountView*bl = imap->accountView(); | ||
469 | if (!bl) return; | ||
470 | bl->downloadMails(folder,imap->getWrapper()); | ||
471 | } | ||
472 | |||
392 | void IMAPfolderItem::contextMenuSelected(int id) | 473 | void IMAPfolderItem::contextMenuSelected(int id) |
393 | { | 474 | { |
@@ -407,4 +488,7 @@ void IMAPfolderItem::contextMenuSelected(int id) | |||
407 | deleteFolder(); | 488 | deleteFolder(); |
408 | break; | 489 | break; |
490 | case 4: | ||
491 | downloadMails(); | ||
492 | break; | ||
409 | default: | 493 | default: |
410 | break; | 494 | break; |
@@ -418,4 +502,31 @@ void IMAPfolderItem::contextMenuSelected(int id) | |||
418 | const QString AccountViewItem::contextName="AccountViewItem"; | 502 | const QString AccountViewItem::contextName="AccountViewItem"; |
419 | 503 | ||
504 | AccountViewItem::AccountViewItem( AccountView *parent ) | ||
505 | : QListViewItem( parent ) | ||
506 | { | ||
507 | m_Backlink = parent; | ||
508 | } | ||
509 | |||
510 | AccountViewItem::AccountViewItem( QListViewItem *parent) | ||
511 | : QListViewItem( parent) | ||
512 | { | ||
513 | m_Backlink = 0; | ||
514 | } | ||
515 | |||
516 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) | ||
517 | :QListViewItem( parent,after ) | ||
518 | { | ||
519 | m_Backlink = 0; | ||
520 | } | ||
521 | |||
522 | AccountViewItem::~AccountViewItem() | ||
523 | { | ||
524 | } | ||
525 | |||
526 | AccountView*AccountViewItem::accountView() | ||
527 | { | ||
528 | return m_Backlink; | ||
529 | } | ||
530 | |||
420 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) | 531 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) |
421 | { | 532 | { |
@@ -448,4 +559,10 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | |||
448 | } | 559 | } |
449 | 560 | ||
561 | AccountView::~AccountView() | ||
562 | { | ||
563 | imapAccounts.clear(); | ||
564 | mboxAccounts.clear(); | ||
565 | } | ||
566 | |||
450 | void AccountView::slotContextMenu(int id) | 567 | void AccountView::slotContextMenu(int id) |
451 | { | 568 | { |
@@ -472,5 +589,8 @@ void AccountView::populate( QList<Account> list ) | |||
472 | clear(); | 589 | clear(); |
473 | 590 | ||
474 | (void) new MBOXviewItem(AbstractMail::defaultLocalfolder(),this); | 591 | imapAccounts.clear(); |
592 | mboxAccounts.clear(); | ||
593 | |||
594 | mboxAccounts.append(new MBOXviewItem(AbstractMail::defaultLocalfolder(),this)); | ||
475 | 595 | ||
476 | Account *it; | 596 | Account *it; |
@@ -479,8 +599,9 @@ void AccountView::populate( QList<Account> list ) | |||
479 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 599 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
480 | qDebug( "added IMAP " + imap->getAccountName() ); | 600 | qDebug( "added IMAP " + imap->getAccountName() ); |
481 | (void) new IMAPviewItem( imap, this ); | 601 | imapAccounts.append(new IMAPviewItem( imap, this )); |
482 | } else if ( it->getType().compare( "POP3" ) == 0 ) { | 602 | } else if ( it->getType().compare( "POP3" ) == 0 ) { |
483 | POP3account *pop3 = static_cast<POP3account *>(it); | 603 | POP3account *pop3 = static_cast<POP3account *>(it); |
484 | qDebug( "added POP3 " + pop3->getAccountName() ); | 604 | qDebug( "added POP3 " + pop3->getAccountName() ); |
605 | /* must not be hold 'cause it isn't required */ | ||
485 | (void) new POP3viewItem( pop3, this ); | 606 | (void) new POP3viewItem( pop3, this ); |
486 | } | 607 | } |
@@ -525,13 +646,60 @@ RecBody AccountView::fetchBody(const RecMail&aMail) | |||
525 | } | 646 | } |
526 | 647 | ||
648 | void AccountView::setupFolderselect(Selectstore*sels) | ||
649 | { | ||
650 | sels->showMaximized(); | ||
651 | QStringList sFolders; | ||
652 | unsigned int i = 0; | ||
653 | for (i=0; i < mboxAccounts.count();++i) { | ||
654 | mboxAccounts[i]->refresh(false); | ||
655 | sFolders = mboxAccounts[i]->subFolders(); | ||
656 | sels->addAccounts(mboxAccounts[i]->getWrapper(),sFolders); | ||
657 | } | ||
658 | for (i=0; i < imapAccounts.count();++i) { | ||
659 | if (imapAccounts[i]->offline()) | ||
660 | continue; | ||
661 | imapAccounts[i]->refreshFolders(false); | ||
662 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | ||
663 | } | ||
664 | } | ||
665 | |||
666 | void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) | ||
667 | { | ||
668 | unsigned int i = 0; | ||
669 | AbstractMail*targetMail = 0; | ||
670 | QString targetFolder = ""; | ||
671 | Selectstore sels; | ||
672 | setupFolderselect(&sels); | ||
673 | if (!sels.exec()) return; | ||
674 | targetMail = sels.currentMail(); | ||
675 | targetFolder = sels.currentFolder(); | ||
676 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | ||
677 | targetFolder.isEmpty()) { | ||
678 | return; | ||
679 | } | ||
680 | |||
681 | QList<RecMail> t; | ||
682 | fromWrapper->listMessages(fromFolder->getName(),t); | ||
683 | encodedString*st = 0; | ||
684 | for (i = 0; i < t.count();++i) { | ||
685 | RecMail*r = t.at(i); | ||
686 | st = fromWrapper->fetchRawBody(*r); | ||
687 | if (st) { | ||
688 | targetMail->storeMessage(st->Content(),st->Length(),targetFolder); | ||
689 | delete st; | ||
690 | } | ||
691 | } | ||
692 | } | ||
693 | |||
527 | /** | 694 | /** |
528 | * MBOX Account stuff | 695 | * MBOX Account stuff |
529 | */ | 696 | */ |
530 | 697 | ||
531 | MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) | 698 | MBOXviewItem::MBOXviewItem( const QString&aPath, AccountView *parent ) |
532 | : AccountViewItem( parent ) | 699 | : AccountViewItem( parent ) |
533 | { | 700 | { |
534 | m_Path = aPath; | 701 | m_Path = aPath; |
535 | wrapper = AbstractMail::getWrapper( m_Path ); | 702 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
703 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | ||
536 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 704 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
537 | setText( 0, " Local Folders" ); | 705 | setText( 0, " Local Folders" ); |
@@ -603,4 +771,17 @@ void MBOXviewItem::createFolder() | |||
603 | } | 771 | } |
604 | 772 | ||
773 | QStringList MBOXviewItem::subFolders() | ||
774 | { | ||
775 | QStringList result; | ||
776 | QListViewItem *child = firstChild(); | ||
777 | while ( child ) { | ||
778 | MBOXfolderItem *tmp = (MBOXfolderItem*)child; | ||
779 | child = child->nextSibling(); | ||
780 | result.append(tmp->getFolder()->getName()); | ||
781 | } | ||
782 | qDebug("Size of result: %i",result.count()); | ||
783 | return result; | ||
784 | } | ||
785 | |||
605 | void MBOXviewItem::contextMenuSelected(int which) | 786 | void MBOXviewItem::contextMenuSelected(int which) |
606 | { | 787 | { |
@@ -637,4 +818,9 @@ MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QList | |||
637 | } | 818 | } |
638 | 819 | ||
820 | Folder*MBOXfolderItem::getFolder() | ||
821 | { | ||
822 | return folder; | ||
823 | } | ||
824 | |||
639 | void MBOXfolderItem::refresh(QList<RecMail>&target) | 825 | void MBOXfolderItem::refresh(QList<RecMail>&target) |
640 | { | 826 | { |
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index 7131192..48f52c7 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -13,4 +13,6 @@ class RecMail; | |||
13 | class RecBody; | 13 | class RecBody; |
14 | class QPopupMenu; | 14 | class QPopupMenu; |
15 | class Selectstore; | ||
16 | class AccountView; | ||
15 | 17 | ||
16 | class AccountViewItem : public QListViewItem | 18 | class AccountViewItem : public QListViewItem |
@@ -18,14 +20,17 @@ class AccountViewItem : public QListViewItem | |||
18 | 20 | ||
19 | public: | 21 | public: |
20 | AccountViewItem( QListView *parent ) : QListViewItem( parent ) {} | 22 | AccountViewItem( AccountView *parent ); |
21 | AccountViewItem( QListViewItem *parent) : QListViewItem( parent) {} | 23 | AccountViewItem( QListViewItem *parent); |
22 | AccountViewItem( QListViewItem *parent , QListViewItem*after ) : QListViewItem( parent,after ) {} | 24 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); |
25 | virtual ~AccountViewItem(); | ||
23 | virtual void refresh(QList<RecMail>&)=0; | 26 | virtual void refresh(QList<RecMail>&)=0; |
24 | virtual RecBody fetchBody(const RecMail&)=0; | 27 | virtual RecBody fetchBody(const RecMail&)=0; |
25 | virtual QPopupMenu * getContextMenu(){return 0;}; | 28 | virtual QPopupMenu * getContextMenu(){return 0;}; |
26 | virtual void contextMenuSelected(int){} | 29 | virtual void contextMenuSelected(int){} |
30 | virtual AccountView*accountView(); | ||
27 | protected: | 31 | protected: |
28 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); | 32 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); |
29 | static const QString contextName; | 33 | static const QString contextName; |
34 | AccountView*m_Backlink; | ||
30 | }; | 35 | }; |
31 | 36 | ||
@@ -34,13 +39,17 @@ class POP3viewItem : public AccountViewItem | |||
34 | 39 | ||
35 | public: | 40 | public: |
36 | POP3viewItem( POP3account *a, QListView *parent ); | 41 | POP3viewItem( POP3account *a, AccountView *parent ); |
37 | ~POP3viewItem(); | 42 | virtual ~POP3viewItem(); |
38 | virtual void refresh( QList<RecMail> &target ); | 43 | virtual void refresh( QList<RecMail> &target ); |
39 | virtual RecBody fetchBody( const RecMail &mail ); | 44 | virtual RecBody fetchBody( const RecMail &mail ); |
40 | AbstractMail *getWrapper(); | 45 | AbstractMail *getWrapper(); |
41 | private: | 46 | virtual QPopupMenu * getContextMenu(); |
47 | virtual void contextMenuSelected(int); | ||
48 | |||
49 | protected: | ||
42 | POP3account *account; | 50 | POP3account *account; |
43 | AbstractMail *wrapper; | 51 | AbstractMail *wrapper; |
44 | 52 | void disconnect(); | |
53 | void setOnOffline(); | ||
45 | }; | 54 | }; |
46 | 55 | ||
@@ -50,5 +59,5 @@ class POP3folderItem : public AccountViewItem | |||
50 | public: | 59 | public: |
51 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); | 60 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); |
52 | ~POP3folderItem(); | 61 | virtual ~POP3folderItem(); |
53 | virtual void refresh(QList<RecMail>&); | 62 | virtual void refresh(QList<RecMail>&); |
54 | virtual RecBody fetchBody(const RecMail&); | 63 | virtual RecBody fetchBody(const RecMail&); |
@@ -58,6 +67,4 @@ public: | |||
58 | protected: | 67 | protected: |
59 | void downloadMails(); | 68 | void downloadMails(); |
60 | |||
61 | private: | ||
62 | Folder *folder; | 69 | Folder *folder; |
63 | POP3viewItem *pop3; | 70 | POP3viewItem *pop3; |
@@ -70,6 +77,6 @@ class IMAPviewItem : public AccountViewItem | |||
70 | friend class IMAPfolderItem; | 77 | friend class IMAPfolderItem; |
71 | public: | 78 | public: |
72 | IMAPviewItem( IMAPaccount *a, QListView *parent ); | 79 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); |
73 | ~IMAPviewItem(); | 80 | virtual ~IMAPviewItem(); |
74 | virtual void refresh(QList<RecMail>&); | 81 | virtual void refresh(QList<RecMail>&); |
75 | virtual RecBody fetchBody(const RecMail&); | 82 | virtual RecBody fetchBody(const RecMail&); |
@@ -77,14 +84,15 @@ public: | |||
77 | virtual QPopupMenu * getContextMenu(); | 84 | virtual QPopupMenu * getContextMenu(); |
78 | virtual void contextMenuSelected(int); | 85 | virtual void contextMenuSelected(int); |
86 | const QStringList&subFolders(); | ||
87 | virtual void refreshFolders(bool force=false); | ||
88 | bool offline(); | ||
79 | 89 | ||
80 | protected: | 90 | protected: |
81 | IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0); | 91 | IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0); |
82 | virtual void refreshFolders(bool force=false); | ||
83 | virtual void createNewFolder(); | 92 | virtual void createNewFolder(); |
84 | virtual void removeChilds(); | 93 | virtual void removeChilds(); |
85 | |||
86 | private: | ||
87 | IMAPaccount *account; | 94 | IMAPaccount *account; |
88 | AbstractMail *wrapper; | 95 | AbstractMail *wrapper; |
96 | QStringList currentFolders; | ||
89 | }; | 97 | }; |
90 | 98 | ||
@@ -95,5 +103,5 @@ public: | |||
95 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); | 103 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); |
96 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | 104 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); |
97 | ~IMAPfolderItem(); | 105 | virtual ~IMAPfolderItem(); |
98 | virtual void refresh(QList<RecMail>&); | 106 | virtual void refresh(QList<RecMail>&); |
99 | virtual RecBody fetchBody(const RecMail&); | 107 | virtual RecBody fetchBody(const RecMail&); |
@@ -105,6 +113,5 @@ protected: | |||
105 | virtual void createNewFolder(); | 113 | virtual void createNewFolder(); |
106 | virtual void deleteFolder(); | 114 | virtual void deleteFolder(); |
107 | 115 | virtual void downloadMails(); | |
108 | private: | ||
109 | Folder *folder; | 116 | Folder *folder; |
110 | IMAPviewItem *imap; | 117 | IMAPviewItem *imap; |
@@ -116,7 +123,6 @@ class MBOXviewItem : public AccountViewItem | |||
116 | 123 | ||
117 | public: | 124 | public: |
118 | // MBOXviewItem( MBOXaccount *a, QListView *parent ); | 125 | MBOXviewItem( const QString&aMboxPath, AccountView *parent ); |
119 | MBOXviewItem( const QString&aMboxPath, QListView *parent ); | 126 | virtual ~MBOXviewItem(); |
120 | ~MBOXviewItem(); | ||
121 | virtual void refresh( QList<RecMail> &target ); | 127 | virtual void refresh( QList<RecMail> &target ); |
122 | virtual RecBody fetchBody( const RecMail &mail ); | 128 | virtual RecBody fetchBody( const RecMail &mail ); |
@@ -124,11 +130,9 @@ public: | |||
124 | virtual QPopupMenu * getContextMenu(); | 130 | virtual QPopupMenu * getContextMenu(); |
125 | virtual void contextMenuSelected(int); | 131 | virtual void contextMenuSelected(int); |
132 | QStringList subFolders(); | ||
133 | virtual void refresh(bool force=false); | ||
126 | 134 | ||
127 | protected: | 135 | protected: |
128 | virtual void refresh(bool force=false); | ||
129 | virtual void createFolder(); | 136 | virtual void createFolder(); |
130 | |||
131 | private: | ||
132 | // MBOXaccount *account; | ||
133 | QString m_Path; | 137 | QString m_Path; |
134 | AbstractMail *wrapper; | 138 | AbstractMail *wrapper; |
@@ -141,13 +145,13 @@ class MBOXfolderItem : public AccountViewItem | |||
141 | public: | 145 | public: |
142 | MBOXfolderItem( Folder *folder, MBOXviewItem *parent , QListViewItem*after ); | 146 | MBOXfolderItem( Folder *folder, MBOXviewItem *parent , QListViewItem*after ); |
143 | ~MBOXfolderItem(); | 147 | virtual ~MBOXfolderItem(); |
144 | virtual void refresh(QList<RecMail>&); | 148 | virtual void refresh(QList<RecMail>&); |
145 | virtual RecBody fetchBody(const RecMail&); | 149 | virtual RecBody fetchBody(const RecMail&); |
146 | virtual QPopupMenu * getContextMenu(); | 150 | virtual QPopupMenu * getContextMenu(); |
147 | virtual void contextMenuSelected(int); | 151 | virtual void contextMenuSelected(int); |
152 | virtual Folder*getFolder(); | ||
148 | 153 | ||
149 | protected: | 154 | protected: |
150 | virtual void deleteFolder(); | 155 | virtual void deleteFolder(); |
151 | private: | ||
152 | Folder *folder; | 156 | Folder *folder; |
153 | MBOXviewItem *mbox; | 157 | MBOXviewItem *mbox; |
@@ -160,6 +164,8 @@ class AccountView : public QListView | |||
160 | public: | 164 | public: |
161 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 165 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
162 | void populate( QList<Account> list ); | 166 | virtual ~AccountView(); |
163 | RecBody fetchBody(const RecMail&aMail); | 167 | virtual void populate( QList<Account> list ); |
168 | virtual RecBody fetchBody(const RecMail&aMail); | ||
169 | virtual void downloadMails(Folder*fromFolder,AbstractMail*fromWrapper); | ||
164 | 170 | ||
165 | public slots: | 171 | public slots: |
@@ -169,10 +175,13 @@ public slots: | |||
169 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); | 175 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); |
170 | virtual void slotContextMenu(int id); | 176 | virtual void slotContextMenu(int id); |
177 | void setupFolderselect(Selectstore*sels); | ||
171 | 178 | ||
172 | signals: | 179 | signals: |
173 | void refreshMailview(QList<RecMail>*); | 180 | void refreshMailview(QList<RecMail>*); |
174 | 181 | ||
175 | private: | 182 | protected: |
176 | QListViewItem* m_currentItem; | 183 | QListViewItem* m_currentItem; |
184 | QValueList<IMAPviewItem*> imapAccounts; | ||
185 | QValueList<MBOXviewItem*> mboxAccounts; | ||
177 | }; | 186 | }; |
178 | 187 | ||
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 80d0b52..3dd2fce 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -22,7 +22,7 @@ AbstractMail* AbstractMail::getWrapper(POP3account *a) | |||
22 | } | 22 | } |
23 | 23 | ||
24 | AbstractMail* AbstractMail::getWrapper(const QString&a) | 24 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) |
25 | { | 25 | { |
26 | return new MBOXwrapper(a); | 26 | return new MBOXwrapper(a,name); |
27 | } | 27 | } |
28 | 28 | ||
@@ -100,2 +100,7 @@ QString AbstractMail::defaultLocalfolder() | |||
100 | return f; | 100 | return f; |
101 | } | 101 | } |
102 | |||
103 | /* temporary - will be removed when implemented in all classes */ | ||
104 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) | ||
105 | { | ||
106 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 9770991..15d83cb 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -32,4 +32,5 @@ public: | |||
32 | virtual void answeredMail(const RecMail&mail)=0; | 32 | virtual void answeredMail(const RecMail&mail)=0; |
33 | virtual int deleteAllMail(const Folder*)=0; | 33 | virtual int deleteAllMail(const Folder*)=0; |
34 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); | ||
34 | virtual int deleteMbox(const Folder*)=0; | 35 | virtual int deleteMbox(const Folder*)=0; |
35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 36 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
@@ -47,9 +48,10 @@ public: | |||
47 | static AbstractMail* getWrapper(POP3account *a); | 48 | static AbstractMail* getWrapper(POP3account *a); |
48 | /* mbox only! */ | 49 | /* mbox only! */ |
49 | static AbstractMail* getWrapper(const QString&a); | 50 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); |
50 | 51 | ||
51 | static QString defaultLocalfolder(); | 52 | static QString defaultLocalfolder(); |
52 | 53 | ||
53 | virtual const QString&getType()const=0; | 54 | virtual const QString&getType()const=0; |
55 | virtual const QString&getName()const=0; | ||
54 | 56 | ||
55 | protected: | 57 | protected: |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index d252159..bb74de9 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -30,4 +30,5 @@ void IMAPwrapper::login() | |||
30 | int err = MAILIMAP_NO_ERROR; | 30 | int err = MAILIMAP_NO_ERROR; |
31 | 31 | ||
32 | if (account->getOffline()) return; | ||
32 | /* we are connected this moment */ | 33 | /* we are connected this moment */ |
33 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ | 34 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ |
@@ -1007,4 +1008,9 @@ const QString&IMAPwrapper::getType()const | |||
1007 | } | 1008 | } |
1008 | 1009 | ||
1010 | const QString&IMAPwrapper::getName()const | ||
1011 | { | ||
1012 | return account->getAccountName(); | ||
1013 | } | ||
1014 | |||
1009 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) | 1015 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) |
1010 | { | 1016 | { |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index b246f58..b2bd7e9 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -46,4 +46,6 @@ public: | |||
46 | virtual void logout(); | 46 | virtual void logout(); |
47 | virtual const QString&getType()const; | 47 | virtual const QString&getType()const; |
48 | virtual const QString&getName()const; | ||
49 | |||
48 | protected: | 50 | protected: |
49 | RecMail*parse_list_result(mailimap_msg_att*); | 51 | RecMail*parse_list_result(mailimap_msg_att*); |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index bc496f7..97f301e 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -9,6 +9,6 @@ | |||
9 | const QString MBOXwrapper::wrapperType="MBOX"; | 9 | const QString MBOXwrapper::wrapperType="MBOX"; |
10 | 10 | ||
11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) | 11 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) |
12 | : Genericwrapper(),MBOXPath(mbox_dir) | 12 | : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) |
13 | { | 13 | { |
14 | QDir dir(MBOXPath); | 14 | QDir dir(MBOXPath); |
@@ -331,2 +331,7 @@ const QString&MBOXwrapper::getType()const | |||
331 | return wrapperType; | 331 | return wrapperType; |
332 | } | 332 | } |
333 | |||
334 | const QString&MBOXwrapper::getName()const | ||
335 | { | ||
336 | return MBOXName; | ||
337 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index 2794014..194ff86 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h | |||
@@ -14,5 +14,5 @@ class MBOXwrapper : public Genericwrapper | |||
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | public: | 15 | public: |
16 | MBOXwrapper(const QString & dir); | 16 | MBOXwrapper(const QString & dir,const QString&name); |
17 | virtual ~MBOXwrapper(); | 17 | virtual ~MBOXwrapper(); |
18 | 18 | ||
@@ -33,11 +33,13 @@ public: | |||
33 | 33 | ||
34 | virtual encodedString* fetchRawBody(const RecMail&mail); | 34 | virtual encodedString* fetchRawBody(const RecMail&mail); |
35 | virtual void deleteMails(const QString & mailbox,QList<RecMail> &target); | 35 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); |
36 | virtual int deleteAllMail(const Folder*); | 36 | virtual int deleteAllMail(const Folder*); |
37 | virtual const QString&getType()const; | 37 | virtual const QString&getType()const; |
38 | virtual const QString&getName()const; | ||
38 | 39 | ||
39 | protected: | 40 | protected: |
40 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); | 41 | static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); |
41 | QString MBOXPath; | 42 | QString MBOXPath; |
43 | QString MBOXName; | ||
42 | static const QString wrapperType; | 44 | static const QString wrapperType; |
43 | }; | 45 | }; |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index cceb22e..67bde38 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -109,4 +109,5 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | |||
109 | void POP3wrapper::login() | 109 | void POP3wrapper::login() |
110 | { | 110 | { |
111 | if (account->getOffline()) return; | ||
111 | /* we'll hold the line */ | 112 | /* we'll hold the line */ |
112 | if ( m_pop3 != NULL ) return; | 113 | if ( m_pop3 != NULL ) return; |
@@ -250,2 +251,7 @@ const QString&POP3wrapper::getType()const | |||
250 | return account->getType(); | 251 | return account->getType(); |
251 | } | 252 | } |
253 | |||
254 | const QString&POP3wrapper::getName()const | ||
255 | { | ||
256 | return account->getAccountName(); | ||
257 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index f0307b6..d2b708d 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -31,4 +31,5 @@ public: | |||
31 | virtual void logout(); | 31 | virtual void logout(); |
32 | virtual const QString&getType()const; | 32 | virtual const QString&getType()const; |
33 | virtual const QString&getName()const; | ||
33 | static void pop3_progress( size_t current, size_t maximum ); | 34 | static void pop3_progress( size_t current, size_t maximum ); |
34 | 35 | ||
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index c5187f5..02a80a3 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -169,4 +169,6 @@ void IMAPaccount::read() | |||
169 | prefix = conf->readEntry("MailPrefix",""); | 169 | prefix = conf->readEntry("MailPrefix",""); |
170 | if (prefix.isNull()) prefix = ""; | 170 | if (prefix.isNull()) prefix = ""; |
171 | offline = conf->readBoolEntry("Offline",false); | ||
172 | delete conf; | ||
171 | } | 173 | } |
172 | 174 | ||
@@ -185,5 +187,7 @@ void IMAPaccount::save() | |||
185 | conf->writeEntryCrypt( "Password", password ); | 187 | conf->writeEntryCrypt( "Password", password ); |
186 | conf->writeEntry( "MailPrefix",prefix); | 188 | conf->writeEntry( "MailPrefix",prefix); |
189 | conf->writeEntry( "Offline",offline); | ||
187 | conf->write(); | 190 | conf->write(); |
191 | delete conf; | ||
188 | } | 192 | } |
189 | 193 | ||
@@ -239,4 +243,6 @@ void POP3account::read() | |||
239 | user = conf->readEntry( "User" ); | 243 | user = conf->readEntry( "User" ); |
240 | password = conf->readEntryCrypt( "Password" ); | 244 | password = conf->readEntryCrypt( "Password" ); |
245 | offline = conf->readBoolEntry("Offline",false); | ||
246 | delete conf; | ||
241 | } | 247 | } |
242 | 248 | ||
@@ -254,5 +260,7 @@ void POP3account::save() | |||
254 | conf->writeEntry( "User", user ); | 260 | conf->writeEntry( "User", user ); |
255 | conf->writeEntryCrypt( "Password", password ); | 261 | conf->writeEntryCrypt( "Password", password ); |
262 | conf->writeEntry( "Offline",offline); | ||
256 | conf->write(); | 263 | conf->write(); |
264 | delete conf; | ||
257 | } | 265 | } |
258 | 266 | ||
@@ -314,4 +322,5 @@ void SMTPaccount::read() | |||
314 | user = conf->readEntry( "User" ); | 322 | user = conf->readEntry( "User" ); |
315 | password = conf->readEntryCrypt( "Password" ); | 323 | password = conf->readEntryCrypt( "Password" ); |
324 | delete conf; | ||
316 | } | 325 | } |
317 | 326 | ||
@@ -331,4 +340,5 @@ void SMTPaccount::save() | |||
331 | conf->writeEntryCrypt( "Password", password ); | 340 | conf->writeEntryCrypt( "Password", password ); |
332 | conf->write(); | 341 | conf->write(); |
342 | delete conf; | ||
333 | } | 343 | } |
334 | 344 | ||
@@ -387,4 +397,5 @@ void NNTPaccount::read() | |||
387 | user = conf->readEntry( "User" ); | 397 | user = conf->readEntry( "User" ); |
388 | password = conf->readEntryCrypt( "Password" ); | 398 | password = conf->readEntryCrypt( "Password" ); |
399 | delete conf; | ||
389 | } | 400 | } |
390 | 401 | ||
@@ -404,4 +415,5 @@ void NNTPaccount::save() | |||
404 | conf->writeEntryCrypt( "Password", password ); | 415 | conf->writeEntryCrypt( "Password", password ); |
405 | conf->write(); | 416 | conf->write(); |
417 | delete conf; | ||
406 | } | 418 | } |
407 | 419 | ||
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h index caa5dfc..2104997 100644 --- a/noncore/net/mail/libmailwrapper/settings.h +++ b/noncore/net/mail/libmailwrapper/settings.h | |||
@@ -32,4 +32,7 @@ public: | |||
32 | bool getSSL() { return ssl; } | 32 | bool getSSL() { return ssl; } |
33 | 33 | ||
34 | void setOffline(bool b) {offline = b;} | ||
35 | bool getOffline()const{return offline;} | ||
36 | |||
34 | virtual QString getFileName() { return accountName; } | 37 | virtual QString getFileName() { return accountName; } |
35 | virtual void read() { qDebug( "base reading..." ); } | 38 | virtual void read() { qDebug( "base reading..." ); } |
@@ -39,5 +42,5 @@ protected: | |||
39 | QString accountName, type, server, port, user, password; | 42 | QString accountName, type, server, port, user, password; |
40 | bool ssl; | 43 | bool ssl; |
41 | 44 | bool offline; | |
42 | }; | 45 | }; |
43 | 46 | ||
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 4764b77..281b88e 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -490,5 +490,5 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) | |||
490 | if (!mail) return; | 490 | if (!mail) return; |
491 | QString localfolders = AbstractMail::defaultLocalfolder(); | 491 | QString localfolders = AbstractMail::defaultLocalfolder(); |
492 | MBOXwrapper*wrap = new MBOXwrapper(localfolders); | 492 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
493 | wrap->storeMessage(mail,length,box); | 493 | wrap->storeMessage(mail,length,box); |
494 | delete wrap; | 494 | delete wrap; |
@@ -517,9 +517,7 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | |||
517 | return; | 517 | return; |
518 | } | 518 | } |
519 | QString tmp = data; | ||
520 | tmp.replace(QRegExp("\r+",true,false),""); | ||
521 | msg = 0; | 519 | msg = 0; |
522 | if (later) { | 520 | if (later) { |
523 | storeMail((char*)tmp.data(),tmp.length(),"Outgoing"); | 521 | storeMail(data,size,"Outgoing"); |
524 | if (data) free( data ); | 522 | if (data) free( data ); |
525 | Config cfg( "mail" ); | 523 | Config cfg( "mail" ); |
@@ -637,5 +635,5 @@ void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) | |||
637 | } | 635 | } |
638 | 636 | ||
639 | int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | 637 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which) |
640 | { | 638 | { |
641 | size_t curTok = 0; | 639 | size_t curTok = 0; |
@@ -686,5 +684,5 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
686 | 684 | ||
687 | QString localfolders = AbstractMail::defaultLocalfolder(); | 685 | QString localfolders = AbstractMail::defaultLocalfolder(); |
688 | MBOXwrapper*wrap = new MBOXwrapper(localfolders); | 686 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
689 | if (!wrap) { | 687 | if (!wrap) { |
690 | qDebug("memory error"); | 688 | qDebug("memory error"); |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index 04fc4b0..7dcdbfd 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h | |||
@@ -11,5 +11,5 @@ | |||
11 | 11 | ||
12 | class Mail; | 12 | class Mail; |
13 | class MBOXwrapper; | 13 | class AbstractMail; |
14 | class RecMail; | 14 | class RecMail; |
15 | class Attachment; | 15 | class Attachment; |
@@ -60,5 +60,5 @@ protected: | |||
60 | Settings *settings; | 60 | Settings *settings; |
61 | 61 | ||
62 | int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which); | 62 | int sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which); |
63 | 63 | ||
64 | int m_queuedMail; | 64 | int m_queuedMail; |
diff --git a/noncore/net/mail/selectstore.cpp b/noncore/net/mail/selectstore.cpp index 28ab5a8..0a07d51 100644 --- a/noncore/net/mail/selectstore.cpp +++ b/noncore/net/mail/selectstore.cpp | |||
@@ -1,8 +1,14 @@ | |||
1 | #include "selectstore.h" | 1 | #include "selectstore.h" |
2 | #include <qlineedit.h> | ||
3 | #include <qcheckbox.h> | ||
4 | #include <qcombobox.h> | ||
5 | #include <libmailwrapper/abstractmail.h> | ||
2 | 6 | ||
3 | Selectstore::Selectstore(QWidget* parent, const char* name) | 7 | Selectstore::Selectstore(QWidget* parent, const char* name) |
4 | :selectstoreui(parent,name,true) | 8 | :selectstoreui(parent,name,true) |
5 | { | 9 | { |
6 | 10 | folderMap.clear(); | |
11 | mailMap.clear(); | ||
12 | cMail = 0; | ||
7 | } | 13 | } |
8 | 14 | ||
@@ -13,4 +19,7 @@ Selectstore::~Selectstore() | |||
13 | void Selectstore::slotCreateNewFolder() | 19 | void Selectstore::slotCreateNewFolder() |
14 | { | 20 | { |
21 | bool how = newFoldersel->isChecked(); | ||
22 | folderSelection->setEnabled(!how); | ||
23 | newFolderedit->setEnabled(how); | ||
15 | } | 24 | } |
16 | 25 | ||
@@ -18,2 +27,44 @@ void Selectstore::slotMoveMail() | |||
18 | { | 27 | { |
19 | } | 28 | } |
29 | |||
30 | void Selectstore::addAccounts(AbstractMail*mail,const QStringList&folders) | ||
31 | { | ||
32 | accountSelection->insertItem(mail->getName()); | ||
33 | mailMap[accountSelection->count()-1]=mail; | ||
34 | folderMap[accountSelection->count()-1]=folders; | ||
35 | if (accountSelection->count()==1) { | ||
36 | cMail = mail; | ||
37 | folderSelection->insertStringList(folders); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | void Selectstore::slotAccountselected(int i) | ||
42 | { | ||
43 | folderSelection->clear(); | ||
44 | folderSelection->insertStringList(folderMap[i]); | ||
45 | cMail = mailMap[i]; | ||
46 | } | ||
47 | |||
48 | QString Selectstore::currentFolder() | ||
49 | { | ||
50 | if (newFoldersel->isChecked()) { | ||
51 | return newFolderedit->text(); | ||
52 | } else { | ||
53 | return folderSelection->currentText(); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | AbstractMail*Selectstore::currentMail() | ||
58 | { | ||
59 | return cMail; | ||
60 | } | ||
61 | |||
62 | bool Selectstore::newFolder() | ||
63 | { | ||
64 | return newFoldersel->isChecked(); | ||
65 | } | ||
66 | |||
67 | bool Selectstore::moveMails() | ||
68 | { | ||
69 | return selMove->isChecked(); | ||
70 | } | ||
diff --git a/noncore/net/mail/selectstore.h b/noncore/net/mail/selectstore.h index 8b8e8ee..447a6ae 100644 --- a/noncore/net/mail/selectstore.h +++ b/noncore/net/mail/selectstore.h | |||
@@ -3,4 +3,9 @@ | |||
3 | 3 | ||
4 | #include "selectstoreui.h" | 4 | #include "selectstoreui.h" |
5 | #include <qvaluelist.h> | ||
6 | #include <qmap.h> | ||
7 | #include <qstringlist.h> | ||
8 | |||
9 | class AbstractMail; | ||
5 | 10 | ||
6 | class Selectstore:public selectstoreui | 11 | class Selectstore:public selectstoreui |
@@ -10,10 +15,19 @@ public: | |||
10 | Selectstore(QWidget* parent = 0, const char* name = 0); | 15 | Selectstore(QWidget* parent = 0, const char* name = 0); |
11 | virtual ~Selectstore(); | 16 | virtual ~Selectstore(); |
17 | virtual void addAccounts(AbstractMail*mail,const QStringList&folders); | ||
18 | virtual QString currentFolder(); | ||
19 | virtual AbstractMail*currentMail(); | ||
20 | bool newFolder(); | ||
21 | bool moveMails(); | ||
12 | 22 | ||
13 | protected: | 23 | protected slots: |
14 | virtual void slotCreateNewFolder(); | 24 | virtual void slotCreateNewFolder(); |
15 | virtual void slotMoveMail(); | 25 | virtual void slotMoveMail(); |
16 | protected slots: | 26 | virtual void slotAccountselected(int); |
17 | 27 | ||
28 | protected: | ||
29 | QMap<int,QStringList> folderMap; | ||
30 | QMap<int,AbstractMail*> mailMap; | ||
31 | AbstractMail*cMail; | ||
18 | }; | 32 | }; |
19 | #endif | 33 | #endif |
diff --git a/noncore/net/mail/selectstoreui.ui b/noncore/net/mail/selectstoreui.ui index 3741b71..5f0e507 100644 --- a/noncore/net/mail/selectstoreui.ui +++ b/noncore/net/mail/selectstoreui.ui | |||
@@ -12,5 +12,5 @@ | |||
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>190</width> | 14 | <width>182</width> |
15 | <height>273</height> | 15 | <height>273</height> |
16 | </rect> | 16 | </rect> |
@@ -29,9 +29,9 @@ | |||
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>1</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>1</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
@@ -175,4 +175,25 @@ | |||
175 | </widget> | 175 | </widget> |
176 | <widget> | 176 | <widget> |
177 | <class>QLabel</class> | ||
178 | <property stdset="1"> | ||
179 | <name>name</name> | ||
180 | <cstring>newFolderLabel</cstring> | ||
181 | </property> | ||
182 | <property stdset="1"> | ||
183 | <name>text</name> | ||
184 | <string>Prefix will prepend, no need to enter it!</string> | ||
185 | </property> | ||
186 | <property stdset="1"> | ||
187 | <name>alignment</name> | ||
188 | <set>WordBreak|AlignCenter</set> | ||
189 | </property> | ||
190 | <property> | ||
191 | <name>hAlign</name> | ||
192 | </property> | ||
193 | <property> | ||
194 | <name>wordwrap</name> | ||
195 | </property> | ||
196 | </widget> | ||
197 | <widget> | ||
177 | <class>Line</class> | 198 | <class>Line</class> |
178 | <property stdset="1"> | 199 | <property stdset="1"> |
@@ -232,6 +253,20 @@ | |||
232 | <slot>slotCreateNewFolder()</slot> | 253 | <slot>slotCreateNewFolder()</slot> |
233 | </connection> | 254 | </connection> |
234 | <slot access="protected">slotMoveMail()</slot> | 255 | <connection> |
256 | <sender>accountSelection</sender> | ||
257 | <signal>activated(int)</signal> | ||
258 | <receiver>selectstoreui</receiver> | ||
259 | <slot>slotAccountselected(int)</slot> | ||
260 | </connection> | ||
261 | <connection> | ||
262 | <sender>folderSelection</sender> | ||
263 | <signal>activated(int)</signal> | ||
264 | <receiver>selectstoreui</receiver> | ||
265 | <slot>slotFolderSelected(int)</slot> | ||
266 | </connection> | ||
267 | <slot access="protected">slotFolderSelected(int)</slot> | ||
268 | <slot access="protected">slotAccountselected(int)</slot> | ||
235 | <slot access="protected">slotCreateNewFolder()</slot> | 269 | <slot access="protected">slotCreateNewFolder()</slot> |
270 | <slot access="protected">slotMoveMail()</slot> | ||
236 | </connections> | 271 | </connections> |
237 | <tabstops> | 272 | <tabstops> |