-rw-r--r-- | noncore/net/mail/accountitem.cpp | 190 | ||||
-rw-r--r-- | noncore/net/mail/accountitem.h | 40 | ||||
-rw-r--r-- | noncore/net/mail/accountview.cpp | 9 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 10 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/libmailwrapper.pro | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.cpp | 241 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.h | 48 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/nntpconfigui.ui | 503 |
10 files changed, 842 insertions, 212 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index c8f6ec4..32a96ff 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -1,927 +1,1117 @@ | |||
1 | 1 | ||
2 | #include "accountitem.h" | 2 | #include "accountitem.h" |
3 | #include "accountview.h" | 3 | #include "accountview.h" |
4 | #include "selectstore.h" | 4 | #include "selectstore.h" |
5 | #include "newmaildir.h" | 5 | #include "newmaildir.h" |
6 | #include "defines.h" | 6 | #include "defines.h" |
7 | 7 | ||
8 | /* OPIE */ | 8 | /* OPIE */ |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | #include <libmailwrapper/abstractmail.h> | 10 | #include <libmailwrapper/abstractmail.h> |
11 | #include <libmailwrapper/mailwrapper.h> | 11 | #include <libmailwrapper/mailwrapper.h> |
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | 13 | ||
14 | /* QT */ | 14 | /* QT */ |
15 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | 17 | ||
18 | #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 );} |
19 | /** | 19 | /** |
20 | * POP3 Account stuff | 20 | * POP3 Account stuff |
21 | */ | 21 | */ |
22 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | 22 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) |
23 | : AccountViewItem( parent ) | 23 | : AccountViewItem( parent ) |
24 | { | 24 | { |
25 | account = a; | 25 | account = a; |
26 | wrapper = AbstractMail::getWrapper( account ); | 26 | wrapper = AbstractMail::getWrapper( account ); |
27 | SETPIX(PIXMAP_POP3FOLDER); | 27 | SETPIX(PIXMAP_POP3FOLDER); |
28 | #if 0 | 28 | #if 0 |
29 | if (!account->getOffline()) | 29 | if (!account->getOffline()) |
30 | { | 30 | { |
31 | setPixmap( 0, ); | 31 | setPixmap( 0, ); |
32 | } | 32 | } |
33 | else | 33 | else |
34 | { | 34 | { |
35 | setPixmap( 0, PIXMAP_OFFLINE ); | 35 | setPixmap( 0, PIXMAP_OFFLINE ); |
36 | } | 36 | } |
37 | #endif | 37 | #endif |
38 | setText( 0, account->getAccountName() ); | 38 | setText( 0, account->getAccountName() ); |
39 | setOpen( true ); | 39 | setOpen( true ); |
40 | } | 40 | } |
41 | 41 | ||
42 | POP3viewItem::~POP3viewItem() | 42 | POP3viewItem::~POP3viewItem() |
43 | { | 43 | { |
44 | delete wrapper; | 44 | delete wrapper; |
45 | } | 45 | } |
46 | 46 | ||
47 | AbstractMail *POP3viewItem::getWrapper() | 47 | AbstractMail *POP3viewItem::getWrapper() |
48 | { | 48 | { |
49 | return wrapper; | 49 | return wrapper; |
50 | } | 50 | } |
51 | 51 | ||
52 | void POP3viewItem::refresh( QList<RecMail> & ) | 52 | void POP3viewItem::refresh( QList<RecMail> & ) |
53 | { | 53 | { |
54 | refresh(); | 54 | refresh(); |
55 | } | 55 | } |
56 | 56 | ||
57 | void POP3viewItem::refresh() | 57 | void POP3viewItem::refresh() |
58 | { | 58 | { |
59 | if (account->getOffline()) return; | 59 | if (account->getOffline()) return; |
60 | QList<Folder> *folders = wrapper->listFolders(); | 60 | QList<Folder> *folders = wrapper->listFolders(); |
61 | QListViewItem *child = firstChild(); | 61 | QListViewItem *child = firstChild(); |
62 | while ( child ) | 62 | while ( child ) |
63 | { | 63 | { |
64 | QListViewItem *tmp = child; | 64 | QListViewItem *tmp = child; |
65 | child = child->nextSibling(); | 65 | child = child->nextSibling(); |
66 | delete tmp; | 66 | delete tmp; |
67 | } | 67 | } |
68 | Folder *it; | 68 | Folder *it; |
69 | QListViewItem*item = 0; | 69 | QListViewItem*item = 0; |
70 | for ( it = folders->first(); it; it = folders->next() ) | 70 | for ( it = folders->first(); it; it = folders->next() ) |
71 | { | 71 | { |
72 | item = new POP3folderItem( it, this , item ); | 72 | item = new POP3folderItem( it, this , item ); |
73 | item->setSelectable(it->may_select()); | 73 | item->setSelectable(it->may_select()); |
74 | } | 74 | } |
75 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 75 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
76 | folders->setAutoDelete(false); | 76 | folders->setAutoDelete(false); |
77 | delete folders; | 77 | delete folders; |
78 | } | 78 | } |
79 | 79 | ||
80 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) | 80 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) |
81 | { | 81 | { |
82 | qDebug( "POP3 fetchBody" ); | 82 | qDebug( "POP3 fetchBody" ); |
83 | return wrapper->fetchBody( mail ); | 83 | return wrapper->fetchBody( mail ); |
84 | } | 84 | } |
85 | 85 | ||
86 | QPopupMenu * POP3viewItem::getContextMenu() | 86 | QPopupMenu * POP3viewItem::getContextMenu() |
87 | { | 87 | { |
88 | QPopupMenu *m = new QPopupMenu(0); | 88 | QPopupMenu *m = new QPopupMenu(0); |
89 | if (m) | 89 | if (m) |
90 | { | 90 | { |
91 | if (!account->getOffline()) | 91 | if (!account->getOffline()) |
92 | { | 92 | { |
93 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 93 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
94 | m->insertItem(QObject::tr("Set offline",contextName),1); | 94 | m->insertItem(QObject::tr("Set offline",contextName),1); |
95 | } | 95 | } |
96 | else | 96 | else |
97 | { | 97 | { |
98 | m->insertItem(QObject::tr("Set online",contextName),1); | 98 | m->insertItem(QObject::tr("Set online",contextName),1); |
99 | } | 99 | } |
100 | } | 100 | } |
101 | return m; | 101 | return m; |
102 | } | 102 | } |
103 | 103 | ||
104 | void POP3viewItem::disconnect() | 104 | void POP3viewItem::disconnect() |
105 | { | 105 | { |
106 | QListViewItem *child = firstChild(); | 106 | QListViewItem *child = firstChild(); |
107 | while ( child ) | 107 | while ( child ) |
108 | { | 108 | { |
109 | QListViewItem *tmp = child; | 109 | QListViewItem *tmp = child; |
110 | child = child->nextSibling(); | 110 | child = child->nextSibling(); |
111 | delete tmp; | 111 | delete tmp; |
112 | } | 112 | } |
113 | wrapper->logout(); | 113 | wrapper->logout(); |
114 | } | 114 | } |
115 | 115 | ||
116 | void POP3viewItem::setOnOffline() | 116 | void POP3viewItem::setOnOffline() |
117 | { | 117 | { |
118 | if (!account->getOffline()) | 118 | if (!account->getOffline()) |
119 | { | 119 | { |
120 | disconnect(); | 120 | disconnect(); |
121 | } | 121 | } |
122 | account->setOffline(!account->getOffline()); | 122 | account->setOffline(!account->getOffline()); |
123 | account->save(); | 123 | account->save(); |
124 | SETPIX(PIXMAP_POP3FOLDER); | 124 | SETPIX(PIXMAP_POP3FOLDER); |
125 | refresh(); | 125 | refresh(); |
126 | } | 126 | } |
127 | 127 | ||
128 | void POP3viewItem::contextMenuSelected(int which) | 128 | void POP3viewItem::contextMenuSelected(int which) |
129 | { | 129 | { |
130 | switch (which) | 130 | switch (which) |
131 | { | 131 | { |
132 | case 0: | 132 | case 0: |
133 | disconnect(); | 133 | disconnect(); |
134 | break; | 134 | break; |
135 | case 1: | 135 | case 1: |
136 | setOnOffline(); | 136 | setOnOffline(); |
137 | break; | 137 | break; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | POP3folderItem::~POP3folderItem() | 141 | POP3folderItem::~POP3folderItem() |
142 | {} | 142 | {} |
143 | 143 | ||
144 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) | 144 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) |
145 | : AccountViewItem( parent,after ) | 145 | : AccountViewItem( parent,after ) |
146 | { | 146 | { |
147 | folder = folderInit; | 147 | folder = folderInit; |
148 | pop3 = parent; | 148 | pop3 = parent; |
149 | if (folder->getDisplayName().lower()!="inbox") | 149 | if (folder->getDisplayName().lower()!="inbox") |
150 | { | 150 | { |
151 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 151 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
152 | } | 152 | } |
153 | else | 153 | else |
154 | { | 154 | { |
155 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 155 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
156 | } | 156 | } |
157 | setText( 0, folder->getDisplayName() ); | 157 | setText( 0, folder->getDisplayName() ); |
158 | } | 158 | } |
159 | 159 | ||
160 | void POP3folderItem::refresh(QList<RecMail>&target) | 160 | void POP3folderItem::refresh(QList<RecMail>&target) |
161 | { | 161 | { |
162 | if (folder->may_select()) | 162 | if (folder->may_select()) |
163 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 163 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
164 | } | 164 | } |
165 | 165 | ||
166 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) | 166 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) |
167 | { | 167 | { |
168 | return pop3->getWrapper()->fetchBody(aMail); | 168 | return pop3->getWrapper()->fetchBody(aMail); |
169 | } | 169 | } |
170 | 170 | ||
171 | QPopupMenu * POP3folderItem::getContextMenu() | 171 | QPopupMenu * POP3folderItem::getContextMenu() |
172 | { | 172 | { |
173 | QPopupMenu *m = new QPopupMenu(0); | 173 | QPopupMenu *m = new QPopupMenu(0); |
174 | if (m) | 174 | if (m) |
175 | { | 175 | { |
176 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 176 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
177 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 177 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
178 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 178 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
179 | } | 179 | } |
180 | return m; | 180 | return m; |
181 | } | 181 | } |
182 | 182 | ||
183 | void POP3folderItem::downloadMails() | 183 | void POP3folderItem::downloadMails() |
184 | { | 184 | { |
185 | AccountView*bl = pop3->accountView(); | 185 | AccountView*bl = pop3->accountView(); |
186 | if (!bl) return; | 186 | if (!bl) return; |
187 | bl->downloadMails(folder,pop3->getWrapper()); | 187 | bl->downloadMails(folder,pop3->getWrapper()); |
188 | } | 188 | } |
189 | 189 | ||
190 | void POP3folderItem::contextMenuSelected(int which) | 190 | void POP3folderItem::contextMenuSelected(int which) |
191 | { | 191 | { |
192 | AccountView * view = (AccountView*)listView(); | 192 | AccountView * view = (AccountView*)listView(); |
193 | switch (which) | 193 | switch (which) |
194 | { | 194 | { |
195 | case 0: | 195 | case 0: |
196 | /* must be 'cause pop3 lists are cached */ | 196 | /* must be 'cause pop3 lists are cached */ |
197 | pop3->getWrapper()->logout(); | 197 | pop3->getWrapper()->logout(); |
198 | view->refreshCurrent(); | 198 | view->refreshCurrent(); |
199 | break; | 199 | break; |
200 | case 1: | 200 | case 1: |
201 | deleteAllMail(pop3->getWrapper(),folder); | 201 | deleteAllMail(pop3->getWrapper(),folder); |
202 | break; | 202 | break; |
203 | case 2: | 203 | case 2: |
204 | downloadMails(); | 204 | downloadMails(); |
205 | break; | 205 | break; |
206 | default: | 206 | default: |
207 | break; | 207 | break; |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | /** | 211 | /** |
212 | * NNTP Account stuff | ||
213 | */ | ||
214 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | ||
215 | : AccountViewItem( parent ) | ||
216 | { | ||
217 | account = a; | ||
218 | wrapper = AbstractMail::getWrapper( account ); | ||
219 | //FIXME | ||
220 | SETPIX(PIXMAP_POP3FOLDER); | ||
221 | #if 0 | ||
222 | if (!account->getOffline()) | ||
223 | { | ||
224 | setPixmap( 0, ); | ||
225 | } | ||
226 | else | ||
227 | { | ||
228 | setPixmap( 0, PIXMAP_OFFLINE ); | ||
229 | } | ||
230 | #endif | ||
231 | setText( 0, account->getAccountName() ); | ||
232 | setOpen( true ); | ||
233 | } | ||
234 | |||
235 | NNTPviewItem::~NNTPviewItem() | ||
236 | { | ||
237 | delete wrapper; | ||
238 | } | ||
239 | |||
240 | AbstractMail *NNTPviewItem::getWrapper() | ||
241 | { | ||
242 | return wrapper; | ||
243 | } | ||
244 | |||
245 | void NNTPviewItem::refresh( QList<RecMail> & ) | ||
246 | { | ||
247 | refresh(); | ||
248 | } | ||
249 | |||
250 | void NNTPviewItem::refresh() | ||
251 | { | ||
252 | if (account->getOffline()) return; | ||
253 | QList<Folder> *folders = wrapper->listFolders(); | ||
254 | QListViewItem *child = firstChild(); | ||
255 | while ( child ) | ||
256 | { | ||
257 | QListViewItem *tmp = child; | ||
258 | child = child->nextSibling(); | ||
259 | delete tmp; | ||
260 | } | ||
261 | Folder *it; | ||
262 | QListViewItem*item = 0; | ||
263 | for ( it = folders->first(); it; it = folders->next() ) | ||
264 | { | ||
265 | item = new NNTPfolderItem( it, this , item ); | ||
266 | item->setSelectable(it->may_select()); | ||
267 | } | ||
268 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
269 | folders->setAutoDelete(false); | ||
270 | delete folders; | ||
271 | } | ||
272 | |||
273 | RecBody NNTPviewItem::fetchBody( const RecMail &mail ) | ||
274 | { | ||
275 | qDebug( "NNTP fetchBody" ); | ||
276 | return wrapper->fetchBody( mail ); | ||
277 | } | ||
278 | |||
279 | QPopupMenu * NNTPviewItem::getContextMenu() | ||
280 | { | ||
281 | QPopupMenu *m = new QPopupMenu(0); | ||
282 | if (m) | ||
283 | { | ||
284 | if (!account->getOffline()) | ||
285 | { | ||
286 | m->insertItem(QObject::tr("Disconnect",contextName),0); | ||
287 | m->insertItem(QObject::tr("Set offline",contextName),1); | ||
288 | } | ||
289 | else | ||
290 | { | ||
291 | m->insertItem(QObject::tr("Set online",contextName),1); | ||
292 | } | ||
293 | } | ||
294 | return m; | ||
295 | } | ||
296 | |||
297 | void NNTPviewItem::disconnect() | ||
298 | { | ||
299 | QListViewItem *child = firstChild(); | ||
300 | while ( child ) | ||
301 | { | ||
302 | QListViewItem *tmp = child; | ||
303 | child = child->nextSibling(); | ||
304 | delete tmp; | ||
305 | } | ||
306 | wrapper->logout(); | ||
307 | } | ||
308 | |||
309 | void NNTPviewItem::setOnOffline() | ||
310 | { | ||
311 | if (!account->getOffline()) | ||
312 | { | ||
313 | disconnect(); | ||
314 | } | ||
315 | account->setOffline(!account->getOffline()); | ||
316 | account->save(); | ||
317 | //FIXME | ||
318 | SETPIX(PIXMAP_POP3FOLDER); | ||
319 | refresh(); | ||
320 | } | ||
321 | |||
322 | void NNTPviewItem::contextMenuSelected(int which) | ||
323 | { | ||
324 | switch (which) | ||
325 | { | ||
326 | case 0: | ||
327 | disconnect(); | ||
328 | break; | ||
329 | case 1: | ||
330 | setOnOffline(); | ||
331 | break; | ||
332 | } | ||
333 | } | ||
334 | |||
335 | NNTPfolderItem::~NNTPfolderItem() | ||
336 | {} | ||
337 | |||
338 | NNTPfolderItem::NNTPfolderItem( Folder *folderInit, NNTPviewItem *parent , QListViewItem*after ) | ||
339 | : AccountViewItem( parent,after ) | ||
340 | { | ||
341 | folder = folderInit; | ||
342 | nntp = parent; | ||
343 | if (folder->getDisplayName().lower()!="inbox") | ||
344 | { | ||
345 | setPixmap( 0, PIXMAP_POP3FOLDER ); | ||
346 | } | ||
347 | else | ||
348 | { | ||
349 | setPixmap( 0, PIXMAP_INBOXFOLDER); | ||
350 | } | ||
351 | setText( 0, folder->getDisplayName() ); | ||
352 | } | ||
353 | |||
354 | void NNTPfolderItem::refresh(QList<RecMail>&target) | ||
355 | { | ||
356 | if (folder->may_select()) | ||
357 | nntp->getWrapper()->listMessages( folder->getName(),target ); | ||
358 | } | ||
359 | |||
360 | RecBody NNTPfolderItem::fetchBody(const RecMail&aMail) | ||
361 | { | ||
362 | return nntp->getWrapper()->fetchBody(aMail); | ||
363 | } | ||
364 | |||
365 | QPopupMenu * NNTPfolderItem::getContextMenu() | ||
366 | { | ||
367 | QPopupMenu *m = new QPopupMenu(0); | ||
368 | if (m) | ||
369 | { | ||
370 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | ||
371 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),1); | ||
372 | } | ||
373 | return m; | ||
374 | } | ||
375 | |||
376 | void NNTPfolderItem::downloadMails() | ||
377 | { | ||
378 | AccountView*bl = nntp->accountView(); | ||
379 | if (!bl) return; | ||
380 | bl->downloadMails(folder,nntp->getWrapper()); | ||
381 | } | ||
382 | |||
383 | void NNTPfolderItem::contextMenuSelected(int which) | ||
384 | { | ||
385 | AccountView * view = (AccountView*)listView(); | ||
386 | switch (which) | ||
387 | { | ||
388 | case 0: | ||
389 | /* must be 'cause pop3 lists are cached */ | ||
390 | nntp->getWrapper()->logout(); | ||
391 | view->refreshCurrent(); | ||
392 | break; | ||
393 | case 1: | ||
394 | downloadMails(); | ||
395 | break; | ||
396 | default: | ||
397 | break; | ||
398 | } | ||
399 | } | ||
400 | |||
401 | /** | ||
212 | * IMAP Account stuff | 402 | * IMAP Account stuff |
213 | */ | 403 | */ |
214 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) | 404 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) |
215 | : AccountViewItem( parent ) | 405 | : AccountViewItem( parent ) |
216 | { | 406 | { |
217 | account = a; | 407 | account = a; |
218 | wrapper = AbstractMail::getWrapper( account ); | 408 | wrapper = AbstractMail::getWrapper( account ); |
219 | SETPIX(PIXMAP_IMAPFOLDER); | 409 | SETPIX(PIXMAP_IMAPFOLDER); |
220 | setText( 0, account->getAccountName() ); | 410 | setText( 0, account->getAccountName() ); |
221 | setOpen( true ); | 411 | setOpen( true ); |
222 | } | 412 | } |
223 | 413 | ||
224 | IMAPviewItem::~IMAPviewItem() | 414 | IMAPviewItem::~IMAPviewItem() |
225 | { | 415 | { |
226 | delete wrapper; | 416 | delete wrapper; |
227 | } | 417 | } |
228 | 418 | ||
229 | AbstractMail *IMAPviewItem::getWrapper() | 419 | AbstractMail *IMAPviewItem::getWrapper() |
230 | { | 420 | { |
231 | return wrapper; | 421 | return wrapper; |
232 | } | 422 | } |
233 | 423 | ||
234 | void IMAPviewItem::refresh(QList<RecMail>&) | 424 | void IMAPviewItem::refresh(QList<RecMail>&) |
235 | { | 425 | { |
236 | refreshFolders(false); | 426 | refreshFolders(false); |
237 | } | 427 | } |
238 | 428 | ||
239 | const QStringList&IMAPviewItem::subFolders() | 429 | const QStringList&IMAPviewItem::subFolders() |
240 | { | 430 | { |
241 | return currentFolders; | 431 | return currentFolders; |
242 | } | 432 | } |
243 | 433 | ||
244 | void IMAPviewItem::refreshFolders(bool force) | 434 | void IMAPviewItem::refreshFolders(bool force) |
245 | { | 435 | { |
246 | if (childCount()>0 && force==false) return; | 436 | if (childCount()>0 && force==false) return; |
247 | if (account->getOffline()) return; | 437 | if (account->getOffline()) return; |
248 | 438 | ||
249 | removeChilds(); | 439 | removeChilds(); |
250 | currentFolders.clear(); | 440 | currentFolders.clear(); |
251 | QList<Folder> *folders = wrapper->listFolders(); | 441 | QList<Folder> *folders = wrapper->listFolders(); |
252 | 442 | ||
253 | Folder *it; | 443 | Folder *it; |
254 | QListViewItem*item = 0; | 444 | QListViewItem*item = 0; |
255 | QListViewItem*titem = 0; | 445 | QListViewItem*titem = 0; |
256 | QString fname,del,search; | 446 | QString fname,del,search; |
257 | int pos; | 447 | int pos; |
258 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 448 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
259 | folders->setAutoDelete(false); | 449 | folders->setAutoDelete(false); |
260 | 450 | ||
261 | for ( it = folders->first(); it; it = folders->next() ) | 451 | for ( it = folders->first(); it; it = folders->next() ) |
262 | { | 452 | { |
263 | if (it->getDisplayName().lower()=="inbox") | 453 | if (it->getDisplayName().lower()=="inbox") |
264 | { | 454 | { |
265 | item = new IMAPfolderItem( it, this , item ); | 455 | item = new IMAPfolderItem( it, this , item ); |
266 | folders->remove(it); | 456 | folders->remove(it); |
267 | qDebug("inbox found"); | 457 | qDebug("inbox found"); |
268 | break; | 458 | break; |
269 | } | 459 | } |
270 | } | 460 | } |
271 | for ( it = folders->first(); it; it = folders->next() ) | 461 | for ( it = folders->first(); it; it = folders->next() ) |
272 | { | 462 | { |
273 | fname = it->getDisplayName(); | 463 | fname = it->getDisplayName(); |
274 | currentFolders.append(it->getName()); | 464 | currentFolders.append(it->getName()); |
275 | pos = fname.findRev(it->Separator()); | 465 | pos = fname.findRev(it->Separator()); |
276 | if (pos != -1) | 466 | if (pos != -1) |
277 | { | 467 | { |
278 | fname = fname.left(pos); | 468 | fname = fname.left(pos); |
279 | } | 469 | } |
280 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 470 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
281 | if (pitem) | 471 | if (pitem) |
282 | { | 472 | { |
283 | titem = item; | 473 | titem = item; |
284 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); | 474 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); |
285 | /* setup the short name */ | 475 | /* setup the short name */ |
286 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); | 476 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); |
287 | item = titem; | 477 | item = titem; |
288 | } | 478 | } |
289 | else | 479 | else |
290 | { | 480 | { |
291 | item = new IMAPfolderItem( it, this , item ); | 481 | item = new IMAPfolderItem( it, this , item ); |
292 | } | 482 | } |
293 | } | 483 | } |
294 | delete folders; | 484 | delete folders; |
295 | } | 485 | } |
296 | 486 | ||
297 | QPopupMenu * IMAPviewItem::getContextMenu() | 487 | QPopupMenu * IMAPviewItem::getContextMenu() |
298 | { | 488 | { |
299 | QPopupMenu *m = new QPopupMenu(0); | 489 | QPopupMenu *m = new QPopupMenu(0); |
300 | if (m) | 490 | if (m) |
301 | { | 491 | { |
302 | if (!account->getOffline()) | 492 | if (!account->getOffline()) |
303 | { | 493 | { |
304 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 494 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
305 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 495 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
306 | m->insertSeparator(); | 496 | m->insertSeparator(); |
307 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 497 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
308 | m->insertItem(QObject::tr("Set offline",contextName),3); | 498 | m->insertItem(QObject::tr("Set offline",contextName),3); |
309 | } | 499 | } |
310 | else | 500 | else |
311 | { | 501 | { |
312 | m->insertItem(QObject::tr("Set online",contextName),3); | 502 | m->insertItem(QObject::tr("Set online",contextName),3); |
313 | } | 503 | } |
314 | } | 504 | } |
315 | return m; | 505 | return m; |
316 | } | 506 | } |
317 | 507 | ||
318 | void IMAPviewItem::createNewFolder() | 508 | void IMAPviewItem::createNewFolder() |
319 | { | 509 | { |
320 | Newmdirdlg ndirdlg; | 510 | Newmdirdlg ndirdlg; |
321 | if ( QPEApplication::execDialog( &ndirdlg )) | 511 | if ( QPEApplication::execDialog( &ndirdlg )) |
322 | { | 512 | { |
323 | QString ndir = ndirdlg.Newdir(); | 513 | QString ndir = ndirdlg.Newdir(); |
324 | bool makesubs = ndirdlg.subpossible(); | 514 | bool makesubs = ndirdlg.subpossible(); |
325 | QString delemiter = "/"; | 515 | QString delemiter = "/"; |
326 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 516 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
327 | if (item) | 517 | if (item) |
328 | { | 518 | { |
329 | delemiter = item->Delemiter(); | 519 | delemiter = item->Delemiter(); |
330 | } | 520 | } |
331 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 521 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
332 | { | 522 | { |
333 | refreshFolders(true); | 523 | refreshFolders(true); |
334 | } | 524 | } |
335 | } | 525 | } |
336 | } | 526 | } |
337 | 527 | ||
338 | void IMAPviewItem::contextMenuSelected(int id) | 528 | void IMAPviewItem::contextMenuSelected(int id) |
339 | { | 529 | { |
340 | qDebug("Id selected: %i",id); | 530 | qDebug("Id selected: %i",id); |
341 | switch (id) | 531 | switch (id) |
342 | { | 532 | { |
343 | case 0: | 533 | case 0: |
344 | refreshFolders(true); | 534 | refreshFolders(true); |
345 | break; | 535 | break; |
346 | case 1: | 536 | case 1: |
347 | createNewFolder(); | 537 | createNewFolder(); |
348 | break; | 538 | break; |
349 | case 2: | 539 | case 2: |
350 | removeChilds(); | 540 | removeChilds(); |
351 | wrapper->logout(); | 541 | wrapper->logout(); |
352 | break; | 542 | break; |
353 | case 3: | 543 | case 3: |
354 | if (account->getOffline()==false) | 544 | if (account->getOffline()==false) |
355 | { | 545 | { |
356 | removeChilds(); | 546 | removeChilds(); |
357 | wrapper->logout(); | 547 | wrapper->logout(); |
358 | } | 548 | } |
359 | account->setOffline(!account->getOffline()); | 549 | account->setOffline(!account->getOffline()); |
360 | account->save(); | 550 | account->save(); |
361 | SETPIX(PIXMAP_IMAPFOLDER); | 551 | SETPIX(PIXMAP_IMAPFOLDER); |
362 | refreshFolders(false); | 552 | refreshFolders(false); |
363 | break; | 553 | break; |
364 | default: | 554 | default: |
365 | break; | 555 | break; |
366 | } | 556 | } |
367 | } | 557 | } |
368 | 558 | ||
369 | RecBody IMAPviewItem::fetchBody(const RecMail&) | 559 | RecBody IMAPviewItem::fetchBody(const RecMail&) |
370 | { | 560 | { |
371 | return RecBody(); | 561 | return RecBody(); |
372 | } | 562 | } |
373 | 563 | ||
374 | bool IMAPviewItem::offline() | 564 | bool IMAPviewItem::offline() |
375 | { | 565 | { |
376 | return account->getOffline(); | 566 | return account->getOffline(); |
377 | } | 567 | } |
378 | 568 | ||
379 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) | 569 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) |
380 | : AccountViewItem( parent , after ) | 570 | : AccountViewItem( parent , after ) |
381 | { | 571 | { |
382 | folder = folderInit; | 572 | folder = folderInit; |
383 | imap = parent; | 573 | imap = parent; |
384 | if (folder->getDisplayName().lower()!="inbox") | 574 | if (folder->getDisplayName().lower()!="inbox") |
385 | { | 575 | { |
386 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 576 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
387 | } | 577 | } |
388 | else | 578 | else |
389 | { | 579 | { |
390 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 580 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
391 | } | 581 | } |
392 | setText( 0, folder->getDisplayName() ); | 582 | setText( 0, folder->getDisplayName() ); |
393 | } | 583 | } |
394 | 584 | ||
395 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 585 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
396 | : AccountViewItem( parent,after ) | 586 | : AccountViewItem( parent,after ) |
397 | { | 587 | { |
398 | folder = folderInit; | 588 | folder = folderInit; |
399 | imap = master; | 589 | imap = master; |
400 | if (folder->getDisplayName().lower()!="inbox") | 590 | if (folder->getDisplayName().lower()!="inbox") |
401 | { | 591 | { |
402 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 592 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
403 | } | 593 | } |
404 | else | 594 | else |
405 | { | 595 | { |
406 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 596 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
407 | } | 597 | } |
408 | setText( 0, folder->getDisplayName() ); | 598 | setText( 0, folder->getDisplayName() ); |
409 | } | 599 | } |
410 | 600 | ||
411 | IMAPfolderItem::~IMAPfolderItem() | 601 | IMAPfolderItem::~IMAPfolderItem() |
412 | {} | 602 | {} |
413 | 603 | ||
414 | const QString& IMAPfolderItem::Delemiter()const | 604 | const QString& IMAPfolderItem::Delemiter()const |
415 | { | 605 | { |
416 | return folder->Separator(); | 606 | return folder->Separator(); |
417 | } | 607 | } |
418 | 608 | ||
419 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 609 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
420 | { | 610 | { |
421 | if (folder->may_select()) | 611 | if (folder->may_select()) |
422 | { | 612 | { |
423 | imap->getWrapper()->listMessages( folder->getName(),target ); | 613 | imap->getWrapper()->listMessages( folder->getName(),target ); |
424 | } | 614 | } |
425 | else | 615 | else |
426 | { | 616 | { |
427 | target.clear(); | 617 | target.clear(); |
428 | } | 618 | } |
429 | } | 619 | } |
430 | 620 | ||
431 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | 621 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) |
432 | { | 622 | { |
433 | return imap->getWrapper()->fetchBody(aMail); | 623 | return imap->getWrapper()->fetchBody(aMail); |
434 | } | 624 | } |
435 | 625 | ||
436 | QPopupMenu * IMAPfolderItem::getContextMenu() | 626 | QPopupMenu * IMAPfolderItem::getContextMenu() |
437 | { | 627 | { |
438 | QPopupMenu *m = new QPopupMenu(0); | 628 | QPopupMenu *m = new QPopupMenu(0); |
439 | if (m) | 629 | if (m) |
440 | { | 630 | { |
441 | if (folder->may_select()) | 631 | if (folder->may_select()) |
442 | { | 632 | { |
443 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 633 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
444 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | 634 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); |
445 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 635 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
446 | } | 636 | } |
447 | if (folder->no_inferior()==false) | 637 | if (folder->no_inferior()==false) |
448 | { | 638 | { |
449 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 639 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
450 | } | 640 | } |
451 | if (folder->getDisplayName().lower()!="inbox") | 641 | if (folder->getDisplayName().lower()!="inbox") |
452 | { | 642 | { |
453 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 643 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
454 | } | 644 | } |
455 | } | 645 | } |
456 | return m; | 646 | return m; |
457 | } | 647 | } |
458 | 648 | ||
459 | void IMAPfolderItem::createNewFolder() | 649 | void IMAPfolderItem::createNewFolder() |
460 | { | 650 | { |
461 | Newmdirdlg ndirdlg; | 651 | Newmdirdlg ndirdlg; |
462 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 652 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
463 | { | 653 | { |
464 | QString ndir = ndirdlg.Newdir(); | 654 | QString ndir = ndirdlg.Newdir(); |
465 | bool makesubs = ndirdlg.subpossible(); | 655 | bool makesubs = ndirdlg.subpossible(); |
466 | QString delemiter = Delemiter(); | 656 | QString delemiter = Delemiter(); |
467 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 657 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
468 | { | 658 | { |
469 | imap->refreshFolders(true); | 659 | imap->refreshFolders(true); |
470 | } | 660 | } |
471 | } | 661 | } |
472 | } | 662 | } |
473 | 663 | ||
474 | void IMAPfolderItem::deleteFolder() | 664 | void IMAPfolderItem::deleteFolder() |
475 | { | 665 | { |
476 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 666 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
477 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 667 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
478 | QObject::tr("Yes",contextName), | 668 | QObject::tr("Yes",contextName), |
479 | QObject::tr("No",contextName),QString::null,1,1); | 669 | QObject::tr("No",contextName),QString::null,1,1); |
480 | qDebug("Auswahl: %i",yesno); | 670 | qDebug("Auswahl: %i",yesno); |
481 | if (yesno == 0) | 671 | if (yesno == 0) |
482 | { | 672 | { |
483 | if (imap->getWrapper()->deleteMbox(folder)) | 673 | if (imap->getWrapper()->deleteMbox(folder)) |
484 | { | 674 | { |
485 | QListView*v=listView(); | 675 | QListView*v=listView(); |
486 | IMAPviewItem * box = imap; | 676 | IMAPviewItem * box = imap; |
487 | /* be carefull - after that this object is destroyd so don't use | 677 | /* be carefull - after that this object is destroyd so don't use |
488 | * any member of it after that call!!*/ | 678 | * any member of it after that call!!*/ |
489 | imap->refreshFolders(true); | 679 | imap->refreshFolders(true); |
490 | if (v) | 680 | if (v) |
491 | { | 681 | { |
492 | v->setSelected(box,true); | 682 | v->setSelected(box,true); |
493 | } | 683 | } |
494 | } | 684 | } |
495 | } | 685 | } |
496 | } | 686 | } |
497 | 687 | ||
498 | void IMAPfolderItem::downloadMails() | 688 | void IMAPfolderItem::downloadMails() |
499 | { | 689 | { |
500 | AccountView*bl = imap->accountView(); | 690 | AccountView*bl = imap->accountView(); |
501 | if (!bl) return; | 691 | if (!bl) return; |
502 | bl->downloadMails(folder,imap->getWrapper()); | 692 | bl->downloadMails(folder,imap->getWrapper()); |
503 | } | 693 | } |
504 | 694 | ||
505 | void IMAPfolderItem::contextMenuSelected(int id) | 695 | void IMAPfolderItem::contextMenuSelected(int id) |
506 | { | 696 | { |
507 | qDebug("Selected id: %i",id); | 697 | qDebug("Selected id: %i",id); |
508 | AccountView * view = (AccountView*)listView(); | 698 | AccountView * view = (AccountView*)listView(); |
509 | switch(id) | 699 | switch(id) |
510 | { | 700 | { |
511 | case 0: | 701 | case 0: |
512 | view->refreshCurrent(); | 702 | view->refreshCurrent(); |
513 | break; | 703 | break; |
514 | case 1: | 704 | case 1: |
515 | deleteAllMail(imap->getWrapper(),folder); | 705 | deleteAllMail(imap->getWrapper(),folder); |
516 | break; | 706 | break; |
517 | case 2: | 707 | case 2: |
518 | createNewFolder(); | 708 | createNewFolder(); |
519 | break; | 709 | break; |
520 | case 3: | 710 | case 3: |
521 | deleteFolder(); | 711 | deleteFolder(); |
522 | break; | 712 | break; |
523 | case 4: | 713 | case 4: |
524 | downloadMails(); | 714 | downloadMails(); |
525 | break; | 715 | break; |
526 | default: | 716 | default: |
527 | break; | 717 | break; |
528 | } | 718 | } |
529 | } | 719 | } |
530 | 720 | ||
531 | /** | 721 | /** |
532 | * MH Account stuff | 722 | * MH Account stuff |
533 | */ | 723 | */ |
534 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 724 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
535 | POP3 and MBOX */ | 725 | POP3 and MBOX */ |
536 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 726 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
537 | : AccountViewItem( parent ) | 727 | : AccountViewItem( parent ) |
538 | { | 728 | { |
539 | m_Path = aPath; | 729 | m_Path = aPath; |
540 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 730 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
541 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 731 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); |
542 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 732 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
543 | setText( 0, " Local Folders" ); | 733 | setText( 0, " Local Folders" ); |
544 | setOpen( true ); | 734 | setOpen( true ); |
545 | folder = 0; | 735 | folder = 0; |
546 | } | 736 | } |
547 | 737 | ||
548 | MHviewItem::~MHviewItem() | 738 | MHviewItem::~MHviewItem() |
549 | { | 739 | { |
550 | delete wrapper; | 740 | delete wrapper; |
551 | } | 741 | } |
552 | 742 | ||
553 | AbstractMail *MHviewItem::getWrapper() | 743 | AbstractMail *MHviewItem::getWrapper() |
554 | { | 744 | { |
555 | return wrapper; | 745 | return wrapper; |
556 | } | 746 | } |
557 | 747 | ||
558 | void MHviewItem::refresh( QList<RecMail> & target) | 748 | void MHviewItem::refresh( QList<RecMail> & target) |
559 | { | 749 | { |
560 | refresh(false); | 750 | refresh(false); |
561 | getWrapper()->listMessages( "",target ); | 751 | getWrapper()->listMessages( "",target ); |
562 | } | 752 | } |
563 | 753 | ||
564 | void MHviewItem::refresh(bool force) | 754 | void MHviewItem::refresh(bool force) |
565 | { | 755 | { |
566 | if (childCount()>0 && force==false) return; | 756 | if (childCount()>0 && force==false) return; |
567 | removeChilds(); | 757 | removeChilds(); |
568 | currentFolders.clear(); | 758 | currentFolders.clear(); |
569 | QList<Folder> *folders = wrapper->listFolders(); | 759 | QList<Folder> *folders = wrapper->listFolders(); |
570 | Folder *it; | 760 | Folder *it; |
571 | MHfolderItem*item = 0; | 761 | MHfolderItem*item = 0; |
572 | MHfolderItem*pmaster = 0; | 762 | MHfolderItem*pmaster = 0; |
573 | QString fname = ""; | 763 | QString fname = ""; |
574 | int pos; | 764 | int pos; |
575 | for ( it = folders->first(); it; it = folders->next() ) | 765 | for ( it = folders->first(); it; it = folders->next() ) |
576 | { | 766 | { |
577 | fname = it->getDisplayName(); | 767 | fname = it->getDisplayName(); |
578 | /* this folder itself */ | 768 | /* this folder itself */ |
579 | if (fname=="/") | 769 | if (fname=="/") |
580 | { | 770 | { |
581 | currentFolders.append(fname); | 771 | currentFolders.append(fname); |
582 | folder = it; | 772 | folder = it; |
583 | continue; | 773 | continue; |
584 | } | 774 | } |
585 | currentFolders.append(fname); | 775 | currentFolders.append(fname); |
586 | pos = fname.findRev("/"); | 776 | pos = fname.findRev("/"); |
587 | if (pos > 0) | 777 | if (pos > 0) |
588 | { | 778 | { |
589 | fname = fname.left(pos); | 779 | fname = fname.left(pos); |
590 | pmaster = (MHfolderItem*)findSubItem(fname); | 780 | pmaster = (MHfolderItem*)findSubItem(fname); |
591 | } | 781 | } |
592 | else | 782 | else |
593 | { | 783 | { |
594 | pmaster = 0; | 784 | pmaster = 0; |
595 | } | 785 | } |
596 | if (pmaster) | 786 | if (pmaster) |
597 | { | 787 | { |
598 | item = new MHfolderItem( it, pmaster, item, this ); | 788 | item = new MHfolderItem( it, pmaster, item, this ); |
599 | } | 789 | } |
600 | else | 790 | else |
601 | { | 791 | { |
602 | item = new MHfolderItem( it, this , item ); | 792 | item = new MHfolderItem( it, this , item ); |
603 | } | 793 | } |
604 | item->setSelectable(it->may_select()); | 794 | item->setSelectable(it->may_select()); |
605 | } | 795 | } |
606 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 796 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
607 | folders->setAutoDelete(false); | 797 | folders->setAutoDelete(false); |
608 | delete folders; | 798 | delete folders; |
609 | } | 799 | } |
610 | 800 | ||
611 | RecBody MHviewItem::fetchBody( const RecMail &mail ) | 801 | RecBody MHviewItem::fetchBody( const RecMail &mail ) |
612 | { | 802 | { |
613 | qDebug( "MH fetchBody" ); | 803 | qDebug( "MH fetchBody" ); |
614 | return wrapper->fetchBody( mail ); | 804 | return wrapper->fetchBody( mail ); |
615 | } | 805 | } |
616 | 806 | ||
617 | QPopupMenu * MHviewItem::getContextMenu() | 807 | QPopupMenu * MHviewItem::getContextMenu() |
618 | { | 808 | { |
619 | QPopupMenu *m = new QPopupMenu(0); | 809 | QPopupMenu *m = new QPopupMenu(0); |
620 | if (m) | 810 | if (m) |
621 | { | 811 | { |
622 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 812 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
623 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 813 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
624 | m->insertItem(QObject::tr("Delete all mails",contextName),2); | 814 | m->insertItem(QObject::tr("Delete all mails",contextName),2); |
625 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); | 815 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); |
626 | } | 816 | } |
627 | return m; | 817 | return m; |
628 | } | 818 | } |
629 | 819 | ||
630 | void MHviewItem::createFolder() | 820 | void MHviewItem::createFolder() |
631 | { | 821 | { |
632 | Newmdirdlg ndirdlg(0,0,true); | 822 | Newmdirdlg ndirdlg(0,0,true); |
633 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 823 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
634 | { | 824 | { |
635 | QString ndir = ndirdlg.Newdir(); | 825 | QString ndir = ndirdlg.Newdir(); |
636 | if (wrapper->createMbox(ndir)) | 826 | if (wrapper->createMbox(ndir)) |
637 | { | 827 | { |
638 | refresh(true); | 828 | refresh(true); |
639 | } | 829 | } |
640 | } | 830 | } |
641 | } | 831 | } |
642 | 832 | ||
643 | void MHviewItem::downloadMails() | 833 | void MHviewItem::downloadMails() |
644 | { | 834 | { |
645 | AccountView*bl = accountView(); | 835 | AccountView*bl = accountView(); |
646 | if (!bl) return; | 836 | if (!bl) return; |
647 | bl->downloadMails(folder,getWrapper()); | 837 | bl->downloadMails(folder,getWrapper()); |
648 | } | 838 | } |
649 | 839 | ||
650 | QStringList MHviewItem::subFolders() | 840 | QStringList MHviewItem::subFolders() |
651 | { | 841 | { |
652 | return currentFolders; | 842 | return currentFolders; |
653 | } | 843 | } |
654 | 844 | ||
655 | void MHviewItem::contextMenuSelected(int which) | 845 | void MHviewItem::contextMenuSelected(int which) |
656 | { | 846 | { |
657 | switch (which) | 847 | switch (which) |
658 | { | 848 | { |
659 | case 0: | 849 | case 0: |
660 | refresh(true); | 850 | refresh(true); |
661 | break; | 851 | break; |
662 | case 1: | 852 | case 1: |
663 | createFolder(); | 853 | createFolder(); |
664 | break; | 854 | break; |
665 | case 2: | 855 | case 2: |
666 | deleteAllMail(getWrapper(),folder); | 856 | deleteAllMail(getWrapper(),folder); |
667 | break; | 857 | break; |
668 | case 3: | 858 | case 3: |
669 | downloadMails(); | 859 | downloadMails(); |
670 | break; | 860 | break; |
671 | default: | 861 | default: |
672 | break; | 862 | break; |
673 | } | 863 | } |
674 | } | 864 | } |
675 | 865 | ||
676 | MHfolderItem::~MHfolderItem() | 866 | MHfolderItem::~MHfolderItem() |
677 | {} | 867 | {} |
678 | 868 | ||
679 | MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after ) | 869 | MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after ) |
680 | : AccountViewItem( parent,after ) | 870 | : AccountViewItem( parent,after ) |
681 | { | 871 | { |
682 | folder = folderInit; | 872 | folder = folderInit; |
683 | mbox = parent; | 873 | mbox = parent; |
684 | initName(); | 874 | initName(); |
685 | } | 875 | } |
686 | 876 | ||
687 | MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) | 877 | MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) |
688 | : AccountViewItem( parent,after ) | 878 | : AccountViewItem( parent,after ) |
689 | { | 879 | { |
690 | folder = folderInit; | 880 | folder = folderInit; |
691 | mbox = master; | 881 | mbox = master; |
692 | initName(); | 882 | initName(); |
693 | } | 883 | } |
694 | 884 | ||
695 | void MHfolderItem::initName() | 885 | void MHfolderItem::initName() |
696 | { | 886 | { |
697 | QString bName = folder->getDisplayName(); | 887 | QString bName = folder->getDisplayName(); |
698 | if (bName.startsWith("/")&&bName.length()>1) | 888 | if (bName.startsWith("/")&&bName.length()>1) |
699 | { | 889 | { |
700 | bName.replace(0,1,""); | 890 | bName.replace(0,1,""); |
701 | } | 891 | } |
702 | int pos = bName.findRev("/"); | 892 | int pos = bName.findRev("/"); |
703 | if (pos > 0) | 893 | if (pos > 0) |
704 | { | 894 | { |
705 | bName.replace(0,pos+1,""); | 895 | bName.replace(0,pos+1,""); |
706 | } | 896 | } |
707 | if (bName.lower() == "outgoing") | 897 | if (bName.lower() == "outgoing") |
708 | { | 898 | { |
709 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 899 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
710 | } | 900 | } |
711 | else if (bName.lower() == "inbox") | 901 | else if (bName.lower() == "inbox") |
712 | { | 902 | { |
713 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 903 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
714 | } | 904 | } |
715 | else | 905 | else |
716 | { | 906 | { |
717 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 907 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
718 | } | 908 | } |
719 | setText( 0, bName ); | 909 | setText( 0, bName ); |
720 | } | 910 | } |
721 | 911 | ||
722 | Folder*MHfolderItem::getFolder() | 912 | Folder*MHfolderItem::getFolder() |
723 | { | 913 | { |
724 | return folder; | 914 | return folder; |
725 | } | 915 | } |
726 | 916 | ||
727 | void MHfolderItem::refresh(QList<RecMail>&target) | 917 | void MHfolderItem::refresh(QList<RecMail>&target) |
728 | { | 918 | { |
729 | if (folder->may_select()) | 919 | if (folder->may_select()) |
730 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 920 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
731 | } | 921 | } |
732 | 922 | ||
733 | RecBody MHfolderItem::fetchBody(const RecMail&aMail) | 923 | RecBody MHfolderItem::fetchBody(const RecMail&aMail) |
734 | { | 924 | { |
735 | return mbox->getWrapper()->fetchBody(aMail); | 925 | return mbox->getWrapper()->fetchBody(aMail); |
736 | } | 926 | } |
737 | 927 | ||
738 | void MHfolderItem::deleteFolder() | 928 | void MHfolderItem::deleteFolder() |
739 | { | 929 | { |
740 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 930 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
741 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 931 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
742 | QObject::tr("Yes",contextName), | 932 | QObject::tr("Yes",contextName), |
743 | QObject::tr("No",contextName),QString::null,1,1); | 933 | QObject::tr("No",contextName),QString::null,1,1); |
744 | qDebug("Auswahl: %i",yesno); | 934 | qDebug("Auswahl: %i",yesno); |
745 | if (yesno == 0) | 935 | if (yesno == 0) |
746 | { | 936 | { |
747 | if (mbox->getWrapper()->deleteMbox(folder)) | 937 | if (mbox->getWrapper()->deleteMbox(folder)) |
748 | { | 938 | { |
749 | QListView*v=listView(); | 939 | QListView*v=listView(); |
750 | MHviewItem * box = mbox; | 940 | MHviewItem * box = mbox; |
751 | /* be carefull - after that this object is destroyd so don't use | 941 | /* be carefull - after that this object is destroyd so don't use |
752 | * any member of it after that call!!*/ | 942 | * any member of it after that call!!*/ |
753 | mbox->refresh(true); | 943 | mbox->refresh(true); |
754 | if (v) | 944 | if (v) |
755 | { | 945 | { |
756 | v->setSelected(box,true); | 946 | v->setSelected(box,true); |
757 | } | 947 | } |
758 | } | 948 | } |
759 | } | 949 | } |
760 | } | 950 | } |
761 | 951 | ||
762 | QPopupMenu * MHfolderItem::getContextMenu() | 952 | QPopupMenu * MHfolderItem::getContextMenu() |
763 | { | 953 | { |
764 | QPopupMenu *m = new QPopupMenu(0); | 954 | QPopupMenu *m = new QPopupMenu(0); |
765 | if (m) | 955 | if (m) |
766 | { | 956 | { |
767 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 957 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
768 | m->insertItem(QObject::tr("Delete all mails",contextName),0); | 958 | m->insertItem(QObject::tr("Delete all mails",contextName),0); |
769 | m->insertItem(QObject::tr("Create new subfolder",contextName),3); | 959 | m->insertItem(QObject::tr("Create new subfolder",contextName),3); |
770 | m->insertItem(QObject::tr("Delete folder",contextName),1); | 960 | m->insertItem(QObject::tr("Delete folder",contextName),1); |
771 | } | 961 | } |
772 | return m; | 962 | return m; |
773 | } | 963 | } |
774 | 964 | ||
775 | void MHfolderItem::downloadMails() | 965 | void MHfolderItem::downloadMails() |
776 | { | 966 | { |
777 | AccountView*bl = mbox->accountView(); | 967 | AccountView*bl = mbox->accountView(); |
778 | if (!bl) return; | 968 | if (!bl) return; |
779 | bl->downloadMails(folder,mbox->getWrapper()); | 969 | bl->downloadMails(folder,mbox->getWrapper()); |
780 | } | 970 | } |
781 | 971 | ||
782 | void MHfolderItem::createFolder() | 972 | void MHfolderItem::createFolder() |
783 | { | 973 | { |
784 | Newmdirdlg ndirdlg(0,0,true); | 974 | Newmdirdlg ndirdlg(0,0,true); |
785 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 975 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
786 | { | 976 | { |
787 | QString ndir = ndirdlg.Newdir(); | 977 | QString ndir = ndirdlg.Newdir(); |
788 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 978 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
789 | { | 979 | { |
790 | QListView*v=listView(); | 980 | QListView*v=listView(); |
791 | MHviewItem * box = mbox; | 981 | MHviewItem * box = mbox; |
792 | /* be carefull - after that this object is destroyd so don't use | 982 | /* be carefull - after that this object is destroyd so don't use |
793 | * any member of it after that call!!*/ | 983 | * any member of it after that call!!*/ |
794 | mbox->refresh(true); | 984 | mbox->refresh(true); |
795 | if (v) | 985 | if (v) |
796 | { | 986 | { |
797 | v->setSelected(box,true); | 987 | v->setSelected(box,true); |
798 | } | 988 | } |
799 | } | 989 | } |
800 | } | 990 | } |
801 | } | 991 | } |
802 | 992 | ||
803 | void MHfolderItem::contextMenuSelected(int which) | 993 | void MHfolderItem::contextMenuSelected(int which) |
804 | { | 994 | { |
805 | switch(which) | 995 | switch(which) |
806 | { | 996 | { |
807 | case 0: | 997 | case 0: |
808 | deleteAllMail(mbox->getWrapper(),folder); | 998 | deleteAllMail(mbox->getWrapper(),folder); |
809 | break; | 999 | break; |
810 | case 1: | 1000 | case 1: |
811 | deleteFolder(); | 1001 | deleteFolder(); |
812 | break; | 1002 | break; |
813 | case 2: | 1003 | case 2: |
814 | downloadMails(); | 1004 | downloadMails(); |
815 | break; | 1005 | break; |
816 | case 3: | 1006 | case 3: |
817 | createFolder(); | 1007 | createFolder(); |
818 | break; | 1008 | break; |
819 | default: | 1009 | default: |
820 | break; | 1010 | break; |
821 | } | 1011 | } |
822 | } | 1012 | } |
823 | 1013 | ||
824 | /** | 1014 | /** |
825 | * Generic stuff | 1015 | * Generic stuff |
826 | */ | 1016 | */ |
827 | 1017 | ||
828 | const QString AccountViewItem::contextName="AccountViewItem"; | 1018 | const QString AccountViewItem::contextName="AccountViewItem"; |
829 | 1019 | ||
830 | AccountViewItem::AccountViewItem( AccountView *parent ) | 1020 | AccountViewItem::AccountViewItem( AccountView *parent ) |
831 | : QListViewItem( parent ) | 1021 | : QListViewItem( parent ) |
832 | { | 1022 | { |
833 | init(); | 1023 | init(); |
834 | m_Backlink = parent; | 1024 | m_Backlink = parent; |
835 | } | 1025 | } |
836 | 1026 | ||
837 | AccountViewItem::AccountViewItem( QListViewItem *parent) | 1027 | AccountViewItem::AccountViewItem( QListViewItem *parent) |
838 | : QListViewItem( parent) | 1028 | : QListViewItem( parent) |
839 | { | 1029 | { |
840 | init(); | 1030 | init(); |
841 | } | 1031 | } |
842 | 1032 | ||
843 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) | 1033 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) |
844 | :QListViewItem( parent,after ) | 1034 | :QListViewItem( parent,after ) |
845 | { | 1035 | { |
846 | init(); | 1036 | init(); |
847 | } | 1037 | } |
848 | 1038 | ||
849 | void AccountViewItem::init() | 1039 | void AccountViewItem::init() |
850 | { | 1040 | { |
851 | m_Backlink = 0; | 1041 | m_Backlink = 0; |
852 | folder = 0; | 1042 | folder = 0; |
853 | } | 1043 | } |
854 | 1044 | ||
855 | AccountViewItem::~AccountViewItem() | 1045 | AccountViewItem::~AccountViewItem() |
856 | { | 1046 | { |
857 | if (folder) delete folder; | 1047 | if (folder) delete folder; |
858 | } | 1048 | } |
859 | 1049 | ||
860 | AccountView*AccountViewItem::accountView() | 1050 | AccountView*AccountViewItem::accountView() |
861 | { | 1051 | { |
862 | return m_Backlink; | 1052 | return m_Backlink; |
863 | } | 1053 | } |
864 | 1054 | ||
865 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) | 1055 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) |
866 | { | 1056 | { |
867 | if (!wrapper) return; | 1057 | if (!wrapper) return; |
868 | QString fname=""; | 1058 | QString fname=""; |
869 | if (folder) fname = folder->getDisplayName(); | 1059 | if (folder) fname = folder->getDisplayName(); |
870 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | 1060 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
871 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). | 1061 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). |
872 | arg(fname), | 1062 | arg(fname), |
873 | QObject::tr("Yes",contextName), | 1063 | QObject::tr("Yes",contextName), |
874 | QObject::tr("No",contextName),QString::null,1,1); | 1064 | QObject::tr("No",contextName),QString::null,1,1); |
875 | qDebug("Auswahl: %i",yesno); | 1065 | qDebug("Auswahl: %i",yesno); |
876 | if (yesno == 0) | 1066 | if (yesno == 0) |
877 | { | 1067 | { |
878 | if (wrapper->deleteAllMail(folder)) | 1068 | if (wrapper->deleteAllMail(folder)) |
879 | { | 1069 | { |
880 | AccountView * view = (AccountView*)listView(); | 1070 | AccountView * view = (AccountView*)listView(); |
881 | if (view) view->refreshCurrent(); | 1071 | if (view) view->refreshCurrent(); |
882 | } | 1072 | } |
883 | } | 1073 | } |
884 | } | 1074 | } |
885 | 1075 | ||
886 | void AccountViewItem::removeChilds() | 1076 | void AccountViewItem::removeChilds() |
887 | { | 1077 | { |
888 | QListViewItem *child = firstChild(); | 1078 | QListViewItem *child = firstChild(); |
889 | while ( child ) | 1079 | while ( child ) |
890 | { | 1080 | { |
891 | QListViewItem *tmp = child; | 1081 | QListViewItem *tmp = child; |
892 | child = child->nextSibling(); | 1082 | child = child->nextSibling(); |
893 | delete tmp; | 1083 | delete tmp; |
894 | } | 1084 | } |
895 | } | 1085 | } |
896 | 1086 | ||
897 | bool AccountViewItem::matchName(const QString&name)const | 1087 | bool AccountViewItem::matchName(const QString&name)const |
898 | { | 1088 | { |
899 | if (!folder) return false; | 1089 | if (!folder) return false; |
900 | return folder->getDisplayName()==name; | 1090 | return folder->getDisplayName()==name; |
901 | } | 1091 | } |
902 | 1092 | ||
903 | 1093 | ||
904 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) | 1094 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) |
905 | { | 1095 | { |
906 | AccountViewItem*pitem,*sitem; | 1096 | AccountViewItem*pitem,*sitem; |
907 | if (!start) pitem = (AccountViewItem*)firstChild(); | 1097 | if (!start) pitem = (AccountViewItem*)firstChild(); |
908 | else pitem = (AccountViewItem*)start->firstChild(); | 1098 | else pitem = (AccountViewItem*)start->firstChild(); |
909 | while (pitem) | 1099 | while (pitem) |
910 | { | 1100 | { |
911 | if (pitem->matchName(path)) | 1101 | if (pitem->matchName(path)) |
912 | { | 1102 | { |
913 | break; | 1103 | break; |
914 | } | 1104 | } |
915 | if (pitem->childCount()>0) | 1105 | if (pitem->childCount()>0) |
916 | { | 1106 | { |
917 | sitem = findSubItem(path,pitem); | 1107 | sitem = findSubItem(path,pitem); |
918 | if (sitem) | 1108 | if (sitem) |
919 | { | 1109 | { |
920 | pitem = sitem; | 1110 | pitem = sitem; |
921 | break; | 1111 | break; |
922 | } | 1112 | } |
923 | } | 1113 | } |
924 | pitem=(AccountViewItem*)pitem->nextSibling(); | 1114 | pitem=(AccountViewItem*)pitem->nextSibling(); |
925 | } | 1115 | } |
926 | return pitem; | 1116 | return pitem; |
927 | } | 1117 | } |
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index 99208b6..a138c9b 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h | |||
@@ -1,164 +1,204 @@ | |||
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 IMAPaccount; | 15 | class IMAPaccount; |
15 | class AbstractMail; | 16 | class AbstractMail; |
16 | class Folder; | 17 | class Folder; |
17 | 18 | ||
18 | class AccountViewItem : public QListViewItem | 19 | class AccountViewItem : public QListViewItem |
19 | { | 20 | { |
20 | 21 | ||
21 | public: | 22 | public: |
22 | AccountViewItem( AccountView *parent ); | 23 | AccountViewItem( AccountView *parent ); |
23 | AccountViewItem( QListViewItem *parent); | 24 | AccountViewItem( QListViewItem *parent); |
24 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); | 25 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); |
25 | virtual ~AccountViewItem(); | 26 | virtual ~AccountViewItem(); |
26 | virtual void refresh(QList<RecMail>&)=0; | 27 | virtual void refresh(QList<RecMail>&)=0; |
27 | virtual RecBody fetchBody(const RecMail&)=0; | 28 | virtual RecBody fetchBody(const RecMail&)=0; |
28 | virtual QPopupMenu * getContextMenu(){return 0;}; | 29 | virtual QPopupMenu * getContextMenu(){return 0;}; |
29 | virtual void contextMenuSelected(int){} | 30 | virtual void contextMenuSelected(int){} |
30 | virtual AccountView*accountView(); | 31 | virtual AccountView*accountView(); |
31 | virtual bool matchName(const QString&name)const; | 32 | virtual bool matchName(const QString&name)const; |
32 | 33 | ||
33 | protected: | 34 | protected: |
34 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); | 35 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); |
35 | virtual void init(); | 36 | virtual void init(); |
36 | virtual void removeChilds(); | 37 | virtual void removeChilds(); |
37 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); | 38 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); |
38 | static const QString contextName; | 39 | static const QString contextName; |
39 | AccountView*m_Backlink; | 40 | AccountView*m_Backlink; |
40 | Folder *folder; | 41 | Folder *folder; |
41 | }; | 42 | }; |
42 | 43 | ||
43 | class POP3viewItem : public AccountViewItem | 44 | class POP3viewItem : public AccountViewItem |
44 | { | 45 | { |
45 | 46 | ||
46 | public: | 47 | public: |
47 | POP3viewItem( POP3account *a, AccountView *parent ); | 48 | POP3viewItem( POP3account *a, AccountView *parent ); |
48 | virtual ~POP3viewItem(); | 49 | virtual ~POP3viewItem(); |
49 | virtual void refresh( QList<RecMail> &target ); | 50 | virtual void refresh( QList<RecMail> &target ); |
50 | virtual RecBody fetchBody( const RecMail &mail ); | 51 | virtual RecBody fetchBody( const RecMail &mail ); |
51 | AbstractMail *getWrapper(); | 52 | AbstractMail *getWrapper(); |
52 | virtual QPopupMenu * getContextMenu(); | 53 | virtual QPopupMenu * getContextMenu(); |
53 | virtual void contextMenuSelected(int); | 54 | virtual void contextMenuSelected(int); |
54 | 55 | ||
55 | protected: | 56 | protected: |
56 | POP3account *account; | 57 | POP3account *account; |
57 | virtual void refresh(); | 58 | virtual void refresh(); |
58 | AbstractMail *wrapper; | 59 | AbstractMail *wrapper; |
59 | void disconnect(); | 60 | void disconnect(); |
60 | void setOnOffline(); | 61 | void setOnOffline(); |
61 | }; | 62 | }; |
62 | 63 | ||
63 | class POP3folderItem : public AccountViewItem | 64 | class POP3folderItem : public AccountViewItem |
64 | { | 65 | { |
65 | 66 | ||
66 | public: | 67 | public: |
67 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); | 68 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); |
68 | virtual ~POP3folderItem(); | 69 | virtual ~POP3folderItem(); |
69 | virtual void refresh(QList<RecMail>&); | 70 | virtual void refresh(QList<RecMail>&); |
70 | virtual RecBody fetchBody(const RecMail&); | 71 | virtual RecBody fetchBody(const RecMail&); |
71 | virtual QPopupMenu * getContextMenu(); | 72 | virtual QPopupMenu * getContextMenu(); |
72 | virtual void contextMenuSelected(int); | 73 | virtual void contextMenuSelected(int); |
73 | 74 | ||
74 | protected: | 75 | protected: |
75 | void downloadMails(); | 76 | void downloadMails(); |
76 | POP3viewItem *pop3; | 77 | POP3viewItem *pop3; |
77 | }; | 78 | }; |
78 | 79 | ||
80 | |||
81 | class NNTPviewItem : public AccountViewItem | ||
82 | { | ||
83 | |||
84 | public: | ||
85 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); | ||
86 | virtual ~NNTPviewItem(); | ||
87 | virtual void refresh( QList<RecMail> &target ); | ||
88 | virtual RecBody fetchBody( const RecMail &mail ); | ||
89 | AbstractMail *getWrapper(); | ||
90 | virtual QPopupMenu * getContextMenu(); | ||
91 | virtual void contextMenuSelected(int); | ||
92 | |||
93 | protected: | ||
94 | NNTPaccount *account; | ||
95 | virtual void refresh(); | ||
96 | AbstractMail *wrapper; | ||
97 | void disconnect(); | ||
98 | void setOnOffline(); | ||
99 | }; | ||
100 | |||
101 | class NNTPfolderItem : public AccountViewItem | ||
102 | { | ||
103 | |||
104 | public: | ||
105 | NNTPfolderItem( Folder *folder, NNTPviewItem *parent , QListViewItem*after ); | ||
106 | virtual ~NNTPfolderItem(); | ||
107 | virtual void refresh(QList<RecMail>&); | ||
108 | virtual RecBody fetchBody(const RecMail&); | ||
109 | virtual QPopupMenu * getContextMenu(); | ||
110 | virtual void contextMenuSelected(int); | ||
111 | |||
112 | protected: | ||
113 | void downloadMails(); | ||
114 | NNTPviewItem *nntp; | ||
115 | }; | ||
116 | |||
117 | |||
118 | |||
79 | class IMAPviewItem : public AccountViewItem | 119 | class IMAPviewItem : public AccountViewItem |
80 | { | 120 | { |
81 | friend class IMAPfolderItem; | 121 | friend class IMAPfolderItem; |
82 | public: | 122 | public: |
83 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); | 123 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); |
84 | virtual ~IMAPviewItem(); | 124 | virtual ~IMAPviewItem(); |
85 | virtual void refresh(QList<RecMail>&); | 125 | virtual void refresh(QList<RecMail>&); |
86 | virtual RecBody fetchBody(const RecMail&); | 126 | virtual RecBody fetchBody(const RecMail&); |
87 | AbstractMail *getWrapper(); | 127 | AbstractMail *getWrapper(); |
88 | virtual QPopupMenu * getContextMenu(); | 128 | virtual QPopupMenu * getContextMenu(); |
89 | virtual void contextMenuSelected(int); | 129 | virtual void contextMenuSelected(int); |
90 | const QStringList&subFolders(); | 130 | const QStringList&subFolders(); |
91 | virtual void refreshFolders(bool force=false); | 131 | virtual void refreshFolders(bool force=false); |
92 | bool offline(); | 132 | bool offline(); |
93 | 133 | ||
94 | protected: | 134 | protected: |
95 | virtual void createNewFolder(); | 135 | virtual void createNewFolder(); |
96 | IMAPaccount *account; | 136 | IMAPaccount *account; |
97 | AbstractMail *wrapper; | 137 | AbstractMail *wrapper; |
98 | QStringList currentFolders; | 138 | QStringList currentFolders; |
99 | }; | 139 | }; |
100 | 140 | ||
101 | class IMAPfolderItem : public AccountViewItem | 141 | class IMAPfolderItem : public AccountViewItem |
102 | { | 142 | { |
103 | 143 | ||
104 | public: | 144 | public: |
105 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); | 145 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); |
106 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | 146 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); |
107 | virtual ~IMAPfolderItem(); | 147 | virtual ~IMAPfolderItem(); |
108 | virtual void refresh(QList<RecMail>&); | 148 | virtual void refresh(QList<RecMail>&); |
109 | virtual RecBody fetchBody(const RecMail&); | 149 | virtual RecBody fetchBody(const RecMail&); |
110 | virtual QPopupMenu * getContextMenu(); | 150 | virtual QPopupMenu * getContextMenu(); |
111 | virtual void contextMenuSelected(int); | 151 | virtual void contextMenuSelected(int); |
112 | virtual const QString& Delemiter()const; | 152 | virtual const QString& Delemiter()const; |
113 | protected: | 153 | protected: |
114 | virtual void createNewFolder(); | 154 | virtual void createNewFolder(); |
115 | virtual void deleteFolder(); | 155 | virtual void deleteFolder(); |
116 | virtual void downloadMails(); | 156 | virtual void downloadMails(); |
117 | IMAPviewItem *imap; | 157 | IMAPviewItem *imap; |
118 | }; | 158 | }; |
119 | 159 | ||
120 | class MHviewItem : public AccountViewItem | 160 | class MHviewItem : public AccountViewItem |
121 | { | 161 | { |
122 | friend class MHfolderItem; | 162 | friend class MHfolderItem; |
123 | 163 | ||
124 | public: | 164 | public: |
125 | MHviewItem( const QString&aMboxPath, AccountView *parent ); | 165 | MHviewItem( const QString&aMboxPath, AccountView *parent ); |
126 | virtual ~MHviewItem(); | 166 | virtual ~MHviewItem(); |
127 | virtual void refresh( QList<RecMail> &target ); | 167 | virtual void refresh( QList<RecMail> &target ); |
128 | virtual RecBody fetchBody( const RecMail &mail ); | 168 | virtual RecBody fetchBody( const RecMail &mail ); |
129 | AbstractMail *getWrapper(); | 169 | AbstractMail *getWrapper(); |
130 | virtual QPopupMenu * getContextMenu(); | 170 | virtual QPopupMenu * getContextMenu(); |
131 | virtual void contextMenuSelected(int); | 171 | virtual void contextMenuSelected(int); |
132 | QStringList subFolders(); | 172 | QStringList subFolders(); |
133 | virtual void refresh(bool force=false); | 173 | virtual void refresh(bool force=false); |
134 | 174 | ||
135 | protected: | 175 | protected: |
136 | void downloadMails(); | 176 | void downloadMails(); |
137 | virtual void createFolder(); | 177 | virtual void createFolder(); |
138 | QString m_Path; | 178 | QString m_Path; |
139 | AbstractMail *wrapper; | 179 | AbstractMail *wrapper; |
140 | QStringList currentFolders; | 180 | QStringList currentFolders; |
141 | }; | 181 | }; |
142 | 182 | ||
143 | class MHfolderItem : public AccountViewItem | 183 | class MHfolderItem : public AccountViewItem |
144 | { | 184 | { |
145 | 185 | ||
146 | public: | 186 | public: |
147 | MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after ); | 187 | MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after ); |
148 | MHfolderItem( Folder *folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); | 188 | MHfolderItem( Folder *folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); |
149 | virtual ~MHfolderItem(); | 189 | virtual ~MHfolderItem(); |
150 | virtual void refresh(QList<RecMail>&); | 190 | virtual void refresh(QList<RecMail>&); |
151 | virtual RecBody fetchBody(const RecMail&); | 191 | virtual RecBody fetchBody(const RecMail&); |
152 | virtual QPopupMenu * getContextMenu(); | 192 | virtual QPopupMenu * getContextMenu(); |
153 | virtual void contextMenuSelected(int); | 193 | virtual void contextMenuSelected(int); |
154 | virtual Folder*getFolder(); | 194 | virtual Folder*getFolder(); |
155 | 195 | ||
156 | protected: | 196 | protected: |
157 | void downloadMails(); | 197 | void downloadMails(); |
158 | virtual void createFolder(); | 198 | virtual void createFolder(); |
159 | virtual void deleteFolder(); | 199 | virtual void deleteFolder(); |
160 | void initName(); | 200 | void initName(); |
161 | MHviewItem *mbox; | 201 | MHviewItem *mbox; |
162 | }; | 202 | }; |
163 | 203 | ||
164 | #endif | 204 | #endif |
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 2ddf834..c2185f2 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,163 +1,170 @@ | |||
1 | 1 | ||
2 | #include "accountview.h" | 2 | #include "accountview.h" |
3 | #include "accountitem.h" | 3 | #include "accountitem.h" |
4 | #include "selectstore.h" | 4 | #include "selectstore.h" |
5 | 5 | ||
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | #include <libmailwrapper/settings.h> | 7 | #include <libmailwrapper/settings.h> |
8 | #include <libmailwrapper/mailwrapper.h> | 8 | #include <libmailwrapper/mailwrapper.h> |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | #include <libmailwrapper/abstractmail.h> | 10 | #include <libmailwrapper/abstractmail.h> |
11 | #include <qpe/qpeapplication.h> | 11 | #include <qpe/qpeapplication.h> |
12 | 12 | ||
13 | /* QT */ | 13 | /* QT */ |
14 | #include <qmessagebox.h> | 14 | #include <qmessagebox.h> |
15 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
16 | 16 | ||
17 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 17 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
18 | : QListView( parent, name, flags ) | 18 | : QListView( parent, name, flags ) |
19 | { | 19 | { |
20 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), | 20 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), |
21 | SLOT( refresh( QListViewItem * ) ) ); | 21 | SLOT( refresh( QListViewItem * ) ) ); |
22 | connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, | 22 | connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, |
23 | SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); | 23 | SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); |
24 | setSorting(0); | 24 | setSorting(0); |
25 | } | 25 | } |
26 | 26 | ||
27 | AccountView::~AccountView() | 27 | AccountView::~AccountView() |
28 | { | 28 | { |
29 | imapAccounts.clear(); | 29 | imapAccounts.clear(); |
30 | mhAccounts.clear(); | 30 | mhAccounts.clear(); |
31 | } | 31 | } |
32 | 32 | ||
33 | void AccountView::slotContextMenu(int id) | 33 | void AccountView::slotContextMenu(int id) |
34 | { | 34 | { |
35 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 35 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
36 | if (!view) return; | 36 | if (!view) return; |
37 | view->contextMenuSelected(id); | 37 | view->contextMenuSelected(id); |
38 | } | 38 | } |
39 | 39 | ||
40 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 40 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) |
41 | { | 41 | { |
42 | if (button==1) {return;} | 42 | if (button==1) {return;} |
43 | if (!item) return; | 43 | if (!item) return; |
44 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 44 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
45 | QPopupMenu*m = view->getContextMenu(); | 45 | QPopupMenu*m = view->getContextMenu(); |
46 | if (!m) return; | 46 | if (!m) return; |
47 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 47 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
48 | m->setFocus(); | 48 | m->setFocus(); |
49 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 49 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
50 | delete m; | 50 | delete m; |
51 | } | 51 | } |
52 | 52 | ||
53 | void AccountView::populate( QList<Account> list ) | 53 | void AccountView::populate( QList<Account> list ) |
54 | { | 54 | { |
55 | clear(); | 55 | clear(); |
56 | 56 | ||
57 | imapAccounts.clear(); | 57 | imapAccounts.clear(); |
58 | mhAccounts.clear(); | 58 | mhAccounts.clear(); |
59 | 59 | ||
60 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 60 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
61 | 61 | ||
62 | Account *it; | 62 | Account *it; |
63 | for ( it = list.first(); it; it = list.next() ) | 63 | for ( it = list.first(); it; it = list.next() ) |
64 | { | 64 | { |
65 | if ( it->getType().compare( "IMAP" ) == 0 ) | 65 | if ( it->getType().compare( "IMAP" ) == 0 ) |
66 | { | 66 | { |
67 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 67 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
68 | qDebug( "added IMAP " + imap->getAccountName() ); | 68 | qDebug( "added IMAP " + imap->getAccountName() ); |
69 | imapAccounts.append(new IMAPviewItem( imap, this )); | 69 | imapAccounts.append(new IMAPviewItem( imap, this )); |
70 | } | 70 | } |
71 | else if ( it->getType().compare( "POP3" ) == 0 ) | 71 | else if ( it->getType().compare( "POP3" ) == 0 ) |
72 | { | 72 | { |
73 | POP3account *pop3 = static_cast<POP3account *>(it); | 73 | POP3account *pop3 = static_cast<POP3account *>(it); |
74 | qDebug( "added POP3 " + pop3->getAccountName() ); | 74 | qDebug( "added POP3 " + pop3->getAccountName() ); |
75 | /* must not be hold 'cause it isn't required */ | 75 | /* must not be hold 'cause it isn't required */ |
76 | (void) new POP3viewItem( pop3, this ); | 76 | (void) new POP3viewItem( pop3, this ); |
77 | } | 77 | } |
78 | } | 78 | else if ( it->getType().compare( "NNTP" ) == 0 ) |
79 | { | ||
80 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | ||
81 | qDebug( "added NNTP " + nntp->getAccountName() ); | ||
82 | /* must not be hold 'cause it isn't required */ | ||
83 | (void) new NNTPviewItem( nntp, this ); | ||
84 | } | ||
85 | } | ||
79 | } | 86 | } |
80 | 87 | ||
81 | void AccountView::refresh(QListViewItem *item) | 88 | void AccountView::refresh(QListViewItem *item) |
82 | { | 89 | { |
83 | 90 | ||
84 | qDebug("AccountView refresh..."); | 91 | qDebug("AccountView refresh..."); |
85 | if ( item ) | 92 | if ( item ) |
86 | { | 93 | { |
87 | m_currentItem = item; | 94 | m_currentItem = item; |
88 | QList<RecMail> headerlist; | 95 | QList<RecMail> headerlist; |
89 | headerlist.setAutoDelete(true); | 96 | headerlist.setAutoDelete(true); |
90 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 97 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
91 | view->refresh(headerlist); | 98 | view->refresh(headerlist); |
92 | emit refreshMailview(&headerlist); | 99 | emit refreshMailview(&headerlist); |
93 | } | 100 | } |
94 | } | 101 | } |
95 | 102 | ||
96 | void AccountView::refreshCurrent() | 103 | void AccountView::refreshCurrent() |
97 | { | 104 | { |
98 | m_currentItem = currentItem(); | 105 | m_currentItem = currentItem(); |
99 | if ( !m_currentItem ) return; | 106 | if ( !m_currentItem ) return; |
100 | QList<RecMail> headerlist; | 107 | QList<RecMail> headerlist; |
101 | headerlist.setAutoDelete(true); | 108 | headerlist.setAutoDelete(true); |
102 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 109 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
103 | view->refresh(headerlist); | 110 | view->refresh(headerlist); |
104 | emit refreshMailview(&headerlist); | 111 | emit refreshMailview(&headerlist); |
105 | } | 112 | } |
106 | 113 | ||
107 | void AccountView::refreshAll() | 114 | void AccountView::refreshAll() |
108 | { | 115 | { |
109 | } | 116 | } |
110 | 117 | ||
111 | RecBody AccountView::fetchBody(const RecMail&aMail) | 118 | RecBody AccountView::fetchBody(const RecMail&aMail) |
112 | { | 119 | { |
113 | QListViewItem*item = selectedItem (); | 120 | QListViewItem*item = selectedItem (); |
114 | if (!item) return RecBody(); | 121 | if (!item) return RecBody(); |
115 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 122 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
116 | return view->fetchBody(aMail); | 123 | return view->fetchBody(aMail); |
117 | } | 124 | } |
118 | 125 | ||
119 | void AccountView::setupFolderselect(Selectstore*sels) | 126 | void AccountView::setupFolderselect(Selectstore*sels) |
120 | { | 127 | { |
121 | QPEApplication::showDialog( sels ); | 128 | QPEApplication::showDialog( sels ); |
122 | QStringList sFolders; | 129 | QStringList sFolders; |
123 | unsigned int i = 0; | 130 | unsigned int i = 0; |
124 | for (i=0; i < mhAccounts.count();++i) | 131 | for (i=0; i < mhAccounts.count();++i) |
125 | { | 132 | { |
126 | mhAccounts[i]->refresh(false); | 133 | mhAccounts[i]->refresh(false); |
127 | sFolders = mhAccounts[i]->subFolders(); | 134 | sFolders = mhAccounts[i]->subFolders(); |
128 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); | 135 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); |
129 | } | 136 | } |
130 | for (i=0; i < imapAccounts.count();++i) | 137 | for (i=0; i < imapAccounts.count();++i) |
131 | { | 138 | { |
132 | if (imapAccounts[i]->offline()) | 139 | if (imapAccounts[i]->offline()) |
133 | continue; | 140 | continue; |
134 | imapAccounts[i]->refreshFolders(false); | 141 | imapAccounts[i]->refreshFolders(false); |
135 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | 142 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); |
136 | } | 143 | } |
137 | } | 144 | } |
138 | 145 | ||
139 | void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) | 146 | void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) |
140 | { | 147 | { |
141 | AbstractMail*targetMail = 0; | 148 | AbstractMail*targetMail = 0; |
142 | QString targetFolder = ""; | 149 | QString targetFolder = ""; |
143 | Selectstore sels; | 150 | Selectstore sels; |
144 | setupFolderselect(&sels); | 151 | setupFolderselect(&sels); |
145 | if (!sels.exec()) return; | 152 | if (!sels.exec()) return; |
146 | targetMail = sels.currentMail(); | 153 | targetMail = sels.currentMail(); |
147 | targetFolder = sels.currentFolder(); | 154 | targetFolder = sels.currentFolder(); |
148 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 155 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
149 | targetFolder.isEmpty()) | 156 | targetFolder.isEmpty()) |
150 | { | 157 | { |
151 | return; | 158 | return; |
152 | } | 159 | } |
153 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 160 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
154 | { | 161 | { |
155 | QMessageBox::critical(0,tr("Error creating new Folder"), | 162 | QMessageBox::critical(0,tr("Error creating new Folder"), |
156 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 163 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
157 | return; | 164 | return; |
158 | } | 165 | } |
159 | qDebug("Targetfolder: %s",targetFolder.latin1()); | 166 | qDebug("Targetfolder: %s",targetFolder.latin1()); |
160 | qDebug("Fromfolder: %s",fromFolder->getName().latin1()); | 167 | qDebug("Fromfolder: %s",fromFolder->getName().latin1()); |
161 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); | 168 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); |
162 | refreshCurrent(); | 169 | refreshCurrent(); |
163 | } | 170 | } |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 592cd5e..741a8e1 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -1,139 +1,145 @@ | |||
1 | #include "abstractmail.h" | 1 | #include "abstractmail.h" |
2 | #include "imapwrapper.h" | 2 | #include "imapwrapper.h" |
3 | #include "pop3wrapper.h" | 3 | #include "pop3wrapper.h" |
4 | #include "nntpwrapper.h" | ||
4 | #include "mhwrapper.h" | 5 | #include "mhwrapper.h" |
5 | #include "mboxwrapper.h" | 6 | #include "mboxwrapper.h" |
6 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
7 | 8 | ||
8 | #include <qstring.h> | 9 | #include <qstring.h> |
9 | #include <qfile.h> | 10 | #include <qfile.h> |
10 | #include <qtextstream.h> | 11 | #include <qtextstream.h> |
11 | #include <stdlib.h> | 12 | #include <stdlib.h> |
12 | #include <libetpan/mailmime_content.h> | 13 | #include <libetpan/mailmime_content.h> |
13 | #include <libetpan/mailmime.h> | 14 | #include <libetpan/mailmime.h> |
14 | 15 | ||
15 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | 16 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) |
16 | { | 17 | { |
17 | return new IMAPwrapper(a); | 18 | return new IMAPwrapper(a); |
18 | } | 19 | } |
19 | 20 | ||
20 | AbstractMail* AbstractMail::getWrapper(POP3account *a) | 21 | AbstractMail* AbstractMail::getWrapper(POP3account *a) |
21 | { | 22 | { |
22 | return new POP3wrapper(a); | 23 | return new POP3wrapper(a); |
23 | } | 24 | } |
24 | 25 | ||
26 | AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) | ||
27 | { | ||
28 | return new NNTPwrapper(a); | ||
29 | } | ||
30 | |||
25 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) | 31 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) |
26 | { | 32 | { |
27 | return new MHwrapper(a,name); | 33 | return new MHwrapper(a,name); |
28 | } | 34 | } |
29 | 35 | ||
30 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) | 36 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) |
31 | { | 37 | { |
32 | qDebug("Decode string start"); | 38 | qDebug("Decode string start"); |
33 | char*result_text; | 39 | char*result_text; |
34 | size_t index = 0; | 40 | size_t index = 0; |
35 | /* reset for recursive use! */ | 41 | /* reset for recursive use! */ |
36 | size_t target_length = 0; | 42 | size_t target_length = 0; |
37 | result_text = 0; | 43 | result_text = 0; |
38 | int mimetype = MAILMIME_MECHANISM_7BIT; | 44 | int mimetype = MAILMIME_MECHANISM_7BIT; |
39 | if (enc.lower()=="quoted-printable") { | 45 | if (enc.lower()=="quoted-printable") { |
40 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; | 46 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; |
41 | } else if (enc.lower()=="base64") { | 47 | } else if (enc.lower()=="base64") { |
42 | mimetype = MAILMIME_MECHANISM_BASE64; | 48 | mimetype = MAILMIME_MECHANISM_BASE64; |
43 | } else if (enc.lower()=="8bit") { | 49 | } else if (enc.lower()=="8bit") { |
44 | mimetype = MAILMIME_MECHANISM_8BIT; | 50 | mimetype = MAILMIME_MECHANISM_8BIT; |
45 | } else if (enc.lower()=="binary") { | 51 | } else if (enc.lower()=="binary") { |
46 | mimetype = MAILMIME_MECHANISM_BINARY; | 52 | mimetype = MAILMIME_MECHANISM_BINARY; |
47 | } | 53 | } |
48 | 54 | ||
49 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, | 55 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, |
50 | &result_text,&target_length); | 56 | &result_text,&target_length); |
51 | 57 | ||
52 | encodedString* result = new encodedString(); | 58 | encodedString* result = new encodedString(); |
53 | if (err == MAILIMF_NO_ERROR) { | 59 | if (err == MAILIMF_NO_ERROR) { |
54 | result->setContent(result_text,target_length); | 60 | result->setContent(result_text,target_length); |
55 | } | 61 | } |
56 | qDebug("Decode string finished"); | 62 | qDebug("Decode string finished"); |
57 | return result; | 63 | return result; |
58 | } | 64 | } |
59 | 65 | ||
60 | QString AbstractMail::convert_String(const char*text) | 66 | QString AbstractMail::convert_String(const char*text) |
61 | { | 67 | { |
62 | size_t index = 0; | 68 | size_t index = 0; |
63 | char*res = 0; | 69 | char*res = 0; |
64 | 70 | ||
65 | /* attention - doesn't work with arm systems! */ | 71 | /* attention - doesn't work with arm systems! */ |
66 | int err = mailmime_encoded_phrase_parse("iso-8859-1", | 72 | int err = mailmime_encoded_phrase_parse("iso-8859-1", |
67 | text, strlen(text),&index, "iso-8859-1",&res); | 73 | text, strlen(text),&index, "iso-8859-1",&res); |
68 | if (err != MAILIMF_NO_ERROR) { | 74 | if (err != MAILIMF_NO_ERROR) { |
69 | if (res) free(res); | 75 | if (res) free(res); |
70 | return QString(text); | 76 | return QString(text); |
71 | } | 77 | } |
72 | if (res) { | 78 | if (res) { |
73 | QString result(res); | 79 | QString result(res); |
74 | free(res); | 80 | free(res); |
75 | return result; | 81 | return result; |
76 | } | 82 | } |
77 | return QString(text); | 83 | return QString(text); |
78 | } | 84 | } |
79 | 85 | ||
80 | /* cp & paste from launcher */ | 86 | /* cp & paste from launcher */ |
81 | QString AbstractMail::gen_attachment_id() | 87 | QString AbstractMail::gen_attachment_id() |
82 | { | 88 | { |
83 | QFile file( "/proc/sys/kernel/random/uuid" ); | 89 | QFile file( "/proc/sys/kernel/random/uuid" ); |
84 | if (!file.open(IO_ReadOnly ) ) | 90 | if (!file.open(IO_ReadOnly ) ) |
85 | return QString::null; | 91 | return QString::null; |
86 | 92 | ||
87 | QTextStream stream(&file); | 93 | QTextStream stream(&file); |
88 | 94 | ||
89 | return "{" + stream.read().stripWhiteSpace() + "}"; | 95 | return "{" + stream.read().stripWhiteSpace() + "}"; |
90 | } | 96 | } |
91 | 97 | ||
92 | int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) | 98 | int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) |
93 | { | 99 | { |
94 | return 0; | 100 | return 0; |
95 | } | 101 | } |
96 | 102 | ||
97 | QString AbstractMail::defaultLocalfolder() | 103 | QString AbstractMail::defaultLocalfolder() |
98 | { | 104 | { |
99 | QString f = getenv( "HOME" ); | 105 | QString f = getenv( "HOME" ); |
100 | f += "/Applications/opiemail/localmail"; | 106 | f += "/Applications/opiemail/localmail"; |
101 | return f; | 107 | return f; |
102 | } | 108 | } |
103 | 109 | ||
104 | /* temporary - will be removed when implemented in all classes */ | 110 | /* temporary - will be removed when implemented in all classes */ |
105 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) | 111 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) |
106 | { | 112 | { |
107 | } | 113 | } |
108 | 114 | ||
109 | void AbstractMail::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 115 | void AbstractMail::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
110 | { | 116 | { |
111 | QList<RecMail> t; | 117 | QList<RecMail> t; |
112 | listMessages(fromFolder->getName(),t); | 118 | listMessages(fromFolder->getName(),t); |
113 | encodedString*st = 0; | 119 | encodedString*st = 0; |
114 | while (t.count()>0) { | 120 | while (t.count()>0) { |
115 | RecMail*r = t.at(0); | 121 | RecMail*r = t.at(0); |
116 | st = fetchRawBody(*r); | 122 | st = fetchRawBody(*r); |
117 | if (st) { | 123 | if (st) { |
118 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | 124 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); |
119 | delete st; | 125 | delete st; |
120 | } | 126 | } |
121 | t.removeFirst(); | 127 | t.removeFirst(); |
122 | } | 128 | } |
123 | if (moveit) { | 129 | if (moveit) { |
124 | deleteAllMail(fromFolder); | 130 | deleteAllMail(fromFolder); |
125 | } | 131 | } |
126 | } | 132 | } |
127 | 133 | ||
128 | void AbstractMail::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 134 | void AbstractMail::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
129 | { | 135 | { |
130 | encodedString*st = 0; | 136 | encodedString*st = 0; |
131 | st = fetchRawBody(mail); | 137 | st = fetchRawBody(mail); |
132 | if (st) { | 138 | if (st) { |
133 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | 139 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); |
134 | delete st; | 140 | delete st; |
135 | } | 141 | } |
136 | if (moveit) { | 142 | if (moveit) { |
137 | deleteMail(mail); | 143 | deleteMail(mail); |
138 | } | 144 | } |
139 | } | 145 | } |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index f93bab4..b6e1538 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -1,65 +1,66 @@ | |||
1 | #ifndef __abstract_mail_ | 1 | #ifndef __abstract_mail_ |
2 | #define __abstract_mail_ | 2 | #define __abstract_mail_ |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | #include "settings.h" | 5 | #include "settings.h" |
6 | 6 | ||
7 | class RecMail; | 7 | class RecMail; |
8 | class RecBody; | 8 | class RecBody; |
9 | class RecPart; | 9 | class RecPart; |
10 | class IMAPwrapper; | 10 | class IMAPwrapper; |
11 | class POP3wrapper; | 11 | class POP3wrapper; |
12 | class Folder; | 12 | class Folder; |
13 | class encodedString; | 13 | class encodedString; |
14 | struct folderStat; | 14 | struct folderStat; |
15 | 15 | ||
16 | class AbstractMail:public QObject | 16 | class AbstractMail:public QObject |
17 | { | 17 | { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | public: | 19 | public: |
20 | AbstractMail(){}; | 20 | AbstractMail(){}; |
21 | virtual ~AbstractMail(){} | 21 | virtual ~AbstractMail(){} |
22 | virtual QList<Folder>* listFolders()=0; | 22 | virtual QList<Folder>* listFolders()=0; |
23 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; | 23 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; |
24 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; | 24 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; |
25 | virtual RecBody fetchBody(const RecMail&mail)=0; | 25 | virtual RecBody fetchBody(const RecMail&mail)=0; |
26 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; | 26 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; |
27 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; | 27 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; |
28 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; | 28 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; |
29 | virtual encodedString* fetchRawBody(const RecMail&mail)=0; | 29 | virtual encodedString* fetchRawBody(const RecMail&mail)=0; |
30 | 30 | ||
31 | virtual void deleteMail(const RecMail&mail)=0; | 31 | virtual void deleteMail(const RecMail&mail)=0; |
32 | virtual void answeredMail(const RecMail&mail)=0; | 32 | virtual void answeredMail(const RecMail&mail)=0; |
33 | virtual int deleteAllMail(const Folder*)=0; | 33 | virtual int deleteAllMail(const Folder*)=0; |
34 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); | 34 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); |
35 | virtual int deleteMbox(const Folder*)=0; | 35 | virtual int deleteMbox(const Folder*)=0; |
36 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 36 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
37 | 37 | ||
38 | virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 38 | virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
39 | virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 39 | virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
40 | 40 | ||
41 | virtual void cleanMimeCache(){}; | 41 | virtual void cleanMimeCache(){}; |
42 | /* mail box methods */ | 42 | /* mail box methods */ |
43 | /* parameter is the box to create. | 43 | /* parameter is the box to create. |
44 | * if the implementing subclass has prefixes, | 44 | * if the implementing subclass has prefixes, |
45 | * them has to be appended automatic. | 45 | * them has to be appended automatic. |
46 | */ | 46 | */ |
47 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); | 47 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); |
48 | virtual void logout()=0; | 48 | virtual void logout()=0; |
49 | 49 | ||
50 | static AbstractMail* getWrapper(IMAPaccount *a); | 50 | static AbstractMail* getWrapper(IMAPaccount *a); |
51 | static AbstractMail* getWrapper(POP3account *a); | 51 | static AbstractMail* getWrapper(POP3account *a); |
52 | static AbstractMail* getWrapper(NNTPaccount *a); | ||
52 | /* mbox only! */ | 53 | /* mbox only! */ |
53 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); | 54 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); |
54 | 55 | ||
55 | static QString defaultLocalfolder(); | 56 | static QString defaultLocalfolder(); |
56 | 57 | ||
57 | virtual const QString&getType()const=0; | 58 | virtual const QString&getType()const=0; |
58 | virtual const QString&getName()const=0; | 59 | virtual const QString&getName()const=0; |
59 | 60 | ||
60 | protected: | 61 | protected: |
61 | static encodedString*decode_String(const encodedString*text,const QString&enc); | 62 | static encodedString*decode_String(const encodedString*text,const QString&enc); |
62 | static QString convert_String(const char*text); | 63 | static QString convert_String(const char*text); |
63 | static QString gen_attachment_id(); | 64 | static QString gen_attachment_id(); |
64 | }; | 65 | }; |
65 | #endif | 66 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/libmailwrapper.pro b/noncore/net/mail/libmailwrapper/libmailwrapper.pro index 71f6cca..8ea04a4 100644 --- a/noncore/net/mail/libmailwrapper/libmailwrapper.pro +++ b/noncore/net/mail/libmailwrapper/libmailwrapper.pro | |||
@@ -1,48 +1,50 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | 3 | ||
4 | HEADERS = mailwrapper.h \ | 4 | HEADERS = mailwrapper.h \ |
5 | imapwrapper.h \ | 5 | imapwrapper.h \ |
6 | mailtypes.h \ | 6 | mailtypes.h \ |
7 | pop3wrapper.h \ | 7 | pop3wrapper.h \ |
8 | abstractmail.h \ | 8 | abstractmail.h \ |
9 | smtpwrapper.h \ | 9 | smtpwrapper.h \ |
10 | genericwrapper.h \ | 10 | genericwrapper.h \ |
11 | mboxwrapper.h \ | 11 | mboxwrapper.h \ |
12 | settings.h \ | 12 | settings.h \ |
13 | logindialog.h \ | 13 | logindialog.h \ |
14 | sendmailprogress.h \ | 14 | sendmailprogress.h \ |
15 | statusmail.h \ | 15 | statusmail.h \ |
16 | mhwrapper.h | 16 | mhwrapper.h \ |
17 | nntpwrapper.h | ||
17 | 18 | ||
18 | SOURCES = imapwrapper.cpp \ | 19 | SOURCES = imapwrapper.cpp \ |
19 | mailwrapper.cpp \ | 20 | mailwrapper.cpp \ |
20 | mailtypes.cpp \ | 21 | mailtypes.cpp \ |
21 | pop3wrapper.cpp \ | 22 | pop3wrapper.cpp \ |
22 | abstractmail.cpp \ | 23 | abstractmail.cpp \ |
23 | smtpwrapper.cpp \ | 24 | smtpwrapper.cpp \ |
24 | genericwrapper.cpp \ | 25 | genericwrapper.cpp \ |
25 | mboxwrapper.cpp \ | 26 | mboxwrapper.cpp \ |
26 | settings.cpp \ | 27 | settings.cpp \ |
27 | logindialog.cpp \ | 28 | logindialog.cpp \ |
28 | sendmailprogress.cpp \ | 29 | sendmailprogress.cpp \ |
29 | statusmail.cpp \ | 30 | statusmail.cpp \ |
30 | mhwrapper.cpp | 31 | mhwrapper.cpp \ |
32 | nntpwrapper.cpp | ||
31 | 33 | ||
32 | INTERFACES = logindialogui.ui \ | 34 | INTERFACES = logindialogui.ui \ |
33 | sendmailprogressui.ui | 35 | sendmailprogressui.ui |
34 | 36 | ||
35 | 37 | ||
36 | INCLUDEPATH += $(OPIEDIR)/include | 38 | INCLUDEPATH += $(OPIEDIR)/include |
37 | 39 | ||
38 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | 40 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) |
39 | contains( CONFTEST, y ){ | 41 | contains( CONFTEST, y ){ |
40 | LIBS += -lqpe -letpan -lssl -lcrypto -liconv | 42 | LIBS += -lqpe -letpan -lssl -lcrypto -liconv |
41 | }else{ | 43 | }else{ |
42 | LIBS += -lqpe -letpan -lssl -lcrypto | 44 | LIBS += -lqpe -letpan -lssl -lcrypto |
43 | } | 45 | } |
44 | 46 | ||
45 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 47 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
46 | TARGET = mailwrapper | 48 | TARGET = mailwrapper |
47 | 49 | ||
48 | include ( $(OPIEDIR)/include.pro ) | 50 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp new file mode 100644 index 0000000..e73a890 --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp | |||
@@ -0,0 +1,241 @@ | |||
1 | #include "nntpwrapper.h" | ||
2 | #include "logindialog.h" | ||
3 | #include "mailtypes.h" | ||
4 | |||
5 | #include <qfile.h> | ||
6 | |||
7 | #include <stdlib.h> | ||
8 | |||
9 | #include <libetpan/libetpan.h> | ||
10 | #include <libetpan/nntpdriver.h> | ||
11 | |||
12 | |||
13 | |||
14 | #define HARD_MSG_SIZE_LIMIT 5242880 | ||
15 | |||
16 | NNTPwrapper::NNTPwrapper( NNTPaccount *a ) | ||
17 | : Genericwrapper() { | ||
18 | account = a; | ||
19 | m_nntp = NULL; | ||
20 | msgTempName = a->getFileName()+"_msg_cache"; | ||
21 | last_msg_id = 0; | ||
22 | } | ||
23 | |||
24 | NNTPwrapper::~NNTPwrapper() { | ||
25 | logout(); | ||
26 | QFile msg_cache(msgTempName); | ||
27 | if (msg_cache.exists()) { | ||
28 | msg_cache.remove(); | ||
29 | } | ||
30 | } | ||
31 | |||
32 | void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { | ||
33 | qDebug( "NNTP: %i of %i", current, maximum ); | ||
34 | } | ||
35 | |||
36 | |||
37 | RecBody NNTPwrapper::fetchBody( const RecMail &mail ) { | ||
38 | int err = NEWSNNTP_NO_ERROR; | ||
39 | char *message = 0; | ||
40 | size_t length = 0; | ||
41 | |||
42 | login(); | ||
43 | if ( !m_nntp ) { | ||
44 | return RecBody(); | ||
45 | } | ||
46 | |||
47 | RecBody body; | ||
48 | mailmessage * mailmsg; | ||
49 | if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { | ||
50 | qDebug("Message to large: %i",mail.Msgsize()); | ||
51 | return body; | ||
52 | } | ||
53 | |||
54 | QFile msg_cache(msgTempName); | ||
55 | |||
56 | cleanMimeCache(); | ||
57 | |||
58 | if (mail.getNumber()!=last_msg_id) { | ||
59 | if (msg_cache.exists()) { | ||
60 | msg_cache.remove(); | ||
61 | } | ||
62 | msg_cache.open(IO_ReadWrite|IO_Truncate); | ||
63 | last_msg_id = mail.getNumber(); | ||
64 | err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); | ||
65 | err = mailmessage_fetch(mailmsg,&message,&length); | ||
66 | msg_cache.writeBlock(message,length); | ||
67 | } else { | ||
68 | QString msg=""; | ||
69 | msg_cache.open(IO_ReadOnly); | ||
70 | message = new char[4096]; | ||
71 | memset(message,0,4096); | ||
72 | while (msg_cache.readBlock(message,4095)>0) { | ||
73 | msg+=message; | ||
74 | memset(message,0,4096); | ||
75 | } | ||
76 | delete message; | ||
77 | message = (char*)malloc(msg.length()+1*sizeof(char)); | ||
78 | memset(message,0,msg.length()+1); | ||
79 | memcpy(message,msg.latin1(),msg.length()); | ||
80 | /* transform to libetpan stuff */ | ||
81 | mailmsg = mailmessage_new(); | ||
82 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); | ||
83 | generic_message_t * msg_data; | ||
84 | msg_data = (generic_message_t *)mailmsg->msg_data; | ||
85 | msg_data->msg_fetched = 1; | ||
86 | msg_data->msg_message = message; | ||
87 | msg_data->msg_length = strlen(message); | ||
88 | } | ||
89 | body = parseMail(mailmsg); | ||
90 | |||
91 | /* clean up */ | ||
92 | if (mailmsg) | ||
93 | mailmessage_free(mailmsg); | ||
94 | if (message) | ||
95 | free(message); | ||
96 | |||
97 | return body; | ||
98 | } | ||
99 | |||
100 | |||
101 | void NNTPwrapper::listMessages(const QString &, QList<RecMail> &target ) | ||
102 | { | ||
103 | login(); | ||
104 | if (!m_nntp) | ||
105 | return; | ||
106 | uint32_t res_messages,res_recent,res_unseen; | ||
107 | mailsession_status_folder(m_nntp->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); | ||
108 | parseList(target,m_nntp->sto_session,"INBOX"); | ||
109 | } | ||
110 | |||
111 | void NNTPwrapper::login() | ||
112 | { | ||
113 | if (account->getOffline()) | ||
114 | return; | ||
115 | /* we'll hold the line */ | ||
116 | if ( m_nntp != NULL ) | ||
117 | return; | ||
118 | |||
119 | const char *server, *user, *pass; | ||
120 | uint16_t port; | ||
121 | int err = NEWSNNTP_NO_ERROR; | ||
122 | |||
123 | server = account->getServer().latin1(); | ||
124 | port = account->getPort().toUInt(); | ||
125 | |||
126 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | ||
127 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | ||
128 | login.show(); | ||
129 | if ( QDialog::Accepted == login.exec() ) { | ||
130 | // ok | ||
131 | user = login.getUser().latin1(); | ||
132 | pass = login.getPassword().latin1(); | ||
133 | } else { | ||
134 | // cancel | ||
135 | qDebug( "NNTP: Login canceled" ); | ||
136 | return; | ||
137 | } | ||
138 | } else { | ||
139 | user = account->getUser().latin1(); | ||
140 | pass = account->getPassword().latin1(); | ||
141 | } | ||
142 | |||
143 | // bool ssl = account->getSSL(); | ||
144 | |||
145 | m_nntp=mailstorage_new(NULL); | ||
146 | |||
147 | int conntypeset = account->ConnectionType(); | ||
148 | int conntype = 0; | ||
149 | if ( conntypeset == 3 ) { | ||
150 | conntype = CONNECTION_TYPE_COMMAND; | ||
151 | } else if ( conntypeset == 2 ) { | ||
152 | conntype = CONNECTION_TYPE_TLS; | ||
153 | } else if ( conntypeset == 1 ) { | ||
154 | conntype = CONNECTION_TYPE_STARTTLS; | ||
155 | } else if ( conntypeset == 0 ) { | ||
156 | conntype = CONNECTION_TYPE_TRY_STARTTLS; | ||
157 | } | ||
158 | |||
159 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, conntype, NNTP_AUTH_TYPE_PLAIN, | ||
160 | (char*)user,(char*)pass,0,0,0); | ||
161 | |||
162 | err = mailstorage_connect(m_nntp); | ||
163 | |||
164 | if (err != NEWSNNTP_NO_ERROR) { | ||
165 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); | ||
166 | // Global::statusMessage(tr("Error initializing folder")); | ||
167 | mailstorage_free(m_nntp); | ||
168 | m_nntp = 0; | ||
169 | } | ||
170 | } | ||
171 | |||
172 | void NNTPwrapper::logout() | ||
173 | { | ||
174 | int err = NEWSNNTP_NO_ERROR; | ||
175 | if ( m_nntp == NULL ) | ||
176 | return; | ||
177 | mailstorage_free(m_nntp); | ||
178 | m_nntp = 0; | ||
179 | } | ||
180 | |||
181 | QList<Folder>* NNTPwrapper::listFolders() { | ||
182 | QList<Folder> * folders = new QList<Folder>(); | ||
183 | folders->setAutoDelete( false ); | ||
184 | clist *result = 0; | ||
185 | |||
186 | // int err = | ||
187 | // if ( err == _NO_ERROR ) { | ||
188 | // current = result->first; | ||
189 | // for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { | ||
190 | |||
191 | |||
192 | // Folder*inb=new Folder("INBOX","/"); | ||
193 | |||
194 | |||
195 | // folders->append(inb); | ||
196 | return folders; | ||
197 | } | ||
198 | |||
199 | |||
200 | void NNTPwrapper::answeredMail(const RecMail&) {} | ||
201 | |||
202 | void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) { | ||
203 | login(); | ||
204 | target_stat.message_count = 0; | ||
205 | target_stat.message_unseen = 0; | ||
206 | target_stat.message_recent = 0; | ||
207 | if (!m_nntp) | ||
208 | return; | ||
209 | int r = mailsession_status_folder(m_nntp->sto_session,0,&target_stat.message_count, | ||
210 | &target_stat.message_recent,&target_stat.message_unseen); | ||
211 | } | ||
212 | |||
213 | |||
214 | encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) { | ||
215 | char*target=0; | ||
216 | size_t length=0; | ||
217 | encodedString*res = 0; | ||
218 | mailmessage * mailmsg = 0; | ||
219 | int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); | ||
220 | err = mailmessage_fetch(mailmsg,&target,&length); | ||
221 | if (mailmsg) | ||
222 | mailmessage_free(mailmsg); | ||
223 | if (target) { | ||
224 | res = new encodedString(target,length); | ||
225 | } | ||
226 | return res; | ||
227 | } | ||
228 | |||
229 | const QString&NNTPwrapper::getType()const { | ||
230 | return account->getType(); | ||
231 | } | ||
232 | |||
233 | const QString&NNTPwrapper::getName()const{ | ||
234 | return account->getAccountName(); | ||
235 | } | ||
236 | |||
237 | void NNTPwrapper::deleteMail(const RecMail&mail) { | ||
238 | } | ||
239 | |||
240 | int NNTPwrapper::deleteAllMail(const Folder*) { | ||
241 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h new file mode 100644 index 0000000..e47e68f --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef __NNTPWRAPPER | ||
2 | #define __NNTPWRAPPER | ||
3 | |||
4 | #include "mailwrapper.h" | ||
5 | #include "genericwrapper.h" | ||
6 | #include <qstring.h> | ||
7 | #include <libetpan/clist.h> | ||
8 | |||
9 | class encodedString; | ||
10 | struct mailstorage; | ||
11 | struct mailfolder; | ||
12 | |||
13 | class NNTPwrapper : public Genericwrapper | ||
14 | { | ||
15 | |||
16 | Q_OBJECT | ||
17 | |||
18 | public: | ||
19 | NNTPwrapper( NNTPaccount *a ); | ||
20 | virtual ~NNTPwrapper(); | ||
21 | |||
22 | /* mailbox will be ignored */ | ||
23 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | ||
24 | /* should only get the subscribed one */ | ||
25 | virtual QList<Folder>* listFolders(); | ||
26 | /* mailbox will be ignored */ | ||
27 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | ||
28 | |||
29 | virtual void deleteMail(const RecMail&mail); | ||
30 | virtual void answeredMail(const RecMail&mail); | ||
31 | virtual int deleteAllMail(const Folder*); | ||
32 | |||
33 | virtual RecBody fetchBody( const RecMail &mail ); | ||
34 | virtual encodedString* fetchRawBody(const RecMail&mail); | ||
35 | virtual void logout(); | ||
36 | virtual const QString&getType()const; | ||
37 | virtual const QString&getName()const; | ||
38 | static void nntp_progress( size_t current, size_t maximum ); | ||
39 | |||
40 | protected: | ||
41 | void login(); | ||
42 | NNTPaccount *account; | ||
43 | mailstorage* m_nntp; | ||
44 | |||
45 | |||
46 | }; | ||
47 | |||
48 | #endif | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 14c2059..6fab401 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -1,255 +1,255 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include "pop3wrapper.h" | 2 | #include "pop3wrapper.h" |
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
4 | #include "logindialog.h" | 4 | #include "logindialog.h" |
5 | #include <libetpan/libetpan.h> | 5 | #include <libetpan/libetpan.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qstring.h> | 8 | //#include <qstring.h> |
9 | 9 | ||
10 | /* we don't fetch messages larger than 5 MB */ | 10 | /* we don't fetch messages larger than 5 MB */ |
11 | #define HARD_MSG_SIZE_LIMIT 5242880 | 11 | #define HARD_MSG_SIZE_LIMIT 5242880 |
12 | 12 | ||
13 | POP3wrapper::POP3wrapper( POP3account *a ) | 13 | POP3wrapper::POP3wrapper( POP3account *a ) |
14 | : Genericwrapper() { | 14 | : Genericwrapper() { |
15 | account = a; | 15 | account = a; |
16 | m_pop3 = NULL; | 16 | m_pop3 = NULL; |
17 | msgTempName = a->getFileName()+"_msg_cache"; | 17 | msgTempName = a->getFileName()+"_msg_cache"; |
18 | last_msg_id = 0; | 18 | last_msg_id = 0; |
19 | } | 19 | } |
20 | 20 | ||
21 | POP3wrapper::~POP3wrapper() { | 21 | POP3wrapper::~POP3wrapper() { |
22 | logout(); | 22 | logout(); |
23 | QFile msg_cache(msgTempName); | 23 | QFile msg_cache(msgTempName); |
24 | if (msg_cache.exists()) { | 24 | if (msg_cache.exists()) { |
25 | msg_cache.remove(); | 25 | msg_cache.remove(); |
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { | 29 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { |
30 | qDebug( "POP3: %i of %i", current, maximum ); | 30 | qDebug( "POP3: %i of %i", current, maximum ); |
31 | } | 31 | } |
32 | 32 | ||
33 | RecBody POP3wrapper::fetchBody( const RecMail &mail ) { | 33 | RecBody POP3wrapper::fetchBody( const RecMail &mail ) { |
34 | int err = MAILPOP3_NO_ERROR; | 34 | int err = MAILPOP3_NO_ERROR; |
35 | char *message = 0; | 35 | char *message = 0; |
36 | size_t length = 0; | 36 | size_t length = 0; |
37 | 37 | ||
38 | login(); | 38 | login(); |
39 | if ( !m_pop3 ) { | 39 | if ( !m_pop3 ) { |
40 | return RecBody(); | 40 | return RecBody(); |
41 | } | 41 | } |
42 | 42 | ||
43 | RecBody body; | 43 | RecBody body; |
44 | mailmessage * mailmsg; | 44 | mailmessage * mailmsg; |
45 | if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { | 45 | if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { |
46 | qDebug("Message to large: %i",mail.Msgsize()); | 46 | qDebug("Message to large: %i",mail.Msgsize()); |
47 | return body; | 47 | return body; |
48 | } | 48 | } |
49 | 49 | ||
50 | QFile msg_cache(msgTempName); | 50 | QFile msg_cache(msgTempName); |
51 | 51 | ||
52 | cleanMimeCache(); | 52 | cleanMimeCache(); |
53 | 53 | ||
54 | if (mail.getNumber()!=last_msg_id) { | 54 | if (mail.getNumber()!=last_msg_id) { |
55 | if (msg_cache.exists()) { | 55 | if (msg_cache.exists()) { |
56 | msg_cache.remove(); | 56 | msg_cache.remove(); |
57 | } | 57 | } |
58 | msg_cache.open(IO_ReadWrite|IO_Truncate); | 58 | msg_cache.open(IO_ReadWrite|IO_Truncate); |
59 | last_msg_id = mail.getNumber(); | 59 | last_msg_id = mail.getNumber(); |
60 | err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); | 60 | err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); |
61 | err = mailmessage_fetch(mailmsg,&message,&length); | 61 | err = mailmessage_fetch(mailmsg,&message,&length); |
62 | msg_cache.writeBlock(message,length); | 62 | msg_cache.writeBlock(message,length); |
63 | } else { | 63 | } else { |
64 | QString msg=""; | 64 | QString msg=""; |
65 | msg_cache.open(IO_ReadOnly); | 65 | msg_cache.open(IO_ReadOnly); |
66 | message = new char[4096]; | 66 | message = new char[4096]; |
67 | memset(message,0,4096); | 67 | memset(message,0,4096); |
68 | while (msg_cache.readBlock(message,4095)>0) { | 68 | while (msg_cache.readBlock(message,4095)>0) { |
69 | msg+=message; | 69 | msg+=message; |
70 | memset(message,0,4096); | 70 | memset(message,0,4096); |
71 | } | 71 | } |
72 | delete message; | 72 | delete message; |
73 | message = (char*)malloc(msg.length()+1*sizeof(char)); | 73 | message = (char*)malloc(msg.length()+1*sizeof(char)); |
74 | memset(message,0,msg.length()+1); | 74 | memset(message,0,msg.length()+1); |
75 | memcpy(message,msg.latin1(),msg.length()); | 75 | memcpy(message,msg.latin1(),msg.length()); |
76 | /* transform to libetpan stuff */ | 76 | /* transform to libetpan stuff */ |
77 | mailmsg = mailmessage_new(); | 77 | mailmsg = mailmessage_new(); |
78 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); | 78 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); |
79 | generic_message_t * msg_data; | 79 | generic_message_t * msg_data; |
80 | msg_data = (generic_message_t *)mailmsg->msg_data; | 80 | msg_data = (generic_message_t *)mailmsg->msg_data; |
81 | msg_data->msg_fetched = 1; | 81 | msg_data->msg_fetched = 1; |
82 | msg_data->msg_message = message; | 82 | msg_data->msg_message = message; |
83 | msg_data->msg_length = strlen(message); | 83 | msg_data->msg_length = strlen(message); |
84 | } | 84 | } |
85 | body = parseMail(mailmsg); | 85 | body = parseMail(mailmsg); |
86 | 86 | ||
87 | /* clean up */ | 87 | /* clean up */ |
88 | if (mailmsg) | 88 | if (mailmsg) |
89 | mailmessage_free(mailmsg); | 89 | mailmessage_free(mailmsg); |
90 | if (message) | 90 | if (message) |
91 | free(message); | 91 | free(message); |
92 | 92 | ||
93 | return body; | 93 | return body; |
94 | } | 94 | } |
95 | 95 | ||
96 | void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) | 96 | void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) |
97 | { | 97 | { |
98 | login(); | 98 | login(); |
99 | if (!m_pop3) | 99 | if (!m_pop3) |
100 | return; | 100 | return; |
101 | uint32_t res_messages,res_recent,res_unseen; | 101 | uint32_t res_messages,res_recent,res_unseen; |
102 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); | 102 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); |
103 | parseList(target,m_pop3->sto_session,"INBOX"); | 103 | parseList(target,m_pop3->sto_session,"INBOX"); |
104 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); | 104 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); |
105 | } | 105 | } |
106 | 106 | ||
107 | void POP3wrapper::login() | 107 | void POP3wrapper::login() |
108 | { | 108 | { |
109 | if (account->getOffline()) | 109 | if (account->getOffline()) |
110 | return; | 110 | return; |
111 | /* we'll hold the line */ | 111 | /* we'll hold the line */ |
112 | if ( m_pop3 != NULL ) | 112 | if ( m_pop3 != NULL ) |
113 | return; | 113 | return; |
114 | 114 | ||
115 | const char *server, *user, *pass; | 115 | const char *server, *user, *pass; |
116 | uint16_t port; | 116 | uint16_t port; |
117 | int err = MAILPOP3_NO_ERROR; | 117 | int err = MAILPOP3_NO_ERROR; |
118 | 118 | ||
119 | server = account->getServer().latin1(); | 119 | server = account->getServer().latin1(); |
120 | port = account->getPort().toUInt(); | 120 | port = account->getPort().toUInt(); |
121 | 121 | ||
122 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 122 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
123 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 123 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
124 | login.show(); | 124 | login.show(); |
125 | if ( QDialog::Accepted == login.exec() ) { | 125 | if ( QDialog::Accepted == login.exec() ) { |
126 | // ok | 126 | // ok |
127 | user = login.getUser().latin1(); | 127 | user = login.getUser().latin1(); |
128 | pass = login.getPassword().latin1(); | 128 | pass = login.getPassword().latin1(); |
129 | } else { | 129 | } else { |
130 | // cancel | 130 | // cancel |
131 | qDebug( "POP3: Login canceled" ); | 131 | qDebug( "POP3: Login canceled" ); |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | } else { | 134 | } else { |
135 | user = account->getUser().latin1(); | 135 | user = account->getUser().latin1(); |
136 | pass = account->getPassword().latin1(); | 136 | pass = account->getPassword().latin1(); |
137 | } | 137 | } |
138 | 138 | ||
139 | // bool ssl = account->getSSL(); | 139 | // bool ssl = account->getSSL(); |
140 | 140 | ||
141 | m_pop3=mailstorage_new(NULL); | 141 | m_pop3=mailstorage_new(NULL); |
142 | 142 | ||
143 | int conntypeset = account->ConnectionType(); | 143 | int conntypeset = account->ConnectionType(); |
144 | int conntype = 0; | 144 | int conntype = 0; |
145 | if ( conntypeset == 3 ) { | 145 | if ( conntypeset == 3 ) { |
146 | conntype = CONNECTION_TYPE_COMMAND; | 146 | conntype = CONNECTION_TYPE_COMMAND; |
147 | } else if ( conntypeset == 2 ) { | 147 | } else if ( conntypeset == 2 ) { |
148 | conntype = CONNECTION_TYPE_TLS; | 148 | conntype = CONNECTION_TYPE_TLS; |
149 | } else if ( conntypeset == 1 ) { | 149 | } else if ( conntypeset == 1 ) { |
150 | conntype = CONNECTION_TYPE_STARTTLS; | 150 | conntype = CONNECTION_TYPE_STARTTLS; |
151 | } else if ( conntypeset == 0 ) { | 151 | } else if ( conntypeset == 0 ) { |
152 | conntype = CONNECTION_TYPE_TRY_STARTTLS; | 152 | conntype = CONNECTION_TYPE_TRY_STARTTLS; |
153 | } | 153 | } |
154 | 154 | ||
155 | //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); | 155 | //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); |
156 | 156 | ||
157 | pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, | 157 | pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, |
158 | (char*)user,(char*)pass,0,0,0); | 158 | (char*)user,(char*)pass,0,0,0); |
159 | 159 | ||
160 | 160 | ||
161 | err = mailstorage_connect(m_pop3); | 161 | err = mailstorage_connect(m_pop3); |
162 | if (err != MAIL_NO_ERROR) { | 162 | if (err != MAIL_NO_ERROR) { |
163 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); | 163 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); |
164 | Global::statusMessage(tr("Error initializing folder")); | 164 | Global::statusMessage(tr("Error initializing folder")); |
165 | mailstorage_free(m_pop3); | 165 | mailstorage_free(m_pop3); |
166 | m_pop3 = 0; | 166 | m_pop3 = 0; |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | void POP3wrapper::logout() | 170 | void POP3wrapper::logout() |
171 | { | 171 | { |
172 | int err = MAILPOP3_NO_ERROR; | 172 | int err = MAILPOP3_NO_ERROR; |
173 | if ( m_pop3 == NULL ) | 173 | if ( m_pop3 == NULL ) |
174 | return; | 174 | return; |
175 | mailstorage_free(m_pop3); | 175 | mailstorage_free(m_pop3); |
176 | m_pop3 = 0; | 176 | m_pop3 = 0; |
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
180 | QList<Folder>* POP3wrapper::listFolders() { | 180 | QList<Folder>* POP3wrapper::listFolders() { |
181 | QList<Folder> * folders = new QList<Folder>(); | 181 | QList<Folder> * folders = new QList<Folder>(); |
182 | folders->setAutoDelete( false ); | 182 | folders->setAutoDelete( false ); |
183 | Folder*inb=new Folder("INBOX","/"); | 183 | Folder*inb=new Folder("INBOX","/"); |
184 | folders->append(inb); | 184 | folders->append(inb); |
185 | return folders; | 185 | return folders; |
186 | } | 186 | } |
187 | 187 | ||
188 | void POP3wrapper::deleteMail(const RecMail&mail) { | 188 | void POP3wrapper::deleteMail(const RecMail&mail) { |
189 | login(); | 189 | login(); |
190 | if (!m_pop3) | 190 | if (!m_pop3) |
191 | return; | 191 | return; |
192 | int err = mailsession_remove_message(m_pop3->sto_session,mail.getNumber()); | 192 | int err = mailsession_remove_message(m_pop3->sto_session,mail.getNumber()); |
193 | if (err != MAIL_NO_ERROR) { | 193 | if (err != MAIL_NO_ERROR) { |
194 | Global::statusMessage(tr("error deleting mail")); | 194 | Global::statusMessage(tr("error deleting mail")); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | void POP3wrapper::answeredMail(const RecMail&) {} | 198 | void POP3wrapper::answeredMail(const RecMail&) {} |
199 | 199 | ||
200 | int POP3wrapper::deleteAllMail(const Folder*) { | 200 | int POP3wrapper::deleteAllMail(const Folder*) { |
201 | login(); | 201 | login(); |
202 | if (!m_pop3) | 202 | if (!m_pop3) |
203 | return 0; | 203 | return 0; |
204 | int res = 1; | 204 | int res = 1; |
205 | 205 | ||
206 | uint32_t result = 0; | 206 | uint32_t result = 0; |
207 | int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); | 207 | int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); |
208 | if (err != MAIL_NO_ERROR) { | 208 | if (err != MAIL_NO_ERROR) { |
209 | Global::statusMessage(tr("Error getting folder info")); | 209 | Global::statusMessage(tr("Error getting folder info")); |
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
212 | for (unsigned int i = 0; i < result; ++i) { | 212 | for (unsigned int i = 0; i < result; ++i) { |
213 | err = mailsession_remove_message(m_pop3->sto_session,i+1); | 213 | err = mailsession_remove_message(m_pop3->sto_session,i+1); |
214 | if (err != MAIL_NO_ERROR) { | 214 | if (err != MAIL_NO_ERROR) { |
215 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | 215 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); |
216 | res=0; | 216 | res=0; |
217 | } | 217 | } |
218 | break; | 218 | break; |
219 | } | 219 | } |
220 | return res; | 220 | return res; |
221 | } | 221 | } |
222 | 222 | ||
223 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { | 223 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { |
224 | login(); | 224 | login(); |
225 | target_stat.message_count = 0; | 225 | target_stat.message_count = 0; |
226 | target_stat.message_unseen = 0; | 226 | target_stat.message_unseen = 0; |
227 | target_stat.message_recent = 0; | 227 | target_stat.message_recent = 0; |
228 | if (!m_pop3) | 228 | if (!m_pop3) |
229 | return; | 229 | return; |
230 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, | 230 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, |
231 | &target_stat.message_recent,&target_stat.message_unseen); | 231 | &target_stat.message_recent,&target_stat.message_unseen); |
232 | } | 232 | } |
233 | 233 | ||
234 | encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) { | 234 | encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) { |
235 | char*target=0; | 235 | char*target=0; |
236 | size_t length=0; | 236 | size_t length=0; |
237 | encodedString*res = 0; | 237 | encodedString*res = 0; |
238 | mailmessage * mailmsg = 0; | 238 | mailmessage * mailmsg = 0; |
239 | int err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); | 239 | int err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); |
240 | err = mailmessage_fetch(mailmsg,&target,&length); | 240 | err = mailmessage_fetch(mailmsg,&target,&length); |
241 | if (mailmsg) | 241 | if (mailmsg) |
242 | mailmessage_free(mailmsg); | 242 | mailmessage_free(mailmsg); |
243 | if (target) { | 243 | if (target) { |
244 | res = new encodedString(target,length); | 244 | res = new encodedString(target,length); |
245 | } | 245 | } |
246 | return res; | 246 | return res; |
247 | } | 247 | } |
248 | 248 | ||
249 | const QString&POP3wrapper::getType()const { | 249 | const QString&POP3wrapper::getType()const { |
250 | return account->getType(); | 250 | return account->getType(); |
251 | } | 251 | } |
252 | 252 | ||
253 | const QString&POP3wrapper::getName()const{ | 253 | const QString&POP3wrapper::getName()const{ |
254 | return account->getAccountName(); | 254 | return account->getAccountName(); |
255 | } | 255 | } |
diff --git a/noncore/net/mail/nntpconfigui.ui b/noncore/net/mail/nntpconfigui.ui index cc439f4..7769804 100644 --- a/noncore/net/mail/nntpconfigui.ui +++ b/noncore/net/mail/nntpconfigui.ui | |||
@@ -1,257 +1,352 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NNTPconfigUI</class> | 2 | <class>NNTPconfigUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NNTPconfigUI</cstring> | 7 | <cstring>NNTPconfigUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>228</width> | 14 | <width>413</width> |
15 | <height>320</height> | 15 | <height>520</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Configure NNTP</string> | 20 | <string>Configure NNTP</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <grid> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>4</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>3</number> | 35 | <number>3</number> |
36 | </property> | 36 | </property> |
37 | <widget row="2" column="1" > | 37 | <widget> |
38 | <class>QLineEdit</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>serverLine</cstring> | ||
42 | </property> | ||
43 | </widget> | ||
44 | <widget row="3" column="0" > | ||
45 | <class>QLabel</class> | ||
46 | <property stdset="1"> | ||
47 | <name>name</name> | ||
48 | <cstring>portLabel</cstring> | ||
49 | </property> | ||
50 | <property stdset="1"> | ||
51 | <name>text</name> | ||
52 | <string>Port</string> | ||
53 | </property> | ||
54 | </widget> | ||
55 | <widget row="3" column="1" > | ||
56 | <class>QLineEdit</class> | ||
57 | <property stdset="1"> | ||
58 | <name>name</name> | ||
59 | <cstring>portLine</cstring> | ||
60 | </property> | ||
61 | </widget> | ||
62 | <widget row="0" column="1" > | ||
63 | <class>QLineEdit</class> | ||
64 | <property stdset="1"> | ||
65 | <name>name</name> | ||
66 | <cstring>accountLine</cstring> | ||
67 | </property> | ||
68 | <property> | ||
69 | <name>toolTip</name> | ||
70 | <string>Name of the Account</string> | ||
71 | </property> | ||
72 | </widget> | ||
73 | <widget row="0" column="0" > | ||
74 | <class>QLabel</class> | ||
75 | <property stdset="1"> | ||
76 | <name>name</name> | ||
77 | <cstring>accountLabel</cstring> | ||
78 | </property> | ||
79 | <property stdset="1"> | ||
80 | <name>text</name> | ||
81 | <string>Account</string> | ||
82 | </property> | ||
83 | </widget> | ||
84 | <widget row="2" column="0" > | ||
85 | <class>QLabel</class> | ||
86 | <property stdset="1"> | ||
87 | <name>name</name> | ||
88 | <cstring>serverLabel</cstring> | ||
89 | </property> | ||
90 | <property stdset="1"> | ||
91 | <name>enabled</name> | ||
92 | <bool>true</bool> | ||
93 | </property> | ||
94 | <property stdset="1"> | ||
95 | <name>caption</name> | ||
96 | <string></string> | ||
97 | </property> | ||
98 | <property stdset="1"> | ||
99 | <name>text</name> | ||
100 | <string>Server</string> | ||
101 | </property> | ||
102 | <property> | ||
103 | <name>layoutMargin</name> | ||
104 | </property> | ||
105 | <property> | ||
106 | <name>layoutSpacing</name> | ||
107 | </property> | ||
108 | </widget> | ||
109 | <widget row="1" column="0" rowspan="1" colspan="2" > | ||
110 | <class>Line</class> | ||
111 | <property stdset="1"> | ||
112 | <name>name</name> | ||
113 | <cstring>line1</cstring> | ||
114 | </property> | ||
115 | <property stdset="1"> | ||
116 | <name>caption</name> | ||
117 | <string></string> | ||
118 | </property> | ||
119 | <property stdset="1"> | ||
120 | <name>orientation</name> | ||
121 | <enum>Horizontal</enum> | ||
122 | </property> | ||
123 | <property> | ||
124 | <name>layoutMargin</name> | ||
125 | </property> | ||
126 | <property> | ||
127 | <name>layoutSpacing</name> | ||
128 | </property> | ||
129 | </widget> | ||
130 | <widget row="4" column="1" > | ||
131 | <class>QCheckBox</class> | ||
132 | <property stdset="1"> | ||
133 | <name>name</name> | ||
134 | <cstring>sslBox</cstring> | ||
135 | </property> | ||
136 | <property stdset="1"> | ||
137 | <name>text</name> | ||
138 | <string>Use SSL</string> | ||
139 | </property> | ||
140 | </widget> | ||
141 | <widget row="5" column="0" rowspan="1" colspan="2" > | ||
142 | <class>Line</class> | ||
143 | <property stdset="1"> | 39 | <property stdset="1"> |
144 | <name>name</name> | 40 | <name>name</name> |
145 | <cstring>line2</cstring> | 41 | <cstring>TabWidget2</cstring> |
146 | </property> | ||
147 | <property stdset="1"> | ||
148 | <name>enabled</name> | ||
149 | <bool>true</bool> | ||
150 | </property> | ||
151 | <property stdset="1"> | ||
152 | <name>caption</name> | ||
153 | <string></string> | ||
154 | </property> | ||
155 | <property stdset="1"> | ||
156 | <name>orientation</name> | ||
157 | <enum>Horizontal</enum> | ||
158 | </property> | 42 | </property> |
159 | <property> | 43 | <property> |
160 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
161 | </property> | 45 | </property> |
162 | <property> | 46 | <property> |
163 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
164 | </property> | 48 | </property> |
49 | <widget> | ||
50 | <class>QWidget</class> | ||
51 | <property stdset="1"> | ||
52 | <name>name</name> | ||
53 | <cstring>tab</cstring> | ||
54 | </property> | ||
55 | <attribute> | ||
56 | <name>title</name> | ||
57 | <string>Account</string> | ||
58 | </attribute> | ||
59 | <grid> | ||
60 | <property stdset="1"> | ||
61 | <name>margin</name> | ||
62 | <number>3</number> | ||
63 | </property> | ||
64 | <property stdset="1"> | ||
65 | <name>spacing</name> | ||
66 | <number>3</number> | ||
67 | </property> | ||
68 | <widget row="2" column="1" > | ||
69 | <class>QLineEdit</class> | ||
70 | <property stdset="1"> | ||
71 | <name>name</name> | ||
72 | <cstring>serverLine</cstring> | ||
73 | </property> | ||
74 | </widget> | ||
75 | <widget row="3" column="0" > | ||
76 | <class>QLabel</class> | ||
77 | <property stdset="1"> | ||
78 | <name>name</name> | ||
79 | <cstring>portLabel</cstring> | ||
80 | </property> | ||
81 | <property stdset="1"> | ||
82 | <name>text</name> | ||
83 | <string>Port</string> | ||
84 | </property> | ||
85 | </widget> | ||
86 | <widget row="3" column="1" > | ||
87 | <class>QLineEdit</class> | ||
88 | <property stdset="1"> | ||
89 | <name>name</name> | ||
90 | <cstring>portLine</cstring> | ||
91 | </property> | ||
92 | </widget> | ||
93 | <widget row="0" column="1" > | ||
94 | <class>QLineEdit</class> | ||
95 | <property stdset="1"> | ||
96 | <name>name</name> | ||
97 | <cstring>accountLine</cstring> | ||
98 | </property> | ||
99 | <property> | ||
100 | <name>toolTip</name> | ||
101 | <string>Name of the Account</string> | ||
102 | </property> | ||
103 | </widget> | ||
104 | <widget row="0" column="0" > | ||
105 | <class>QLabel</class> | ||
106 | <property stdset="1"> | ||
107 | <name>name</name> | ||
108 | <cstring>accountLabel</cstring> | ||
109 | </property> | ||
110 | <property stdset="1"> | ||
111 | <name>text</name> | ||
112 | <string>Account</string> | ||
113 | </property> | ||
114 | </widget> | ||
115 | <widget row="2" column="0" > | ||
116 | <class>QLabel</class> | ||
117 | <property stdset="1"> | ||
118 | <name>name</name> | ||
119 | <cstring>serverLabel</cstring> | ||
120 | </property> | ||
121 | <property stdset="1"> | ||
122 | <name>enabled</name> | ||
123 | <bool>true</bool> | ||
124 | </property> | ||
125 | <property stdset="1"> | ||
126 | <name>caption</name> | ||
127 | <string></string> | ||
128 | </property> | ||
129 | <property stdset="1"> | ||
130 | <name>text</name> | ||
131 | <string>Server</string> | ||
132 | </property> | ||
133 | <property> | ||
134 | <name>layoutMargin</name> | ||
135 | </property> | ||
136 | <property> | ||
137 | <name>layoutSpacing</name> | ||
138 | </property> | ||
139 | </widget> | ||
140 | <widget row="1" column="0" rowspan="1" colspan="2" > | ||
141 | <class>Line</class> | ||
142 | <property stdset="1"> | ||
143 | <name>name</name> | ||
144 | <cstring>line1</cstring> | ||
145 | </property> | ||
146 | <property stdset="1"> | ||
147 | <name>caption</name> | ||
148 | <string></string> | ||
149 | </property> | ||
150 | <property stdset="1"> | ||
151 | <name>orientation</name> | ||
152 | <enum>Horizontal</enum> | ||
153 | </property> | ||
154 | <property> | ||
155 | <name>layoutMargin</name> | ||
156 | </property> | ||
157 | <property> | ||
158 | <name>layoutSpacing</name> | ||
159 | </property> | ||
160 | </widget> | ||
161 | <widget row="4" column="1" > | ||
162 | <class>QCheckBox</class> | ||
163 | <property stdset="1"> | ||
164 | <name>name</name> | ||
165 | <cstring>sslBox</cstring> | ||
166 | </property> | ||
167 | <property stdset="1"> | ||
168 | <name>text</name> | ||
169 | <string>Use SSL</string> | ||
170 | </property> | ||
171 | </widget> | ||
172 | <widget row="5" column="0" rowspan="2" colspan="2" > | ||
173 | <class>Line</class> | ||
174 | <property stdset="1"> | ||
175 | <name>name</name> | ||
176 | <cstring>line2</cstring> | ||
177 | </property> | ||
178 | <property stdset="1"> | ||
179 | <name>enabled</name> | ||
180 | <bool>true</bool> | ||
181 | </property> | ||
182 | <property stdset="1"> | ||
183 | <name>caption</name> | ||
184 | <string></string> | ||
185 | </property> | ||
186 | <property stdset="1"> | ||
187 | <name>orientation</name> | ||
188 | <enum>Horizontal</enum> | ||
189 | </property> | ||
190 | <property> | ||
191 | <name>layoutMargin</name> | ||
192 | </property> | ||
193 | <property> | ||
194 | <name>layoutSpacing</name> | ||
195 | </property> | ||
196 | </widget> | ||
197 | <widget row="7" column="0" > | ||
198 | <class>QLabel</class> | ||
199 | <property stdset="1"> | ||
200 | <name>name</name> | ||
201 | <cstring>userLabel</cstring> | ||
202 | </property> | ||
203 | <property stdset="1"> | ||
204 | <name>text</name> | ||
205 | <string>User</string> | ||
206 | </property> | ||
207 | </widget> | ||
208 | <widget row="8" column="0" > | ||
209 | <class>QLabel</class> | ||
210 | <property stdset="1"> | ||
211 | <name>name</name> | ||
212 | <cstring>passLabel</cstring> | ||
213 | </property> | ||
214 | <property stdset="1"> | ||
215 | <name>text</name> | ||
216 | <string>Password</string> | ||
217 | </property> | ||
218 | </widget> | ||
219 | <spacer row="9" column="1" > | ||
220 | <property> | ||
221 | <name>name</name> | ||
222 | <cstring>spacer</cstring> | ||
223 | </property> | ||
224 | <property stdset="1"> | ||
225 | <name>orientation</name> | ||
226 | <enum>Vertical</enum> | ||
227 | </property> | ||
228 | <property stdset="1"> | ||
229 | <name>sizeType</name> | ||
230 | <enum>Expanding</enum> | ||
231 | </property> | ||
232 | <property> | ||
233 | <name>sizeHint</name> | ||
234 | <size> | ||
235 | <width>20</width> | ||
236 | <height>20</height> | ||
237 | </size> | ||
238 | </property> | ||
239 | </spacer> | ||
240 | <widget row="6" column="1" > | ||
241 | <class>QCheckBox</class> | ||
242 | <property stdset="1"> | ||
243 | <name>name</name> | ||
244 | <cstring>loginBox</cstring> | ||
245 | </property> | ||
246 | <property stdset="1"> | ||
247 | <name>text</name> | ||
248 | <string>Use Login</string> | ||
249 | </property> | ||
250 | </widget> | ||
251 | <widget row="7" column="1" > | ||
252 | <class>QLineEdit</class> | ||
253 | <property stdset="1"> | ||
254 | <name>name</name> | ||
255 | <cstring>userLine</cstring> | ||
256 | </property> | ||
257 | <property stdset="1"> | ||
258 | <name>enabled</name> | ||
259 | <bool>false</bool> | ||
260 | </property> | ||
261 | </widget> | ||
262 | <widget row="8" column="1" > | ||
263 | <class>QLineEdit</class> | ||
264 | <property stdset="1"> | ||
265 | <name>name</name> | ||
266 | <cstring>passLine</cstring> | ||
267 | </property> | ||
268 | <property stdset="1"> | ||
269 | <name>enabled</name> | ||
270 | <bool>false</bool> | ||
271 | </property> | ||
272 | <property stdset="1"> | ||
273 | <name>echoMode</name> | ||
274 | <enum>Password</enum> | ||
275 | </property> | ||
276 | </widget> | ||
277 | </grid> | ||
278 | </widget> | ||
279 | <widget> | ||
280 | <class>QWidget</class> | ||
281 | <property stdset="1"> | ||
282 | <name>name</name> | ||
283 | <cstring>tab</cstring> | ||
284 | </property> | ||
285 | <attribute> | ||
286 | <name>title</name> | ||
287 | <string>Groups</string> | ||
288 | </attribute> | ||
289 | <vbox> | ||
290 | <property stdset="1"> | ||
291 | <name>margin</name> | ||
292 | <number>3</number> | ||
293 | </property> | ||
294 | <property stdset="1"> | ||
295 | <name>spacing</name> | ||
296 | <number>3</number> | ||
297 | </property> | ||
298 | <widget> | ||
299 | <class>QListView</class> | ||
300 | <property stdset="1"> | ||
301 | <name>name</name> | ||
302 | <cstring>ListViewGroups</cstring> | ||
303 | </property> | ||
304 | </widget> | ||
305 | <widget> | ||
306 | <class>QPushButton</class> | ||
307 | <property stdset="1"> | ||
308 | <name>name</name> | ||
309 | <cstring>GetNGButton</cstring> | ||
310 | </property> | ||
311 | <property stdset="1"> | ||
312 | <name>text</name> | ||
313 | <string>Get newsgroup list from server</string> | ||
314 | </property> | ||
315 | </widget> | ||
316 | </vbox> | ||
317 | </widget> | ||
165 | </widget> | 318 | </widget> |
166 | <widget row="7" column="0" > | 319 | </vbox> |
167 | <class>QLabel</class> | ||
168 | <property stdset="1"> | ||
169 | <name>name</name> | ||
170 | <cstring>userLabel</cstring> | ||
171 | </property> | ||
172 | <property stdset="1"> | ||
173 | <name>text</name> | ||
174 | <string>User</string> | ||
175 | </property> | ||
176 | </widget> | ||
177 | <widget row="8" column="0" > | ||
178 | <class>QLabel</class> | ||
179 | <property stdset="1"> | ||
180 | <name>name</name> | ||
181 | <cstring>passLabel</cstring> | ||
182 | </property> | ||
183 | <property stdset="1"> | ||
184 | <name>text</name> | ||
185 | <string>Password</string> | ||
186 | </property> | ||
187 | </widget> | ||
188 | <spacer row="9" column="1" > | ||
189 | <property> | ||
190 | <name>name</name> | ||
191 | <cstring>spacer</cstring> | ||
192 | </property> | ||
193 | <property stdset="1"> | ||
194 | <name>orientation</name> | ||
195 | <enum>Vertical</enum> | ||
196 | </property> | ||
197 | <property stdset="1"> | ||
198 | <name>sizeType</name> | ||
199 | <enum>Expanding</enum> | ||
200 | </property> | ||
201 | <property> | ||
202 | <name>sizeHint</name> | ||
203 | <size> | ||
204 | <width>20</width> | ||
205 | <height>20</height> | ||
206 | </size> | ||
207 | </property> | ||
208 | </spacer> | ||
209 | <widget row="6" column="1" > | ||
210 | <class>QCheckBox</class> | ||
211 | <property stdset="1"> | ||
212 | <name>name</name> | ||
213 | <cstring>loginBox</cstring> | ||
214 | </property> | ||
215 | <property stdset="1"> | ||
216 | <name>text</name> | ||
217 | <string>Use Login</string> | ||
218 | </property> | ||
219 | </widget> | ||
220 | <widget row="7" column="1" > | ||
221 | <class>QLineEdit</class> | ||
222 | <property stdset="1"> | ||
223 | <name>name</name> | ||
224 | <cstring>userLine</cstring> | ||
225 | </property> | ||
226 | <property stdset="1"> | ||
227 | <name>enabled</name> | ||
228 | <bool>false</bool> | ||
229 | </property> | ||
230 | </widget> | ||
231 | <widget row="8" column="1" > | ||
232 | <class>QLineEdit</class> | ||
233 | <property stdset="1"> | ||
234 | <name>name</name> | ||
235 | <cstring>passLine</cstring> | ||
236 | </property> | ||
237 | <property stdset="1"> | ||
238 | <name>enabled</name> | ||
239 | <bool>false</bool> | ||
240 | </property> | ||
241 | <property stdset="1"> | ||
242 | <name>echoMode</name> | ||
243 | <enum>Password</enum> | ||
244 | </property> | ||
245 | </widget> | ||
246 | </grid> | ||
247 | </widget> | 320 | </widget> |
321 | <customwidgets> | ||
322 | <customwidget> | ||
323 | <class>QListView</class> | ||
324 | <header location="global">qlistview.h</header> | ||
325 | <sizehint> | ||
326 | <width>-1</width> | ||
327 | <height>-1</height> | ||
328 | </sizehint> | ||
329 | <container>0</container> | ||
330 | <sizepolicy> | ||
331 | <hordata>5</hordata> | ||
332 | <verdata>5</verdata> | ||
333 | </sizepolicy> | ||
334 | <pixmap>image0</pixmap> | ||
335 | </customwidget> | ||
336 | </customwidgets> | ||
337 | <images> | ||
338 | <image> | ||
339 | <name>image0</name> | ||
340 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> | ||
341 | </image> | ||
342 | </images> | ||
248 | <tabstops> | 343 | <tabstops> |
249 | <tabstop>accountLine</tabstop> | 344 | <tabstop>accountLine</tabstop> |
250 | <tabstop>serverLine</tabstop> | 345 | <tabstop>serverLine</tabstop> |
251 | <tabstop>portLine</tabstop> | 346 | <tabstop>portLine</tabstop> |
252 | <tabstop>sslBox</tabstop> | 347 | <tabstop>sslBox</tabstop> |
253 | <tabstop>loginBox</tabstop> | 348 | <tabstop>loginBox</tabstop> |
254 | <tabstop>userLine</tabstop> | 349 | <tabstop>userLine</tabstop> |
255 | <tabstop>passLine</tabstop> | 350 | <tabstop>passLine</tabstop> |
256 | </tabstops> | 351 | </tabstops> |
257 | </UI> | 352 | </UI> |