author | alwin <alwin> | 2004-01-08 02:52:13 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-08 02:52:13 (UTC) |
commit | 05d47b2603adfab0e16f7395e34b7aa56ce6d8de (patch) (unidiff) | |
tree | 4253654acb70b859fd0d32981132dffd35092b9f /noncore/net/mail/accountview.cpp | |
parent | dfa1477a28ecd90e08cf09aeecbe816e94bec0b5 (diff) | |
download | opie-05d47b2603adfab0e16f7395e34b7aa56ce6d8de.zip opie-05d47b2603adfab0e16f7395e34b7aa56ce6d8de.tar.gz opie-05d47b2603adfab0e16f7395e34b7aa56ce6d8de.tar.bz2 |
move/copy mails to another folder resides inside wrappers so we can
use special funs of libetpan and/or mailserver itself (eg. imap)
libetpan 0.32 requires for that feature a patch! (see libetpanstuff/)
accounts marked as "offline" get a new icon
TODO:
- when creating a new folder while copy/move on imap-server, get the
real resulting foldername when using prefix
- implement usage of copy/move inside one mbox using special etpan funs
Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index eea021f..b7de7b9 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qpopupmenu.h> | 8 | #include <qpopupmenu.h> |
9 | 9 | ||
10 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} | ||
10 | /** | 11 | /** |
11 | * POP3 Account stuff | 12 | * POP3 Account stuff |
12 | */ | 13 | */ |
@@ -15,7 +16,14 @@ POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | |||
15 | { | 16 | { |
16 | account = a; | 17 | account = a; |
17 | wrapper = AbstractMail::getWrapper( account ); | 18 | wrapper = AbstractMail::getWrapper( account ); |
18 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 19 | SETPIX(PIXMAP_POP3FOLDER); |
20 | #if 0 | ||
21 | if (!account->getOffline()) { | ||
22 | setPixmap( 0, ); | ||
23 | } else { | ||
24 | setPixmap( 0, PIXMAP_OFFLINE ); | ||
25 | } | ||
26 | #endif | ||
19 | setText( 0, account->getAccountName() ); | 27 | setText( 0, account->getAccountName() ); |
20 | setOpen( true ); | 28 | setOpen( true ); |
21 | } | 29 | } |
@@ -32,6 +40,11 @@ AbstractMail *POP3viewItem::getWrapper() | |||
32 | 40 | ||
33 | void POP3viewItem::refresh( QList<RecMail> & ) | 41 | void POP3viewItem::refresh( QList<RecMail> & ) |
34 | { | 42 | { |
43 | refresh(); | ||
44 | } | ||
45 | |||
46 | void POP3viewItem::refresh() | ||
47 | { | ||
35 | if (account->getOffline()) return; | 48 | if (account->getOffline()) return; |
36 | QList<Folder> *folders = wrapper->listFolders(); | 49 | QList<Folder> *folders = wrapper->listFolders(); |
37 | QListViewItem *child = firstChild(); | 50 | QListViewItem *child = firstChild(); |
@@ -89,6 +102,8 @@ void POP3viewItem::setOnOffline() | |||
89 | } | 102 | } |
90 | account->setOffline(!account->getOffline()); | 103 | account->setOffline(!account->getOffline()); |
91 | account->save(); | 104 | account->save(); |
105 | SETPIX(PIXMAP_POP3FOLDER); | ||
106 | refresh(); | ||
92 | } | 107 | } |
93 | 108 | ||
94 | void POP3viewItem::contextMenuSelected(int which) | 109 | void POP3viewItem::contextMenuSelected(int which) |
@@ -178,7 +193,7 @@ IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) | |||
178 | { | 193 | { |
179 | account = a; | 194 | account = a; |
180 | wrapper = AbstractMail::getWrapper( account ); | 195 | wrapper = AbstractMail::getWrapper( account ); |
181 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 196 | SETPIX(PIXMAP_IMAPFOLDER); |
182 | setText( 0, account->getAccountName() ); | 197 | setText( 0, account->getAccountName() ); |
183 | setOpen( true ); | 198 | setOpen( true ); |
184 | } | 199 | } |
@@ -337,6 +352,7 @@ void IMAPviewItem::contextMenuSelected(int id) | |||
337 | } | 352 | } |
338 | account->setOffline(!account->getOffline()); | 353 | account->setOffline(!account->getOffline()); |
339 | account->save(); | 354 | account->save(); |
355 | SETPIX(PIXMAP_IMAPFOLDER); | ||
340 | refreshFolders(false); | 356 | refreshFolders(false); |
341 | break; | 357 | break; |
342 | default: | 358 | default: |
@@ -665,7 +681,6 @@ void AccountView::setupFolderselect(Selectstore*sels) | |||
665 | 681 | ||
666 | void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) | 682 | void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) |
667 | { | 683 | { |
668 | unsigned int i = 0; | ||
669 | AbstractMail*targetMail = 0; | 684 | AbstractMail*targetMail = 0; |
670 | QString targetFolder = ""; | 685 | QString targetFolder = ""; |
671 | Selectstore sels; | 686 | Selectstore sels; |
@@ -677,18 +692,15 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) | |||
677 | targetFolder.isEmpty()) { | 692 | targetFolder.isEmpty()) { |
678 | return; | 693 | return; |
679 | } | 694 | } |
680 | 695 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { | |
681 | QList<RecMail> t; | 696 | QMessageBox::critical(0,tr("Error creating new Folder"), |
682 | fromWrapper->listMessages(fromFolder->getName(),t); | 697 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
683 | encodedString*st = 0; | 698 | return; |
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 | } | 699 | } |
700 | qDebug("Targetfolder: %s",targetFolder.latin1()); | ||
701 | qDebug("Fromfolder: %s",fromFolder->getName().latin1()); | ||
702 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); | ||
703 | refreshCurrent(); | ||
692 | } | 704 | } |
693 | 705 | ||
694 | /** | 706 | /** |