-rw-r--r-- | noncore/net/mail/.cvsignore | 3 | ||||
-rw-r--r-- | noncore/net/mail/accountitem.cpp | 15 | ||||
-rw-r--r-- | noncore/net/mail/accountitem.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/mail.pro | 11 | ||||
-rw-r--r-- | noncore/net/mail/nntpgroups.cpp | 57 | ||||
-rw-r--r-- | noncore/net/mail/nntpgroups.h | 33 | ||||
-rw-r--r-- | noncore/net/mail/nntpgroupsdlg.cpp | 29 | ||||
-rw-r--r-- | noncore/net/mail/nntpgroupsdlg.h | 24 | ||||
-rw-r--r-- | noncore/net/mail/nntpgroupsui.ui | 88 |
9 files changed, 256 insertions, 5 deletions
diff --git a/noncore/net/mail/.cvsignore b/noncore/net/mail/.cvsignore index 4957719..3819f80 100644 --- a/noncore/net/mail/.cvsignore +++ b/noncore/net/mail/.cvsignore | |||
@@ -1,31 +1,32 @@ | |||
1 | .moc | 1 | .moc |
2 | Makefile | 2 | Makefile |
3 | addresspickerui.cpp | 3 | addresspickerui.cpp |
4 | addresspickerui.h | 4 | addresspickerui.h |
5 | composemailui.cpp | 5 | composemailui.cpp |
6 | composemailui.h | 6 | composemailui.h |
7 | editaccountsui.cpp | 7 | editaccountsui.cpp |
8 | editaccountsui.h | 8 | editaccountsui.h |
9 | imapconfigui.cpp | 9 | imapconfigui.cpp |
10 | imapconfigui.h | 10 | imapconfigui.h |
11 | logindialogui.cpp | 11 | logindialogui.cpp |
12 | logindialogui.h | 12 | logindialogui.h |
13 | nntpconfigui.cpp | 13 | nntpconfigui.cpp |
14 | nntpconfigui.h | 14 | nntpconfigui.h |
15 | pop3configui.cpp | 15 | pop3configui.cpp |
16 | pop3configui.h | 16 | pop3configui.h |
17 | selectmailtypeui.cpp | 17 | selectmailtypeui.cpp |
18 | selectmailtypeui.h | 18 | selectmailtypeui.h |
19 | smtpconfigui.cpp | 19 | smtpconfigui.cpp |
20 | smtpconfigui.h | 20 | smtpconfigui.h |
21 | settingsdialogui.cpp | 21 | settingsdialogui.cpp |
22 | settingsdialogui.h | 22 | settingsdialogui.h |
23 | statuswidgetui.cpp | 23 | statuswidgetui.cpp |
24 | statuswidgetui.h | 24 | statuswidgetui.h |
25 | newmaildirui.cpp | 25 | newmaildirui.cpp |
26 | newmaildirui.h | 26 | newmaildirui.h |
27 | sendmailprogressui.cpp | 27 | sendmailprogressui.cpp |
28 | sendmailprogressui.h | 28 | sendmailprogressui.h |
29 | selectstoreui.cpp | 29 | selectstoreui.cpp |
30 | selectstoreui.h | 30 | selectstoreui.h |
31 | 31 | nntpgroupsui.cpp | |
32 | nntpgroupsui.h | ||
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index e925d8d..0d636a4 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -1,1116 +1,1129 @@ | |||
1 | 1 | ||
2 | #include "accountitem.h" | 2 | #include "accountitem.h" |
3 | #include "accountview.h" | 3 | #include "accountview.h" |
4 | #include "newmaildir.h" | 4 | #include "newmaildir.h" |
5 | #include "nntpgroupsdlg.h" | ||
5 | #include "defines.h" | 6 | #include "defines.h" |
6 | 7 | ||
7 | /* OPIE */ | 8 | /* OPIE */ |
8 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
9 | #include <libmailwrapper/abstractmail.h> | 10 | #include <libmailwrapper/abstractmail.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 11 | #include <libmailwrapper/mailwrapper.h> |
11 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
12 | 13 | ||
13 | /* QT */ | 14 | /* QT */ |
14 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
15 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
16 | 17 | ||
17 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} | 18 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} |
18 | /** | 19 | /** |
19 | * POP3 Account stuff | 20 | * POP3 Account stuff |
20 | */ | 21 | */ |
21 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | 22 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) |
22 | : AccountViewItem( parent ) | 23 | : AccountViewItem( parent ) |
23 | { | 24 | { |
24 | account = a; | 25 | account = a; |
25 | wrapper = AbstractMail::getWrapper( account ); | 26 | wrapper = AbstractMail::getWrapper( account ); |
26 | SETPIX(PIXMAP_POP3FOLDER); | 27 | SETPIX(PIXMAP_POP3FOLDER); |
27 | #if 0 | 28 | #if 0 |
28 | if (!account->getOffline()) | 29 | if (!account->getOffline()) |
29 | { | 30 | { |
30 | setPixmap( 0, ); | 31 | setPixmap( 0, ); |
31 | } | 32 | } |
32 | else | 33 | else |
33 | { | 34 | { |
34 | setPixmap( 0, PIXMAP_OFFLINE ); | 35 | setPixmap( 0, PIXMAP_OFFLINE ); |
35 | } | 36 | } |
36 | #endif | 37 | #endif |
37 | setText( 0, account->getAccountName() ); | 38 | setText( 0, account->getAccountName() ); |
38 | setOpen( true ); | 39 | setOpen( true ); |
39 | } | 40 | } |
40 | 41 | ||
41 | POP3viewItem::~POP3viewItem() | 42 | POP3viewItem::~POP3viewItem() |
42 | { | 43 | { |
43 | delete wrapper; | 44 | delete wrapper; |
44 | } | 45 | } |
45 | 46 | ||
46 | AbstractMail *POP3viewItem::getWrapper() | 47 | AbstractMail *POP3viewItem::getWrapper() |
47 | { | 48 | { |
48 | return wrapper; | 49 | return wrapper; |
49 | } | 50 | } |
50 | 51 | ||
51 | void POP3viewItem::refresh( QList<RecMail> & ) | 52 | void POP3viewItem::refresh( QList<RecMail> & ) |
52 | { | 53 | { |
53 | refresh(); | 54 | refresh(); |
54 | } | 55 | } |
55 | 56 | ||
56 | void POP3viewItem::refresh() | 57 | void POP3viewItem::refresh() |
57 | { | 58 | { |
58 | if (account->getOffline()) return; | 59 | if (account->getOffline()) return; |
59 | QList<Folder> *folders = wrapper->listFolders(); | 60 | QList<Folder> *folders = wrapper->listFolders(); |
60 | QListViewItem *child = firstChild(); | 61 | QListViewItem *child = firstChild(); |
61 | while ( child ) | 62 | while ( child ) |
62 | { | 63 | { |
63 | QListViewItem *tmp = child; | 64 | QListViewItem *tmp = child; |
64 | child = child->nextSibling(); | 65 | child = child->nextSibling(); |
65 | delete tmp; | 66 | delete tmp; |
66 | } | 67 | } |
67 | Folder *it; | 68 | Folder *it; |
68 | QListViewItem*item = 0; | 69 | QListViewItem*item = 0; |
69 | for ( it = folders->first(); it; it = folders->next() ) | 70 | for ( it = folders->first(); it; it = folders->next() ) |
70 | { | 71 | { |
71 | item = new POP3folderItem( it, this , item ); | 72 | item = new POP3folderItem( it, this , item ); |
72 | item->setSelectable(it->may_select()); | 73 | item->setSelectable(it->may_select()); |
73 | } | 74 | } |
74 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 75 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
75 | folders->setAutoDelete(false); | 76 | folders->setAutoDelete(false); |
76 | delete folders; | 77 | delete folders; |
77 | } | 78 | } |
78 | 79 | ||
79 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) | 80 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) |
80 | { | 81 | { |
81 | qDebug( "POP3 fetchBody" ); | 82 | qDebug( "POP3 fetchBody" ); |
82 | return wrapper->fetchBody( mail ); | 83 | return wrapper->fetchBody( mail ); |
83 | } | 84 | } |
84 | 85 | ||
85 | QPopupMenu * POP3viewItem::getContextMenu() | 86 | QPopupMenu * POP3viewItem::getContextMenu() |
86 | { | 87 | { |
87 | QPopupMenu *m = new QPopupMenu(0); | 88 | QPopupMenu *m = new QPopupMenu(0); |
88 | if (m) | 89 | if (m) |
89 | { | 90 | { |
90 | if (!account->getOffline()) | 91 | if (!account->getOffline()) |
91 | { | 92 | { |
92 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 93 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
93 | m->insertItem(QObject::tr("Set offline",contextName),1); | 94 | m->insertItem(QObject::tr("Set offline",contextName),1); |
94 | } | 95 | } |
95 | else | 96 | else |
96 | { | 97 | { |
97 | m->insertItem(QObject::tr("Set online",contextName),1); | 98 | m->insertItem(QObject::tr("Set online",contextName),1); |
98 | } | 99 | } |
99 | } | 100 | } |
100 | return m; | 101 | return m; |
101 | } | 102 | } |
102 | 103 | ||
103 | void POP3viewItem::disconnect() | 104 | void POP3viewItem::disconnect() |
104 | { | 105 | { |
105 | QListViewItem *child = firstChild(); | 106 | QListViewItem *child = firstChild(); |
106 | while ( child ) | 107 | while ( child ) |
107 | { | 108 | { |
108 | QListViewItem *tmp = child; | 109 | QListViewItem *tmp = child; |
109 | child = child->nextSibling(); | 110 | child = child->nextSibling(); |
110 | delete tmp; | 111 | delete tmp; |
111 | } | 112 | } |
112 | wrapper->logout(); | 113 | wrapper->logout(); |
113 | } | 114 | } |
114 | 115 | ||
115 | void POP3viewItem::setOnOffline() | 116 | void POP3viewItem::setOnOffline() |
116 | { | 117 | { |
117 | if (!account->getOffline()) | 118 | if (!account->getOffline()) |
118 | { | 119 | { |
119 | disconnect(); | 120 | disconnect(); |
120 | } | 121 | } |
121 | account->setOffline(!account->getOffline()); | 122 | account->setOffline(!account->getOffline()); |
122 | account->save(); | 123 | account->save(); |
123 | SETPIX(PIXMAP_POP3FOLDER); | 124 | SETPIX(PIXMAP_POP3FOLDER); |
124 | refresh(); | 125 | refresh(); |
125 | } | 126 | } |
126 | 127 | ||
127 | void POP3viewItem::contextMenuSelected(int which) | 128 | void POP3viewItem::contextMenuSelected(int which) |
128 | { | 129 | { |
129 | switch (which) | 130 | switch (which) |
130 | { | 131 | { |
131 | case 0: | 132 | case 0: |
132 | disconnect(); | 133 | disconnect(); |
133 | break; | 134 | break; |
134 | case 1: | 135 | case 1: |
135 | setOnOffline(); | 136 | setOnOffline(); |
136 | break; | 137 | break; |
137 | } | 138 | } |
138 | } | 139 | } |
139 | 140 | ||
140 | POP3folderItem::~POP3folderItem() | 141 | POP3folderItem::~POP3folderItem() |
141 | {} | 142 | {} |
142 | 143 | ||
143 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) | 144 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) |
144 | : AccountViewItem( parent,after ) | 145 | : AccountViewItem( parent,after ) |
145 | { | 146 | { |
146 | folder = folderInit; | 147 | folder = folderInit; |
147 | pop3 = parent; | 148 | pop3 = parent; |
148 | if (folder->getDisplayName().lower()!="inbox") | 149 | if (folder->getDisplayName().lower()!="inbox") |
149 | { | 150 | { |
150 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 151 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
151 | } | 152 | } |
152 | else | 153 | else |
153 | { | 154 | { |
154 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 155 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
155 | } | 156 | } |
156 | setText( 0, folder->getDisplayName() ); | 157 | setText( 0, folder->getDisplayName() ); |
157 | } | 158 | } |
158 | 159 | ||
159 | void POP3folderItem::refresh(QList<RecMail>&target) | 160 | void POP3folderItem::refresh(QList<RecMail>&target) |
160 | { | 161 | { |
161 | if (folder->may_select()) | 162 | if (folder->may_select()) |
162 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 163 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
163 | } | 164 | } |
164 | 165 | ||
165 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) | 166 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) |
166 | { | 167 | { |
167 | return pop3->getWrapper()->fetchBody(aMail); | 168 | return pop3->getWrapper()->fetchBody(aMail); |
168 | } | 169 | } |
169 | 170 | ||
170 | QPopupMenu * POP3folderItem::getContextMenu() | 171 | QPopupMenu * POP3folderItem::getContextMenu() |
171 | { | 172 | { |
172 | QPopupMenu *m = new QPopupMenu(0); | 173 | QPopupMenu *m = new QPopupMenu(0); |
173 | if (m) | 174 | if (m) |
174 | { | 175 | { |
175 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 176 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
176 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 177 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
177 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 178 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
178 | } | 179 | } |
179 | return m; | 180 | return m; |
180 | } | 181 | } |
181 | 182 | ||
182 | void POP3folderItem::downloadMails() | 183 | void POP3folderItem::downloadMails() |
183 | { | 184 | { |
184 | AccountView*bl = pop3->accountView(); | 185 | AccountView*bl = pop3->accountView(); |
185 | if (!bl) return; | 186 | if (!bl) return; |
186 | bl->downloadMails(folder,pop3->getWrapper()); | 187 | bl->downloadMails(folder,pop3->getWrapper()); |
187 | } | 188 | } |
188 | 189 | ||
189 | void POP3folderItem::contextMenuSelected(int which) | 190 | void POP3folderItem::contextMenuSelected(int which) |
190 | { | 191 | { |
191 | AccountView * view = (AccountView*)listView(); | 192 | AccountView * view = (AccountView*)listView(); |
192 | switch (which) | 193 | switch (which) |
193 | { | 194 | { |
194 | case 0: | 195 | case 0: |
195 | /* must be 'cause pop3 lists are cached */ | 196 | /* must be 'cause pop3 lists are cached */ |
196 | pop3->getWrapper()->logout(); | 197 | pop3->getWrapper()->logout(); |
197 | view->refreshCurrent(); | 198 | view->refreshCurrent(); |
198 | break; | 199 | break; |
199 | case 1: | 200 | case 1: |
200 | deleteAllMail(pop3->getWrapper(),folder); | 201 | deleteAllMail(pop3->getWrapper(),folder); |
201 | break; | 202 | break; |
202 | case 2: | 203 | case 2: |
203 | downloadMails(); | 204 | downloadMails(); |
204 | break; | 205 | break; |
205 | default: | 206 | default: |
206 | break; | 207 | break; |
207 | } | 208 | } |
208 | } | 209 | } |
209 | 210 | ||
210 | /** | 211 | /** |
211 | * NNTP Account stuff | 212 | * NNTP Account stuff |
212 | */ | 213 | */ |
213 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | 214 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) |
214 | : AccountViewItem( parent ) | 215 | : AccountViewItem( parent ) |
215 | { | 216 | { |
216 | account = a; | 217 | account = a; |
217 | wrapper = AbstractMail::getWrapper( account ); | 218 | wrapper = AbstractMail::getWrapper( account ); |
218 | //FIXME | 219 | //FIXME |
219 | SETPIX(PIXMAP_POP3FOLDER); | 220 | SETPIX(PIXMAP_POP3FOLDER); |
220 | #if 0 | 221 | #if 0 |
221 | if (!account->getOffline()) | 222 | if (!account->getOffline()) |
222 | { | 223 | { |
223 | setPixmap( 0, ); | 224 | setPixmap( 0, ); |
224 | } | 225 | } |
225 | else | 226 | else |
226 | { | 227 | { |
227 | setPixmap( 0, PIXMAP_OFFLINE ); | 228 | setPixmap( 0, PIXMAP_OFFLINE ); |
228 | } | 229 | } |
229 | #endif | 230 | #endif |
230 | setText( 0, account->getAccountName() ); | 231 | setText( 0, account->getAccountName() ); |
231 | setOpen( true ); | 232 | setOpen( true ); |
232 | } | 233 | } |
233 | 234 | ||
234 | NNTPviewItem::~NNTPviewItem() | 235 | NNTPviewItem::~NNTPviewItem() |
235 | { | 236 | { |
236 | delete wrapper; | 237 | delete wrapper; |
237 | } | 238 | } |
238 | 239 | ||
239 | AbstractMail *NNTPviewItem::getWrapper() | 240 | AbstractMail *NNTPviewItem::getWrapper() |
240 | { | 241 | { |
241 | return wrapper; | 242 | return wrapper; |
242 | } | 243 | } |
243 | 244 | ||
244 | void NNTPviewItem::refresh( QList<RecMail> & ) | 245 | void NNTPviewItem::refresh( QList<RecMail> & ) |
245 | { | 246 | { |
246 | refresh(); | 247 | refresh(); |
247 | } | 248 | } |
248 | 249 | ||
249 | void NNTPviewItem::refresh() | 250 | void NNTPviewItem::refresh() |
250 | { | 251 | { |
251 | if (account->getOffline()) return; | 252 | if (account->getOffline()) return; |
252 | QList<Folder> *folders = wrapper->listFolders(); | 253 | QList<Folder> *folders = wrapper->listFolders(); |
253 | QListViewItem *child = firstChild(); | 254 | QListViewItem *child = firstChild(); |
254 | while ( child ) | 255 | while ( child ) |
255 | { | 256 | { |
256 | QListViewItem *tmp = child; | 257 | QListViewItem *tmp = child; |
257 | child = child->nextSibling(); | 258 | child = child->nextSibling(); |
258 | delete tmp; | 259 | delete tmp; |
259 | } | 260 | } |
260 | Folder *it; | 261 | Folder *it; |
261 | QListViewItem*item = 0; | 262 | QListViewItem*item = 0; |
262 | for ( it = folders->first(); it; it = folders->next() ) | 263 | for ( it = folders->first(); it; it = folders->next() ) |
263 | { | 264 | { |
264 | item = new NNTPfolderItem( it, this , item ); | 265 | item = new NNTPfolderItem( it, this , item ); |
265 | item->setSelectable(it->may_select()); | 266 | item->setSelectable(it->may_select()); |
266 | } | 267 | } |
267 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 268 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
268 | folders->setAutoDelete(false); | 269 | folders->setAutoDelete(false); |
269 | delete folders; | 270 | delete folders; |
270 | } | 271 | } |
271 | 272 | ||
272 | RecBody NNTPviewItem::fetchBody( const RecMail &mail ) | 273 | RecBody NNTPviewItem::fetchBody( const RecMail &mail ) |
273 | { | 274 | { |
274 | qDebug( "NNTP fetchBody" ); | 275 | qDebug( "NNTP fetchBody" ); |
275 | return wrapper->fetchBody( mail ); | 276 | return wrapper->fetchBody( mail ); |
276 | } | 277 | } |
277 | 278 | ||
278 | QPopupMenu * NNTPviewItem::getContextMenu() | 279 | QPopupMenu * NNTPviewItem::getContextMenu() |
279 | { | 280 | { |
280 | QPopupMenu *m = new QPopupMenu(0); | 281 | QPopupMenu *m = new QPopupMenu(0); |
281 | if (m) | 282 | if (m) |
282 | { | 283 | { |
283 | if (!account->getOffline()) | 284 | if (!account->getOffline()) |
284 | { | 285 | { |
285 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 286 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
286 | m->insertItem(QObject::tr("Set offline",contextName),1); | 287 | m->insertItem(QObject::tr("Set offline",contextName),1); |
288 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); | ||
287 | } | 289 | } |
288 | else | 290 | else |
289 | { | 291 | { |
290 | m->insertItem(QObject::tr("Set online",contextName),1); | 292 | m->insertItem(QObject::tr("Set online",contextName),1); |
291 | } | 293 | } |
292 | } | 294 | } |
293 | return m; | 295 | return m; |
294 | } | 296 | } |
295 | 297 | ||
298 | void NNTPviewItem::subscribeGroups() | ||
299 | { | ||
300 | NNTPGroupsDlg dlg(account); | ||
301 | if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){ | ||
302 | refresh(); | ||
303 | } | ||
304 | } | ||
305 | |||
296 | void NNTPviewItem::disconnect() | 306 | void NNTPviewItem::disconnect() |
297 | { | 307 | { |
298 | QListViewItem *child = firstChild(); | 308 | QListViewItem *child = firstChild(); |
299 | while ( child ) | 309 | while ( child ) |
300 | { | 310 | { |
301 | QListViewItem *tmp = child; | 311 | QListViewItem *tmp = child; |
302 | child = child->nextSibling(); | 312 | child = child->nextSibling(); |
303 | delete tmp; | 313 | delete tmp; |
304 | } | 314 | } |
305 | wrapper->logout(); | 315 | wrapper->logout(); |
306 | } | 316 | } |
307 | 317 | ||
308 | void NNTPviewItem::setOnOffline() | 318 | void NNTPviewItem::setOnOffline() |
309 | { | 319 | { |
310 | if (!account->getOffline()) | 320 | if (!account->getOffline()) |
311 | { | 321 | { |
312 | disconnect(); | 322 | disconnect(); |
313 | } | 323 | } |
314 | account->setOffline(!account->getOffline()); | 324 | account->setOffline(!account->getOffline()); |
315 | account->save(); | 325 | account->save(); |
316 | //FIXME | 326 | //FIXME |
317 | SETPIX(PIXMAP_POP3FOLDER); | 327 | SETPIX(PIXMAP_POP3FOLDER); |
318 | refresh(); | 328 | refresh(); |
319 | } | 329 | } |
320 | 330 | ||
321 | void NNTPviewItem::contextMenuSelected(int which) | 331 | void NNTPviewItem::contextMenuSelected(int which) |
322 | { | 332 | { |
323 | switch (which) | 333 | switch (which) |
324 | { | 334 | { |
325 | case 0: | 335 | case 0: |
326 | disconnect(); | 336 | disconnect(); |
327 | break; | 337 | break; |
328 | case 1: | 338 | case 1: |
329 | setOnOffline(); | 339 | setOnOffline(); |
330 | break; | 340 | break; |
341 | case 2: | ||
342 | subscribeGroups(); | ||
343 | break; | ||
331 | } | 344 | } |
332 | } | 345 | } |
333 | 346 | ||
334 | NNTPfolderItem::~NNTPfolderItem() | 347 | NNTPfolderItem::~NNTPfolderItem() |
335 | {} | 348 | {} |
336 | 349 | ||
337 | NNTPfolderItem::NNTPfolderItem( Folder *folderInit, NNTPviewItem *parent , QListViewItem*after ) | 350 | NNTPfolderItem::NNTPfolderItem( Folder *folderInit, NNTPviewItem *parent , QListViewItem*after ) |
338 | : AccountViewItem( parent,after ) | 351 | : AccountViewItem( parent,after ) |
339 | { | 352 | { |
340 | folder = folderInit; | 353 | folder = folderInit; |
341 | nntp = parent; | 354 | nntp = parent; |
342 | if (folder->getDisplayName().lower()!="inbox") | 355 | if (folder->getDisplayName().lower()!="inbox") |
343 | { | 356 | { |
344 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 357 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
345 | } | 358 | } |
346 | else | 359 | else |
347 | { | 360 | { |
348 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 361 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
349 | } | 362 | } |
350 | setText( 0, folder->getDisplayName() ); | 363 | setText( 0, folder->getDisplayName() ); |
351 | } | 364 | } |
352 | 365 | ||
353 | void NNTPfolderItem::refresh(QList<RecMail>&target) | 366 | void NNTPfolderItem::refresh(QList<RecMail>&target) |
354 | { | 367 | { |
355 | if (folder->may_select()) | 368 | if (folder->may_select()) |
356 | nntp->getWrapper()->listMessages( folder->getName(),target ); | 369 | nntp->getWrapper()->listMessages( folder->getName(),target ); |
357 | } | 370 | } |
358 | 371 | ||
359 | RecBody NNTPfolderItem::fetchBody(const RecMail&aMail) | 372 | RecBody NNTPfolderItem::fetchBody(const RecMail&aMail) |
360 | { | 373 | { |
361 | return nntp->getWrapper()->fetchBody(aMail); | 374 | return nntp->getWrapper()->fetchBody(aMail); |
362 | } | 375 | } |
363 | 376 | ||
364 | QPopupMenu * NNTPfolderItem::getContextMenu() | 377 | QPopupMenu * NNTPfolderItem::getContextMenu() |
365 | { | 378 | { |
366 | QPopupMenu *m = new QPopupMenu(0); | 379 | QPopupMenu *m = new QPopupMenu(0); |
367 | if (m) | 380 | if (m) |
368 | { | 381 | { |
369 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 382 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
370 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),1); | 383 | m->insertItem(QObject::tr("Copy all postings",contextName),1); |
371 | } | 384 | } |
372 | return m; | 385 | return m; |
373 | } | 386 | } |
374 | 387 | ||
375 | void NNTPfolderItem::downloadMails() | 388 | void NNTPfolderItem::downloadMails() |
376 | { | 389 | { |
377 | AccountView*bl = nntp->accountView(); | 390 | AccountView*bl = nntp->accountView(); |
378 | if (!bl) return; | 391 | if (!bl) return; |
379 | bl->downloadMails(folder,nntp->getWrapper()); | 392 | bl->downloadMails(folder,nntp->getWrapper()); |
380 | } | 393 | } |
381 | 394 | ||
382 | void NNTPfolderItem::contextMenuSelected(int which) | 395 | void NNTPfolderItem::contextMenuSelected(int which) |
383 | { | 396 | { |
384 | AccountView * view = (AccountView*)listView(); | 397 | AccountView * view = (AccountView*)listView(); |
385 | switch (which) | 398 | switch (which) |
386 | { | 399 | { |
387 | case 0: | 400 | case 0: |
388 | /* must be 'cause pop3 lists are cached */ | 401 | /* must be 'cause pop3 lists are cached */ |
389 | nntp->getWrapper()->logout(); | 402 | nntp->getWrapper()->logout(); |
390 | view->refreshCurrent(); | 403 | view->refreshCurrent(); |
391 | break; | 404 | break; |
392 | case 1: | 405 | case 1: |
393 | downloadMails(); | 406 | downloadMails(); |
394 | break; | 407 | break; |
395 | default: | 408 | default: |
396 | break; | 409 | break; |
397 | } | 410 | } |
398 | } | 411 | } |
399 | 412 | ||
400 | /** | 413 | /** |
401 | * IMAP Account stuff | 414 | * IMAP Account stuff |
402 | */ | 415 | */ |
403 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) | 416 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) |
404 | : AccountViewItem( parent ) | 417 | : AccountViewItem( parent ) |
405 | { | 418 | { |
406 | account = a; | 419 | account = a; |
407 | wrapper = AbstractMail::getWrapper( account ); | 420 | wrapper = AbstractMail::getWrapper( account ); |
408 | SETPIX(PIXMAP_IMAPFOLDER); | 421 | SETPIX(PIXMAP_IMAPFOLDER); |
409 | setText( 0, account->getAccountName() ); | 422 | setText( 0, account->getAccountName() ); |
410 | setOpen( true ); | 423 | setOpen( true ); |
411 | } | 424 | } |
412 | 425 | ||
413 | IMAPviewItem::~IMAPviewItem() | 426 | IMAPviewItem::~IMAPviewItem() |
414 | { | 427 | { |
415 | delete wrapper; | 428 | delete wrapper; |
416 | } | 429 | } |
417 | 430 | ||
418 | AbstractMail *IMAPviewItem::getWrapper() | 431 | AbstractMail *IMAPviewItem::getWrapper() |
419 | { | 432 | { |
420 | return wrapper; | 433 | return wrapper; |
421 | } | 434 | } |
422 | 435 | ||
423 | void IMAPviewItem::refresh(QList<RecMail>&) | 436 | void IMAPviewItem::refresh(QList<RecMail>&) |
424 | { | 437 | { |
425 | refreshFolders(false); | 438 | refreshFolders(false); |
426 | } | 439 | } |
427 | 440 | ||
428 | const QStringList&IMAPviewItem::subFolders() | 441 | const QStringList&IMAPviewItem::subFolders() |
429 | { | 442 | { |
430 | return currentFolders; | 443 | return currentFolders; |
431 | } | 444 | } |
432 | 445 | ||
433 | void IMAPviewItem::refreshFolders(bool force) | 446 | void IMAPviewItem::refreshFolders(bool force) |
434 | { | 447 | { |
435 | if (childCount()>0 && force==false) return; | 448 | if (childCount()>0 && force==false) return; |
436 | if (account->getOffline()) return; | 449 | if (account->getOffline()) return; |
437 | 450 | ||
438 | removeChilds(); | 451 | removeChilds(); |
439 | currentFolders.clear(); | 452 | currentFolders.clear(); |
440 | QList<Folder> *folders = wrapper->listFolders(); | 453 | QList<Folder> *folders = wrapper->listFolders(); |
441 | 454 | ||
442 | Folder *it; | 455 | Folder *it; |
443 | QListViewItem*item = 0; | 456 | QListViewItem*item = 0; |
444 | QListViewItem*titem = 0; | 457 | QListViewItem*titem = 0; |
445 | QString fname,del,search; | 458 | QString fname,del,search; |
446 | int pos; | 459 | int pos; |
447 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 460 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
448 | folders->setAutoDelete(false); | 461 | folders->setAutoDelete(false); |
449 | 462 | ||
450 | for ( it = folders->first(); it; it = folders->next() ) | 463 | for ( it = folders->first(); it; it = folders->next() ) |
451 | { | 464 | { |
452 | if (it->getDisplayName().lower()=="inbox") | 465 | if (it->getDisplayName().lower()=="inbox") |
453 | { | 466 | { |
454 | item = new IMAPfolderItem( it, this , item ); | 467 | item = new IMAPfolderItem( it, this , item ); |
455 | folders->remove(it); | 468 | folders->remove(it); |
456 | qDebug("inbox found"); | 469 | qDebug("inbox found"); |
457 | break; | 470 | break; |
458 | } | 471 | } |
459 | } | 472 | } |
460 | for ( it = folders->first(); it; it = folders->next() ) | 473 | for ( it = folders->first(); it; it = folders->next() ) |
461 | { | 474 | { |
462 | fname = it->getDisplayName(); | 475 | fname = it->getDisplayName(); |
463 | currentFolders.append(it->getName()); | 476 | currentFolders.append(it->getName()); |
464 | pos = fname.findRev(it->Separator()); | 477 | pos = fname.findRev(it->Separator()); |
465 | if (pos != -1) | 478 | if (pos != -1) |
466 | { | 479 | { |
467 | fname = fname.left(pos); | 480 | fname = fname.left(pos); |
468 | } | 481 | } |
469 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 482 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
470 | if (pitem) | 483 | if (pitem) |
471 | { | 484 | { |
472 | titem = item; | 485 | titem = item; |
473 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); | 486 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); |
474 | /* setup the short name */ | 487 | /* setup the short name */ |
475 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); | 488 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); |
476 | item = titem; | 489 | item = titem; |
477 | } | 490 | } |
478 | else | 491 | else |
479 | { | 492 | { |
480 | item = new IMAPfolderItem( it, this , item ); | 493 | item = new IMAPfolderItem( it, this , item ); |
481 | } | 494 | } |
482 | } | 495 | } |
483 | delete folders; | 496 | delete folders; |
484 | } | 497 | } |
485 | 498 | ||
486 | QPopupMenu * IMAPviewItem::getContextMenu() | 499 | QPopupMenu * IMAPviewItem::getContextMenu() |
487 | { | 500 | { |
488 | QPopupMenu *m = new QPopupMenu(0); | 501 | QPopupMenu *m = new QPopupMenu(0); |
489 | if (m) | 502 | if (m) |
490 | { | 503 | { |
491 | if (!account->getOffline()) | 504 | if (!account->getOffline()) |
492 | { | 505 | { |
493 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 506 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
494 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 507 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
495 | m->insertSeparator(); | 508 | m->insertSeparator(); |
496 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 509 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
497 | m->insertItem(QObject::tr("Set offline",contextName),3); | 510 | m->insertItem(QObject::tr("Set offline",contextName),3); |
498 | } | 511 | } |
499 | else | 512 | else |
500 | { | 513 | { |
501 | m->insertItem(QObject::tr("Set online",contextName),3); | 514 | m->insertItem(QObject::tr("Set online",contextName),3); |
502 | } | 515 | } |
503 | } | 516 | } |
504 | return m; | 517 | return m; |
505 | } | 518 | } |
506 | 519 | ||
507 | void IMAPviewItem::createNewFolder() | 520 | void IMAPviewItem::createNewFolder() |
508 | { | 521 | { |
509 | Newmdirdlg ndirdlg; | 522 | Newmdirdlg ndirdlg; |
510 | if ( QPEApplication::execDialog( &ndirdlg )) | 523 | if ( QPEApplication::execDialog( &ndirdlg )) |
511 | { | 524 | { |
512 | QString ndir = ndirdlg.Newdir(); | 525 | QString ndir = ndirdlg.Newdir(); |
513 | bool makesubs = ndirdlg.subpossible(); | 526 | bool makesubs = ndirdlg.subpossible(); |
514 | QString delemiter = "/"; | 527 | QString delemiter = "/"; |
515 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 528 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
516 | if (item) | 529 | if (item) |
517 | { | 530 | { |
518 | delemiter = item->Delemiter(); | 531 | delemiter = item->Delemiter(); |
519 | } | 532 | } |
520 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 533 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
521 | { | 534 | { |
522 | refreshFolders(true); | 535 | refreshFolders(true); |
523 | } | 536 | } |
524 | } | 537 | } |
525 | } | 538 | } |
526 | 539 | ||
527 | void IMAPviewItem::contextMenuSelected(int id) | 540 | void IMAPviewItem::contextMenuSelected(int id) |
528 | { | 541 | { |
529 | qDebug("Id selected: %i",id); | 542 | qDebug("Id selected: %i",id); |
530 | switch (id) | 543 | switch (id) |
531 | { | 544 | { |
532 | case 0: | 545 | case 0: |
533 | refreshFolders(true); | 546 | refreshFolders(true); |
534 | break; | 547 | break; |
535 | case 1: | 548 | case 1: |
536 | createNewFolder(); | 549 | createNewFolder(); |
537 | break; | 550 | break; |
538 | case 2: | 551 | case 2: |
539 | removeChilds(); | 552 | removeChilds(); |
540 | wrapper->logout(); | 553 | wrapper->logout(); |
541 | break; | 554 | break; |
542 | case 3: | 555 | case 3: |
543 | if (account->getOffline()==false) | 556 | if (account->getOffline()==false) |
544 | { | 557 | { |
545 | removeChilds(); | 558 | removeChilds(); |
546 | wrapper->logout(); | 559 | wrapper->logout(); |
547 | } | 560 | } |
548 | account->setOffline(!account->getOffline()); | 561 | account->setOffline(!account->getOffline()); |
549 | account->save(); | 562 | account->save(); |
550 | SETPIX(PIXMAP_IMAPFOLDER); | 563 | SETPIX(PIXMAP_IMAPFOLDER); |
551 | refreshFolders(false); | 564 | refreshFolders(false); |
552 | break; | 565 | break; |
553 | default: | 566 | default: |
554 | break; | 567 | break; |
555 | } | 568 | } |
556 | } | 569 | } |
557 | 570 | ||
558 | RecBody IMAPviewItem::fetchBody(const RecMail&) | 571 | RecBody IMAPviewItem::fetchBody(const RecMail&) |
559 | { | 572 | { |
560 | return RecBody(); | 573 | return RecBody(); |
561 | } | 574 | } |
562 | 575 | ||
563 | bool IMAPviewItem::offline() | 576 | bool IMAPviewItem::offline() |
564 | { | 577 | { |
565 | return account->getOffline(); | 578 | return account->getOffline(); |
566 | } | 579 | } |
567 | 580 | ||
568 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) | 581 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) |
569 | : AccountViewItem( parent , after ) | 582 | : AccountViewItem( parent , after ) |
570 | { | 583 | { |
571 | folder = folderInit; | 584 | folder = folderInit; |
572 | imap = parent; | 585 | imap = parent; |
573 | if (folder->getDisplayName().lower()!="inbox") | 586 | if (folder->getDisplayName().lower()!="inbox") |
574 | { | 587 | { |
575 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 588 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
576 | } | 589 | } |
577 | else | 590 | else |
578 | { | 591 | { |
579 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 592 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
580 | } | 593 | } |
581 | setText( 0, folder->getDisplayName() ); | 594 | setText( 0, folder->getDisplayName() ); |
582 | } | 595 | } |
583 | 596 | ||
584 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 597 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
585 | : AccountViewItem( parent,after ) | 598 | : AccountViewItem( parent,after ) |
586 | { | 599 | { |
587 | folder = folderInit; | 600 | folder = folderInit; |
588 | imap = master; | 601 | imap = master; |
589 | if (folder->getDisplayName().lower()!="inbox") | 602 | if (folder->getDisplayName().lower()!="inbox") |
590 | { | 603 | { |
591 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 604 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
592 | } | 605 | } |
593 | else | 606 | else |
594 | { | 607 | { |
595 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 608 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
596 | } | 609 | } |
597 | setText( 0, folder->getDisplayName() ); | 610 | setText( 0, folder->getDisplayName() ); |
598 | } | 611 | } |
599 | 612 | ||
600 | IMAPfolderItem::~IMAPfolderItem() | 613 | IMAPfolderItem::~IMAPfolderItem() |
601 | {} | 614 | {} |
602 | 615 | ||
603 | const QString& IMAPfolderItem::Delemiter()const | 616 | const QString& IMAPfolderItem::Delemiter()const |
604 | { | 617 | { |
605 | return folder->Separator(); | 618 | return folder->Separator(); |
606 | } | 619 | } |
607 | 620 | ||
608 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 621 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
609 | { | 622 | { |
610 | if (folder->may_select()) | 623 | if (folder->may_select()) |
611 | { | 624 | { |
612 | imap->getWrapper()->listMessages( folder->getName(),target ); | 625 | imap->getWrapper()->listMessages( folder->getName(),target ); |
613 | } | 626 | } |
614 | else | 627 | else |
615 | { | 628 | { |
616 | target.clear(); | 629 | target.clear(); |
617 | } | 630 | } |
618 | } | 631 | } |
619 | 632 | ||
620 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | 633 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) |
621 | { | 634 | { |
622 | return imap->getWrapper()->fetchBody(aMail); | 635 | return imap->getWrapper()->fetchBody(aMail); |
623 | } | 636 | } |
624 | 637 | ||
625 | QPopupMenu * IMAPfolderItem::getContextMenu() | 638 | QPopupMenu * IMAPfolderItem::getContextMenu() |
626 | { | 639 | { |
627 | QPopupMenu *m = new QPopupMenu(0); | 640 | QPopupMenu *m = new QPopupMenu(0); |
628 | if (m) | 641 | if (m) |
629 | { | 642 | { |
630 | if (folder->may_select()) | 643 | if (folder->may_select()) |
631 | { | 644 | { |
632 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 645 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
633 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | 646 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); |
634 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 647 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
635 | } | 648 | } |
636 | if (folder->no_inferior()==false) | 649 | if (folder->no_inferior()==false) |
637 | { | 650 | { |
638 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 651 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
639 | } | 652 | } |
640 | if (folder->getDisplayName().lower()!="inbox") | 653 | if (folder->getDisplayName().lower()!="inbox") |
641 | { | 654 | { |
642 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 655 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
643 | } | 656 | } |
644 | } | 657 | } |
645 | return m; | 658 | return m; |
646 | } | 659 | } |
647 | 660 | ||
648 | void IMAPfolderItem::createNewFolder() | 661 | void IMAPfolderItem::createNewFolder() |
649 | { | 662 | { |
650 | Newmdirdlg ndirdlg; | 663 | Newmdirdlg ndirdlg; |
651 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 664 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
652 | { | 665 | { |
653 | QString ndir = ndirdlg.Newdir(); | 666 | QString ndir = ndirdlg.Newdir(); |
654 | bool makesubs = ndirdlg.subpossible(); | 667 | bool makesubs = ndirdlg.subpossible(); |
655 | QString delemiter = Delemiter(); | 668 | QString delemiter = Delemiter(); |
656 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 669 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
657 | { | 670 | { |
658 | imap->refreshFolders(true); | 671 | imap->refreshFolders(true); |
659 | } | 672 | } |
660 | } | 673 | } |
661 | } | 674 | } |
662 | 675 | ||
663 | void IMAPfolderItem::deleteFolder() | 676 | void IMAPfolderItem::deleteFolder() |
664 | { | 677 | { |
665 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 678 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
666 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 679 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
667 | QObject::tr("Yes",contextName), | 680 | QObject::tr("Yes",contextName), |
668 | QObject::tr("No",contextName),QString::null,1,1); | 681 | QObject::tr("No",contextName),QString::null,1,1); |
669 | qDebug("Auswahl: %i",yesno); | 682 | qDebug("Auswahl: %i",yesno); |
670 | if (yesno == 0) | 683 | if (yesno == 0) |
671 | { | 684 | { |
672 | if (imap->getWrapper()->deleteMbox(folder)) | 685 | if (imap->getWrapper()->deleteMbox(folder)) |
673 | { | 686 | { |
674 | QListView*v=listView(); | 687 | QListView*v=listView(); |
675 | IMAPviewItem * box = imap; | 688 | IMAPviewItem * box = imap; |
676 | /* be carefull - after that this object is destroyd so don't use | 689 | /* be carefull - after that this object is destroyd so don't use |
677 | * any member of it after that call!!*/ | 690 | * any member of it after that call!!*/ |
678 | imap->refreshFolders(true); | 691 | imap->refreshFolders(true); |
679 | if (v) | 692 | if (v) |
680 | { | 693 | { |
681 | v->setSelected(box,true); | 694 | v->setSelected(box,true); |
682 | } | 695 | } |
683 | } | 696 | } |
684 | } | 697 | } |
685 | } | 698 | } |
686 | 699 | ||
687 | void IMAPfolderItem::downloadMails() | 700 | void IMAPfolderItem::downloadMails() |
688 | { | 701 | { |
689 | AccountView*bl = imap->accountView(); | 702 | AccountView*bl = imap->accountView(); |
690 | if (!bl) return; | 703 | if (!bl) return; |
691 | bl->downloadMails(folder,imap->getWrapper()); | 704 | bl->downloadMails(folder,imap->getWrapper()); |
692 | } | 705 | } |
693 | 706 | ||
694 | void IMAPfolderItem::contextMenuSelected(int id) | 707 | void IMAPfolderItem::contextMenuSelected(int id) |
695 | { | 708 | { |
696 | qDebug("Selected id: %i",id); | 709 | qDebug("Selected id: %i",id); |
697 | AccountView * view = (AccountView*)listView(); | 710 | AccountView * view = (AccountView*)listView(); |
698 | switch(id) | 711 | switch(id) |
699 | { | 712 | { |
700 | case 0: | 713 | case 0: |
701 | view->refreshCurrent(); | 714 | view->refreshCurrent(); |
702 | break; | 715 | break; |
703 | case 1: | 716 | case 1: |
704 | deleteAllMail(imap->getWrapper(),folder); | 717 | deleteAllMail(imap->getWrapper(),folder); |
705 | break; | 718 | break; |
706 | case 2: | 719 | case 2: |
707 | createNewFolder(); | 720 | createNewFolder(); |
708 | break; | 721 | break; |
709 | case 3: | 722 | case 3: |
710 | deleteFolder(); | 723 | deleteFolder(); |
711 | break; | 724 | break; |
712 | case 4: | 725 | case 4: |
713 | downloadMails(); | 726 | downloadMails(); |
714 | break; | 727 | break; |
715 | default: | 728 | default: |
716 | break; | 729 | break; |
717 | } | 730 | } |
718 | } | 731 | } |
719 | 732 | ||
720 | /** | 733 | /** |
721 | * MH Account stuff | 734 | * MH Account stuff |
722 | */ | 735 | */ |
723 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 736 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
724 | POP3 and MBOX */ | 737 | POP3 and MBOX */ |
725 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 738 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
726 | : AccountViewItem( parent ) | 739 | : AccountViewItem( parent ) |
727 | { | 740 | { |
728 | m_Path = aPath; | 741 | m_Path = aPath; |
729 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 742 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
730 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 743 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); |
731 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 744 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
732 | setText( 0, " Local Folders" ); | 745 | setText( 0, " Local Folders" ); |
733 | setOpen( true ); | 746 | setOpen( true ); |
734 | folder = 0; | 747 | folder = 0; |
735 | } | 748 | } |
736 | 749 | ||
737 | MHviewItem::~MHviewItem() | 750 | MHviewItem::~MHviewItem() |
738 | { | 751 | { |
739 | delete wrapper; | 752 | delete wrapper; |
740 | } | 753 | } |
741 | 754 | ||
742 | AbstractMail *MHviewItem::getWrapper() | 755 | AbstractMail *MHviewItem::getWrapper() |
743 | { | 756 | { |
744 | return wrapper; | 757 | return wrapper; |
745 | } | 758 | } |
746 | 759 | ||
747 | void MHviewItem::refresh( QList<RecMail> & target) | 760 | void MHviewItem::refresh( QList<RecMail> & target) |
748 | { | 761 | { |
749 | refresh(false); | 762 | refresh(false); |
750 | getWrapper()->listMessages( "",target ); | 763 | getWrapper()->listMessages( "",target ); |
751 | } | 764 | } |
752 | 765 | ||
753 | void MHviewItem::refresh(bool force) | 766 | void MHviewItem::refresh(bool force) |
754 | { | 767 | { |
755 | if (childCount()>0 && force==false) return; | 768 | if (childCount()>0 && force==false) return; |
756 | removeChilds(); | 769 | removeChilds(); |
757 | currentFolders.clear(); | 770 | currentFolders.clear(); |
758 | QList<Folder> *folders = wrapper->listFolders(); | 771 | QList<Folder> *folders = wrapper->listFolders(); |
759 | Folder *it; | 772 | Folder *it; |
760 | MHfolderItem*item = 0; | 773 | MHfolderItem*item = 0; |
761 | MHfolderItem*pmaster = 0; | 774 | MHfolderItem*pmaster = 0; |
762 | QString fname = ""; | 775 | QString fname = ""; |
763 | int pos; | 776 | int pos; |
764 | for ( it = folders->first(); it; it = folders->next() ) | 777 | for ( it = folders->first(); it; it = folders->next() ) |
765 | { | 778 | { |
766 | fname = it->getDisplayName(); | 779 | fname = it->getDisplayName(); |
767 | /* this folder itself */ | 780 | /* this folder itself */ |
768 | if (fname=="/") | 781 | if (fname=="/") |
769 | { | 782 | { |
770 | currentFolders.append(fname); | 783 | currentFolders.append(fname); |
771 | folder = it; | 784 | folder = it; |
772 | continue; | 785 | continue; |
773 | } | 786 | } |
774 | currentFolders.append(fname); | 787 | currentFolders.append(fname); |
775 | pos = fname.findRev("/"); | 788 | pos = fname.findRev("/"); |
776 | if (pos > 0) | 789 | if (pos > 0) |
777 | { | 790 | { |
778 | fname = fname.left(pos); | 791 | fname = fname.left(pos); |
779 | pmaster = (MHfolderItem*)findSubItem(fname); | 792 | pmaster = (MHfolderItem*)findSubItem(fname); |
780 | } | 793 | } |
781 | else | 794 | else |
782 | { | 795 | { |
783 | pmaster = 0; | 796 | pmaster = 0; |
784 | } | 797 | } |
785 | if (pmaster) | 798 | if (pmaster) |
786 | { | 799 | { |
787 | item = new MHfolderItem( it, pmaster, item, this ); | 800 | item = new MHfolderItem( it, pmaster, item, this ); |
788 | } | 801 | } |
789 | else | 802 | else |
790 | { | 803 | { |
791 | item = new MHfolderItem( it, this , item ); | 804 | item = new MHfolderItem( it, this , item ); |
792 | } | 805 | } |
793 | item->setSelectable(it->may_select()); | 806 | item->setSelectable(it->may_select()); |
794 | } | 807 | } |
795 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 808 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
796 | folders->setAutoDelete(false); | 809 | folders->setAutoDelete(false); |
797 | delete folders; | 810 | delete folders; |
798 | } | 811 | } |
799 | 812 | ||
800 | RecBody MHviewItem::fetchBody( const RecMail &mail ) | 813 | RecBody MHviewItem::fetchBody( const RecMail &mail ) |
801 | { | 814 | { |
802 | qDebug( "MH fetchBody" ); | 815 | qDebug( "MH fetchBody" ); |
803 | return wrapper->fetchBody( mail ); | 816 | return wrapper->fetchBody( mail ); |
804 | } | 817 | } |
805 | 818 | ||
806 | QPopupMenu * MHviewItem::getContextMenu() | 819 | QPopupMenu * MHviewItem::getContextMenu() |
807 | { | 820 | { |
808 | QPopupMenu *m = new QPopupMenu(0); | 821 | QPopupMenu *m = new QPopupMenu(0); |
809 | if (m) | 822 | if (m) |
810 | { | 823 | { |
811 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 824 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
812 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 825 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
813 | m->insertItem(QObject::tr("Delete all mails",contextName),2); | 826 | m->insertItem(QObject::tr("Delete all mails",contextName),2); |
814 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); | 827 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); |
815 | } | 828 | } |
816 | return m; | 829 | return m; |
817 | } | 830 | } |
818 | 831 | ||
819 | void MHviewItem::createFolder() | 832 | void MHviewItem::createFolder() |
820 | { | 833 | { |
821 | Newmdirdlg ndirdlg(0,0,true); | 834 | Newmdirdlg ndirdlg(0,0,true); |
822 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 835 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
823 | { | 836 | { |
824 | QString ndir = ndirdlg.Newdir(); | 837 | QString ndir = ndirdlg.Newdir(); |
825 | if (wrapper->createMbox(ndir)) | 838 | if (wrapper->createMbox(ndir)) |
826 | { | 839 | { |
827 | refresh(true); | 840 | refresh(true); |
828 | } | 841 | } |
829 | } | 842 | } |
830 | } | 843 | } |
831 | 844 | ||
832 | void MHviewItem::downloadMails() | 845 | void MHviewItem::downloadMails() |
833 | { | 846 | { |
834 | AccountView*bl = accountView(); | 847 | AccountView*bl = accountView(); |
835 | if (!bl) return; | 848 | if (!bl) return; |
836 | bl->downloadMails(folder,getWrapper()); | 849 | bl->downloadMails(folder,getWrapper()); |
837 | } | 850 | } |
838 | 851 | ||
839 | QStringList MHviewItem::subFolders() | 852 | QStringList MHviewItem::subFolders() |
840 | { | 853 | { |
841 | return currentFolders; | 854 | return currentFolders; |
842 | } | 855 | } |
843 | 856 | ||
844 | void MHviewItem::contextMenuSelected(int which) | 857 | void MHviewItem::contextMenuSelected(int which) |
845 | { | 858 | { |
846 | switch (which) | 859 | switch (which) |
847 | { | 860 | { |
848 | case 0: | 861 | case 0: |
849 | refresh(true); | 862 | refresh(true); |
850 | break; | 863 | break; |
851 | case 1: | 864 | case 1: |
852 | createFolder(); | 865 | createFolder(); |
853 | break; | 866 | break; |
854 | case 2: | 867 | case 2: |
855 | deleteAllMail(getWrapper(),folder); | 868 | deleteAllMail(getWrapper(),folder); |
856 | break; | 869 | break; |
857 | case 3: | 870 | case 3: |
858 | downloadMails(); | 871 | downloadMails(); |
859 | break; | 872 | break; |
860 | default: | 873 | default: |
861 | break; | 874 | break; |
862 | } | 875 | } |
863 | } | 876 | } |
864 | 877 | ||
865 | MHfolderItem::~MHfolderItem() | 878 | MHfolderItem::~MHfolderItem() |
866 | {} | 879 | {} |
867 | 880 | ||
868 | MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after ) | 881 | MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after ) |
869 | : AccountViewItem( parent,after ) | 882 | : AccountViewItem( parent,after ) |
870 | { | 883 | { |
871 | folder = folderInit; | 884 | folder = folderInit; |
872 | mbox = parent; | 885 | mbox = parent; |
873 | initName(); | 886 | initName(); |
874 | } | 887 | } |
875 | 888 | ||
876 | MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) | 889 | MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) |
877 | : AccountViewItem( parent,after ) | 890 | : AccountViewItem( parent,after ) |
878 | { | 891 | { |
879 | folder = folderInit; | 892 | folder = folderInit; |
880 | mbox = master; | 893 | mbox = master; |
881 | initName(); | 894 | initName(); |
882 | } | 895 | } |
883 | 896 | ||
884 | void MHfolderItem::initName() | 897 | void MHfolderItem::initName() |
885 | { | 898 | { |
886 | QString bName = folder->getDisplayName(); | 899 | QString bName = folder->getDisplayName(); |
887 | if (bName.startsWith("/")&&bName.length()>1) | 900 | if (bName.startsWith("/")&&bName.length()>1) |
888 | { | 901 | { |
889 | bName.replace(0,1,""); | 902 | bName.replace(0,1,""); |
890 | } | 903 | } |
891 | int pos = bName.findRev("/"); | 904 | int pos = bName.findRev("/"); |
892 | if (pos > 0) | 905 | if (pos > 0) |
893 | { | 906 | { |
894 | bName.replace(0,pos+1,""); | 907 | bName.replace(0,pos+1,""); |
895 | } | 908 | } |
896 | if (bName.lower() == "outgoing") | 909 | if (bName.lower() == "outgoing") |
897 | { | 910 | { |
898 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 911 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
899 | } | 912 | } |
900 | else if (bName.lower() == "inbox") | 913 | else if (bName.lower() == "inbox") |
901 | { | 914 | { |
902 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 915 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
903 | } | 916 | } |
904 | else | 917 | else |
905 | { | 918 | { |
906 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 919 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
907 | } | 920 | } |
908 | setText( 0, bName ); | 921 | setText( 0, bName ); |
909 | } | 922 | } |
910 | 923 | ||
911 | Folder*MHfolderItem::getFolder() | 924 | Folder*MHfolderItem::getFolder() |
912 | { | 925 | { |
913 | return folder; | 926 | return folder; |
914 | } | 927 | } |
915 | 928 | ||
916 | void MHfolderItem::refresh(QList<RecMail>&target) | 929 | void MHfolderItem::refresh(QList<RecMail>&target) |
917 | { | 930 | { |
918 | if (folder->may_select()) | 931 | if (folder->may_select()) |
919 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 932 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
920 | } | 933 | } |
921 | 934 | ||
922 | RecBody MHfolderItem::fetchBody(const RecMail&aMail) | 935 | RecBody MHfolderItem::fetchBody(const RecMail&aMail) |
923 | { | 936 | { |
924 | return mbox->getWrapper()->fetchBody(aMail); | 937 | return mbox->getWrapper()->fetchBody(aMail); |
925 | } | 938 | } |
926 | 939 | ||
927 | void MHfolderItem::deleteFolder() | 940 | void MHfolderItem::deleteFolder() |
928 | { | 941 | { |
929 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 942 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
930 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 943 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
931 | QObject::tr("Yes",contextName), | 944 | QObject::tr("Yes",contextName), |
932 | QObject::tr("No",contextName),QString::null,1,1); | 945 | QObject::tr("No",contextName),QString::null,1,1); |
933 | qDebug("Auswahl: %i",yesno); | 946 | qDebug("Auswahl: %i",yesno); |
934 | if (yesno == 0) | 947 | if (yesno == 0) |
935 | { | 948 | { |
936 | if (mbox->getWrapper()->deleteMbox(folder)) | 949 | if (mbox->getWrapper()->deleteMbox(folder)) |
937 | { | 950 | { |
938 | QListView*v=listView(); | 951 | QListView*v=listView(); |
939 | MHviewItem * box = mbox; | 952 | MHviewItem * box = mbox; |
940 | /* be carefull - after that this object is destroyd so don't use | 953 | /* be carefull - after that this object is destroyd so don't use |
941 | * any member of it after that call!!*/ | 954 | * any member of it after that call!!*/ |
942 | mbox->refresh(true); | 955 | mbox->refresh(true); |
943 | if (v) | 956 | if (v) |
944 | { | 957 | { |
945 | v->setSelected(box,true); | 958 | v->setSelected(box,true); |
946 | } | 959 | } |
947 | } | 960 | } |
948 | } | 961 | } |
949 | } | 962 | } |
950 | 963 | ||
951 | QPopupMenu * MHfolderItem::getContextMenu() | 964 | QPopupMenu * MHfolderItem::getContextMenu() |
952 | { | 965 | { |
953 | QPopupMenu *m = new QPopupMenu(0); | 966 | QPopupMenu *m = new QPopupMenu(0); |
954 | if (m) | 967 | if (m) |
955 | { | 968 | { |
956 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 969 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
957 | m->insertItem(QObject::tr("Delete all mails",contextName),0); | 970 | m->insertItem(QObject::tr("Delete all mails",contextName),0); |
958 | m->insertItem(QObject::tr("Create new subfolder",contextName),3); | 971 | m->insertItem(QObject::tr("Create new subfolder",contextName),3); |
959 | m->insertItem(QObject::tr("Delete folder",contextName),1); | 972 | m->insertItem(QObject::tr("Delete folder",contextName),1); |
960 | } | 973 | } |
961 | return m; | 974 | return m; |
962 | } | 975 | } |
963 | 976 | ||
964 | void MHfolderItem::downloadMails() | 977 | void MHfolderItem::downloadMails() |
965 | { | 978 | { |
966 | AccountView*bl = mbox->accountView(); | 979 | AccountView*bl = mbox->accountView(); |
967 | if (!bl) return; | 980 | if (!bl) return; |
968 | bl->downloadMails(folder,mbox->getWrapper()); | 981 | bl->downloadMails(folder,mbox->getWrapper()); |
969 | } | 982 | } |
970 | 983 | ||
971 | void MHfolderItem::createFolder() | 984 | void MHfolderItem::createFolder() |
972 | { | 985 | { |
973 | Newmdirdlg ndirdlg(0,0,true); | 986 | Newmdirdlg ndirdlg(0,0,true); |
974 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 987 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
975 | { | 988 | { |
976 | QString ndir = ndirdlg.Newdir(); | 989 | QString ndir = ndirdlg.Newdir(); |
977 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 990 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
978 | { | 991 | { |
979 | QListView*v=listView(); | 992 | QListView*v=listView(); |
980 | MHviewItem * box = mbox; | 993 | MHviewItem * box = mbox; |
981 | /* be carefull - after that this object is destroyd so don't use | 994 | /* be carefull - after that this object is destroyd so don't use |
982 | * any member of it after that call!!*/ | 995 | * any member of it after that call!!*/ |
983 | mbox->refresh(true); | 996 | mbox->refresh(true); |
984 | if (v) | 997 | if (v) |
985 | { | 998 | { |
986 | v->setSelected(box,true); | 999 | v->setSelected(box,true); |
987 | } | 1000 | } |
988 | } | 1001 | } |
989 | } | 1002 | } |
990 | } | 1003 | } |
991 | 1004 | ||
992 | void MHfolderItem::contextMenuSelected(int which) | 1005 | void MHfolderItem::contextMenuSelected(int which) |
993 | { | 1006 | { |
994 | switch(which) | 1007 | switch(which) |
995 | { | 1008 | { |
996 | case 0: | 1009 | case 0: |
997 | deleteAllMail(mbox->getWrapper(),folder); | 1010 | deleteAllMail(mbox->getWrapper(),folder); |
998 | break; | 1011 | break; |
999 | case 1: | 1012 | case 1: |
1000 | deleteFolder(); | 1013 | deleteFolder(); |
1001 | break; | 1014 | break; |
1002 | case 2: | 1015 | case 2: |
1003 | downloadMails(); | 1016 | downloadMails(); |
1004 | break; | 1017 | break; |
1005 | case 3: | 1018 | case 3: |
1006 | createFolder(); | 1019 | createFolder(); |
1007 | break; | 1020 | break; |
1008 | default: | 1021 | default: |
1009 | break; | 1022 | break; |
1010 | } | 1023 | } |
1011 | } | 1024 | } |
1012 | 1025 | ||
1013 | /** | 1026 | /** |
1014 | * Generic stuff | 1027 | * Generic stuff |
1015 | */ | 1028 | */ |
1016 | 1029 | ||
1017 | const QString AccountViewItem::contextName="AccountViewItem"; | 1030 | const QString AccountViewItem::contextName="AccountViewItem"; |
1018 | 1031 | ||
1019 | AccountViewItem::AccountViewItem( AccountView *parent ) | 1032 | AccountViewItem::AccountViewItem( AccountView *parent ) |
1020 | : QListViewItem( parent ) | 1033 | : QListViewItem( parent ) |
1021 | { | 1034 | { |
1022 | init(); | 1035 | init(); |
1023 | m_Backlink = parent; | 1036 | m_Backlink = parent; |
1024 | } | 1037 | } |
1025 | 1038 | ||
1026 | AccountViewItem::AccountViewItem( QListViewItem *parent) | 1039 | AccountViewItem::AccountViewItem( QListViewItem *parent) |
1027 | : QListViewItem( parent) | 1040 | : QListViewItem( parent) |
1028 | { | 1041 | { |
1029 | init(); | 1042 | init(); |
1030 | } | 1043 | } |
1031 | 1044 | ||
1032 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) | 1045 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) |
1033 | :QListViewItem( parent,after ) | 1046 | :QListViewItem( parent,after ) |
1034 | { | 1047 | { |
1035 | init(); | 1048 | init(); |
1036 | } | 1049 | } |
1037 | 1050 | ||
1038 | void AccountViewItem::init() | 1051 | void AccountViewItem::init() |
1039 | { | 1052 | { |
1040 | m_Backlink = 0; | 1053 | m_Backlink = 0; |
1041 | folder = 0; | 1054 | folder = 0; |
1042 | } | 1055 | } |
1043 | 1056 | ||
1044 | AccountViewItem::~AccountViewItem() | 1057 | AccountViewItem::~AccountViewItem() |
1045 | { | 1058 | { |
1046 | if (folder) delete folder; | 1059 | if (folder) delete folder; |
1047 | } | 1060 | } |
1048 | 1061 | ||
1049 | AccountView*AccountViewItem::accountView() | 1062 | AccountView*AccountViewItem::accountView() |
1050 | { | 1063 | { |
1051 | return m_Backlink; | 1064 | return m_Backlink; |
1052 | } | 1065 | } |
1053 | 1066 | ||
1054 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) | 1067 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) |
1055 | { | 1068 | { |
1056 | if (!wrapper) return; | 1069 | if (!wrapper) return; |
1057 | QString fname=""; | 1070 | QString fname=""; |
1058 | if (folder) fname = folder->getDisplayName(); | 1071 | if (folder) fname = folder->getDisplayName(); |
1059 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | 1072 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
1060 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). | 1073 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). |
1061 | arg(fname), | 1074 | arg(fname), |
1062 | QObject::tr("Yes",contextName), | 1075 | QObject::tr("Yes",contextName), |
1063 | QObject::tr("No",contextName),QString::null,1,1); | 1076 | QObject::tr("No",contextName),QString::null,1,1); |
1064 | qDebug("Auswahl: %i",yesno); | 1077 | qDebug("Auswahl: %i",yesno); |
1065 | if (yesno == 0) | 1078 | if (yesno == 0) |
1066 | { | 1079 | { |
1067 | if (wrapper->deleteAllMail(folder)) | 1080 | if (wrapper->deleteAllMail(folder)) |
1068 | { | 1081 | { |
1069 | AccountView * view = (AccountView*)listView(); | 1082 | AccountView * view = (AccountView*)listView(); |
1070 | if (view) view->refreshCurrent(); | 1083 | if (view) view->refreshCurrent(); |
1071 | } | 1084 | } |
1072 | } | 1085 | } |
1073 | } | 1086 | } |
1074 | 1087 | ||
1075 | void AccountViewItem::removeChilds() | 1088 | void AccountViewItem::removeChilds() |
1076 | { | 1089 | { |
1077 | QListViewItem *child = firstChild(); | 1090 | QListViewItem *child = firstChild(); |
1078 | while ( child ) | 1091 | while ( child ) |
1079 | { | 1092 | { |
1080 | QListViewItem *tmp = child; | 1093 | QListViewItem *tmp = child; |
1081 | child = child->nextSibling(); | 1094 | child = child->nextSibling(); |
1082 | delete tmp; | 1095 | delete tmp; |
1083 | } | 1096 | } |
1084 | } | 1097 | } |
1085 | 1098 | ||
1086 | bool AccountViewItem::matchName(const QString&name)const | 1099 | bool AccountViewItem::matchName(const QString&name)const |
1087 | { | 1100 | { |
1088 | if (!folder) return false; | 1101 | if (!folder) return false; |
1089 | return folder->getDisplayName()==name; | 1102 | return folder->getDisplayName()==name; |
1090 | } | 1103 | } |
1091 | 1104 | ||
1092 | 1105 | ||
1093 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) | 1106 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) |
1094 | { | 1107 | { |
1095 | AccountViewItem*pitem,*sitem; | 1108 | AccountViewItem*pitem,*sitem; |
1096 | if (!start) pitem = (AccountViewItem*)firstChild(); | 1109 | if (!start) pitem = (AccountViewItem*)firstChild(); |
1097 | else pitem = (AccountViewItem*)start->firstChild(); | 1110 | else pitem = (AccountViewItem*)start->firstChild(); |
1098 | while (pitem) | 1111 | while (pitem) |
1099 | { | 1112 | { |
1100 | if (pitem->matchName(path)) | 1113 | if (pitem->matchName(path)) |
1101 | { | 1114 | { |
1102 | break; | 1115 | break; |
1103 | } | 1116 | } |
1104 | if (pitem->childCount()>0) | 1117 | if (pitem->childCount()>0) |
1105 | { | 1118 | { |
1106 | sitem = findSubItem(path,pitem); | 1119 | sitem = findSubItem(path,pitem); |
1107 | if (sitem) | 1120 | if (sitem) |
1108 | { | 1121 | { |
1109 | pitem = sitem; | 1122 | pitem = sitem; |
1110 | break; | 1123 | break; |
1111 | } | 1124 | } |
1112 | } | 1125 | } |
1113 | pitem=(AccountViewItem*)pitem->nextSibling(); | 1126 | pitem=(AccountViewItem*)pitem->nextSibling(); |
1114 | } | 1127 | } |
1115 | return pitem; | 1128 | return pitem; |
1116 | } | 1129 | } |
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index a138c9b..f3c0f5d 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h | |||
@@ -1,204 +1,205 @@ | |||
1 | #ifndef __ACCOUNT_ITEM | 1 | #ifndef __ACCOUNT_ITEM |
2 | #define __ACCOUNT_ITEM | 2 | #define __ACCOUNT_ITEM |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | 6 | ||
7 | class POP3wrapper; | 7 | class POP3wrapper; |
8 | class RecMail; | 8 | class RecMail; |
9 | class RecBody; | 9 | class RecBody; |
10 | class QPopupMenu; | 10 | class QPopupMenu; |
11 | class Selectstore; | 11 | class Selectstore; |
12 | class AccountView; | 12 | class AccountView; |
13 | class POP3account; | 13 | class POP3account; |
14 | class NNTPaccount; | 14 | class NNTPaccount; |
15 | class IMAPaccount; | 15 | class IMAPaccount; |
16 | class AbstractMail; | 16 | class AbstractMail; |
17 | class Folder; | 17 | class Folder; |
18 | 18 | ||
19 | class AccountViewItem : public QListViewItem | 19 | class AccountViewItem : public QListViewItem |
20 | { | 20 | { |
21 | 21 | ||
22 | public: | 22 | public: |
23 | AccountViewItem( AccountView *parent ); | 23 | AccountViewItem( AccountView *parent ); |
24 | AccountViewItem( QListViewItem *parent); | 24 | AccountViewItem( QListViewItem *parent); |
25 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); | 25 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); |
26 | virtual ~AccountViewItem(); | 26 | virtual ~AccountViewItem(); |
27 | virtual void refresh(QList<RecMail>&)=0; | 27 | virtual void refresh(QList<RecMail>&)=0; |
28 | virtual RecBody fetchBody(const RecMail&)=0; | 28 | virtual RecBody fetchBody(const RecMail&)=0; |
29 | virtual QPopupMenu * getContextMenu(){return 0;}; | 29 | virtual QPopupMenu * getContextMenu(){return 0;}; |
30 | virtual void contextMenuSelected(int){} | 30 | virtual void contextMenuSelected(int){} |
31 | virtual AccountView*accountView(); | 31 | virtual AccountView*accountView(); |
32 | virtual bool matchName(const QString&name)const; | 32 | virtual bool matchName(const QString&name)const; |
33 | 33 | ||
34 | protected: | 34 | protected: |
35 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); | 35 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); |
36 | virtual void init(); | 36 | virtual void init(); |
37 | virtual void removeChilds(); | 37 | virtual void removeChilds(); |
38 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); | 38 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); |
39 | static const QString contextName; | 39 | static const QString contextName; |
40 | AccountView*m_Backlink; | 40 | AccountView*m_Backlink; |
41 | Folder *folder; | 41 | Folder *folder; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | class POP3viewItem : public AccountViewItem | 44 | class POP3viewItem : public AccountViewItem |
45 | { | 45 | { |
46 | 46 | ||
47 | public: | 47 | public: |
48 | POP3viewItem( POP3account *a, AccountView *parent ); | 48 | POP3viewItem( POP3account *a, AccountView *parent ); |
49 | virtual ~POP3viewItem(); | 49 | virtual ~POP3viewItem(); |
50 | virtual void refresh( QList<RecMail> &target ); | 50 | virtual void refresh( QList<RecMail> &target ); |
51 | virtual RecBody fetchBody( const RecMail &mail ); | 51 | virtual RecBody fetchBody( const RecMail &mail ); |
52 | AbstractMail *getWrapper(); | 52 | AbstractMail *getWrapper(); |
53 | virtual QPopupMenu * getContextMenu(); | 53 | virtual QPopupMenu * getContextMenu(); |
54 | virtual void contextMenuSelected(int); | 54 | virtual void contextMenuSelected(int); |
55 | 55 | ||
56 | protected: | 56 | protected: |
57 | POP3account *account; | 57 | POP3account *account; |
58 | virtual void refresh(); | 58 | virtual void refresh(); |
59 | AbstractMail *wrapper; | 59 | AbstractMail *wrapper; |
60 | void disconnect(); | 60 | void disconnect(); |
61 | void setOnOffline(); | 61 | void setOnOffline(); |
62 | }; | 62 | }; |
63 | 63 | ||
64 | class POP3folderItem : public AccountViewItem | 64 | class POP3folderItem : public AccountViewItem |
65 | { | 65 | { |
66 | 66 | ||
67 | public: | 67 | public: |
68 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); | 68 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); |
69 | virtual ~POP3folderItem(); | 69 | virtual ~POP3folderItem(); |
70 | virtual void refresh(QList<RecMail>&); | 70 | virtual void refresh(QList<RecMail>&); |
71 | virtual RecBody fetchBody(const RecMail&); | 71 | virtual RecBody fetchBody(const RecMail&); |
72 | virtual QPopupMenu * getContextMenu(); | 72 | virtual QPopupMenu * getContextMenu(); |
73 | virtual void contextMenuSelected(int); | 73 | virtual void contextMenuSelected(int); |
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | void downloadMails(); | 76 | void downloadMails(); |
77 | POP3viewItem *pop3; | 77 | POP3viewItem *pop3; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | 80 | ||
81 | class NNTPviewItem : public AccountViewItem | 81 | class NNTPviewItem : public AccountViewItem |
82 | { | 82 | { |
83 | 83 | ||
84 | public: | 84 | public: |
85 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); | 85 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); |
86 | virtual ~NNTPviewItem(); | 86 | virtual ~NNTPviewItem(); |
87 | virtual void refresh( QList<RecMail> &target ); | 87 | virtual void refresh( QList<RecMail> &target ); |
88 | virtual RecBody fetchBody( const RecMail &mail ); | 88 | virtual RecBody fetchBody( const RecMail &mail ); |
89 | AbstractMail *getWrapper(); | 89 | AbstractMail *getWrapper(); |
90 | virtual QPopupMenu * getContextMenu(); | 90 | virtual QPopupMenu * getContextMenu(); |
91 | virtual void contextMenuSelected(int); | 91 | virtual void contextMenuSelected(int); |
92 | 92 | ||
93 | protected: | 93 | protected: |
94 | NNTPaccount *account; | 94 | NNTPaccount *account; |
95 | virtual void refresh(); | 95 | virtual void refresh(); |
96 | AbstractMail *wrapper; | 96 | AbstractMail *wrapper; |
97 | void disconnect(); | 97 | void disconnect(); |
98 | void setOnOffline(); | 98 | void setOnOffline(); |
99 | void subscribeGroups(); | ||
99 | }; | 100 | }; |
100 | 101 | ||
101 | class NNTPfolderItem : public AccountViewItem | 102 | class NNTPfolderItem : public AccountViewItem |
102 | { | 103 | { |
103 | 104 | ||
104 | public: | 105 | public: |
105 | NNTPfolderItem( Folder *folder, NNTPviewItem *parent , QListViewItem*after ); | 106 | NNTPfolderItem( Folder *folder, NNTPviewItem *parent , QListViewItem*after ); |
106 | virtual ~NNTPfolderItem(); | 107 | virtual ~NNTPfolderItem(); |
107 | virtual void refresh(QList<RecMail>&); | 108 | virtual void refresh(QList<RecMail>&); |
108 | virtual RecBody fetchBody(const RecMail&); | 109 | virtual RecBody fetchBody(const RecMail&); |
109 | virtual QPopupMenu * getContextMenu(); | 110 | virtual QPopupMenu * getContextMenu(); |
110 | virtual void contextMenuSelected(int); | 111 | virtual void contextMenuSelected(int); |
111 | 112 | ||
112 | protected: | 113 | protected: |
113 | void downloadMails(); | 114 | void downloadMails(); |
114 | NNTPviewItem *nntp; | 115 | NNTPviewItem *nntp; |
115 | }; | 116 | }; |
116 | 117 | ||
117 | 118 | ||
118 | 119 | ||
119 | class IMAPviewItem : public AccountViewItem | 120 | class IMAPviewItem : public AccountViewItem |
120 | { | 121 | { |
121 | friend class IMAPfolderItem; | 122 | friend class IMAPfolderItem; |
122 | public: | 123 | public: |
123 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); | 124 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); |
124 | virtual ~IMAPviewItem(); | 125 | virtual ~IMAPviewItem(); |
125 | virtual void refresh(QList<RecMail>&); | 126 | virtual void refresh(QList<RecMail>&); |
126 | virtual RecBody fetchBody(const RecMail&); | 127 | virtual RecBody fetchBody(const RecMail&); |
127 | AbstractMail *getWrapper(); | 128 | AbstractMail *getWrapper(); |
128 | virtual QPopupMenu * getContextMenu(); | 129 | virtual QPopupMenu * getContextMenu(); |
129 | virtual void contextMenuSelected(int); | 130 | virtual void contextMenuSelected(int); |
130 | const QStringList&subFolders(); | 131 | const QStringList&subFolders(); |
131 | virtual void refreshFolders(bool force=false); | 132 | virtual void refreshFolders(bool force=false); |
132 | bool offline(); | 133 | bool offline(); |
133 | 134 | ||
134 | protected: | 135 | protected: |
135 | virtual void createNewFolder(); | 136 | virtual void createNewFolder(); |
136 | IMAPaccount *account; | 137 | IMAPaccount *account; |
137 | AbstractMail *wrapper; | 138 | AbstractMail *wrapper; |
138 | QStringList currentFolders; | 139 | QStringList currentFolders; |
139 | }; | 140 | }; |
140 | 141 | ||
141 | class IMAPfolderItem : public AccountViewItem | 142 | class IMAPfolderItem : public AccountViewItem |
142 | { | 143 | { |
143 | 144 | ||
144 | public: | 145 | public: |
145 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); | 146 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); |
146 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | 147 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); |
147 | virtual ~IMAPfolderItem(); | 148 | virtual ~IMAPfolderItem(); |
148 | virtual void refresh(QList<RecMail>&); | 149 | virtual void refresh(QList<RecMail>&); |
149 | virtual RecBody fetchBody(const RecMail&); | 150 | virtual RecBody fetchBody(const RecMail&); |
150 | virtual QPopupMenu * getContextMenu(); | 151 | virtual QPopupMenu * getContextMenu(); |
151 | virtual void contextMenuSelected(int); | 152 | virtual void contextMenuSelected(int); |
152 | virtual const QString& Delemiter()const; | 153 | virtual const QString& Delemiter()const; |
153 | protected: | 154 | protected: |
154 | virtual void createNewFolder(); | 155 | virtual void createNewFolder(); |
155 | virtual void deleteFolder(); | 156 | virtual void deleteFolder(); |
156 | virtual void downloadMails(); | 157 | virtual void downloadMails(); |
157 | IMAPviewItem *imap; | 158 | IMAPviewItem *imap; |
158 | }; | 159 | }; |
159 | 160 | ||
160 | class MHviewItem : public AccountViewItem | 161 | class MHviewItem : public AccountViewItem |
161 | { | 162 | { |
162 | friend class MHfolderItem; | 163 | friend class MHfolderItem; |
163 | 164 | ||
164 | public: | 165 | public: |
165 | MHviewItem( const QString&aMboxPath, AccountView *parent ); | 166 | MHviewItem( const QString&aMboxPath, AccountView *parent ); |
166 | virtual ~MHviewItem(); | 167 | virtual ~MHviewItem(); |
167 | virtual void refresh( QList<RecMail> &target ); | 168 | virtual void refresh( QList<RecMail> &target ); |
168 | virtual RecBody fetchBody( const RecMail &mail ); | 169 | virtual RecBody fetchBody( const RecMail &mail ); |
169 | AbstractMail *getWrapper(); | 170 | AbstractMail *getWrapper(); |
170 | virtual QPopupMenu * getContextMenu(); | 171 | virtual QPopupMenu * getContextMenu(); |
171 | virtual void contextMenuSelected(int); | 172 | virtual void contextMenuSelected(int); |
172 | QStringList subFolders(); | 173 | QStringList subFolders(); |
173 | virtual void refresh(bool force=false); | 174 | virtual void refresh(bool force=false); |
174 | 175 | ||
175 | protected: | 176 | protected: |
176 | void downloadMails(); | 177 | void downloadMails(); |
177 | virtual void createFolder(); | 178 | virtual void createFolder(); |
178 | QString m_Path; | 179 | QString m_Path; |
179 | AbstractMail *wrapper; | 180 | AbstractMail *wrapper; |
180 | QStringList currentFolders; | 181 | QStringList currentFolders; |
181 | }; | 182 | }; |
182 | 183 | ||
183 | class MHfolderItem : public AccountViewItem | 184 | class MHfolderItem : public AccountViewItem |
184 | { | 185 | { |
185 | 186 | ||
186 | public: | 187 | public: |
187 | MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after ); | 188 | MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after ); |
188 | MHfolderItem( Folder *folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); | 189 | MHfolderItem( Folder *folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); |
189 | virtual ~MHfolderItem(); | 190 | virtual ~MHfolderItem(); |
190 | virtual void refresh(QList<RecMail>&); | 191 | virtual void refresh(QList<RecMail>&); |
191 | virtual RecBody fetchBody(const RecMail&); | 192 | virtual RecBody fetchBody(const RecMail&); |
192 | virtual QPopupMenu * getContextMenu(); | 193 | virtual QPopupMenu * getContextMenu(); |
193 | virtual void contextMenuSelected(int); | 194 | virtual void contextMenuSelected(int); |
194 | virtual Folder*getFolder(); | 195 | virtual Folder*getFolder(); |
195 | 196 | ||
196 | protected: | 197 | protected: |
197 | void downloadMails(); | 198 | void downloadMails(); |
198 | virtual void createFolder(); | 199 | virtual void createFolder(); |
199 | virtual void deleteFolder(); | 200 | virtual void deleteFolder(); |
200 | void initName(); | 201 | void initName(); |
201 | MHviewItem *mbox; | 202 | MHviewItem *mbox; |
202 | }; | 203 | }; |
203 | 204 | ||
204 | #endif | 205 | #endif |
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro index 7e0de2b..005a839 100644 --- a/noncore/net/mail/mail.pro +++ b/noncore/net/mail/mail.pro | |||
@@ -1,61 +1,66 @@ | |||
1 | CONFIG += qt warn_on debug quick-app | 1 | CONFIG += qt warn_on debug quick-app |
2 | 2 | ||
3 | HEADERS = defines.h \ | 3 | HEADERS = defines.h \ |
4 | editaccounts.h \ | 4 | editaccounts.h \ |
5 | composemail.h \ | 5 | composemail.h \ |
6 | accountview.h \ | 6 | accountview.h \ |
7 | accountitem.h \ | 7 | accountitem.h \ |
8 | mainwindow.h \ | 8 | mainwindow.h \ |
9 | viewmail.h \ | 9 | viewmail.h \ |
10 | viewmailbase.h \ | 10 | viewmailbase.h \ |
11 | opiemail.h \ | 11 | opiemail.h \ |
12 | mailistviewitem.h \ | 12 | mailistviewitem.h \ |
13 | settingsdialog.h \ | 13 | settingsdialog.h \ |
14 | statuswidget.h \ | 14 | statuswidget.h \ |
15 | newmaildir.h \ | 15 | newmaildir.h \ |
16 | selectstore.h \ | 16 | selectstore.h \ |
17 | selectsmtp.h | 17 | selectsmtp.h \ |
18 | nntpgroups.h \ | ||
19 | nntpgroupsdlg.h | ||
18 | 20 | ||
19 | SOURCES = main.cpp \ | 21 | SOURCES = main.cpp \ |
20 | opiemail.cpp \ | 22 | opiemail.cpp \ |
21 | mainwindow.cpp \ | 23 | mainwindow.cpp \ |
22 | accountview.cpp \ | 24 | accountview.cpp \ |
23 | accountitem.cpp \ | 25 | accountitem.cpp \ |
24 | composemail.cpp \ | 26 | composemail.cpp \ |
25 | addresspicker.cpp \ | 27 | addresspicker.cpp \ |
26 | editaccounts.cpp \ | 28 | editaccounts.cpp \ |
27 | viewmail.cpp \ | 29 | viewmail.cpp \ |
28 | viewmailbase.cpp \ | 30 | viewmailbase.cpp \ |
29 | mailistviewitem.cpp \ | 31 | mailistviewitem.cpp \ |
30 | settingsdialog.cpp \ | 32 | settingsdialog.cpp \ |
31 | statuswidget.cpp \ | 33 | statuswidget.cpp \ |
32 | newmaildir.cpp \ | 34 | newmaildir.cpp \ |
33 | selectstore.cpp \ | 35 | selectstore.cpp \ |
34 | selectsmtp.cpp | 36 | selectsmtp.cpp \ |
37 | nntpgroups.cpp \ | ||
38 | nntpgroupsdlg.cpp | ||
35 | 39 | ||
36 | INTERFACES = editaccountsui.ui \ | 40 | INTERFACES = editaccountsui.ui \ |
37 | selectmailtypeui.ui \ | 41 | selectmailtypeui.ui \ |
38 | imapconfigui.ui \ | 42 | imapconfigui.ui \ |
39 | pop3configui.ui \ | 43 | pop3configui.ui \ |
40 | nntpconfigui.ui \ | 44 | nntpconfigui.ui \ |
41 | smtpconfigui.ui \ | 45 | smtpconfigui.ui \ |
42 | addresspickerui.ui \ | 46 | addresspickerui.ui \ |
43 | composemailui.ui \ | 47 | composemailui.ui \ |
44 | settingsdialogui.ui \ | 48 | settingsdialogui.ui \ |
45 | statuswidgetui.ui \ | 49 | statuswidgetui.ui \ |
46 | newmaildirui.ui \ | 50 | newmaildirui.ui \ |
47 | selectstoreui.ui | 51 | selectstoreui.ui \ |
52 | nntpgroupsui.ui | ||
48 | 53 | ||
49 | 54 | ||
50 | INCLUDEPATH += $(OPIEDIR)/include | 55 | INCLUDEPATH += $(OPIEDIR)/include |
51 | 56 | ||
52 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | 57 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) |
53 | contains( CONFTEST, y ){ | 58 | contains( CONFTEST, y ){ |
54 | LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lopiedb2 -lmailwrapper -liconv | 59 | LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lopiedb2 -lmailwrapper -liconv |
55 | }else{ | 60 | }else{ |
56 | LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lopiedb2 -lmailwrapper | 61 | LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lopiedb2 -lmailwrapper |
57 | } | 62 | } |
58 | 63 | ||
59 | TARGET = opiemail | 64 | TARGET = opiemail |
60 | 65 | ||
61 | include ( $(OPIEDIR)/include.pro ) | 66 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/mail/nntpgroups.cpp b/noncore/net/mail/nntpgroups.cpp new file mode 100644 index 0000000..97b1985 --- a/dev/null +++ b/noncore/net/mail/nntpgroups.cpp | |||
@@ -0,0 +1,57 @@ | |||
1 | #include "nntpgroups.h" | ||
2 | |||
3 | #include <libmailwrapper/settings.h> | ||
4 | |||
5 | #include <qlistview.h> | ||
6 | |||
7 | NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, WFlags fl) | ||
8 | : NNTPGroupsUI(parent,name,fl),subscribedGroups() | ||
9 | { | ||
10 | m_Account = account; | ||
11 | fillGroups(); | ||
12 | } | ||
13 | |||
14 | NNTPGroups::~NNTPGroups() | ||
15 | { | ||
16 | |||
17 | } | ||
18 | |||
19 | void NNTPGroups::slotGetNG() | ||
20 | { | ||
21 | if (!m_Account) return; | ||
22 | GroupListView->clear(); | ||
23 | NNTPwrapper tmp( m_Account ); | ||
24 | QStringList list = tmp.listAllNewsgroups(); | ||
25 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | ||
26 | QCheckListItem *item; | ||
27 | item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); | ||
28 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | ||
29 | item->setOn( true ); | ||
30 | } | ||
31 | } | ||
32 | } | ||
33 | |||
34 | void NNTPGroups::fillGroups() | ||
35 | { | ||
36 | if (!m_Account) return; | ||
37 | subscribedGroups = m_Account->getGroups(); | ||
38 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | ||
39 | QCheckListItem *item; | ||
40 | item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); | ||
41 | item->setOn( true ); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | void NNTPGroups::storeValues() | ||
46 | { | ||
47 | if (!m_Account) return; | ||
48 | QListViewItemIterator list_it( GroupListView ); | ||
49 | subscribedGroups.clear(); | ||
50 | for ( ; list_it.current(); ++list_it ) { | ||
51 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { | ||
52 | qDebug(list_it.current()->text(0) ); | ||
53 | subscribedGroups.append( list_it.current()->text(0) ); | ||
54 | } | ||
55 | } | ||
56 | m_Account->setGroups( subscribedGroups ); | ||
57 | } | ||
diff --git a/noncore/net/mail/nntpgroups.h b/noncore/net/mail/nntpgroups.h new file mode 100644 index 0000000..8cc2e8b --- a/dev/null +++ b/noncore/net/mail/nntpgroups.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef __NNTPGROUPS_WINDOW__ | ||
2 | #define __NNTPGROUPS_WINDOW__ | ||
3 | |||
4 | #include "nntpgroupsui.h" | ||
5 | |||
6 | #include <libmailwrapper/nntpwrapper.h> | ||
7 | |||
8 | class NNTPaccount; | ||
9 | class QStringList; | ||
10 | |||
11 | class NNTPGroups:public NNTPGroupsUI | ||
12 | { | ||
13 | Q_OBJECT | ||
14 | public: | ||
15 | NNTPGroups(NNTPaccount *account, QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | ||
16 | virtual ~NNTPGroups(); | ||
17 | /* must be called from external. | ||
18 | * it will store the new subscription list into the account | ||
19 | * but don't save them, this must be done by the calling class. | ||
20 | */ | ||
21 | void storeValues(); | ||
22 | |||
23 | protected slots: | ||
24 | virtual void slotGetNG(); | ||
25 | |||
26 | protected: | ||
27 | virtual void fillGroups(); | ||
28 | |||
29 | NNTPaccount*m_Account; | ||
30 | QStringList subscribedGroups; | ||
31 | }; | ||
32 | |||
33 | #endif | ||
diff --git a/noncore/net/mail/nntpgroupsdlg.cpp b/noncore/net/mail/nntpgroupsdlg.cpp new file mode 100644 index 0000000..752ce3c --- a/dev/null +++ b/noncore/net/mail/nntpgroupsdlg.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | #include "nntpgroupsdlg.h" | ||
2 | #include "nntpgroups.h" | ||
3 | |||
4 | #include <libmailwrapper/settings.h> | ||
5 | |||
6 | #include <qlayout.h> | ||
7 | |||
8 | NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name) | ||
9 | : QDialog(parent,name,true) | ||
10 | { | ||
11 | setCaption(tr("Subscribed newsgroups")); | ||
12 | m_Account = account; | ||
13 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | ||
14 | dlglayout->setSpacing(2); | ||
15 | dlglayout->setMargin(1); | ||
16 | groupsWidget = new NNTPGroups(account,this); | ||
17 | dlglayout->addWidget(groupsWidget); | ||
18 | } | ||
19 | |||
20 | NNTPGroupsDlg::~NNTPGroupsDlg() | ||
21 | { | ||
22 | } | ||
23 | |||
24 | void NNTPGroupsDlg::accept() | ||
25 | { | ||
26 | groupsWidget->storeValues(); | ||
27 | m_Account->save(); | ||
28 | QDialog::accept(); | ||
29 | } | ||
diff --git a/noncore/net/mail/nntpgroupsdlg.h b/noncore/net/mail/nntpgroupsdlg.h new file mode 100644 index 0000000..a21bac7 --- a/dev/null +++ b/noncore/net/mail/nntpgroupsdlg.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef __NNTP_GROUP_DLG_H | ||
2 | #define __NNTP_GROUP_DLG_H | ||
3 | |||
4 | #include <qdialog.h> | ||
5 | |||
6 | class NNTPGroups; | ||
7 | class NNTPaccount; | ||
8 | |||
9 | class NNTPGroupsDlg : public QDialog | ||
10 | { | ||
11 | Q_OBJECT | ||
12 | public: | ||
13 | NNTPGroupsDlg(NNTPaccount *account,QWidget * parent=0, const char * name=0); | ||
14 | virtual ~NNTPGroupsDlg(); | ||
15 | |||
16 | protected: | ||
17 | NNTPGroups*groupsWidget; | ||
18 | NNTPaccount*m_Account; | ||
19 | |||
20 | protected slots: | ||
21 | virtual void accept (); | ||
22 | }; | ||
23 | |||
24 | #endif | ||
diff --git a/noncore/net/mail/nntpgroupsui.ui b/noncore/net/mail/nntpgroupsui.ui new file mode 100644 index 0000000..93f487b --- a/dev/null +++ b/noncore/net/mail/nntpgroupsui.ui | |||
@@ -0,0 +1,88 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>NNTPGroupsUI</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>NNTPGroupsUI</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>356</width> | ||
15 | <height>406</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>newsgroupslist</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QListView</class> | ||
39 | <column> | ||
40 | <property> | ||
41 | <name>text</name> | ||
42 | <string>Newsgroups</string> | ||
43 | </property> | ||
44 | <property> | ||
45 | <name>clickable</name> | ||
46 | <bool>true</bool> | ||
47 | </property> | ||
48 | <property> | ||
49 | <name>resizeable</name> | ||
50 | <bool>true</bool> | ||
51 | </property> | ||
52 | </column> | ||
53 | <property stdset="1"> | ||
54 | <name>name</name> | ||
55 | <cstring>GroupListView</cstring> | ||
56 | </property> | ||
57 | <property> | ||
58 | <name>whatsThis</name> | ||
59 | <string>List of groups from the server. On start, only subscribed groups are listed.</string> | ||
60 | </property> | ||
61 | </widget> | ||
62 | <widget> | ||
63 | <class>QPushButton</class> | ||
64 | <property stdset="1"> | ||
65 | <name>name</name> | ||
66 | <cstring>GetNGButton</cstring> | ||
67 | </property> | ||
68 | <property stdset="1"> | ||
69 | <name>text</name> | ||
70 | <string>Get newsgroup list from server</string> | ||
71 | </property> | ||
72 | <property> | ||
73 | <name>whatsThis</name> | ||
74 | <string>Retrieve the list of groups from server</string> | ||
75 | </property> | ||
76 | </widget> | ||
77 | </vbox> | ||
78 | </widget> | ||
79 | <connections> | ||
80 | <connection> | ||
81 | <sender>GetNGButton</sender> | ||
82 | <signal>clicked()</signal> | ||
83 | <receiver>NNTPGroupsUI</receiver> | ||
84 | <slot>slotGetNG()</slot> | ||
85 | </connection> | ||
86 | <slot access="protected">slotGetNG()</slot> | ||
87 | </connections> | ||
88 | </UI> | ||