-rw-r--r-- | noncore/net/mail/accountview.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index b6bf298..bc13336 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,144 +1,145 @@ | |||
1 | #include "accountview.h" | 1 | #include "accountview.h" |
2 | #include "mailtypes.h" | 2 | #include "mailtypes.h" |
3 | #include "defines.h" | 3 | #include "defines.h" |
4 | 4 | ||
5 | 5 | ||
6 | /** | 6 | /** |
7 | * POP3 Account stuff | 7 | * POP3 Account stuff |
8 | */ | 8 | */ |
9 | 9 | ||
10 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) | 10 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) |
11 | : AccountViewItem( parent ) | 11 | : AccountViewItem( parent ) |
12 | { | 12 | { |
13 | account = a; | 13 | account = a; |
14 | wrapper = AbstractMail::getWrapper( account ); | 14 | wrapper = AbstractMail::getWrapper( account ); |
15 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 15 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
16 | setText( 0, account->getAccountName() ); | 16 | setText( 0, account->getAccountName() ); |
17 | setOpen( true ); | ||
17 | } | 18 | } |
18 | 19 | ||
19 | POP3viewItem::~POP3viewItem() | 20 | POP3viewItem::~POP3viewItem() |
20 | { | 21 | { |
21 | delete wrapper; | 22 | delete wrapper; |
22 | } | 23 | } |
23 | 24 | ||
24 | AbstractMail *POP3viewItem::getWrapper() | 25 | AbstractMail *POP3viewItem::getWrapper() |
25 | { | 26 | { |
26 | return wrapper; | 27 | return wrapper; |
27 | } | 28 | } |
28 | 29 | ||
29 | void POP3viewItem::refresh( QList<RecMail> & ) | 30 | void POP3viewItem::refresh( QList<RecMail> & ) |
30 | { | 31 | { |
31 | QList<Folder> *folders = wrapper->listFolders(); | 32 | QList<Folder> *folders = wrapper->listFolders(); |
32 | QListViewItem *child = firstChild(); | 33 | QListViewItem *child = firstChild(); |
33 | while ( child ) { | 34 | while ( child ) { |
34 | QListViewItem *tmp = child; | 35 | QListViewItem *tmp = child; |
35 | child = child->nextSibling(); | 36 | child = child->nextSibling(); |
36 | delete tmp; | 37 | delete tmp; |
37 | } | 38 | } |
38 | Folder *it; | 39 | Folder *it; |
39 | QListViewItem*item = 0; | 40 | QListViewItem*item = 0; |
40 | for ( it = folders->first(); it; it = folders->next() ) { | 41 | for ( it = folders->first(); it; it = folders->next() ) { |
41 | item = new POP3folderItem( it, this , item ); | 42 | item = new POP3folderItem( it, this , item ); |
42 | item->setSelectable(it->may_select()); | 43 | item->setSelectable(it->may_select()); |
43 | } | 44 | } |
44 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 45 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
45 | folders->setAutoDelete(false); | 46 | folders->setAutoDelete(false); |
46 | delete folders; | 47 | delete folders; |
47 | } | 48 | } |
48 | 49 | ||
49 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) | 50 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) |
50 | { | 51 | { |
51 | qDebug( "POP3 fetchBody" ); | 52 | qDebug( "POP3 fetchBody" ); |
52 | return wrapper->fetchBody( mail ); | 53 | return wrapper->fetchBody( mail ); |
53 | } | 54 | } |
54 | 55 | ||
55 | POP3folderItem::~POP3folderItem() | 56 | POP3folderItem::~POP3folderItem() |
56 | { | 57 | { |
57 | delete folder; | 58 | delete folder; |
58 | } | 59 | } |
59 | 60 | ||
60 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) | 61 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) |
61 | : AccountViewItem( parent,after ) | 62 | : AccountViewItem( parent,after ) |
62 | { | 63 | { |
63 | folder = folderInit; | 64 | folder = folderInit; |
64 | pop3 = parent; | 65 | pop3 = parent; |
65 | if (folder->getDisplayName().lower()!="inbox") { | 66 | if (folder->getDisplayName().lower()!="inbox") { |
66 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 67 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
67 | } else { | 68 | } else { |
68 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 69 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
69 | } | 70 | } |
70 | setText( 0, folder->getDisplayName() ); | 71 | setText( 0, folder->getDisplayName() ); |
71 | } | 72 | } |
72 | 73 | ||
73 | void POP3folderItem::refresh(QList<RecMail>&target) | 74 | void POP3folderItem::refresh(QList<RecMail>&target) |
74 | { | 75 | { |
75 | if (folder->may_select()) | 76 | if (folder->may_select()) |
76 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 77 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
77 | } | 78 | } |
78 | 79 | ||
79 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) | 80 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) |
80 | { | 81 | { |
81 | return pop3->getWrapper()->fetchBody(aMail); | 82 | return pop3->getWrapper()->fetchBody(aMail); |
82 | } | 83 | } |
83 | 84 | ||
84 | /** | 85 | /** |
85 | * IMAP Account stuff | 86 | * IMAP Account stuff |
86 | */ | 87 | */ |
87 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) | 88 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) |
88 | : AccountViewItem( parent ) | 89 | : AccountViewItem( parent ) |
89 | { | 90 | { |
90 | account = a; | 91 | account = a; |
91 | wrapper = AbstractMail::getWrapper( account ); | 92 | wrapper = AbstractMail::getWrapper( account ); |
92 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 93 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
93 | setText( 0, account->getAccountName() ); | 94 | setText( 0, account->getAccountName() ); |
94 | setOpen( true ); | 95 | setOpen( true ); |
95 | } | 96 | } |
96 | 97 | ||
97 | IMAPviewItem::~IMAPviewItem() | 98 | IMAPviewItem::~IMAPviewItem() |
98 | { | 99 | { |
99 | delete wrapper; | 100 | delete wrapper; |
100 | } | 101 | } |
101 | 102 | ||
102 | AbstractMail *IMAPviewItem::getWrapper() | 103 | AbstractMail *IMAPviewItem::getWrapper() |
103 | { | 104 | { |
104 | return wrapper; | 105 | return wrapper; |
105 | } | 106 | } |
106 | 107 | ||
107 | void IMAPviewItem::refresh(QList<RecMail>&) | 108 | void IMAPviewItem::refresh(QList<RecMail>&) |
108 | { | 109 | { |
109 | if (childCount()>0) return; | 110 | if (childCount()>0) return; |
110 | QList<Folder> *folders = wrapper->listFolders(); | 111 | QList<Folder> *folders = wrapper->listFolders(); |
111 | 112 | ||
112 | QListViewItem *child = firstChild(); | 113 | QListViewItem *child = firstChild(); |
113 | while ( child ) { | 114 | while ( child ) { |
114 | QListViewItem *tmp = child; | 115 | QListViewItem *tmp = child; |
115 | child = child->nextSibling(); | 116 | child = child->nextSibling(); |
116 | delete tmp; | 117 | delete tmp; |
117 | } | 118 | } |
118 | 119 | ||
119 | Folder *it; | 120 | Folder *it; |
120 | QListViewItem*item = 0; | 121 | QListViewItem*item = 0; |
121 | QListViewItem*titem = 0; | 122 | QListViewItem*titem = 0; |
122 | QListViewItem*inboxitem = 0; | 123 | QListViewItem*inboxitem = 0; |
123 | QString fname,del,search; | 124 | QString fname,del,search; |
124 | int pos; | 125 | int pos; |
125 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 126 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
126 | folders->setAutoDelete(false); | 127 | folders->setAutoDelete(false); |
127 | 128 | ||
128 | for ( it = folders->first(); it; it = folders->next() ) { | 129 | for ( it = folders->first(); it; it = folders->next() ) { |
129 | if (it->getDisplayName().lower()=="inbox") { | 130 | if (it->getDisplayName().lower()=="inbox") { |
130 | inboxitem = new IMAPfolderItem( it, this , item ); | 131 | inboxitem = new IMAPfolderItem( it, this , item ); |
131 | folders->remove(it); | 132 | folders->remove(it); |
132 | qDebug("inbox found"); | 133 | qDebug("inbox found"); |
133 | break; | 134 | break; |
134 | } | 135 | } |
135 | } | 136 | } |
136 | 137 | ||
137 | for ( it = folders->first(); it; it = folders->next() ) { | 138 | for ( it = folders->first(); it; it = folders->next() ) { |
138 | fname = it->getDisplayName(); | 139 | fname = it->getDisplayName(); |
139 | pos = fname.findRev(it->Separator()); | 140 | pos = fname.findRev(it->Separator()); |
140 | if (pos != -1) { | 141 | if (pos != -1) { |
141 | fname = fname.left(pos); | 142 | fname = fname.left(pos); |
142 | qDebug(fname); | 143 | qDebug(fname); |
143 | } | 144 | } |
144 | IMAPfolderItem*pitem = (IMAPfolderItem*)firstChild(); | 145 | IMAPfolderItem*pitem = (IMAPfolderItem*)firstChild(); |