summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp234
-rw-r--r--noncore/net/mail/accountview.h71
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h4
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.h6
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h1
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp12
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h5
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h4
-rw-r--r--noncore/net/mail/selectstore.cpp53
-rw-r--r--noncore/net/mail/selectstore.h18
-rw-r--r--noncore/net/mail/selectstoreui.ui43
17 files changed, 415 insertions, 78 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
@@ -10,7 +10,7 @@
10/** 10/**
11 * POP3 Account stuff 11 * POP3 Account stuff
12 */ 12 */
13POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) 13POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
14 : AccountViewItem( parent ) 14 : AccountViewItem( parent )
15{ 15{
16 account = a; 16 account = a;
@@ -32,6 +32,7 @@ AbstractMail *POP3viewItem::getWrapper()
32 32
33void POP3viewItem::refresh( QList<RecMail> & ) 33void 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();
37 while ( child ) { 38 while ( child ) {
@@ -56,6 +57,52 @@ RecBody POP3viewItem::fetchBody( const RecMail &mail )
56 return wrapper->fetchBody( mail ); 57 return wrapper->fetchBody( mail );
57} 58}
58 59
60QPopupMenu * 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
74void 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
85void POP3viewItem::setOnOffline()
86{
87 if (!account->getOffline()) {
88 disconnect();
89 }
90 account->setOffline(!account->getOffline());
91 account->save();
92}
93
94void 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
59POP3folderItem::~POP3folderItem() 106POP3folderItem::~POP3folderItem()
60{ 107{
61 delete folder; 108 delete folder;
@@ -91,16 +138,16 @@ QPopupMenu * POP3folderItem::getContextMenu()
91 if (m) { 138 if (m) {
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;
97} 144}
98 145
99void POP3folderItem::downloadMails() 146void 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
106void POP3folderItem::contextMenuSelected(int which) 153void POP3folderItem::contextMenuSelected(int which)
@@ -126,7 +173,7 @@ void POP3folderItem::contextMenuSelected(int which)
126/** 173/**
127 * IMAP Account stuff 174 * IMAP Account stuff
128 */ 175 */
129IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) 176IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
130 : AccountViewItem( parent ) 177 : AccountViewItem( parent )
131{ 178{
132 account = a; 179 account = a;
@@ -183,12 +230,18 @@ void IMAPviewItem::removeChilds()
183 230
184} 231}
185 232
233const QStringList&IMAPviewItem::subFolders()
234{
235 return currentFolders;
236}
237
186void IMAPviewItem::refreshFolders(bool force) 238void IMAPviewItem::refreshFolders(bool force)
187{ 239{
188 if (childCount()>0 && force==false) return; 240 if (childCount()>0 && force==false) return;
189 241 if (account->getOffline()) return;
190 removeChilds();
191 242
243 removeChilds();
244 currentFolders.clear();
192 QList<Folder> *folders = wrapper->listFolders(); 245 QList<Folder> *folders = wrapper->listFolders();
193 246
194 Folder *it; 247 Folder *it;
@@ -209,6 +262,7 @@ void IMAPviewItem::refreshFolders(bool force)
209 } 262 }
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) {
214 fname = fname.left(pos); 268 fname = fname.left(pos);
@@ -231,10 +285,15 @@ QPopupMenu * IMAPviewItem::getContextMenu()
231{ 285{
232 QPopupMenu *m = new QPopupMenu(0); 286 QPopupMenu *m = new QPopupMenu(0);
233 if (m) { 287 if (m) {
234 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 288 if (!account->getOffline()) {
235 m->insertItem(QObject::tr("Create new folder",contextName),1); 289 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
236 m->insertSeparator(); 290 m->insertItem(QObject::tr("Create new folder",contextName),1);
237 m->insertItem(QObject::tr("Disconnect",contextName),2); 291 m->insertSeparator();
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;
240} 299}
@@ -271,6 +330,15 @@ void IMAPviewItem::contextMenuSelected(int id)
271 removeChilds(); 330 removeChilds();
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;
276 } 344 }
@@ -281,9 +349,9 @@ RecBody IMAPviewItem::fetchBody(const RecMail&)
281 return RecBody(); 349 return RecBody();
282} 350}
283 351
284IMAPfolderItem::~IMAPfolderItem() 352bool IMAPviewItem::offline()
285{ 353{
286 delete folder; 354 return account->getOffline();
287} 355}
288 356
289IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) 357IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after )
@@ -312,6 +380,11 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QLi
312 setText( 0, folder->getDisplayName() ); 380 setText( 0, folder->getDisplayName() );
313} 381}
314 382
383IMAPfolderItem::~IMAPfolderItem()
384{
385 delete folder;
386}
387
315const QString& IMAPfolderItem::Delemiter()const 388const QString& IMAPfolderItem::Delemiter()const
316{ 389{
317 return folder->Separator(); 390 return folder->Separator();
@@ -342,6 +415,7 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
342 if (m) { 415 if (m) {
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 }
347 if (folder->no_inferior()==false) { 421 if (folder->no_inferior()==false) {
@@ -389,6 +463,13 @@ void IMAPfolderItem::deleteFolder()
389 } 463 }
390} 464}
391 465
466void IMAPfolderItem::downloadMails()
467{
468 AccountView*bl = imap->accountView();
469 if (!bl) return;
470 bl->downloadMails(folder,imap->getWrapper());
471}
472
392void IMAPfolderItem::contextMenuSelected(int id) 473void IMAPfolderItem::contextMenuSelected(int id)
393{ 474{
394 qDebug("Selected id: %i",id); 475 qDebug("Selected id: %i",id);
@@ -406,6 +487,9 @@ void IMAPfolderItem::contextMenuSelected(int id)
406 case 3: 487 case 3:
407 deleteFolder(); 488 deleteFolder();
408 break; 489 break;
490 case 4:
491 downloadMails();
492 break;
409 default: 493 default:
410 break; 494 break;
411 } 495 }
@@ -417,6 +501,33 @@ void IMAPfolderItem::contextMenuSelected(int id)
417 501
418const QString AccountViewItem::contextName="AccountViewItem"; 502const QString AccountViewItem::contextName="AccountViewItem";
419 503
504AccountViewItem::AccountViewItem( AccountView *parent )
505 : QListViewItem( parent )
506{
507 m_Backlink = parent;
508}
509
510AccountViewItem::AccountViewItem( QListViewItem *parent)
511 : QListViewItem( parent)
512{
513 m_Backlink = 0;
514}
515
516AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
517 :QListViewItem( parent,after )
518{
519 m_Backlink = 0;
520}
521
522AccountViewItem::~AccountViewItem()
523{
524}
525
526AccountView*AccountViewItem::accountView()
527{
528 return m_Backlink;
529}
530
420void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) 531void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder)
421{ 532{
422 if (!wrapper) return; 533 if (!wrapper) return;
@@ -447,6 +558,12 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
447 setSorting(0); 558 setSorting(0);
448} 559}
449 560
561AccountView::~AccountView()
562{
563 imapAccounts.clear();
564 mboxAccounts.clear();
565}
566
450void AccountView::slotContextMenu(int id) 567void AccountView::slotContextMenu(int id)
451{ 568{
452 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); 569 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
@@ -471,17 +588,21 @@ void AccountView::populate( QList<Account> list )
471{ 588{
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;
477 for ( it = list.first(); it; it = list.next() ) { 597 for ( it = list.first(); it; it = list.next() ) {
478 if ( it->getType().compare( "IMAP" ) == 0 ) { 598 if ( it->getType().compare( "IMAP" ) == 0 ) {
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 }
487 } 608 }
@@ -503,12 +624,12 @@ void AccountView::refresh(QListViewItem *item) {
503void AccountView::refreshCurrent() 624void AccountView::refreshCurrent()
504{ 625{
505 m_currentItem = currentItem(); 626 m_currentItem = currentItem();
506 if ( !m_currentItem ) return; 627 if ( !m_currentItem ) return;
507 QList<RecMail> headerlist; 628 QList<RecMail> headerlist;
508 headerlist.setAutoDelete(true); 629 headerlist.setAutoDelete(true);
509 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 630 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
510 view->refresh(headerlist); 631 view->refresh(headerlist);
511 emit refreshMailview(&headerlist); 632 emit refreshMailview(&headerlist);
512} 633}
513 634
514void AccountView::refreshAll() 635void AccountView::refreshAll()
@@ -524,15 +645,62 @@ RecBody AccountView::fetchBody(const RecMail&aMail)
524 return view->fetchBody(aMail); 645 return view->fetchBody(aMail);
525} 646}
526 647
648void 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
666void 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
531MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) 698MBOXviewItem::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" );
538 setOpen( true ); 706 setOpen( true );
@@ -602,6 +770,19 @@ void MBOXviewItem::createFolder()
602 } 770 }
603} 771}
604 772
773QStringList 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
605void MBOXviewItem::contextMenuSelected(int which) 786void MBOXviewItem::contextMenuSelected(int which)
606{ 787{
607 switch (which) { 788 switch (which) {
@@ -636,6 +817,11 @@ MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QList
636 setText( 0, folder->getDisplayName() ); 817 setText( 0, folder->getDisplayName() );
637} 818}
638 819
820Folder*MBOXfolderItem::getFolder()
821{
822 return folder;
823}
824
639void MBOXfolderItem::refresh(QList<RecMail>&target) 825void MBOXfolderItem::refresh(QList<RecMail>&target)
640{ 826{
641 if (folder->may_select()) 827 if (folder->may_select())
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
@@ -12,36 +12,45 @@ class POP3wrapper;
12class RecMail; 12class RecMail;
13class RecBody; 13class RecBody;
14class QPopupMenu; 14class QPopupMenu;
15class Selectstore;
16class AccountView;
15 17
16class AccountViewItem : public QListViewItem 18class AccountViewItem : public QListViewItem
17{ 19{
18 20
19public: 21public:
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();
27protected: 31protected:
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
32class POP3viewItem : public AccountViewItem 37class POP3viewItem : public AccountViewItem
33{ 38{
34 39
35public: 40public:
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();
41private: 46 virtual QPopupMenu * getContextMenu();
47 virtual void contextMenuSelected(int);
48
49protected:
42 POP3account *account; 50 POP3account *account;
43 AbstractMail *wrapper; 51 AbstractMail *wrapper;
44 52 void disconnect();
53 void setOnOffline();
45}; 54};
46 55
47class POP3folderItem : public AccountViewItem 56class POP3folderItem : public AccountViewItem
@@ -49,7 +58,7 @@ class POP3folderItem : public AccountViewItem
49 58
50public: 59public:
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&);
55 virtual QPopupMenu * getContextMenu(); 64 virtual QPopupMenu * getContextMenu();
@@ -57,8 +66,6 @@ public:
57 66
58protected: 67protected:
59 void downloadMails(); 68 void downloadMails();
60
61private:
62 Folder *folder; 69 Folder *folder;
63 POP3viewItem *pop3; 70 POP3viewItem *pop3;
64}; 71};
@@ -69,23 +76,24 @@ class IMAPviewItem : public AccountViewItem
69{ 76{
70 friend class IMAPfolderItem; 77 friend class IMAPfolderItem;
71public: 78public:
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&);
76 AbstractMail *getWrapper(); 83 AbstractMail *getWrapper();
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
80protected: 90protected:
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
86private:
87 IMAPaccount *account; 94 IMAPaccount *account;
88 AbstractMail *wrapper; 95 AbstractMail *wrapper;
96 QStringList currentFolders;
89}; 97};
90 98
91class IMAPfolderItem : public AccountViewItem 99class IMAPfolderItem : public AccountViewItem
@@ -94,7 +102,7 @@ class IMAPfolderItem : public AccountViewItem
94public: 102public:
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&);
100 bool matchName(const QString&name)const; 108 bool matchName(const QString&name)const;
@@ -104,8 +112,7 @@ public:
104protected: 112protected:
105 virtual void createNewFolder(); 113 virtual void createNewFolder();
106 virtual void deleteFolder(); 114 virtual void deleteFolder();
107 115 virtual void downloadMails();
108private:
109 Folder *folder; 116 Folder *folder;
110 IMAPviewItem *imap; 117 IMAPviewItem *imap;
111}; 118};
@@ -115,21 +122,18 @@ class MBOXviewItem : public AccountViewItem
115 friend class MBOXfolderItem; 122 friend class MBOXfolderItem;
116 123
117public: 124public:
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 );
123 AbstractMail *getWrapper(); 129 AbstractMail *getWrapper();
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
127protected: 135protected:
128 virtual void refresh(bool force=false);
129 virtual void createFolder(); 136 virtual void createFolder();
130
131private:
132// MBOXaccount *account;
133 QString m_Path; 137 QString m_Path;
134 AbstractMail *wrapper; 138 AbstractMail *wrapper;
135 139
@@ -140,15 +144,15 @@ class MBOXfolderItem : public AccountViewItem
140 144
141public: 145public:
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
149protected: 154protected:
150 virtual void deleteFolder(); 155 virtual void deleteFolder();
151private:
152 Folder *folder; 156 Folder *folder;
153 MBOXviewItem *mbox; 157 MBOXviewItem *mbox;
154}; 158};
@@ -159,8 +163,10 @@ class AccountView : public QListView
159 163
160public: 164public:
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
165public slots: 171public slots:
166 virtual void refreshAll(); 172 virtual void refreshAll();
@@ -168,12 +174,15 @@ public slots:
168 virtual void refreshCurrent(); 174 virtual void refreshCurrent();
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
172signals: 179signals:
173 void refreshMailview(QList<RecMail>*); 180 void refreshMailview(QList<RecMail>*);
174 181
175private: 182protected:
176 QListViewItem* m_currentItem; 183 QListViewItem* m_currentItem;
184 QValueList<IMAPviewItem*> imapAccounts;
185 QValueList<MBOXviewItem*> mboxAccounts;
177}; 186};
178 187
179#endif 188#endif
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
@@ -21,9 +21,9 @@ AbstractMail* AbstractMail::getWrapper(POP3account *a)
21 return new POP3wrapper(a); 21 return new POP3wrapper(a);
22} 22}
23 23
24AbstractMail* AbstractMail::getWrapper(const QString&a) 24AbstractMail* 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
29encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) 29encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
@@ -99,3 +99,8 @@ QString AbstractMail::defaultLocalfolder()
99 f += "/Applications/opiemail/localmail"; 99 f += "/Applications/opiemail/localmail";
100 return f; 100 return f;
101} 101}
102
103/* temporary - will be removed when implemented in all classes */
104void 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
@@ -31,6 +31,7 @@ public:
31 virtual void deleteMail(const RecMail&mail)=0; 31 virtual void deleteMail(const RecMail&mail)=0;
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;
36 37
@@ -46,11 +47,12 @@ public:
46 static AbstractMail* getWrapper(IMAPaccount *a); 47 static AbstractMail* getWrapper(IMAPaccount *a);
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
55protected: 57protected:
56 static encodedString*decode_String(const encodedString*text,const QString&enc); 58 static encodedString*decode_String(const encodedString*text,const QString&enc);
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
@@ -29,6 +29,7 @@ void IMAPwrapper::login()
29 uint16_t port; 29 uint16_t port;
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 */
34 if (m_imap) { 35 if (m_imap) {
@@ -1006,6 +1007,11 @@ const QString&IMAPwrapper::getType()const
1006 return account->getType(); 1007 return account->getType();
1007} 1008}
1008 1009
1010const QString&IMAPwrapper::getName()const
1011{
1012 return account->getAccountName();
1013}
1014
1009encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) 1015encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail)
1010{ 1016{
1011 // dummy 1017 // dummy
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
@@ -45,6 +45,8 @@ public:
45 45
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
48protected: 50protected:
49 RecMail*parse_list_result(mailimap_msg_att*); 51 RecMail*parse_list_result(mailimap_msg_att*);
50 void login(); 52 void login();
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
@@ -8,8 +8,8 @@
8 8
9const QString MBOXwrapper::wrapperType="MBOX"; 9const QString MBOXwrapper::wrapperType="MBOX";
10 10
11MBOXwrapper::MBOXwrapper(const QString & mbox_dir) 11MBOXwrapper::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);
15 if (!dir.exists()) { 15 if (!dir.exists()) {
@@ -330,3 +330,8 @@ const QString&MBOXwrapper::getType()const
330{ 330{
331 return wrapperType; 331 return wrapperType;
332} 332}
333
334const 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
@@ -13,7 +13,7 @@ class MBOXwrapper : public Genericwrapper
13{ 13{
14 Q_OBJECT 14 Q_OBJECT
15public: 15public:
16 MBOXwrapper(const QString & dir); 16 MBOXwrapper(const QString & dir,const QString&name);
17 virtual ~MBOXwrapper(); 17 virtual ~MBOXwrapper();
18 18
19 virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); 19 virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
@@ -32,13 +32,15 @@ public:
32 static void mbox_progress( size_t current, size_t maximum ); 32 static void mbox_progress( size_t current, size_t maximum );
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
39protected: 40protected:
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};
44 46
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
@@ -108,6 +108,7 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target )
108 108
109void POP3wrapper::login() 109void 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;
113 114
@@ -249,3 +250,8 @@ const QString&POP3wrapper::getType()const
249{ 250{
250 return account->getType(); 251 return account->getType();
251} 252}
253
254const 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
@@ -30,6 +30,7 @@ public:
30 virtual encodedString* fetchRawBody(const RecMail&mail); 30 virtual encodedString* fetchRawBody(const RecMail&mail);
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
35protected: 36protected:
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
@@ -168,6 +168,8 @@ void IMAPaccount::read()
168 if (password.isNull()) password = ""; 168 if (password.isNull()) password = "";
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
173void IMAPaccount::save() 175void IMAPaccount::save()
@@ -184,7 +186,9 @@ void IMAPaccount::save()
184 conf->writeEntry( "User", user ); 186 conf->writeEntry( "User", user );
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
190 194
@@ -238,6 +242,8 @@ void POP3account::read()
238 ssl = conf->readBoolEntry( "SSL" ); 242 ssl = conf->readBoolEntry( "SSL" );
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
243void POP3account::save() 249void POP3account::save()
@@ -253,7 +259,9 @@ void POP3account::save()
253 conf->writeEntry( "SSL", ssl ); 259 conf->writeEntry( "SSL", ssl );
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
259 267
@@ -313,6 +321,7 @@ void SMTPaccount::read()
313 login = conf->readBoolEntry( "Login" ); 321 login = conf->readBoolEntry( "Login" );
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
318void SMTPaccount::save() 327void SMTPaccount::save()
@@ -330,6 +339,7 @@ void SMTPaccount::save()
330 conf->writeEntry( "User", user ); 339 conf->writeEntry( "User", user );
331 conf->writeEntryCrypt( "Password", password ); 340 conf->writeEntryCrypt( "Password", password );
332 conf->write(); 341 conf->write();
342 delete conf;
333} 343}
334 344
335 345
@@ -386,6 +396,7 @@ void NNTPaccount::read()
386 login = conf->readBoolEntry( "Login" ); 396 login = conf->readBoolEntry( "Login" );
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
391void NNTPaccount::save() 402void NNTPaccount::save()
@@ -403,6 +414,7 @@ void NNTPaccount::save()
403 conf->writeEntry( "User", user ); 414 conf->writeEntry( "User", user );
404 conf->writeEntryCrypt( "Password", password ); 415 conf->writeEntryCrypt( "Password", password );
405 conf->write(); 416 conf->write();
417 delete conf;
406} 418}
407 419
408 420
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
@@ -30,6 +30,9 @@ public:
30 30
31 void setSSL( bool b ) { ssl = b; } 31 void setSSL( bool b ) { ssl = b; }
32 bool getSSL() { return ssl; } 32 bool getSSL() { return ssl; }
33
34 void setOffline(bool b) {offline = b;}
35 bool getOffline()const{return offline;}
33 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..." ); }
@@ -38,7 +41,7 @@ public:
38protected: 41protected:
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
44class IMAPaccount : public Account 47class IMAPaccount : public Account
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
@@ -489,7 +489,7 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box)
489{ 489{
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;
495} 495}
@@ -516,11 +516,9 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp )
516 qDebug("Error fetching mime..."); 516 qDebug("Error fetching mime...");
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" );
526 cfg.setGroup( "Status" ); 524 cfg.setGroup( "Status" );
@@ -636,7 +634,7 @@ void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
636 } 634 }
637} 635}
638 636
639int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) 637int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which)
640{ 638{
641 size_t curTok = 0; 639 size_t curTok = 0;
642 mailimf_fields *fields = 0; 640 mailimf_fields *fields = 0;
@@ -685,7 +683,7 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp)
685 if (!smtp) return false; 683 if (!smtp) return false;
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");
691 return false; 689 return false;
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
@@ -10,7 +10,7 @@
10#include "settings.h" 10#include "settings.h"
11 11
12class Mail; 12class Mail;
13class MBOXwrapper; 13class AbstractMail;
14class RecMail; 14class RecMail;
15class Attachment; 15class Attachment;
16struct mailimf_fields; 16struct mailimf_fields;
@@ -59,7 +59,7 @@ protected:
59 void storeMail(mailmime*mail, const QString&box); 59 void storeMail(mailmime*mail, const QString&box);
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;
65 static const char* USER_AGENT; 65 static const char* USER_AGENT;
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,9 +1,15 @@
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
3Selectstore::Selectstore(QWidget* parent, const char* name) 7Selectstore::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
9Selectstore::~Selectstore() 15Selectstore::~Selectstore()
@@ -12,8 +18,53 @@ Selectstore::~Selectstore()
12 18
13void Selectstore::slotCreateNewFolder() 19void Selectstore::slotCreateNewFolder()
14{ 20{
21 bool how = newFoldersel->isChecked();
22 folderSelection->setEnabled(!how);
23 newFolderedit->setEnabled(how);
15} 24}
16 25
17void Selectstore::slotMoveMail() 26void Selectstore::slotMoveMail()
18{ 27{
19} 28}
29
30void 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
41void Selectstore::slotAccountselected(int i)
42{
43 folderSelection->clear();
44 folderSelection->insertStringList(folderMap[i]);
45 cMail = mailMap[i];
46}
47
48QString Selectstore::currentFolder()
49{
50 if (newFoldersel->isChecked()) {
51 return newFolderedit->text();
52 } else {
53 return folderSelection->currentText();
54 }
55}
56
57AbstractMail*Selectstore::currentMail()
58{
59 return cMail;
60}
61
62bool Selectstore::newFolder()
63{
64 return newFoldersel->isChecked();
65}
66
67bool 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
@@ -2,6 +2,11 @@
2#define _SELECTSTORE_H 2#define _SELECTSTORE_H
3 3
4#include "selectstoreui.h" 4#include "selectstoreui.h"
5#include <qvaluelist.h>
6#include <qmap.h>
7#include <qstringlist.h>
8
9class AbstractMail;
5 10
6class Selectstore:public selectstoreui 11class Selectstore:public selectstoreui
7{ 12{
@@ -9,11 +14,20 @@ class Selectstore:public selectstoreui
9public: 14public:
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
13protected: 23protected slots:
14 virtual void slotCreateNewFolder(); 24 virtual void slotCreateNewFolder();
15 virtual void slotMoveMail(); 25 virtual void slotMoveMail();
16protected slots: 26 virtual void slotAccountselected(int);
17 27
28protected:
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
@@ -11,7 +11,7 @@
11 <rect> 11 <rect>
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>
17 </property> 17 </property>
@@ -28,11 +28,11 @@
28 <vbox> 28 <vbox>
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>
38 <class>QLabel</class> 38 <class>QLabel</class>
@@ -174,6 +174,27 @@
174 </property> 174 </property>
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">
179 <name>name</name> 200 <name>name</name>
@@ -231,8 +252,22 @@
231 <receiver>selectstoreui</receiver> 252 <receiver>selectstoreui</receiver>
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>
238 <tabstop>accountSelection</tabstop> 273 <tabstop>accountSelection</tabstop>