summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp21
-rw-r--r--kmicromail/editaccounts.cpp70
-rw-r--r--kmicromail/editaccounts.h3
-rw-r--r--kmicromail/mainwindow.cpp7
-rw-r--r--kmicromail/mainwindow.h1
-rw-r--r--kmicromail/nntpconfigui.ui126
-rw-r--r--kmicromail/opiemail.cpp8
-rw-r--r--kmicromail/opiemail.h1
8 files changed, 186 insertions, 51 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index 12d047a..7795055 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -1,1139 +1,1150 @@
1 1
2#include "accountitem.h" 2#include "accountitem.h"
3#include "accountview.h" 3#include "accountview.h"
4#include "newmaildir.h" 4#include "newmaildir.h"
5#include "nntpgroupsdlg.h" 5#include "nntpgroupsdlg.h"
6#include "defines.h" 6#include "defines.h"
7 7
8#include <libmailwrapper/mailtypes.h> 8#include <libmailwrapper/mailtypes.h>
9#include <libmailwrapper/abstractmail.h> 9#include <libmailwrapper/abstractmail.h>
10#include <libmailwrapper/mailwrapper.h> 10#include <libmailwrapper/mailwrapper.h>
11/* OPIE */ 11/* OPIE */
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#include <kiconloader.h> 17#include <kiconloader.h>
18 18
19#define GET_NEW_MAILS 101 19#define GET_NEW_MAILS 101
20 20
21using namespace Opie::Core; 21using namespace Opie::Core;
22#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} 22#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
23/** 23/**
24 * POP3 Account stuff 24 * POP3 Account stuff
25 */ 25 */
26POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) 26POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
27 : AccountViewItem( parent ) 27 : AccountViewItem( parent )
28{ 28{
29 account = a; 29 account = a;
30 wrapper = AbstractMail::getWrapper( account ); 30 wrapper = AbstractMail::getWrapper( account );
31 SETPIX(PIXMAP_POP3FOLDER); 31 SETPIX(PIXMAP_POP3FOLDER);
32#if 0 32#if 0
33 if (!account->getOffline()) 33 if (!account->getOffline())
34 { 34 {
35 setPixmap( 0, ); 35 setPixmap( 0, );
36 } 36 }
37 else 37 else
38 { 38 {
39 setPixmap( 0, PIXMAP_OFFLINE ); 39 setPixmap( 0, PIXMAP_OFFLINE );
40 } 40 }
41#endif 41#endif
42 setText( 0, account->getAccountName() ); 42 setText( 0, account->getAccountName() );
43 setOpen( true ); 43 setOpen( true );
44} 44}
45 45
46POP3viewItem::~POP3viewItem() 46POP3viewItem::~POP3viewItem()
47{ 47{
48 delete wrapper; 48 delete wrapper;
49} 49}
50 50
51AbstractMail *POP3viewItem::getWrapper() 51AbstractMail *POP3viewItem::getWrapper()
52{ 52{
53 return wrapper; 53 return wrapper;
54} 54}
55 55
56void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) 56void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & )
57{ 57{
58 refresh(); 58 refresh();
59} 59}
60 60
61void POP3viewItem::refresh() 61void POP3viewItem::refresh()
62{ 62{
63 if (account->getOffline()) return; 63 if (account->getOffline()) return;
64 QValueList<FolderP> *folders = wrapper->listFolders(); 64 QValueList<FolderP> *folders = wrapper->listFolders();
65 QListViewItem *child = firstChild(); 65 QListViewItem *child = firstChild();
66 while ( child ) 66 while ( child )
67 { 67 {
68 QListViewItem *tmp = child; 68 QListViewItem *tmp = child;
69 child = child->nextSibling(); 69 child = child->nextSibling();
70 delete tmp; 70 delete tmp;
71 } 71 }
72 QValueList<FolderP>::ConstIterator it; 72 QValueList<FolderP>::ConstIterator it;
73 QListViewItem*item = 0; 73 QListViewItem*item = 0;
74 for ( it = folders->begin(); it!=folders->end(); ++it) 74 for ( it = folders->begin(); it!=folders->end(); ++it)
75 { 75 {
76 item = new POP3folderItem( (*it), this , item ); 76 item = new POP3folderItem( (*it), this , item );
77 item->setSelectable( (*it)->may_select()); 77 item->setSelectable( (*it)->may_select());
78 } 78 }
79 delete folders; 79 delete folders;
80} 80}
81 81
82RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) 82RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
83{ 83{
84 84
85 return wrapper->fetchBody( mail ); 85 return wrapper->fetchBody( mail );
86} 86}
87 87
88QPopupMenu * POP3viewItem::getContextMenu() 88QPopupMenu * POP3viewItem::getContextMenu()
89{ 89{
90 QPopupMenu *m = new QPopupMenu(0); 90 QPopupMenu *m = new QPopupMenu(0);
91 if (m) 91 if (m)
92 { 92 {
93 if (!account->getOffline()) 93 if (!account->getOffline())
94 { 94 {
95 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
95 m->insertItem(QObject::tr("Disconnect",contextName),0); 96 m->insertItem(QObject::tr("Disconnect",contextName),0);
96 m->insertItem(QObject::tr("Set offline",contextName),1); 97 m->insertItem(QObject::tr("Set offline",contextName),1);
97 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
98 } 98 }
99 else 99 else
100 { 100 {
101 m->insertItem(QObject::tr("Set online",contextName),1);
102 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); 101 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
102 m->insertItem(QObject::tr("Set online",contextName),1);
103 } 103 }
104 } 104 }
105 return m; 105 return m;
106} 106}
107 107
108void POP3viewItem::disconnect() 108void POP3viewItem::disconnect()
109{ 109{
110 QListViewItem *child = firstChild(); 110 QListViewItem *child = firstChild();
111 while ( child ) 111 while ( child )
112 { 112 {
113 QListViewItem *tmp = child; 113 QListViewItem *tmp = child;
114 child = child->nextSibling(); 114 child = child->nextSibling();
115 delete tmp; 115 delete tmp;
116 } 116 }
117 wrapper->logout(); 117 wrapper->logout();
118} 118}
119 119
120void POP3viewItem::setOnOffline() 120void POP3viewItem::setOnOffline()
121{ 121{
122 if (!account->getOffline()) 122 if (!account->getOffline())
123 { 123 {
124 disconnect(); 124 disconnect();
125 } 125 }
126 account->setOffline(!account->getOffline()); 126 account->setOffline(!account->getOffline());
127 account->save(); 127 account->save();
128 SETPIX(PIXMAP_POP3FOLDER); 128 SETPIX(PIXMAP_POP3FOLDER);
129 refresh(); 129 refresh();
130} 130}
131 131
132void POP3viewItem::contextMenuSelected(int which) 132void POP3viewItem::contextMenuSelected(int which)
133{ 133{
134 switch (which) 134 switch (which)
135 { 135 {
136 case 0: 136 case 0:
137 disconnect(); 137 disconnect();
138 break; 138 break;
139 case 1: 139 case 1:
140 setOnOffline(); 140 setOnOffline();
141 break; 141 break;
142 case GET_NEW_MAILS: // daunlood 142 case GET_NEW_MAILS: // daunlood
143 if (account->getOffline()) 143 if (account->getOffline())
144 setOnOffline(); 144 setOnOffline();
145 AccountView*bl = accountView(); 145 AccountView*bl = accountView();
146 if (!bl) return; 146 if (!bl) return;
147 AccountViewItem* in = findSubItem( "inbox" , 0); 147 AccountViewItem* in = findSubItem( "inbox" , 0);
148 if ( ! in ) 148 if ( ! in )
149 return; 149 return;
150 bl->downloadMailsInbox(in->getFolder() ,getWrapper()); 150 bl->downloadMailsInbox(in->getFolder() ,getWrapper());
151 setOnOffline(); 151 setOnOffline();
152 break; 152 break;
153 } 153 }
154} 154}
155 155
156POP3folderItem::~POP3folderItem() 156POP3folderItem::~POP3folderItem()
157{} 157{}
158 158
159POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) 159POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after )
160 : AccountViewItem(folderInit,parent,after ) 160 : AccountViewItem(folderInit,parent,after )
161{ 161{
162 pop3 = parent; 162 pop3 = parent;
163 if (folder->getDisplayName().lower()!="inbox") 163 if (folder->getDisplayName().lower()!="inbox")
164 { 164 {
165 setPixmap( 0, PIXMAP_POP3FOLDER ); 165 setPixmap( 0, PIXMAP_POP3FOLDER );
166 } 166 }
167 else 167 else
168 { 168 {
169 setPixmap( 0, PIXMAP_INBOXFOLDER); 169 setPixmap( 0, PIXMAP_INBOXFOLDER);
170 } 170 }
171 setText( 0, folder->getDisplayName() ); 171 setText( 0, folder->getDisplayName() );
172} 172}
173 173
174void POP3folderItem::refresh(QValueList<RecMailP>&target) 174void POP3folderItem::refresh(QValueList<RecMailP>&target)
175{ 175{
176 if (folder->may_select()) 176 if (folder->may_select())
177 pop3->getWrapper()->listMessages( folder->getName(),target ); 177 pop3->getWrapper()->listMessages( folder->getName(),target );
178} 178}
179 179
180RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) 180RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail)
181{ 181{
182 return pop3->getWrapper()->fetchBody(aMail); 182 return pop3->getWrapper()->fetchBody(aMail);
183} 183}
184 184
185QPopupMenu * POP3folderItem::getContextMenu() 185QPopupMenu * POP3folderItem::getContextMenu()
186{ 186{
187 QPopupMenu *m = new QPopupMenu(0); 187 QPopupMenu *m = new QPopupMenu(0);
188 if (m) 188 if (m)
189 { 189 {
190 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
190 m->insertItem(QObject::tr("Refresh header list",contextName),0); 191 m->insertItem(QObject::tr("Refresh header list",contextName),0);
191 m->insertItem(QObject::tr("Delete all mails",contextName),1); 192 m->insertItem(QObject::tr("Delete all mails",contextName),1);
192 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); 193 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
193 } 194 }
194 return m; 195 return m;
195} 196}
196 197
197void POP3folderItem::downloadMails() 198void POP3folderItem::downloadMails()
198{ 199{
199 AccountView*bl = pop3->accountView(); 200 AccountView*bl = pop3->accountView();
200 if (!bl) return; 201 if (!bl) return;
201 bl->downloadMails(folder,pop3->getWrapper()); 202 bl->downloadMails(folder,pop3->getWrapper());
202} 203}
203 204
204void POP3folderItem::contextMenuSelected(int which) 205void POP3folderItem::contextMenuSelected(int which)
205{ 206{
206 AccountView * view = (AccountView*)listView(); 207 AccountView * view = (AccountView*)listView();
207 switch (which) 208 switch (which)
208 { 209 {
209 case 0: 210 case 0:
210 /* must be 'cause pop3 lists are cached */ 211 /* must be 'cause pop3 lists are cached */
211 pop3->getWrapper()->logout(); 212 pop3->getWrapper()->logout();
212 view->refreshCurrent(); 213 view->refreshCurrent();
213 break; 214 break;
214 case 1: 215 case 1:
215 deleteAllMail(pop3->getWrapper(),folder); 216 deleteAllMail(pop3->getWrapper(),folder);
216 break; 217 break;
217 case 2: 218 case 2:
218 downloadMails(); 219 downloadMails();
219 break; 220 break;
221 case GET_NEW_MAILS: // daunlood
222 view->downloadMailsInbox(getFolder() ,pop3->getWrapper());
223 break;
220 default: 224 default:
221 break; 225 break;
222 } 226 }
223} 227}
224 228
225/** 229/**
226 * NNTP Account stuff 230 * NNTP Account stuff
227 */ 231 */
228NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) 232NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent )
229 : AccountViewItem( parent ) 233 : AccountViewItem( parent )
230{ 234{
231 account = a; 235 account = a;
232 wrapper = AbstractMail::getWrapper( account ); 236 wrapper = AbstractMail::getWrapper( account );
233 //FIXME 237 //FIXME
234 SETPIX(PIXMAP_POP3FOLDER); 238 SETPIX(PIXMAP_POP3FOLDER);
235#if 0 239#if 0
236 if (!account->getOffline()) 240 if (!account->getOffline())
237 { 241 {
238 setPixmap( 0, ); 242 setPixmap( 0, );
239 } 243 }
240 else 244 else
241 { 245 {
242 setPixmap( 0, PIXMAP_OFFLINE ); 246 setPixmap( 0, PIXMAP_OFFLINE );
243 } 247 }
244#endif 248#endif
245 setText( 0, account->getAccountName() ); 249 setText( 0, account->getAccountName() );
246 setOpen( true ); 250 setOpen( true );
247} 251}
248 252
249NNTPviewItem::~NNTPviewItem() 253NNTPviewItem::~NNTPviewItem()
250{ 254{
251 delete wrapper; 255 delete wrapper;
252} 256}
253 257
254AbstractMail *NNTPviewItem::getWrapper() 258AbstractMail *NNTPviewItem::getWrapper()
255{ 259{
256 return wrapper; 260 return wrapper;
257} 261}
258 262
259void NNTPviewItem::refresh( QValueList<RecMailP> & ) 263void NNTPviewItem::refresh( QValueList<RecMailP> & )
260{ 264{
261 refresh(); 265 refresh();
262} 266}
263 267
264void NNTPviewItem::refresh() 268void NNTPviewItem::refresh()
265{ 269{
266 if (account->getOffline()) return; 270 if (account->getOffline()) return;
267 QValueList<FolderP> *folders = wrapper->listFolders(); 271 QValueList<FolderP> *folders = wrapper->listFolders();
268 272
269 QListViewItem *child = firstChild(); 273 QListViewItem *child = firstChild();
270 while ( child ) 274 while ( child )
271 { 275 {
272 QListViewItem *tmp = child; 276 QListViewItem *tmp = child;
273 child = child->nextSibling(); 277 child = child->nextSibling();
274 delete tmp; 278 delete tmp;
275 } 279 }
276 QValueList<FolderP>::ConstIterator it; 280 QValueList<FolderP>::ConstIterator it;
277 QListViewItem*item = 0; 281 QListViewItem*item = 0;
278 for ( it = folders->begin(); it!=folders->end(); ++it) 282 for ( it = folders->begin(); it!=folders->end(); ++it)
279 { 283 {
280 item = new NNTPfolderItem( (*it), this , item ); 284 item = new NNTPfolderItem( (*it), this , item );
281 item->setSelectable( (*it)->may_select()); 285 item->setSelectable( (*it)->may_select());
282 } 286 }
283 delete folders; 287 delete folders;
284} 288}
285 289
286RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) 290RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
287{ 291{
288 292
289 return wrapper->fetchBody( mail ); 293 return wrapper->fetchBody( mail );
290} 294}
291 295
292QPopupMenu * NNTPviewItem::getContextMenu() 296QPopupMenu * NNTPviewItem::getContextMenu()
293{ 297{
294 QPopupMenu *m = new QPopupMenu(0); 298 QPopupMenu *m = new QPopupMenu(0);
295 if (m) 299 if (m)
296 { 300 {
297 if (!account->getOffline()) 301 if (!account->getOffline())
298 { 302 {
299 m->insertItem(QObject::tr("Disconnect",contextName),0); 303 m->insertItem(QObject::tr("Disconnect",contextName),0);
300 m->insertItem(QObject::tr("Set offline",contextName),1); 304 m->insertItem(QObject::tr("Set offline",contextName),1);
301 m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); 305 m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2);
302 } 306 }
303 else 307 else
304 { 308 {
305 m->insertItem(QObject::tr("Set online",contextName),1); 309 m->insertItem(QObject::tr("Set online",contextName),1);
306 } 310 }
307 } 311 }
308 return m; 312 return m;
309} 313}
310 314
311void NNTPviewItem::subscribeGroups() 315void NNTPviewItem::subscribeGroups()
312{ 316{
313 NNTPGroupsDlg dlg(account); 317 NNTPGroupsDlg dlg(account);
314 dlg.showMaximized(); 318 dlg.showMaximized();
315 if ( dlg.exec()== QDialog::Accepted ){ 319 if ( dlg.exec()== QDialog::Accepted ){
316 refresh(); 320 refresh();
317 } 321 }
318} 322}
319 323
320void NNTPviewItem::disconnect() 324void NNTPviewItem::disconnect()
321{ 325{
322 QListViewItem *child = firstChild(); 326 QListViewItem *child = firstChild();
323 while ( child ) 327 while ( child )
324 { 328 {
325 QListViewItem *tmp = child; 329 QListViewItem *tmp = child;
326 child = child->nextSibling(); 330 child = child->nextSibling();
327 delete tmp; 331 delete tmp;
328 } 332 }
329 wrapper->logout(); 333 wrapper->logout();
330} 334}
331 335
332void NNTPviewItem::setOnOffline() 336void NNTPviewItem::setOnOffline()
333{ 337{
334 if (!account->getOffline()) 338 if (!account->getOffline())
335 { 339 {
336 disconnect(); 340 disconnect();
337 } 341 }
338 account->setOffline(!account->getOffline()); 342 account->setOffline(!account->getOffline());
339 account->save(); 343 account->save();
340 //FIXME 344 //FIXME
341 SETPIX(PIXMAP_POP3FOLDER); 345 SETPIX(PIXMAP_POP3FOLDER);
342 refresh(); 346 refresh();
343} 347}
344 348
345void NNTPviewItem::contextMenuSelected(int which) 349void NNTPviewItem::contextMenuSelected(int which)
346{ 350{
347 switch (which) 351 switch (which)
348 { 352 {
349 case 0: 353 case 0:
350 disconnect(); 354 disconnect();
351 break; 355 break;
352 case 1: 356 case 1:
353 setOnOffline(); 357 setOnOffline();
354 break; 358 break;
355 case 2: 359 case 2:
356 subscribeGroups(); 360 subscribeGroups();
357 break; 361 break;
358 } 362 }
359} 363}
360 364
361NNTPfolderItem::~NNTPfolderItem() 365NNTPfolderItem::~NNTPfolderItem()
362{} 366{}
363 367
364NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) 368NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after )
365 : AccountViewItem( folderInit, parent,after ) 369 : AccountViewItem( folderInit, parent,after )
366{ 370{
367 nntp = parent; 371 nntp = parent;
368 if (folder->getDisplayName().lower()!="inbox") 372 if (folder->getDisplayName().lower()!="inbox")
369 { 373 {
370 setPixmap( 0, PIXMAP_POP3FOLDER ); 374 setPixmap( 0, PIXMAP_POP3FOLDER );
371 } 375 }
372 else 376 else
373 { 377 {
374 setPixmap( 0, PIXMAP_INBOXFOLDER); 378 setPixmap( 0, PIXMAP_INBOXFOLDER);
375 } 379 }
376 setText( 0, folder->getDisplayName() ); 380 setText( 0, folder->getDisplayName() );
377} 381}
378 382
379void NNTPfolderItem::refresh(QValueList<RecMailP>&target) 383void NNTPfolderItem::refresh(QValueList<RecMailP>&target)
380{ 384{
381 if (folder->may_select()) 385 if (folder->may_select())
382 nntp->getWrapper()->listMessages( folder->getName(),target ); 386 nntp->getWrapper()->listMessages( folder->getName(),target );
383} 387}
384 388
385RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) 389RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail)
386{ 390{
387 return nntp->getWrapper()->fetchBody(aMail); 391 return nntp->getWrapper()->fetchBody(aMail);
388} 392}
389 393
390QPopupMenu * NNTPfolderItem::getContextMenu() 394QPopupMenu * NNTPfolderItem::getContextMenu()
391{ 395{
392 QPopupMenu *m = new QPopupMenu(0); 396 QPopupMenu *m = new QPopupMenu(0);
393 if (m) 397 if (m)
394 { 398 {
395 m->insertItem(QObject::tr("Refresh header list",contextName),0); 399 m->insertItem(QObject::tr("Refresh header list",contextName),0);
396 m->insertItem(QObject::tr("Copy all postings",contextName),1); 400 m->insertItem(QObject::tr("Copy all postings",contextName),1);
397 } 401 }
398 return m; 402 return m;
399} 403}
400 404
401void NNTPfolderItem::downloadMails() 405void NNTPfolderItem::downloadMails()
402{ 406{
403 AccountView*bl = nntp->accountView(); 407 AccountView*bl = nntp->accountView();
404 if (!bl) return; 408 if (!bl) return;
405 bl->downloadMails(folder,nntp->getWrapper()); 409 bl->downloadMails(folder,nntp->getWrapper());
406} 410}
407 411
408void NNTPfolderItem::contextMenuSelected(int which) 412void NNTPfolderItem::contextMenuSelected(int which)
409{ 413{
410 AccountView * view = (AccountView*)listView(); 414 AccountView * view = (AccountView*)listView();
411 switch (which) 415 switch (which)
412 { 416 {
413 case 0: 417 case 0:
414 /* must be 'cause pop3 lists are cached */ 418 /* must be 'cause pop3 lists are cached */
415 nntp->getWrapper()->logout(); 419 nntp->getWrapper()->logout();
416 view->refreshCurrent(); 420 view->refreshCurrent();
417 break; 421 break;
418 case 1: 422 case 1:
419 downloadMails(); 423 downloadMails();
420 break; 424 break;
421 default: 425 default:
422 break; 426 break;
423 } 427 }
424} 428}
425 429
426/** 430/**
427 * IMAP Account stuff 431 * IMAP Account stuff
428 */ 432 */
429IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) 433IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
430 : AccountViewItem( parent ) 434 : AccountViewItem( parent )
431{ 435{
432 account = a; 436 account = a;
433 wrapper = AbstractMail::getWrapper( account ); 437 wrapper = AbstractMail::getWrapper( account );
434 SETPIX(PIXMAP_IMAPFOLDER); 438 SETPIX(PIXMAP_IMAPFOLDER);
435 setText( 0, account->getAccountName() ); 439 setText( 0, account->getAccountName() );
436 setOpen( true ); 440 setOpen( true );
437} 441}
438 442
439IMAPviewItem::~IMAPviewItem() 443IMAPviewItem::~IMAPviewItem()
440{ 444{
441 delete wrapper; 445 delete wrapper;
442} 446}
443 447
444AbstractMail *IMAPviewItem::getWrapper() 448AbstractMail *IMAPviewItem::getWrapper()
445{ 449{
446 return wrapper; 450 return wrapper;
447} 451}
448 452
449void IMAPviewItem::refresh(QValueList<RecMailP>&) 453void IMAPviewItem::refresh(QValueList<RecMailP>&)
450{ 454{
451 refreshFolders(false); 455 refreshFolders(false);
452} 456}
453 457
454const QStringList&IMAPviewItem::subFolders() 458const QStringList&IMAPviewItem::subFolders()
455{ 459{
456 return currentFolders; 460 return currentFolders;
457} 461}
458 462
459void IMAPviewItem::refreshFolders(bool force) 463void IMAPviewItem::refreshFolders(bool force)
460{ 464{
461 if (childCount()>0 && force==false) return; 465 if (childCount()>0 && force==false) return;
462 if (account->getOffline()) return; 466 if (account->getOffline()) return;
463 467
464 removeChilds(); 468 removeChilds();
465 currentFolders.clear(); 469 currentFolders.clear();
466 QValueList<FolderP> * folders = wrapper->listFolders(); 470 QValueList<FolderP> * folders = wrapper->listFolders();
467 471
468 QValueList<FolderP>::Iterator it; 472 QValueList<FolderP>::Iterator it;
469 QListViewItem*item = 0; 473 QListViewItem*item = 0;
470 QListViewItem*titem = 0; 474 QListViewItem*titem = 0;
471 QString fname,del,search; 475 QString fname,del,search;
472 int pos; 476 int pos;
473 477
474 for ( it = folders->begin(); it!=folders->end(); ++it) 478 for ( it = folders->begin(); it!=folders->end(); ++it)
475 { 479 {
476 if ((*it)->getDisplayName().lower()=="inbox") 480 if ((*it)->getDisplayName().lower()=="inbox")
477 { 481 {
478 item = new IMAPfolderItem( (*it), this , item ); 482 item = new IMAPfolderItem( (*it), this , item );
479 folders->remove(it); 483 folders->remove(it);
480 break; 484 break;
481 } 485 }
482 } 486 }
483 for ( it = folders->begin(); it!=folders->end(); ++it) 487 for ( it = folders->begin(); it!=folders->end(); ++it)
484 { 488 {
485 fname = (*it)->getDisplayName(); 489 fname = (*it)->getDisplayName();
486 currentFolders.append((*it)->getName()); 490 currentFolders.append((*it)->getName());
487 pos = fname.findRev((*it)->Separator()); 491 pos = fname.findRev((*it)->Separator());
488 if (pos != -1) 492 if (pos != -1)
489 { 493 {
490 fname = fname.left(pos); 494 fname = fname.left(pos);
491 } 495 }
492 IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); 496 IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname);
493 if (pitem) 497 if (pitem)
494 { 498 {
495 titem = item; 499 titem = item;
496 item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); 500 item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this);
497 /* setup the short name */ 501 /* setup the short name */
498 item->setText(0,(*it)->getDisplayName().mid(pos+1)); 502 item->setText(0,(*it)->getDisplayName().mid(pos+1));
499 item = titem; 503 item = titem;
500 } 504 }
501 else 505 else
502 { 506 {
503 item = new IMAPfolderItem( (*it), this , item ); 507 item = new IMAPfolderItem( (*it), this , item );
504 } 508 }
505 } 509 }
506 delete folders; 510 delete folders;
507} 511}
508 512
509QPopupMenu * IMAPviewItem::getContextMenu() 513QPopupMenu * IMAPviewItem::getContextMenu()
510{ 514{
511 QPopupMenu *m = new QPopupMenu(0); 515 QPopupMenu *m = new QPopupMenu(0);
512 if (m) 516 if (m)
513 { 517 {
514 if (!account->getOffline()) 518 if (!account->getOffline())
515 { 519 {
520 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
516 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 521 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
517 m->insertItem(QObject::tr("Create new folder",contextName),1); 522 m->insertItem(QObject::tr("Create new folder",contextName),1);
518 m->insertSeparator(); 523 m->insertSeparator();
519 m->insertItem(QObject::tr("Disconnect",contextName),2); 524 m->insertItem(QObject::tr("Disconnect",contextName),2);
520 m->insertItem(QObject::tr("Set offline",contextName),3); 525 m->insertItem(QObject::tr("Set offline",contextName),3);
521 m->insertSeparator(); 526 m->insertSeparator();
522 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
523 } 527 }
524 else 528 else
525 { 529 {
526 m->insertItem(QObject::tr("Set online",contextName),3);
527 m->insertSeparator();
528 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); 530 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
531 m->insertItem(QObject::tr("Set online",contextName),3);
529 } 532 }
530 } 533 }
531 return m; 534 return m;
532} 535}
533 536
534void IMAPviewItem::createNewFolder() 537void IMAPviewItem::createNewFolder()
535{ 538{
536 Newmdirdlg ndirdlg; 539 Newmdirdlg ndirdlg;
537 540
538 ndirdlg.showMaximized(); 541 ndirdlg.showMaximized();
539 if ( ndirdlg.exec() ) 542 if ( ndirdlg.exec() )
540 { 543 {
541 QString ndir = ndirdlg.Newdir(); 544 QString ndir = ndirdlg.Newdir();
542 bool makesubs = ndirdlg.subpossible(); 545 bool makesubs = ndirdlg.subpossible();
543 QString delemiter = "/"; 546 QString delemiter = "/";
544 IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); 547 IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
545 if (item) 548 if (item)
546 { 549 {
547 delemiter = item->Delemiter(); 550 delemiter = item->Delemiter();
548 } 551 }
549 if (wrapper->createMbox(ndir,0,delemiter,makesubs)) 552 if (wrapper->createMbox(ndir,0,delemiter,makesubs))
550 { 553 {
551 refreshFolders(true); 554 refreshFolders(true);
552 } 555 }
553 } 556 }
554} 557}
555 558
556void IMAPviewItem::contextMenuSelected(int id) 559void IMAPviewItem::contextMenuSelected(int id)
557{ 560{
558 561
559 switch (id) 562 switch (id)
560 { 563 {
561 case 0: 564 case 0:
562 refreshFolders(true); 565 refreshFolders(true);
563 break; 566 break;
564 case 1: 567 case 1:
565 createNewFolder(); 568 createNewFolder();
566 break; 569 break;
567 case 2: 570 case 2:
568 removeChilds(); 571 removeChilds();
569 wrapper->logout(); 572 wrapper->logout();
570 break; 573 break;
571 case 3: 574 case 3:
572 if (account->getOffline()==false) 575 if (account->getOffline()==false)
573 { 576 {
574 removeChilds(); 577 removeChilds();
575 wrapper->logout(); 578 wrapper->logout();
576 } 579 }
577 account->setOffline(!account->getOffline()); 580 account->setOffline(!account->getOffline());
578 account->save(); 581 account->save();
579 SETPIX(PIXMAP_IMAPFOLDER); 582 SETPIX(PIXMAP_IMAPFOLDER);
580 refreshFolders(false); 583 refreshFolders(false);
581 break; 584 break;
582 case GET_NEW_MAILS: // daunlood 585 case GET_NEW_MAILS: // daunlood
583 { 586 {
584 if (account->getOffline()) { 587 if (account->getOffline()) {
585 contextMenuSelected( 3 ); 588 contextMenuSelected( 3 );
586 } 589 }
587 AccountView*bl = accountView(); 590 AccountView*bl = accountView();
588 if (!bl) return; 591 if (!bl) return;
589 AccountViewItem* in = findSubItem( "inbox" , 0); 592 AccountViewItem* in = findSubItem( "inbox" , 0);
590 if ( ! in ) 593 if ( ! in )
591 return; 594 return;
592 bl->downloadMailsInbox(in->getFolder(),getWrapper()); 595 bl->downloadMailsInbox(in->getFolder(),getWrapper());
593 } 596 }
594 break; 597 break;
595 default: 598 default:
596 break; 599 break;
597 } 600 }
598} 601}
599 602
600RECBODYP IMAPviewItem::fetchBody(const RecMailP&) 603RECBODYP IMAPviewItem::fetchBody(const RecMailP&)
601{ 604{
602 return new RecBody(); 605 return new RecBody();
603} 606}
604 607
605bool IMAPviewItem::offline() 608bool IMAPviewItem::offline()
606{ 609{
607 return account->getOffline(); 610 return account->getOffline();
608} 611}
609 612
610IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) 613IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after )
611 : AccountViewItem( folderInit, parent , after ) 614 : AccountViewItem( folderInit, parent , after )
612{ 615{
613 imap = parent; 616 imap = parent;
614 if (folder->getDisplayName().lower()!="inbox") 617 if (folder->getDisplayName().lower()!="inbox")
615 { 618 {
616 setPixmap( 0, PIXMAP_IMAPFOLDER ); 619 setPixmap( 0, PIXMAP_IMAPFOLDER );
617 } 620 }
618 else 621 else
619 { 622 {
620 setPixmap( 0, PIXMAP_INBOXFOLDER); 623 setPixmap( 0, PIXMAP_INBOXFOLDER);
621 } 624 }
622 setText( 0, folder->getDisplayName() ); 625 setText( 0, folder->getDisplayName() );
623} 626}
624 627
625IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) 628IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master )
626 : AccountViewItem(folderInit, parent,after ) 629 : AccountViewItem(folderInit, parent,after )
627{ 630{
628 imap = master; 631 imap = master;
629 if (folder->getDisplayName().lower()!="inbox") 632 if (folder->getDisplayName().lower()!="inbox")
630 { 633 {
631 setPixmap( 0, PIXMAP_IMAPFOLDER ); 634 setPixmap( 0, PIXMAP_IMAPFOLDER );
632 } 635 }
633 else 636 else
634 { 637 {
635 setPixmap( 0, PIXMAP_INBOXFOLDER); 638 setPixmap( 0, PIXMAP_INBOXFOLDER);
636 } 639 }
637 setText( 0, folder->getDisplayName() ); 640 setText( 0, folder->getDisplayName() );
638} 641}
639 642
640IMAPfolderItem::~IMAPfolderItem() 643IMAPfolderItem::~IMAPfolderItem()
641{} 644{}
642 645
643const QString& IMAPfolderItem::Delemiter()const 646const QString& IMAPfolderItem::Delemiter()const
644{ 647{
645 return folder->Separator(); 648 return folder->Separator();
646} 649}
647 650
648void IMAPfolderItem::refresh(QValueList<RecMailP>&target) 651void IMAPfolderItem::refresh(QValueList<RecMailP>&target)
649{ 652{
650 if (folder->may_select()) 653 if (folder->may_select())
651 { 654 {
652 imap->getWrapper()->listMessages( folder->getName(),target ); 655 imap->getWrapper()->listMessages( folder->getName(),target );
653 } 656 }
654 else 657 else
655 { 658 {
656 target.clear(); 659 target.clear();
657 } 660 }
658} 661}
659 662
660RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) 663RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail)
661{ 664{
662 return imap->getWrapper()->fetchBody(aMail); 665 return imap->getWrapper()->fetchBody(aMail);
663} 666}
664 667
665QPopupMenu * IMAPfolderItem::getContextMenu() 668QPopupMenu * IMAPfolderItem::getContextMenu()
666{ 669{
667 QPopupMenu *m = new QPopupMenu(0); 670 QPopupMenu *m = new QPopupMenu(0);
668 if (m) 671 if (m)
669 { 672 {
670 if (folder->may_select()) 673 if (folder->may_select())
671 { 674 {
675 m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
672 m->insertItem(QObject::tr("Refresh header list",contextName),0); 676 m->insertItem(QObject::tr("Refresh header list",contextName),0);
673 m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); 677 m->insertItem(QObject::tr("Move/Copie all mails",contextName),4);
674 m->insertItem(QObject::tr("Delete all mails",contextName),1); 678 m->insertItem(QObject::tr("Delete all mails",contextName),1);
675 } 679 }
676 if (folder->no_inferior()==false) 680 if (folder->no_inferior()==false)
677 { 681 {
678 m->insertItem(QObject::tr("Create new subfolder",contextName),2); 682 m->insertItem(QObject::tr("Create new subfolder",contextName),2);
679 } 683 }
680 if (folder->getDisplayName().lower()!="inbox") 684 if (folder->getDisplayName().lower()!="inbox")
681 { 685 {
682 m->insertItem(QObject::tr("Delete folder",contextName),3); 686 m->insertItem(QObject::tr("Delete folder",contextName),3);
683 } 687 }
684 } 688 }
685 return m; 689 return m;
686} 690}
687 691
688void IMAPfolderItem::createNewFolder() 692void IMAPfolderItem::createNewFolder()
689{ 693{
690 Newmdirdlg ndirdlg; 694 Newmdirdlg ndirdlg;
691 ndirdlg.showMaximized(); 695 ndirdlg.showMaximized();
692 if ( ndirdlg.exec() ) 696 if ( ndirdlg.exec() )
693 { 697 {
694 QString ndir = ndirdlg.Newdir(); 698 QString ndir = ndirdlg.Newdir();
695 bool makesubs = ndirdlg.subpossible(); 699 bool makesubs = ndirdlg.subpossible();
696 QString delemiter = Delemiter(); 700 QString delemiter = Delemiter();
697 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) 701 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
698 { 702 {
699 imap->refreshFolders(true); 703 imap->refreshFolders(true);
700 } 704 }
701 } 705 }
702} 706}
703 707
704void IMAPfolderItem::deleteFolder() 708void IMAPfolderItem::deleteFolder()
705{ 709{
706 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 710 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
707 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 711 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
708 QObject::tr("Yes",contextName), 712 QObject::tr("Yes",contextName),
709 QObject::tr("No",contextName),QString::null,1,1); 713 QObject::tr("No",contextName),QString::null,1,1);
710 714
711 if (yesno == 0) 715 if (yesno == 0)
712 { 716 {
713 if (imap->getWrapper()->deleteMbox(folder)) 717 if (imap->getWrapper()->deleteMbox(folder))
714 { 718 {
715 QListView*v=listView(); 719 QListView*v=listView();
716 IMAPviewItem * box = imap; 720 IMAPviewItem * box = imap;
717 /* be carefull - after that this object is destroyd so don't use 721 /* be carefull - after that this object is destroyd so don't use
718 * any member of it after that call!!*/ 722 * any member of it after that call!!*/
719 imap->refreshFolders(true); 723 imap->refreshFolders(true);
720 if (v) 724 if (v)
721 { 725 {
722 v->setSelected(box,true); 726 v->setSelected(box,true);
723 } 727 }
724 } 728 }
725 } 729 }
726} 730}
727 731
728void IMAPfolderItem::downloadMails() 732void IMAPfolderItem::downloadMails()
729{ 733{
730 AccountView*bl = imap->accountView(); 734 AccountView*bl = imap->accountView();
731 if (!bl) return; 735 if (!bl) return;
732 bl->downloadMails(folder,imap->getWrapper()); 736 bl->downloadMails(folder,imap->getWrapper());
733} 737}
734 738
735void IMAPfolderItem::contextMenuSelected(int id) 739void IMAPfolderItem::contextMenuSelected(int id)
736{ 740{
737 741
738 AccountView * view = (AccountView*)listView(); 742 AccountView * view = (AccountView*)listView();
739 switch(id) 743 switch(id)
740 { 744 {
741 case 0: 745 case 0:
742 view->refreshCurrent(); 746 view->refreshCurrent();
743 break; 747 break;
744 case 1: 748 case 1:
745 deleteAllMail(imap->getWrapper(),folder); 749 deleteAllMail(imap->getWrapper(),folder);
746 break; 750 break;
747 case 2: 751 case 2:
748 createNewFolder(); 752 createNewFolder();
749 break; 753 break;
750 case 3: 754 case 3:
751 deleteFolder(); 755 deleteFolder();
752 break; 756 break;
753 case 4: 757 case 4:
754 downloadMails(); 758 downloadMails();
755 break; 759 break;
760 case GET_NEW_MAILS: // daunlood
761 {
762 AccountView*bl = accountView();
763 if (!bl) return;
764 bl->downloadMailsInbox(getFolder(),imap->getWrapper());
765 }
766 break;
756 default: 767 default:
757 break; 768 break;
758 } 769 }
759} 770}
760 771
761/** 772/**
762 * MH Account stuff 773 * MH Account stuff
763 */ 774 */
764/* MH is a little bit different - the top folder can contains messages other than in IMAP and 775/* MH is a little bit different - the top folder can contains messages other than in IMAP and
765 POP3 and MBOX */ 776 POP3 and MBOX */
766MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) 777MHviewItem::MHviewItem( const QString&aPath, AccountView *parent )
767 : AccountViewItem( parent ) 778 : AccountViewItem( parent )
768{ 779{
769 m_Path = aPath; 780 m_Path = aPath;
770 /* be carefull - the space within settext is wanted - thats why the string twice */ 781 /* be carefull - the space within settext is wanted - thats why the string twice */
771 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); 782 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders");
772 setPixmap( 0, PIXMAP_LOCALFOLDER ); 783 setPixmap( 0, PIXMAP_LOCALFOLDER );
773 setText( 0, " Local Folders" ); 784 setText( 0, " Local Folders" );
774 setOpen( true ); 785 setOpen( true );
775 folder = 0; 786 folder = 0;
776} 787}
777 788
778MHviewItem::~MHviewItem() 789MHviewItem::~MHviewItem()
779{ 790{
780 delete wrapper; 791 delete wrapper;
781} 792}
782 793
783AbstractMail *MHviewItem::getWrapper() 794AbstractMail *MHviewItem::getWrapper()
784{ 795{
785 return wrapper; 796 return wrapper;
786} 797}
787 798
788void MHviewItem::refresh( QValueList<RecMailP> & target) 799void MHviewItem::refresh( QValueList<RecMailP> & target)
789{ 800{
790 refresh(false); 801 refresh(false);
791 getWrapper()->listMessages( "",target ); 802 getWrapper()->listMessages( "",target );
792} 803}
793 804
794void MHviewItem::refresh(bool force) 805void MHviewItem::refresh(bool force)
795{ 806{
796 if (childCount()>0 && force==false) return; 807 if (childCount()>0 && force==false) return;
797 removeChilds(); 808 removeChilds();
798 currentFolders.clear(); 809 currentFolders.clear();
799 QValueList<FolderP> *folders = wrapper->listFolders(); 810 QValueList<FolderP> *folders = wrapper->listFolders();
800 QValueList<FolderP>::ConstIterator it; 811 QValueList<FolderP>::ConstIterator it;
801 MHfolderItem*item = 0; 812 MHfolderItem*item = 0;
802 MHfolderItem*pmaster = 0; 813 MHfolderItem*pmaster = 0;
803 QString fname = ""; 814 QString fname = "";
804 int pos; 815 int pos;
805 for ( it = folders->begin(); it!=folders->end(); ++it) 816 for ( it = folders->begin(); it!=folders->end(); ++it)
806 { 817 {
807 fname = (*it)->getDisplayName(); 818 fname = (*it)->getDisplayName();
808 /* this folder itself */ 819 /* this folder itself */
809 if (fname=="/") 820 if (fname=="/")
810 { 821 {
811 currentFolders.append(fname); 822 currentFolders.append(fname);
812 folder = (*it); 823 folder = (*it);
813 continue; 824 continue;
814 } 825 }
815 currentFolders.append(fname); 826 currentFolders.append(fname);
816 pos = fname.findRev("/"); 827 pos = fname.findRev("/");
817 if (pos > 0) 828 if (pos > 0)
818 { 829 {
819 fname = fname.left(pos); 830 fname = fname.left(pos);
820 pmaster = (MHfolderItem*)findSubItem(fname); 831 pmaster = (MHfolderItem*)findSubItem(fname);
821 } 832 }
822 else 833 else
823 { 834 {
824 pmaster = 0; 835 pmaster = 0;
825 } 836 }
826 if (pmaster) 837 if (pmaster)
827 { 838 {
828 item = new MHfolderItem( (*it), pmaster, item, this ); 839 item = new MHfolderItem( (*it), pmaster, item, this );
829 } 840 }
830 else 841 else
831 { 842 {
832 item = new MHfolderItem( (*it), this , item ); 843 item = new MHfolderItem( (*it), this , item );
833 } 844 }
834 item->setSelectable((*it)->may_select()); 845 item->setSelectable((*it)->may_select());
835 } 846 }
836 delete folders; 847 delete folders;
837} 848}
838 849
839RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) 850RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
840{ 851{
841 852
842 return wrapper->fetchBody( mail ); 853 return wrapper->fetchBody( mail );
843} 854}
844 855
845QPopupMenu * MHviewItem::getContextMenu() 856QPopupMenu * MHviewItem::getContextMenu()
846{ 857{
847 QPopupMenu *m = new QPopupMenu(0); 858 QPopupMenu *m = new QPopupMenu(0);
848 if (m) 859 if (m)
849 { 860 {
850 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 861 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
851 m->insertItem(QObject::tr("Create new folder",contextName),1); 862 m->insertItem(QObject::tr("Create new folder",contextName),1);
852 m->insertItem(QObject::tr("Delete all mails",contextName),2); 863 m->insertItem(QObject::tr("Delete all mails",contextName),2);
853 m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); 864 m->insertItem(QObject::tr("Move/Copie all mails",contextName),3);
854 } 865 }
855 return m; 866 return m;
856} 867}
857 868
858void MHviewItem::createFolder() 869void MHviewItem::createFolder()
859{ 870{
860 Newmdirdlg ndirdlg(0,0,true); 871 Newmdirdlg ndirdlg(0,0,true);
861 ndirdlg.showMaximized(); 872 ndirdlg.showMaximized();
862 if ( ndirdlg.exec() ) 873 if ( ndirdlg.exec() )
863 { 874 {
864 QString ndir = ndirdlg.Newdir(); 875 QString ndir = ndirdlg.Newdir();
865 if (wrapper->createMbox(ndir)) 876 if (wrapper->createMbox(ndir))
866 { 877 {
867 refresh(true); 878 refresh(true);
868 } 879 }
869 } 880 }
870} 881}
871 882
872void MHviewItem::downloadMails() 883void MHviewItem::downloadMails()
873{ 884{
874 AccountView*bl = accountView(); 885 AccountView*bl = accountView();
875 if (!bl) return; 886 if (!bl) return;
876 bl->downloadMails(folder,getWrapper()); 887 bl->downloadMails(folder,getWrapper());
877} 888}
878 889
879QStringList MHviewItem::subFolders() 890QStringList MHviewItem::subFolders()
880{ 891{
881 return currentFolders; 892 return currentFolders;
882} 893}
883 894
884void MHviewItem::contextMenuSelected(int which) 895void MHviewItem::contextMenuSelected(int which)
885{ 896{
886 switch (which) 897 switch (which)
887 { 898 {
888 case 0: 899 case 0:
889 refresh(true); 900 refresh(true);
890 break; 901 break;
891 case 1: 902 case 1:
892 createFolder(); 903 createFolder();
893 break; 904 break;
894 case 2: 905 case 2:
895 deleteAllMail(getWrapper(),folder); 906 deleteAllMail(getWrapper(),folder);
896 break; 907 break;
897 case 3: 908 case 3:
898 downloadMails(); 909 downloadMails();
899 break; 910 break;
900 default: 911 default:
901 break; 912 break;
902 } 913 }
903} 914}
904 915
905MHfolderItem::~MHfolderItem() 916MHfolderItem::~MHfolderItem()
906{} 917{}
907 918
908MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) 919MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after )
909 : AccountViewItem(folderInit, parent,after ) 920 : AccountViewItem(folderInit, parent,after )
910{ 921{
911 mbox = parent; 922 mbox = parent;
912 initName(); 923 initName();
913} 924}
914 925
915MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) 926MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master)
916 : AccountViewItem(folderInit, parent,after ) 927 : AccountViewItem(folderInit, parent,after )
917{ 928{
918 folder = folderInit; 929 folder = folderInit;
919 mbox = master; 930 mbox = master;
920 initName(); 931 initName();
921} 932}
922 933
923void MHfolderItem::initName() 934void MHfolderItem::initName()
924{ 935{
925 QString bName = folder->getDisplayName(); 936 QString bName = folder->getDisplayName();
926 if (bName.startsWith("/")&&bName.length()>1) 937 if (bName.startsWith("/")&&bName.length()>1)
927 { 938 {
928 bName.replace(0,1,""); 939 bName.replace(0,1,"");
929 } 940 }
930 int pos = bName.findRev("/"); 941 int pos = bName.findRev("/");
931 if (pos > 0) 942 if (pos > 0)
932 { 943 {
933 bName.replace(0,pos+1,""); 944 bName.replace(0,pos+1,"");
934 } 945 }
935 if (bName.lower() == "outgoing") 946 if (bName.lower() == "outgoing")
936 { 947 {
937 setPixmap( 0, PIXMAP_OUTBOXFOLDER ); 948 setPixmap( 0, PIXMAP_OUTBOXFOLDER );
938 } 949 }
939 else if (bName.lower() == "inbox") 950 else if (bName.lower() == "inbox")
940 { 951 {
941 setPixmap( 0, PIXMAP_INBOXFOLDER); 952 setPixmap( 0, PIXMAP_INBOXFOLDER);
942 } else if (bName.lower() == "drafts") { 953 } else if (bName.lower() == "drafts") {
943 setPixmap(0, SmallIcon ("edit")); 954 setPixmap(0, SmallIcon ("edit"));
944 } else { 955 } else {
945 setPixmap( 0, PIXMAP_MBOXFOLDER ); 956 setPixmap( 0, PIXMAP_MBOXFOLDER );
946 } 957 }
947 setText( 0, bName ); 958 setText( 0, bName );
948} 959}
949 960
950const FolderP&MHfolderItem::getFolder()const 961const FolderP&MHfolderItem::getFolder()const
951{ 962{
952 return folder; 963 return folder;
953} 964}
954 965
955void MHfolderItem::refresh(QValueList<RecMailP>&target) 966void MHfolderItem::refresh(QValueList<RecMailP>&target)
956{ 967{
957 if (folder->may_select()) 968 if (folder->may_select())
958 mbox->getWrapper()->listMessages( folder->getName(),target ); 969 mbox->getWrapper()->listMessages( folder->getName(),target );
959} 970}
960 971
961RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) 972RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
962{ 973{
963 return mbox->getWrapper()->fetchBody(aMail); 974 return mbox->getWrapper()->fetchBody(aMail);
964} 975}
965 976
966void MHfolderItem::deleteFolder() 977void MHfolderItem::deleteFolder()
967{ 978{
968 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 979 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
969 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 980 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
970 QObject::tr("Yes",contextName), 981 QObject::tr("Yes",contextName),
971 QObject::tr("No",contextName),QString::null,1,1); 982 QObject::tr("No",contextName),QString::null,1,1);
972 983
973 if (yesno == 0) 984 if (yesno == 0)
974 { 985 {
975 if (mbox->getWrapper()->deleteMbox(folder)) 986 if (mbox->getWrapper()->deleteMbox(folder))
976 { 987 {
977 QListView*v=listView(); 988 QListView*v=listView();
978 MHviewItem * box = mbox; 989 MHviewItem * box = mbox;
979 /* be carefull - after that this object is destroyd so don't use 990 /* be carefull - after that this object is destroyd so don't use
980 * any member of it after that call!!*/ 991 * any member of it after that call!!*/
981 mbox->refresh(true); 992 mbox->refresh(true);
982 if (v) 993 if (v)
983 { 994 {
984 v->setSelected(box,true); 995 v->setSelected(box,true);
985 } 996 }
986 } 997 }
987 } 998 }
988} 999}
989 1000
990QPopupMenu * MHfolderItem::getContextMenu() 1001QPopupMenu * MHfolderItem::getContextMenu()
991{ 1002{
992 QPopupMenu *m = new QPopupMenu(0); 1003 QPopupMenu *m = new QPopupMenu(0);
993 if (m) 1004 if (m)
994 { 1005 {
995 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); 1006 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
996 m->insertItem(QObject::tr("Delete all mails",contextName),0); 1007 m->insertItem(QObject::tr("Delete all mails",contextName),0);
997 m->insertItem(QObject::tr("Create new subfolder",contextName),3); 1008 m->insertItem(QObject::tr("Create new subfolder",contextName),3);
998 m->insertItem(QObject::tr("Delete folder",contextName),1); 1009 m->insertItem(QObject::tr("Delete folder",contextName),1);
999 } 1010 }
1000 return m; 1011 return m;
1001} 1012}
1002 1013
1003void MHfolderItem::downloadMails() 1014void MHfolderItem::downloadMails()
1004{ 1015{
1005 AccountView*bl = mbox->accountView(); 1016 AccountView*bl = mbox->accountView();
1006 if (!bl) return; 1017 if (!bl) return;
1007 bl->downloadMails(folder,mbox->getWrapper()); 1018 bl->downloadMails(folder,mbox->getWrapper());
1008} 1019}
1009 1020
1010void MHfolderItem::createFolder() 1021void MHfolderItem::createFolder()
1011{ 1022{
1012 Newmdirdlg ndirdlg(0,0,true); 1023 Newmdirdlg ndirdlg(0,0,true);
1013 ndirdlg.showMaximized(); 1024 ndirdlg.showMaximized();
1014 if (ndirdlg.exec() ) 1025 if (ndirdlg.exec() )
1015 { 1026 {
1016 QString ndir = ndirdlg.Newdir(); 1027 QString ndir = ndirdlg.Newdir();
1017 if (mbox->getWrapper()->createMbox(ndir,folder)) 1028 if (mbox->getWrapper()->createMbox(ndir,folder))
1018 { 1029 {
1019 QListView*v=listView(); 1030 QListView*v=listView();
1020 MHviewItem * box = mbox; 1031 MHviewItem * box = mbox;
1021 /* be carefull - after that this object is destroyd so don't use 1032 /* be carefull - after that this object is destroyd so don't use
1022 * any member of it after that call!!*/ 1033 * any member of it after that call!!*/
1023 mbox->refresh(true); 1034 mbox->refresh(true);
1024 if (v) 1035 if (v)
1025 { 1036 {
1026 v->setSelected(box,true); 1037 v->setSelected(box,true);
1027 } 1038 }
1028 } 1039 }
1029 } 1040 }
1030} 1041}
1031 1042
1032void MHfolderItem::contextMenuSelected(int which) 1043void MHfolderItem::contextMenuSelected(int which)
1033{ 1044{
1034 switch(which) 1045 switch(which)
1035 { 1046 {
1036 case 0: 1047 case 0:
1037 deleteAllMail(mbox->getWrapper(),folder); 1048 deleteAllMail(mbox->getWrapper(),folder);
1038 break; 1049 break;
1039 case 1: 1050 case 1:
1040 deleteFolder(); 1051 deleteFolder();
1041 break; 1052 break;
1042 case 2: 1053 case 2:
1043 downloadMails(); 1054 downloadMails();
1044 break; 1055 break;
1045 case 3: 1056 case 3:
1046 createFolder(); 1057 createFolder();
1047 break; 1058 break;
1048 default: 1059 default:
1049 break; 1060 break;
1050 } 1061 }
1051} 1062}
1052 1063
1053bool MHfolderItem::isDraftfolder() 1064bool MHfolderItem::isDraftfolder()
1054{ 1065{
1055 if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; 1066 if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true;
1056 return false; 1067 return false;
1057} 1068}
1058 1069
1059/** 1070/**
1060 * Generic stuff 1071 * Generic stuff
1061 */ 1072 */
1062 1073
1063const QString AccountViewItem::contextName="AccountViewItem"; 1074const QString AccountViewItem::contextName="AccountViewItem";
1064 1075
1065AccountViewItem::AccountViewItem( AccountView *parent ) 1076AccountViewItem::AccountViewItem( AccountView *parent )
1066 : QListViewItem( parent ) 1077 : QListViewItem( parent )
1067{ 1078{
1068 init(); 1079 init();
1069 m_Backlink = parent; 1080 m_Backlink = parent;
1070} 1081}
1071 1082
1072AccountViewItem::AccountViewItem( QListViewItem *parent) 1083AccountViewItem::AccountViewItem( QListViewItem *parent)
1073 : QListViewItem( parent),folder(0) 1084 : QListViewItem( parent),folder(0)
1074{ 1085{
1075 init(); 1086 init();
1076} 1087}
1077 1088
1078AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) 1089AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
1079 :QListViewItem( parent,after ),folder(0) 1090 :QListViewItem( parent,after ),folder(0)
1080{ 1091{
1081 init(); 1092 init();
1082} 1093}
1083 1094
1084AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) 1095AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after )
1085 :QListViewItem( parent,after ),folder(folderInit) 1096 :QListViewItem( parent,after ),folder(folderInit)
1086{ 1097{
1087 init(); 1098 init();
1088} 1099}
1089 1100
1090void AccountViewItem::init() 1101void AccountViewItem::init()
1091{ 1102{
1092 m_Backlink = 0; 1103 m_Backlink = 0;
1093} 1104}
1094 1105
1095AccountViewItem::~AccountViewItem() 1106AccountViewItem::~AccountViewItem()
1096{ 1107{
1097 folder = 0; 1108 folder = 0;
1098} 1109}
1099 1110
1100AccountView*AccountViewItem::accountView() 1111AccountView*AccountViewItem::accountView()
1101{ 1112{
1102 return m_Backlink; 1113 return m_Backlink;
1103} 1114}
1104 1115
1105void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) 1116void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
1106{ 1117{
1107 if (!wrapper) return; 1118 if (!wrapper) return;
1108 QString fname=""; 1119 QString fname="";
1109 if (folder) fname = folder->getDisplayName(); 1120 if (folder) fname = folder->getDisplayName();
1110 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), 1121 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
1111 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). 1122 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).
1112 arg(fname), 1123 arg(fname),
1113 QObject::tr("Yes",contextName), 1124 QObject::tr("Yes",contextName),
1114 QObject::tr("No",contextName),QString::null,1,1); 1125 QObject::tr("No",contextName),QString::null,1,1);
1115 1126
1116 if (yesno == 0) 1127 if (yesno == 0)
1117 { 1128 {
1118 if (wrapper->deleteAllMail(folder)) 1129 if (wrapper->deleteAllMail(folder))
1119 { 1130 {
1120 AccountView * view = (AccountView*)listView(); 1131 AccountView * view = (AccountView*)listView();
1121 if (view) view->refreshCurrent(); 1132 if (view) view->refreshCurrent();
1122 } 1133 }
1123 } 1134 }
1124} 1135}
1125 1136
1126void AccountViewItem::removeChilds() 1137void AccountViewItem::removeChilds()
1127{ 1138{
1128 QListViewItem *child = firstChild(); 1139 QListViewItem *child = firstChild();
1129 while ( child ) 1140 while ( child )
1130 { 1141 {
1131 QListViewItem *tmp = child; 1142 QListViewItem *tmp = child;
1132 child = child->nextSibling(); 1143 child = child->nextSibling();
1133 delete tmp; 1144 delete tmp;
1134 } 1145 }
1135} 1146}
1136 1147
1137bool AccountViewItem::matchName(const QString&name)const 1148bool AccountViewItem::matchName(const QString&name)const
1138{ 1149{
1139 if (!folder) return false; 1150 if (!folder) return false;
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index d43d23b..733e38a 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -157,465 +157,505 @@ void EditAccounts::slotNewAccount( const QString &type )
157 settings->addAccount( account ); 157 settings->addAccount( account );
158 account->save(); 158 account->save();
159 slotFillLists(); 159 slotFillLists();
160 } 160 }
161 else 161 else
162 { 162 {
163 account->remove(); 163 account->remove();
164 } 164 }
165 } 165 }
166} 166}
167 167
168void EditAccounts::slotEditAccount( Account *account ) 168void EditAccounts::slotEditAccount( Account *account )
169{ 169{
170 if ( account->getType() == MAILLIB::A_IMAP ) 170 if ( account->getType() == MAILLIB::A_IMAP )
171 { 171 {
172 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); 172 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
173 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); 173 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp );
174 if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) 174 if ( QDialog::Accepted == KApplication::execDialog( &imap ) )
175 { 175 {
176 slotFillLists(); 176 slotFillLists();
177 } 177 }
178 } 178 }
179 else if ( account->getType()==MAILLIB::A_POP3 ) 179 else if ( account->getType()==MAILLIB::A_POP3 )
180 { 180 {
181 POP3account *pop3Acc = static_cast<POP3account *>(account); 181 POP3account *pop3Acc = static_cast<POP3account *>(account);
182 POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); 182 POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp );
183 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) 183 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) )
184 { 184 {
185 slotFillLists(); 185 slotFillLists();
186 } 186 }
187 } 187 }
188 else if ( account->getType()==MAILLIB::A_SMTP ) 188 else if ( account->getType()==MAILLIB::A_SMTP )
189 { 189 {
190 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); 190 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account);
191 SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); 191 SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp );
192 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) 192 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) )
193 { 193 {
194 slotFillLists(); 194 slotFillLists();
195 } 195 }
196 } 196 }
197 else if ( account->getType()==MAILLIB::A_NNTP) 197 else if ( account->getType()==MAILLIB::A_NNTP)
198 { 198 {
199 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); 199 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
200 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); 200 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
201 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) 201 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) )
202 { 202 {
203 slotFillLists(); 203 slotFillLists();
204 } 204 }
205 } 205 }
206} 206}
207 207
208void EditAccounts::slotDeleteAccount( Account *account ) 208void EditAccounts::slotDeleteAccount( Account *account )
209{ 209{
210 if ( QMessageBox::information( this, tr( "Question" ), 210 if ( QMessageBox::information( this, tr( "Question" ),
211 tr( "<p>Do you really want to delete the selected Account?</p>" ), 211 tr( "<p>Do you really want to delete the selected Account?</p>" ),
212 tr( "Yes" ), tr( "No" ) ) == 0 ) 212 tr( "Yes" ), tr( "No" ) ) == 0 )
213 { 213 {
214 settings->delAccount( account ); 214 settings->delAccount( account );
215 slotFillLists(); 215 slotFillLists();
216 } 216 }
217} 217}
218 218
219void EditAccounts::slotEditMail() 219void EditAccounts::slotEditMail()
220{ 220{
221 if ( !mailList->currentItem() ) 221 if ( !mailList->currentItem() )
222 { 222 {
223 QMessageBox::information( this, tr( "Error" ), 223 QMessageBox::information( this, tr( "Error" ),
224 tr( "<p>Please select an account.</p>" ), 224 tr( "<p>Please select an account.</p>" ),
225 tr( "Ok" ) ); 225 tr( "Ok" ) );
226 return; 226 return;
227 } 227 }
228 228
229 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 229 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
230 slotEditAccount( a ); 230 slotEditAccount( a );
231} 231}
232 232
233void EditAccounts::slotDeleteMail() 233void EditAccounts::slotDeleteMail()
234{ 234{
235 if ( !mailList->currentItem() ) 235 if ( !mailList->currentItem() )
236 { 236 {
237 QMessageBox::information( this, tr( "Error" ), 237 QMessageBox::information( this, tr( "Error" ),
238 tr( "<p>Please select an account.</p>" ), 238 tr( "<p>Please select an account.</p>" ),
239 tr( "Ok" ) ); 239 tr( "Ok" ) );
240 return; 240 return;
241 } 241 }
242 242
243 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 243 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
244 slotDeleteAccount( a ); 244 slotDeleteAccount( a );
245} 245}
246 246
247void EditAccounts::slotNewNews() 247void EditAccounts::slotNewNews()
248{ 248{
249 slotNewAccount( "NNTP" ); 249 slotNewAccount( "NNTP" );
250} 250}
251 251
252void EditAccounts::slotEditNews() 252void EditAccounts::slotEditNews()
253{ 253{
254 if ( !newsList->currentItem() ) 254 if ( !newsList->currentItem() )
255 { 255 {
256 QMessageBox::information( this, tr( "Error" ), 256 QMessageBox::information( this, tr( "Error" ),
257 tr( "<p>Please select an account.</p>" ), 257 tr( "<p>Please select an account.</p>" ),
258 tr( "Ok" ) ); 258 tr( "Ok" ) );
259 return; 259 return;
260 } 260 }
261 261
262 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 262 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
263 slotEditAccount( a ); 263 slotEditAccount( a );
264} 264}
265 265
266void EditAccounts::slotDeleteNews() 266void EditAccounts::slotDeleteNews()
267{ 267{
268 if ( !newsList->currentItem() ) 268 if ( !newsList->currentItem() )
269 { 269 {
270 QMessageBox::information( this, tr( "Error" ), 270 QMessageBox::information( this, tr( "Error" ),
271 tr( "<p>Please select an account.</p>" ), 271 tr( "<p>Please select an account.</p>" ),
272 tr( "Ok" ) ); 272 tr( "Ok" ) );
273 return; 273 return;
274 } 274 }
275 275
276 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 276 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
277 slotDeleteAccount( a ); 277 slotDeleteAccount( a );
278} 278}
279 279
280void EditAccounts::slotAdjustColumns() 280void EditAccounts::slotAdjustColumns()
281{ 281{
282 int currPage = configTab->currentPageIndex(); 282 int currPage = configTab->currentPageIndex();
283 283
284 configTab->showPage( mailTab ); 284 configTab->showPage( mailTab );
285 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); 285 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
286 mailList->setColumnWidth( 1, 50 ); 286 mailList->setColumnWidth( 1, 50 );
287 287
288 configTab->showPage( newsTab ); 288 configTab->showPage( newsTab );
289 newsList->setColumnWidth( 0, newsList->visibleWidth() ); 289 newsList->setColumnWidth( 0, newsList->visibleWidth() );
290 290
291 configTab->setCurrentPage( currPage ); 291 configTab->setCurrentPage( currPage );
292} 292}
293 293
294void EditAccounts::accept() 294void EditAccounts::accept()
295{ 295{
296 settings->saveAccounts(); 296 settings->saveAccounts();
297 297
298 QDialog::accept(); 298 QDialog::accept();
299} 299}
300 300
301/** 301/**
302 * SelectMailType 302 * SelectMailType
303 */ 303 */
304 304
305SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) 305SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags )
306 : SelectMailTypeUI( parent, name, modal, flags ) 306 : SelectMailTypeUI( parent, name, modal, flags )
307{ 307{
308 selected = selection; 308 selected = selection;
309 selected->replace( 0, selected->length(), typeBox->currentText() ); 309 selected->replace( 0, selected->length(), typeBox->currentText() );
310 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); 310 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) );
311} 311}
312 312
313void SelectMailType::slotSelection( const QString &sel ) 313void SelectMailType::slotSelection( const QString &sel )
314{ 314{
315 selected->replace( 0, selected->length(), sel ); 315 selected->replace( 0, selected->length(), sel );
316} 316}
317 317
318/** 318/**
319 * IMAPconfig 319 * IMAPconfig
320 */ 320 */
321 321
322IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 322IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
323 : IMAPconfigUI( parent, name, modal, flags ) 323 : IMAPconfigUI( parent, name, modal, flags )
324{ 324{
325 data = account; 325 data = account;
326 326
327 fillValues(); 327 fillValues();
328 328
329 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 329 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
330 ComboBox1->insertItem( "Only if available", 0 ); 330 ComboBox1->insertItem( "Only if available", 0 );
331 ComboBox1->insertItem( "Always, Negotiated", 1 ); 331 ComboBox1->insertItem( "Always, Negotiated", 1 );
332 ComboBox1->insertItem( "Connect on secure port", 2 ); 332 ComboBox1->insertItem( "Connect on secure port", 2 );
333 ComboBox1->insertItem( "Run command instead", 3 ); 333 ComboBox1->insertItem( "Run command instead", 3 );
334 CommandEdit->hide(); 334 CommandEdit->hide();
335 ComboBox1->setCurrentItem( data->ConnectionType() ); 335 ComboBox1->setCurrentItem( data->ConnectionType() );
336} 336}
337 337
338void IMAPconfig::slotConnectionToggle( int index ) 338void IMAPconfig::slotConnectionToggle( int index )
339{ 339{
340 if ( index == 2 ) 340 if ( index == 2 )
341 { 341 {
342 portLine->setText( IMAP_SSL_PORT ); 342 portLine->setText( IMAP_SSL_PORT );
343 } 343 }
344 else if ( index == 3 ) 344 else if ( index == 3 )
345 { 345 {
346 portLine->setText( IMAP_PORT ); 346 portLine->setText( IMAP_PORT );
347 CommandEdit->show(); 347 CommandEdit->show();
348 } 348 }
349 else 349 else
350 { 350 {
351 portLine->setText( IMAP_PORT ); 351 portLine->setText( IMAP_PORT );
352 } 352 }
353} 353}
354 354
355void IMAPconfig::fillValues() 355void IMAPconfig::fillValues()
356{ 356{
357 accountLine->setText( data->getAccountName() ); 357 accountLine->setText( data->getAccountName() );
358 serverLine->setText( data->getServer() ); 358 serverLine->setText( data->getServer() );
359 portLine->setText( data->getPort() ); 359 portLine->setText( data->getPort() );
360 ComboBox1->setCurrentItem( data->ConnectionType() ); 360 ComboBox1->setCurrentItem( data->ConnectionType() );
361 userLine->setText( data->getUser() ); 361 userLine->setText( data->getUser() );
362 passLine->setText( data->getPassword() ); 362 passLine->setText( data->getPassword() );
363 prefixLine->setText(data->getPrefix()); 363 prefixLine->setText(data->getPrefix());
364 localFolder->setText( data->getLocalFolder() ); 364 localFolder->setText( data->getLocalFolder() );
365 int max = data->getMaxMailSize() ; 365 int max = data->getMaxMailSize() ;
366 if ( max ) { 366 if ( max ) {
367 CheckBoxDown->setChecked( true ); 367 CheckBoxDown->setChecked( true );
368 SpinBoxDown->setValue ( max ); 368 SpinBoxDown->setValue ( max );
369 } else { 369 } else {
370 CheckBoxDown->setChecked( false ); 370 CheckBoxDown->setChecked( false );
371 SpinBoxDown->setValue ( 5 ); 371 SpinBoxDown->setValue ( 5 );
372 } 372 }
373 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 373 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
374} 374}
375 375
376void IMAPconfig::accept() 376void IMAPconfig::accept()
377{ 377{
378 data->setAccountName( accountLine->text() ); 378 data->setAccountName( accountLine->text() );
379 data->setServer( serverLine->text() ); 379 data->setServer( serverLine->text() );
380 data->setPort( portLine->text() ); 380 data->setPort( portLine->text() );
381 data->setConnectionType( ComboBox1->currentItem() ); 381 data->setConnectionType( ComboBox1->currentItem() );
382 data->setUser( userLine->text() ); 382 data->setUser( userLine->text() );
383 data->setPassword( passLine->text() ); 383 data->setPassword( passLine->text() );
384 data->setPrefix(prefixLine->text()); 384 data->setPrefix(prefixLine->text());
385 data->setLocalFolder( localFolder->text() ); 385 data->setLocalFolder( localFolder->text() );
386 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 386 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
387 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 387 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
388 388
389 QDialog::accept(); 389 QDialog::accept();
390} 390}
391 391
392/** 392/**
393 * POP3config 393 * POP3config
394 */ 394 */
395 395
396POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 396POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
397 : POP3configUI( parent, name, modal, flags ) 397 : POP3configUI( parent, name, modal, flags )
398{ 398{
399 data = account; 399 data = account;
400 fillValues(); 400 fillValues();
401 401
402 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 402 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
403 ComboBox1->insertItem( "Only if available", 0 ); 403 ComboBox1->insertItem( "Only if available", 0 );
404 ComboBox1->insertItem( "Always, Negotiated", 1 ); 404 ComboBox1->insertItem( "Always, Negotiated", 1 );
405 ComboBox1->insertItem( "Connect on secure port", 2 ); 405 ComboBox1->insertItem( "Connect on secure port", 2 );
406 ComboBox1->insertItem( "Run command instead", 3 ); 406 ComboBox1->insertItem( "Run command instead", 3 );
407 CommandEdit->hide(); 407 CommandEdit->hide();
408 ComboBox1->setCurrentItem( data->ConnectionType() ); 408 ComboBox1->setCurrentItem( data->ConnectionType() );
409} 409}
410 410
411void POP3config::slotConnectionToggle( int index ) 411void POP3config::slotConnectionToggle( int index )
412{ 412{
413 // 2 is ssl connection 413 // 2 is ssl connection
414 if ( index == 2 ) 414 if ( index == 2 )
415 { 415 {
416 portLine->setText( POP3_SSL_PORT ); 416 portLine->setText( POP3_SSL_PORT );
417 } 417 }
418 else if ( index == 3 ) 418 else if ( index == 3 )
419 { 419 {
420 portLine->setText( POP3_PORT ); 420 portLine->setText( POP3_PORT );
421 CommandEdit->show(); 421 CommandEdit->show();
422 } 422 }
423 else 423 else
424 { 424 {
425 portLine->setText( POP3_PORT ); 425 portLine->setText( POP3_PORT );
426 } 426 }
427} 427}
428 428
429void POP3config::fillValues() 429void POP3config::fillValues()
430{ 430{
431 accountLine->setText( data->getAccountName() ); 431 accountLine->setText( data->getAccountName() );
432 serverLine->setText( data->getServer() ); 432 serverLine->setText( data->getServer() );
433 portLine->setText( data->getPort() ); 433 portLine->setText( data->getPort() );
434 ComboBox1->setCurrentItem( data->ConnectionType() ); 434 ComboBox1->setCurrentItem( data->ConnectionType() );
435 userLine->setText( data->getUser() ); 435 userLine->setText( data->getUser() );
436 passLine->setText( data->getPassword() ); 436 passLine->setText( data->getPassword() );
437 localFolder->setText( data->getLocalFolder() ); 437 localFolder->setText( data->getLocalFolder() );
438 int max = data->getMaxMailSize() ; 438 int max = data->getMaxMailSize() ;
439 if ( max ) { 439 if ( max ) {
440 CheckBoxDown->setChecked( true ); 440 CheckBoxDown->setChecked( true );
441 SpinBoxDown->setValue ( max ); 441 SpinBoxDown->setValue ( max );
442 } else { 442 } else {
443 CheckBoxDown->setChecked( false ); 443 CheckBoxDown->setChecked( false );
444 SpinBoxDown->setValue ( 5 ); 444 SpinBoxDown->setValue ( 5 );
445 } 445 }
446 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 446 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
447} 447}
448 448
449void POP3config::accept() 449void POP3config::accept()
450{ 450{
451 data->setAccountName( accountLine->text() ); 451 data->setAccountName( accountLine->text() );
452 data->setServer( serverLine->text() ); 452 data->setServer( serverLine->text() );
453 data->setPort( portLine->text() ); 453 data->setPort( portLine->text() );
454 data->setConnectionType( ComboBox1->currentItem() ); 454 data->setConnectionType( ComboBox1->currentItem() );
455 data->setUser( userLine->text() ); 455 data->setUser( userLine->text() );
456 data->setPassword( passLine->text() ); 456 data->setPassword( passLine->text() );
457 data->setLocalFolder( localFolder->text() ); 457 data->setLocalFolder( localFolder->text() );
458 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 458 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
459 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 459 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
460 460
461 QDialog::accept(); 461 QDialog::accept();
462} 462}
463 463
464/** 464/**
465 * SMTPconfig 465 * SMTPconfig
466 */ 466 */
467 467
468SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 468SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
469 : SMTPconfigUI( parent, name, modal, flags ) 469 : SMTPconfigUI( parent, name, modal, flags )
470{ 470{
471 data = account; 471 data = account;
472 472
473 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 473 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
474 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 474 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
475 475
476 fillValues(); 476 fillValues();
477 477
478 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 478 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
479 ComboBox1->insertItem( "Only if available", 0 ); 479 ComboBox1->insertItem( "Only if available", 0 );
480 ComboBox1->insertItem( "Always, Negotiated", 1 ); 480 ComboBox1->insertItem( "Always, Negotiated", 1 );
481 ComboBox1->insertItem( "Connect on secure port", 2 ); 481 ComboBox1->insertItem( "Connect on secure port", 2 );
482 ComboBox1->insertItem( "Run command instead", 3 ); 482 ComboBox1->insertItem( "Run command instead", 3 );
483 CommandEdit->hide(); 483 CommandEdit->hide();
484 ComboBox1->setCurrentItem( data->ConnectionType() ); 484 ComboBox1->setCurrentItem( data->ConnectionType() );
485} 485}
486 486
487void SMTPconfig::slotConnectionToggle( int index ) 487void SMTPconfig::slotConnectionToggle( int index )
488{ 488{
489 // 2 is ssl connection 489 // 2 is ssl connection
490 if ( index == 2 ) 490 if ( index == 2 )
491 { 491 {
492 portLine->setText( SMTP_SSL_PORT ); 492 portLine->setText( SMTP_SSL_PORT );
493 } 493 }
494 else if ( index == 3 ) 494 else if ( index == 3 )
495 { 495 {
496 portLine->setText( SMTP_PORT ); 496 portLine->setText( SMTP_PORT );
497 CommandEdit->show(); 497 CommandEdit->show();
498 } 498 }
499 else 499 else
500 { 500 {
501 portLine->setText( SMTP_PORT ); 501 portLine->setText( SMTP_PORT );
502 } 502 }
503} 503}
504 504
505void SMTPconfig::fillValues() 505void SMTPconfig::fillValues()
506{ 506{
507 accountLine->setText( data->getAccountName() ); 507 accountLine->setText( data->getAccountName() );
508 serverLine->setText( data->getServer() ); 508 serverLine->setText( data->getServer() );
509 portLine->setText( data->getPort() ); 509 portLine->setText( data->getPort() );
510 ComboBox1->setCurrentItem( data->ConnectionType() ); 510 ComboBox1->setCurrentItem( data->ConnectionType() );
511 loginBox->setChecked( data->getLogin() ); 511 loginBox->setChecked( data->getLogin() );
512 userLine->setText( data->getUser() ); 512 userLine->setText( data->getUser() );
513 passLine->setText( data->getPassword() ); 513 passLine->setText( data->getPassword() );
514} 514}
515 515
516void SMTPconfig::accept() 516void SMTPconfig::accept()
517{ 517{
518 data->setAccountName( accountLine->text() ); 518 data->setAccountName( accountLine->text() );
519 data->setServer( serverLine->text() ); 519 data->setServer( serverLine->text() );
520 data->setPort( portLine->text() ); 520 data->setPort( portLine->text() );
521 data->setConnectionType( ComboBox1->currentItem() ); 521 data->setConnectionType( ComboBox1->currentItem() );
522 data->setLogin( loginBox->isChecked() ); 522 data->setLogin( loginBox->isChecked() );
523 data->setUser( userLine->text() ); 523 data->setUser( userLine->text() );
524 data->setPassword( passLine->text() ); 524 data->setPassword( passLine->text() );
525 525
526 QDialog::accept(); 526 QDialog::accept();
527} 527}
528 528
529/** 529/**
530 * NNTPconfig 530 * NNTPconfig
531 */ 531 */
532 532
533NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 533NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
534 : NNTPconfigUI( parent, name, modal, flags ) 534 : NNTPconfigUI( parent, name, modal, flags )
535{ 535{
536 data = account; 536 data = account;
537 537
538 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 538 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
539 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 539 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
540 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); 540 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
541 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) );
542 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) );
541 fillValues(); 543 fillValues();
542 544
543 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); 545 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
544} 546}
545 547
548void NNTPconfig::slotShowSub()
549{
550 save();
551 data->save();
552 ListViewGroups->clear();
553 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
554 QCheckListItem *item;
555 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
556 item->setOn( true );
557 }
558 topLevelWidget()->setCaption( tr("%1 groups subscribed").arg( subscribedGroups.count()));
559}
560void NNTPconfig::slotShowFilter()
561{
562 save();
563 data->save();
564 ListViewGroups->clear();
565 int count = 0;
566 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
567 QCheckListItem *item;
568 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) {
569 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
570 ++count;
571 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
572 item->setOn( true );
573 }
574 }
575 }
576 topLevelWidget()->setCaption( tr("Filter found %1 groups").arg( count));
577}
546void NNTPconfig::slotGetNG() { 578void NNTPconfig::slotGetNG() {
547 save(); 579 save();
548 data->save(); 580 data->save();
581 topLevelWidget()->setCaption( tr("Fetching group list..."));
582 qApp->processEvents();
549 NNTPwrapper* tmp = new NNTPwrapper( data ); 583 NNTPwrapper* tmp = new NNTPwrapper( data );
550 QStringList list = tmp->listAllNewsgroups(); 584 allGroups = tmp->listAllNewsgroups();
585 topLevelWidget()->setCaption( tr("Downloaded %1 group names").arg( allGroups.count()));
551 586
552 ListViewGroups->clear(); 587 ListViewGroups->clear();
553 588
554 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 589 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
555 QCheckListItem *item; 590 QCheckListItem *item;
556 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 591 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
557 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 592 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
558 item->setOn( true ); 593 item->setOn( true );
559 } 594
595 }
560 } 596 }
597 delete tmp;
561} 598}
562 599
563void NNTPconfig::slotSSL( bool enabled ) 600void NNTPconfig::slotSSL( bool enabled )
564{ 601{
565 if ( enabled ) 602 if ( enabled )
566 { 603 {
567 portLine->setText( NNTP_SSL_PORT ); 604 portLine->setText( NNTP_SSL_PORT );
568 } 605 }
569 else 606 else
570 { 607 {
571 portLine->setText( NNTP_PORT ); 608 portLine->setText( NNTP_PORT );
572 } 609 }
573} 610}
574 611
575void NNTPconfig::fillValues() 612void NNTPconfig::fillValues()
576{ 613{
577 accountLine->setText( data->getAccountName() ); 614 accountLine->setText( data->getAccountName() );
578 serverLine->setText( data->getServer() ); 615 serverLine->setText( data->getServer() );
579 portLine->setText( data->getPort() ); 616 portLine->setText( data->getPort() );
580 sslBox->setChecked( data->getSSL() ); 617 sslBox->setChecked( data->getSSL() );
581 loginBox->setChecked( data->getLogin() ); 618 loginBox->setChecked( data->getLogin() );
582 userLine->setText( data->getUser() ); 619 userLine->setText( data->getUser() );
583 passLine->setText( data->getPassword() ); 620 passLine->setText( data->getPassword() );
584 subscribedGroups = data->getGroups(); 621 subscribedGroups = data->getGroups();
585 /* don't forget that - you will overwrite values if user clicks cancel! */ 622 /* don't forget that - you will overwrite values if user clicks cancel! */
586 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 623 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
587 QCheckListItem *item; 624 QCheckListItem *item;
588 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 625 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
589 item->setOn( true ); 626 item->setOn( true );
590 } 627 }
591} 628}
592 629
593void NNTPconfig::save() 630void NNTPconfig::save()
594{ 631{
595 data->setAccountName( accountLine->text() ); 632 data->setAccountName( accountLine->text() );
596 data->setServer( serverLine->text() ); 633 data->setServer( serverLine->text() );
597 data->setPort( portLine->text() ); 634 data->setPort( portLine->text() );
598 data->setSSL( sslBox->isChecked() ); 635 data->setSSL( sslBox->isChecked() );
599 data->setLogin( loginBox->isChecked() ); 636 data->setLogin( loginBox->isChecked() );
600 data->setUser( userLine->text() ); 637 data->setUser( userLine->text() );
601 data->setPassword( passLine->text() ); 638 data->setPassword( passLine->text() );
602 639
603 QListViewItemIterator list_it( ListViewGroups ); 640 QListViewItemIterator list_it( ListViewGroups );
604 641
605 QStringList groupList; 642 for ( ; list_it.current(); ++list_it ) {
606 for ( ; list_it.current(); ++list_it ) {
607 643
608 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { 644 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
609 groupList.append( list_it.current()->text(0) ); 645 if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 )
610 } 646 subscribedGroups.append( list_it.current()->text(0) );
647 } else {
648 if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 )
649 subscribedGroups.remove( list_it.current()->text(0) );
650 }
611 651
612 } 652 }
613 data->setGroups( groupList ); 653 data->setGroups( subscribedGroups );
614} 654}
615 655
616void NNTPconfig::accept() 656void NNTPconfig::accept()
617{ 657{
618 save(); 658 save();
619 QDialog::accept(); 659 QDialog::accept();
620} 660}
621 661
diff --git a/kmicromail/editaccounts.h b/kmicromail/editaccounts.h
index a9eb19f..6cf842e 100644
--- a/kmicromail/editaccounts.h
+++ b/kmicromail/editaccounts.h
@@ -1,153 +1,156 @@
1#ifndef EDITACCOUNTS_H 1#ifndef EDITACCOUNTS_H
2#define EDITACCOUNTS_H 2#define EDITACCOUNTS_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5#include <qlistview.h> 5#include <qlistview.h>
6 6
7#include "editaccountsui.h" 7#include "editaccountsui.h"
8#include "selectmailtypeui.h" 8#include "selectmailtypeui.h"
9#include "imapconfigui.h" 9#include "imapconfigui.h"
10#include "pop3configui.h" 10#include "pop3configui.h"
11#include "smtpconfigui.h" 11#include "smtpconfigui.h"
12#include "nntpconfigui.h" 12#include "nntpconfigui.h"
13 13
14#include <libetpan/clist.h> 14#include <libetpan/clist.h>
15#include <libmailwrapper/settings.h> 15#include <libmailwrapper/settings.h>
16 16
17 17
18class AccountListItem : public QListViewItem 18class AccountListItem : public QListViewItem
19{ 19{
20 20
21public: 21public:
22 AccountListItem( QListView *parent, Account *a); 22 AccountListItem( QListView *parent, Account *a);
23 Account *getAccount() { return account; } 23 Account *getAccount() { return account; }
24 24
25private: 25private:
26 Account *account; 26 Account *account;
27 27
28}; 28};
29 29
30class EditAccounts : public EditAccountsUI 30class EditAccounts : public EditAccountsUI
31{ 31{
32 Q_OBJECT 32 Q_OBJECT
33 33
34public: 34public:
35 EditAccounts( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); 35 EditAccounts( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
36 36
37public slots: 37public slots:
38 void slotNewAccount( const QString &type ); 38 void slotNewAccount( const QString &type );
39 void slotEditAccount( Account *account ); 39 void slotEditAccount( Account *account );
40 void slotDeleteAccount( Account * account ); 40 void slotDeleteAccount( Account * account );
41 void slotAdjustColumns(); 41 void slotAdjustColumns();
42 42
43protected slots: 43protected slots:
44 void slotFillLists(); 44 void slotFillLists();
45 void slotNewMail(); 45 void slotNewMail();
46 void slotEditMail(); 46 void slotEditMail();
47 void slotDeleteMail(); 47 void slotDeleteMail();
48 void slotNewNews(); 48 void slotNewNews();
49 void slotEditNews(); 49 void slotEditNews();
50 void slotDeleteNews(); 50 void slotDeleteNews();
51 void accept(); 51 void accept();
52 52
53private: 53private:
54 Settings *settings; 54 Settings *settings;
55 55
56}; 56};
57 57
58class SelectMailType : public SelectMailTypeUI 58class SelectMailType : public SelectMailTypeUI
59{ 59{
60 Q_OBJECT 60 Q_OBJECT
61 61
62public: 62public:
63 SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); 63 SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
64 64
65private slots: 65private slots:
66 void slotSelection( const QString &sel ); 66 void slotSelection( const QString &sel );
67 67
68private: 68private:
69 QString *selected; 69 QString *selected;
70 70
71}; 71};
72 72
73class IMAPconfig : public IMAPconfigUI 73class IMAPconfig : public IMAPconfigUI
74{ 74{
75 Q_OBJECT 75 Q_OBJECT
76 76
77public: 77public:
78 IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); 78 IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
79 79
80public slots: 80public slots:
81 void fillValues(); 81 void fillValues();
82 82
83protected slots: 83protected slots:
84 void slotConnectionToggle( int index ); 84 void slotConnectionToggle( int index );
85 void accept(); 85 void accept();
86 86
87private: 87private:
88 IMAPaccount *data; 88 IMAPaccount *data;
89 89
90}; 90};
91 91
92class POP3config : public POP3configUI 92class POP3config : public POP3configUI
93{ 93{
94 Q_OBJECT 94 Q_OBJECT
95 95
96public: 96public:
97 POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); 97 POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
98 98
99public slots: 99public slots:
100 void fillValues(); 100 void fillValues();
101 101
102protected slots: 102protected slots:
103 void slotConnectionToggle( int index ); 103 void slotConnectionToggle( int index );
104 void accept(); 104 void accept();
105 105
106private: 106private:
107 POP3account *data; 107 POP3account *data;
108 108
109}; 109};
110 110
111class SMTPconfig : public SMTPconfigUI 111class SMTPconfig : public SMTPconfigUI
112{ 112{
113 Q_OBJECT 113 Q_OBJECT
114 114
115public: 115public:
116 SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); 116 SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
117 117
118public slots: 118public slots:
119 void fillValues(); 119 void fillValues();
120 120
121protected slots: 121protected slots:
122 void slotConnectionToggle( int index ); 122 void slotConnectionToggle( int index );
123 void accept(); 123 void accept();
124 124
125private: 125private:
126 SMTPaccount *data; 126 SMTPaccount *data;
127 127
128}; 128};
129 129
130class NNTPconfig : public NNTPconfigUI 130class NNTPconfig : public NNTPconfigUI
131{ 131{
132 Q_OBJECT 132 Q_OBJECT
133 133
134public: 134public:
135 NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); 135 NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
136 136
137public slots: 137public slots:
138 void fillValues(); 138 void fillValues();
139 139
140protected slots: 140protected slots:
141 void slotSSL( bool enabled ); 141 void slotSSL( bool enabled );
142 void accept(); 142 void accept();
143 void slotGetNG(); 143 void slotGetNG();
144 void slotShowSub();
145 void slotShowFilter();
144 146
145private: 147private:
146 QStringList subscribedGroups; 148 QStringList subscribedGroups;
149 QStringList allGroups;
147 void save(); 150 void save();
148 NNTPaccount *data; 151 NNTPaccount *data;
149 clist* list; 152 clist* list;
150 153
151}; 154};
152 155
153#endif 156#endif
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index d130317..2a67e39 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,298 +1,303 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qvbox.h> 4#include <qvbox.h>
5#include <qheader.h> 5#include <qheader.h>
6#include <qtimer.h> 6#include <qtimer.h>
7#include <qlayout.h> 7#include <qlayout.h>
8#include <kdialog.h> 8#include <kdialog.h>
9#include <kiconloader.h> 9#include <kiconloader.h>
10#include <kapplication.h> 10#include <kapplication.h>
11 11
12#ifndef DESKTOP_VERSION 12#ifndef DESKTOP_VERSION
13#include <qpe/qpeapplication.h> 13#include <qpe/qpeapplication.h>
14#endif 14#endif
15#include "defines.h" 15#include "defines.h"
16#include "mainwindow.h" 16#include "mainwindow.h"
17#include <KDGanttMinimizeSplitter.h> 17#include <KDGanttMinimizeSplitter.h>
18 18
19 19
20#include <kabc/stdaddressbook.h> 20#include <kabc/stdaddressbook.h>
21 21
22MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 22MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
23 : QMainWindow( parent, name ) //, flags ) 23 : QMainWindow( parent, name ) //, flags )
24{ 24{
25 setCaption( tr( "KOpieMail/Pi" ) ); 25 setCaption( tr( "KOpieMail/Pi" ) );
26 setToolBarsMovable( false ); 26 setToolBarsMovable( false );
27 //KABC::StdAddressBook::self(); 27 //KABC::StdAddressBook::self();
28 toolBar = new QToolBar( this ); 28 toolBar = new QToolBar( this );
29 menuBar = new QPEMenuBar( toolBar ); 29 menuBar = new QPEMenuBar( toolBar );
30 mailMenu = new QPopupMenu( menuBar ); 30 mailMenu = new QPopupMenu( menuBar );
31 menuBar->insertItem( tr( "Mail" ), mailMenu ); 31 menuBar->insertItem( tr( "Mail" ), mailMenu );
32 settingsMenu = new QPopupMenu( menuBar ); 32 settingsMenu = new QPopupMenu( menuBar );
33 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 33 menuBar->insertItem( tr( "Settings" ), settingsMenu );
34 34
35 addToolBar( toolBar ); 35 addToolBar( toolBar );
36 toolBar->setHorizontalStretchable( true ); 36 toolBar->setHorizontalStretchable( true );
37 QAction* getMail = new QAction( tr( "Get all new mails" ), SmallIcon("add"),
38 0, 0, this );
39 connect(getMail, SIGNAL( activated() ),
40 SLOT( slotGetAllMail() ) );
41 getMail->addTo( mailMenu );
37 42
38 QAction* getMail = new QAction( tr( "Get new mail" ), SmallIcon("add"), 43 getMail = new QAction( tr( "Get new messages" ), SmallIcon("add"),
39 0, 0, this ); 44 0, 0, this );
40 getMail->addTo( toolBar ); 45 getMail->addTo( toolBar );
41 getMail->addTo( mailMenu ); 46 getMail->addTo( mailMenu );
42 connect(getMail, SIGNAL( activated() ), 47 connect(getMail, SIGNAL( activated() ),
43 SLOT( slotGetMail() ) ); 48 SLOT( slotGetMail() ) );
44 49
45 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), 50 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"),
46 0, 0, this ); 51 0, 0, this );
47 composeMail->addTo( toolBar ); 52 composeMail->addTo( toolBar );
48 composeMail->addTo( mailMenu ); 53 composeMail->addTo( mailMenu );
49 54
50 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , 55 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") ,
51 0, 0, this ); 56 0, 0, this );
52 sendQueued->addTo( toolBar ); 57 sendQueued->addTo( toolBar );
53 sendQueued->addTo( mailMenu ); 58 sendQueued->addTo( mailMenu );
54 59
55 /* 60 /*
56 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 61 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
57 0, 0, this ); 62 0, 0, this );
58 syncFolders->addTo( toolBar ); 63 syncFolders->addTo( toolBar );
59 syncFolders->addTo( mailMenu ); 64 syncFolders->addTo( mailMenu );
60 */ 65 */
61 66
62 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , 67 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") ,
63 0, 0, this, 0, true ); 68 0, 0, this, 0, true );
64 showFolders->addTo( toolBar ); 69 showFolders->addTo( toolBar );
65 showFolders->addTo( mailMenu ); 70 showFolders->addTo( mailMenu );
66 showFolders->setOn( true ); 71 showFolders->setOn( true );
67 connect(showFolders, SIGNAL( toggled(bool) ), 72 connect(showFolders, SIGNAL( toggled(bool) ),
68 SLOT( slotShowFolders(bool) ) ); 73 SLOT( slotShowFolders(bool) ) );
69 74
70 /* 75 /*
71 searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), 76 searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ),
72 0, 0, this ); 77 0, 0, this );
73 searchMails->addTo( toolBar ); 78 searchMails->addTo( toolBar );
74 searchMails->addTo( mailMenu ); 79 searchMails->addTo( mailMenu );
75 */ 80 */
76 81
77 deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); 82 deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this);
78 deleteMails->addTo( toolBar ); 83 deleteMails->addTo( toolBar );
79 deleteMails->addTo( mailMenu ); 84 deleteMails->addTo( mailMenu );
80 connect( deleteMails, SIGNAL( activated() ), 85 connect( deleteMails, SIGNAL( activated() ),
81 SLOT( slotDeleteMail() ) ); 86 SLOT( slotDeleteMail() ) );
82 87
83 editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , 88 editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") ,
84 0, 0, this ); 89 0, 0, this );
85 editSettings->addTo( settingsMenu ); 90 editSettings->addTo( settingsMenu );
86 connect( editSettings, SIGNAL( activated() ), 91 connect( editSettings, SIGNAL( activated() ),
87 SLOT( slotEditSettings() ) ); 92 SLOT( slotEditSettings() ) );
88 editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , 93 editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") ,
89 0, 0, this ); 94 0, 0, this );
90 editAccounts->addTo( settingsMenu ); 95 editAccounts->addTo( settingsMenu );
91 96
92 //setCentralWidget( view ); 97 //setCentralWidget( view );
93 98
94 QVBox* wrapperBox = new QVBox( this ); 99 QVBox* wrapperBox = new QVBox( this );
95 setCentralWidget( wrapperBox ); 100 setCentralWidget( wrapperBox );
96 101
97 // QWidget *view = new QWidget( wrapperBox ); 102 // QWidget *view = new QWidget( wrapperBox );
98 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 103 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
99 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 104 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
100 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 105 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
101 106
102 folderView = new AccountView( split ); 107 folderView = new AccountView( split );
103 folderView->header()->hide(); 108 folderView->header()->hide();
104 folderView->setRootIsDecorated( false ); 109 folderView->setRootIsDecorated( false );
105 folderView->addColumn( tr( "Mailbox" ) ); 110 folderView->addColumn( tr( "Mailbox" ) );
106 111
107 //layout->addWidget( folderView ); 112 //layout->addWidget( folderView );
108 113
109 mailView = new QListView( split ); 114 mailView = new QListView( split );
110 mailView->addColumn( tr( " " ) ); 115 mailView->addColumn( tr( " " ) );
111 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 116 mailView->addColumn( tr( "Subject" ),QListView::Manual );
112 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 117 mailView->addColumn( tr( "Sender" ),QListView::Manual );
113 mailView->addColumn( tr( "Size" ),QListView::Manual); 118 mailView->addColumn( tr( "Size" ),QListView::Manual);
114 mailView->addColumn( tr( "Date" ),QListView::Manual); 119 mailView->addColumn( tr( "Date" ),QListView::Manual);
115 mailView->setAllColumnsShowFocus(true); 120 mailView->setAllColumnsShowFocus(true);
116 //mailView->setSorting(-1); 121 //mailView->setSorting(-1);
117 mailView->setRootIsDecorated( false ); 122 mailView->setRootIsDecorated( false );
118 statusWidget = new StatusWidget( wrapperBox ); 123 statusWidget = new StatusWidget( wrapperBox );
119 statusWidget->hide(); 124 statusWidget->hide();
120 125
121 //layout->addWidget( mailView ); 126 //layout->addWidget( mailView );
122 //layout->setStretchFactor( folderView, 1 ); 127 //layout->setStretchFactor( folderView, 1 );
123 //layout->setStretchFactor( mailView, 2 ); 128 //layout->setStretchFactor( mailView, 2 );
124 129
125 slotAdjustLayout(); 130 slotAdjustLayout();
126#ifndef DESKTOP_VERSION 131#ifndef DESKTOP_VERSION
127 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 132 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
128 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 133 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
129#endif 134#endif
130 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 135 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
131 SLOT( mailLeftClicked(QListViewItem*) ) ); 136 SLOT( mailLeftClicked(QListViewItem*) ) );
132 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 137 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
133 SLOT( mailLeftClicked(QListViewItem*) ) ); 138 SLOT( mailLeftClicked(QListViewItem*) ) );
134 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 139 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
135 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 140 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
136 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 141 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
137 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 142 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
138 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 143 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
139 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 144 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
140// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 145// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
141 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 146 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
142 //mailView->setMultiSelection ( true ); 147 //mailView->setMultiSelection ( true );
143 mailView->setSelectionMode( QListView::Extended ); 148 mailView->setSelectionMode( QListView::Extended );
144 QValueList<int> list; 149 QValueList<int> list;
145 int fw = 100; 150 int fw = 100;
146 if ( QApplication::desktop()->width() > 320 ) 151 if ( QApplication::desktop()->width() > 320 )
147 fw = 50; 152 fw = 50;
148 list.append( fw ); 153 list.append( fw );
149 list.append( 100 ); 154 list.append( 100 );
150 split->setSizes( list ); 155 split->setSizes( list );
151 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 156 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
152 mailView->setShowSortIndicator ( true ); 157 mailView->setShowSortIndicator ( true );
153 QLabel *spacer = new QLabel( toolBar ); 158 QLabel *spacer = new QLabel( toolBar );
154 spacer->setBackgroundMode( QWidget::PaletteButton ); 159 spacer->setBackgroundMode( QWidget::PaletteButton );
155 toolBar->setStretchableWidget( spacer ); 160 toolBar->setStretchableWidget( spacer );
156 161
157 QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); 162 QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this);
158 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 163 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
159 if ( QApplication::desktop()->width() > 320 ) 164 if ( QApplication::desktop()->width() > 320 )
160 closeMail->addTo(toolBar); 165 closeMail->addTo(toolBar);
161 closeMail->addTo(mailMenu); 166 closeMail->addTo(mailMenu);
162 167
163 168
164 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 169 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
165 menuBar->insertItem( tr( "Help" ), helpMenu ); 170 menuBar->insertItem( tr( "Help" ), helpMenu );
166 QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this); 171 QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this);
167 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 172 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
168 li->addTo(helpMenu); 173 li->addTo(helpMenu);
169 li = new QAction(tr("Licence"),QPixmap(), 0, 0, this); 174 li = new QAction(tr("Licence"),QPixmap(), 0, 0, this);
170 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 175 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
171 li->addTo(helpMenu); 176 li->addTo(helpMenu);
172 li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this); 177 li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this);
173 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 178 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
174 li->addTo(helpMenu); 179 li->addTo(helpMenu);
175} 180}
176 181
177MainWindow::~MainWindow() 182MainWindow::~MainWindow()
178{ 183{
179} 184}
180 185
181void MainWindow::showLicence() 186void MainWindow::showLicence()
182{ 187{
183 KApplication::showLicence(); 188 KApplication::showLicence();
184} 189}
185void MainWindow::showAbout() 190void MainWindow::showAbout()
186{ 191{
187 QString version; 192 QString version;
188#include <../version> 193#include <../version>
189 194
190 QString cap = "About KOpieMail/Pi"; 195 QString cap = "About KOpieMail/Pi";
191 QString text =i18n("KOpieMail/Platform-independent\n") + 196 QString text =i18n("KOpieMail/Platform-independent\n") +
192 "(OM/Pi) " + version + " - " 197 "(OM/Pi) " + version + " - "
193 198
194#ifdef DESKTOP_VERSION 199#ifdef DESKTOP_VERSION
195 "Desktop Edition\n" 200 "Desktop Edition\n"
196#else 201#else
197 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 202 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
198#endif 203#endif
199 "www.pi-sync.net\n\n" 204 "www.pi-sync.net\n\n"
200 205
201 206
202 207
203"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" 208"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n"
204 "KOpieMail/Pi is based on Opie Mail\n" 209 "KOpieMail/Pi is based on Opie Mail\n"
205 "Copyright (c) Rajko Albrecht and the Opie team\n" 210 "Copyright (c) Rajko Albrecht and the Opie team\n"
206 "KOpieMail/Pi is licensed under the GPL\n" 211 "KOpieMail/Pi is licensed under the GPL\n"
207 "\n" 212 "\n"
208 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 213 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
209 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 214 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
210 "libEtPan has its own licence - see LibEtPan licence\n"; 215 "libEtPan has its own licence - see LibEtPan licence\n";
211 216
212 KApplication::showText( cap, text ); 217 KApplication::showText( cap, text );
213} 218}
214void MainWindow::showEtpanLicence() 219void MainWindow::showEtpanLicence()
215{ 220{
216 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 221 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
217 222
218} 223}
219void MainWindow::appMessage(const QCString &, const QByteArray &) 224void MainWindow::appMessage(const QCString &, const QByteArray &)
220{ 225{
221 qDebug("appMessage implemented by subclass"); 226 qDebug("appMessage implemented by subclass");
222} 227}
223 228
224void MainWindow::slotAdjustLayout() { 229void MainWindow::slotAdjustLayout() {
225 230
226 /* 231 /*
227 QWidget *d = QApplication::desktop(); 232 QWidget *d = QApplication::desktop();
228 233
229 if ( d->width() < d->height() ) { 234 if ( d->width() < d->height() ) {
230 layout->setDirection( QBoxLayout::TopToBottom ); 235 layout->setDirection( QBoxLayout::TopToBottom );
231 } else { 236 } else {
232 layout->setDirection( QBoxLayout::LeftToRight ); 237 layout->setDirection( QBoxLayout::LeftToRight );
233 } 238 }
234 */ 239 */
235} 240}
236 241
237void MainWindow::slotAdjustColumns() 242void MainWindow::slotAdjustColumns()
238{ 243{
239 bool hidden = folderView->isHidden(); 244 bool hidden = folderView->isHidden();
240 if ( hidden ) folderView->show(); 245 if ( hidden ) folderView->show();
241 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 246 folderView->setColumnWidth( 0, folderView->visibleWidth() );
242 if ( hidden ) folderView->hide(); 247 if ( hidden ) folderView->hide();
243 248
244 mailView->setColumnWidth( 0, 10 ); 249 mailView->setColumnWidth( 0, 10 );
245 mailView->setColumnWidth( 1, 100 ); 250 mailView->setColumnWidth( 1, 100 );
246 mailView->setColumnWidth( 2, 100 ); 251 mailView->setColumnWidth( 2, 100 );
247 mailView->setColumnWidth( 3, 50 ); 252 mailView->setColumnWidth( 3, 50 );
248 mailView->setColumnWidth( 4, 120 ); 253 mailView->setColumnWidth( 4, 120 );
249} 254}
250 255
251void MainWindow::slotEditSettings() 256void MainWindow::slotEditSettings()
252{ 257{
253} 258}
254 259
255void MainWindow::slotShowFolders( bool ) 260void MainWindow::slotShowFolders( bool )
256{ 261{
257 qDebug("not implemented: "); 262 qDebug("not implemented: ");
258} 263}
259 264
260void MainWindow::refreshMailView(const QValueList<RecMailP>&) 265void MainWindow::refreshMailView(const QValueList<RecMailP>&)
261{ 266{
262 qDebug("not implemented: "); 267 qDebug("not implemented: ");
263} 268}
264 269
265void MainWindow::mailLeftClicked(QListViewItem * ) 270void MainWindow::mailLeftClicked(QListViewItem * )
266{ 271{
267 qDebug("not implemented: "); 272 qDebug("not implemented: ");
268} 273}
269 274
270void MainWindow::displayMail() 275void MainWindow::displayMail()
271{ 276{
272 qDebug("not implemented: "); 277 qDebug("not implemented: ");
273} 278}
274 279
275void MainWindow::slotDeleteMail() 280void MainWindow::slotDeleteMail()
276{ 281{
277 qDebug("not implemented: "); 282 qDebug("not implemented: ");
278} 283}
279 284
280void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 285void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
281{ 286{
282 qDebug("not implemented: "); 287 qDebug("not implemented: ");
283} 288}
284 289
285void MainWindow::slotSendQueued() 290void MainWindow::slotSendQueued()
286{ 291{
287 qDebug("not implemented: "); 292 qDebug("not implemented: ");
288} 293}
289 294
290void MainWindow::slotEditAccounts() 295void MainWindow::slotEditAccounts()
291{ 296{
292 qDebug("not implemented: "); 297 qDebug("not implemented: ");
293} 298}
294 299
295void MainWindow::slotComposeMail() 300void MainWindow::slotComposeMail()
296{ 301{
297 qDebug("not implemented: "); 302 qDebug("not implemented: ");
298} 303}
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h
index ff0ff20..35b9c8c 100644
--- a/kmicromail/mainwindow.h
+++ b/kmicromail/mainwindow.h
@@ -1,66 +1,67 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#ifndef MAINWINDOW_H 3#ifndef MAINWINDOW_H
4#define MAINWINDOW_H 4#define MAINWINDOW_H
5 5
6#include <qmainwindow.h> 6#include <qmainwindow.h>
7#include <qlistview.h> 7#include <qlistview.h>
8#include <qaction.h> 8#include <qaction.h>
9 9
10#include <qtoolbar.h> 10#include <qtoolbar.h>
11#ifdef DESKTOP_VERSION 11#ifdef DESKTOP_VERSION
12#include <qmenubar.h> 12#include <qmenubar.h>
13#else 13#else
14#include <qpe/qpemenubar.h> 14#include <qpe/qpemenubar.h>
15#endif 15#endif
16 16
17#include "accountview.h" 17#include "accountview.h"
18#include "statuswidget.h" 18#include "statuswidget.h"
19 19
20#include <libmailwrapper/mailtypes.h> 20#include <libmailwrapper/mailtypes.h>
21#include <opie2/osmartpointer.h> 21#include <opie2/osmartpointer.h>
22 22
23class RecMail; 23class RecMail;
24 24
25class MainWindow : public QMainWindow 25class MainWindow : public QMainWindow
26{ 26{
27 Q_OBJECT 27 Q_OBJECT
28 28
29public: 29public:
30 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 30 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
31 virtual ~MainWindow(); 31 virtual ~MainWindow();
32 32
33public slots: 33public slots:
34 virtual void slotAdjustColumns(); 34 virtual void slotAdjustColumns();
35 virtual void appMessage(const QCString &msg, const QByteArray &data); 35 virtual void appMessage(const QCString &msg, const QByteArray &data);
36 virtual void slotComposeMail(); 36 virtual void slotComposeMail();
37 37
38protected slots: 38protected slots:
39 virtual void slotSendQueued(); 39 virtual void slotSendQueued();
40 virtual void slotEditAccounts(); 40 virtual void slotEditAccounts();
41 virtual void slotShowFolders( bool show ); 41 virtual void slotShowFolders( bool show );
42 virtual void refreshMailView(const QValueList<RecMailP>&); 42 virtual void refreshMailView(const QValueList<RecMailP>&);
43 virtual void displayMail(); 43 virtual void displayMail();
44 virtual void slotGetMail() = 0; 44 virtual void slotGetMail() = 0;
45 virtual void slotGetAllMail() = 0;
45 virtual void slotDeleteMail(); 46 virtual void slotDeleteMail();
46 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 47 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
47 virtual void slotAdjustLayout(); 48 virtual void slotAdjustLayout();
48 virtual void slotEditSettings(); 49 virtual void slotEditSettings();
49 virtual void mailLeftClicked( QListViewItem * ); 50 virtual void mailLeftClicked( QListViewItem * );
50 void showLicence(); 51 void showLicence();
51 void showAbout(); 52 void showAbout();
52 void showEtpanLicence(); 53 void showEtpanLicence();
53 54
54protected: 55protected:
55 QToolBar *toolBar; 56 QToolBar *toolBar;
56 StatusWidget *statusWidget; 57 StatusWidget *statusWidget;
57 QPEMenuBar *menuBar; 58 QPEMenuBar *menuBar;
58 QPopupMenu *mailMenu, *settingsMenu; 59 QPopupMenu *mailMenu, *settingsMenu;
59 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, 60 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
60 *editSettings, *editAccounts, *syncFolders; 61 *editSettings, *editAccounts, *syncFolders;
61 AccountView *folderView; 62 AccountView *folderView;
62 QListView *mailView; 63 QListView *mailView;
63 //QBoxLayout *layout; 64 //QBoxLayout *layout;
64}; 65};
65 66
66#endif 67#endif
diff --git a/kmicromail/nntpconfigui.ui b/kmicromail/nntpconfigui.ui
index 25d564e..16ff6fc 100644
--- a/kmicromail/nntpconfigui.ui
+++ b/kmicromail/nntpconfigui.ui
@@ -1,344 +1,410 @@
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>409</width> 14 <width>268</width>
15 <height>520</height> 15 <height>347</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 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>3</number> 31 <number>2</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> 37 <widget>
38 <class>QTabWidget</class> 38 <class>QTabWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>TabWidget2</cstring> 41 <cstring>TabWidget2</cstring>
42 </property> 42 </property>
43 <property> 43 <property>
44 <name>layoutMargin</name> 44 <name>layoutMargin</name>
45 </property> 45 </property>
46 <property> 46 <property>
47 <name>layoutSpacing</name> 47 <name>layoutSpacing</name>
48 </property> 48 </property>
49 <widget> 49 <widget>
50 <class>QWidget</class> 50 <class>QWidget</class>
51 <property stdset="1"> 51 <property stdset="1">
52 <name>name</name> 52 <name>name</name>
53 <cstring>tab</cstring> 53 <cstring>tab</cstring>
54 </property> 54 </property>
55 <attribute> 55 <attribute>
56 <name>title</name> 56 <name>title</name>
57 <string>Account</string> 57 <string>Account</string>
58 </attribute> 58 </attribute>
59 <grid> 59 <grid>
60 <property stdset="1"> 60 <property stdset="1">
61 <name>margin</name> 61 <name>margin</name>
62 <number>3</number> 62 <number>3</number>
63 </property> 63 </property>
64 <property stdset="1"> 64 <property stdset="1">
65 <name>spacing</name> 65 <name>spacing</name>
66 <number>3</number> 66 <number>3</number>
67 </property> 67 </property>
68 <widget row="2" column="1" > 68 <widget row="2" column="1" >
69 <class>QLineEdit</class> 69 <class>QLineEdit</class>
70 <property stdset="1"> 70 <property stdset="1">
71 <name>name</name> 71 <name>name</name>
72 <cstring>serverLine</cstring> 72 <cstring>serverLine</cstring>
73 </property> 73 </property>
74 </widget> 74 </widget>
75 <widget row="3" column="0" > 75 <widget row="3" column="0" >
76 <class>QLabel</class> 76 <class>QLabel</class>
77 <property stdset="1"> 77 <property stdset="1">
78 <name>name</name> 78 <name>name</name>
79 <cstring>portLabel</cstring> 79 <cstring>portLabel</cstring>
80 </property> 80 </property>
81 <property stdset="1"> 81 <property stdset="1">
82 <name>text</name> 82 <name>text</name>
83 <string>Port</string> 83 <string>Port</string>
84 </property> 84 </property>
85 </widget> 85 </widget>
86 <widget row="3" column="1" > 86 <widget row="3" column="1" >
87 <class>QLineEdit</class> 87 <class>QLineEdit</class>
88 <property stdset="1"> 88 <property stdset="1">
89 <name>name</name> 89 <name>name</name>
90 <cstring>portLine</cstring> 90 <cstring>portLine</cstring>
91 </property> 91 </property>
92 </widget> 92 </widget>
93 <widget row="0" column="1" > 93 <widget row="0" column="1" >
94 <class>QLineEdit</class> 94 <class>QLineEdit</class>
95 <property stdset="1"> 95 <property stdset="1">
96 <name>name</name> 96 <name>name</name>
97 <cstring>accountLine</cstring> 97 <cstring>accountLine</cstring>
98 </property> 98 </property>
99 <property> 99 <property>
100 <name>toolTip</name> 100 <name>toolTip</name>
101 <string>Name of the Account</string> 101 <string>Name of the Account</string>
102 </property> 102 </property>
103 </widget> 103 </widget>
104 <widget row="0" column="0" > 104 <widget row="0" column="0" >
105 <class>QLabel</class> 105 <class>QLabel</class>
106 <property stdset="1"> 106 <property stdset="1">
107 <name>name</name> 107 <name>name</name>
108 <cstring>accountLabel</cstring> 108 <cstring>accountLabel</cstring>
109 </property> 109 </property>
110 <property stdset="1"> 110 <property stdset="1">
111 <name>text</name> 111 <name>text</name>
112 <string>Account</string> 112 <string>Account</string>
113 </property> 113 </property>
114 </widget> 114 </widget>
115 <widget row="2" column="0" > 115 <widget row="2" column="0" >
116 <class>QLabel</class> 116 <class>QLabel</class>
117 <property stdset="1"> 117 <property stdset="1">
118 <name>name</name> 118 <name>name</name>
119 <cstring>serverLabel</cstring> 119 <cstring>serverLabel</cstring>
120 </property> 120 </property>
121 <property stdset="1"> 121 <property stdset="1">
122 <name>enabled</name> 122 <name>enabled</name>
123 <bool>true</bool> 123 <bool>true</bool>
124 </property> 124 </property>
125 <property stdset="1"> 125 <property stdset="1">
126 <name>caption</name> 126 <name>caption</name>
127 <string></string> 127 <string></string>
128 </property> 128 </property>
129 <property stdset="1"> 129 <property stdset="1">
130 <name>text</name> 130 <name>text</name>
131 <string>Server</string> 131 <string>Server</string>
132 </property> 132 </property>
133 <property> 133 <property>
134 <name>layoutMargin</name> 134 <name>layoutMargin</name>
135 </property> 135 </property>
136 <property> 136 <property>
137 <name>layoutSpacing</name> 137 <name>layoutSpacing</name>
138 </property> 138 </property>
139 </widget> 139 </widget>
140 <widget row="1" column="0" rowspan="1" colspan="2" > 140 <widget row="1" column="0" rowspan="1" colspan="2" >
141 <class>Line</class> 141 <class>Line</class>
142 <property stdset="1"> 142 <property stdset="1">
143 <name>name</name> 143 <name>name</name>
144 <cstring>line1</cstring> 144 <cstring>line1</cstring>
145 </property> 145 </property>
146 <property stdset="1"> 146 <property stdset="1">
147 <name>caption</name> 147 <name>caption</name>
148 <string></string> 148 <string></string>
149 </property> 149 </property>
150 <property stdset="1"> 150 <property stdset="1">
151 <name>orientation</name> 151 <name>orientation</name>
152 <enum>Horizontal</enum> 152 <enum>Horizontal</enum>
153 </property> 153 </property>
154 <property> 154 <property>
155 <name>layoutMargin</name> 155 <name>layoutMargin</name>
156 </property> 156 </property>
157 <property> 157 <property>
158 <name>layoutSpacing</name> 158 <name>layoutSpacing</name>
159 </property> 159 </property>
160 </widget> 160 </widget>
161 <widget row="4" column="1" > 161 <widget row="4" column="1" >
162 <class>QCheckBox</class> 162 <class>QCheckBox</class>
163 <property stdset="1"> 163 <property stdset="1">
164 <name>name</name> 164 <name>name</name>
165 <cstring>sslBox</cstring> 165 <cstring>sslBox</cstring>
166 </property> 166 </property>
167 <property stdset="1"> 167 <property stdset="1">
168 <name>text</name> 168 <name>text</name>
169 <string>Use SSL</string> 169 <string>Use SSL</string>
170 </property> 170 </property>
171 </widget> 171 </widget>
172 <widget row="5" column="0" rowspan="2" colspan="2" > 172 <widget row="5" column="0" rowspan="2" colspan="2" >
173 <class>Line</class> 173 <class>Line</class>
174 <property stdset="1"> 174 <property stdset="1">
175 <name>name</name> 175 <name>name</name>
176 <cstring>line2</cstring> 176 <cstring>line2</cstring>
177 </property> 177 </property>
178 <property stdset="1"> 178 <property stdset="1">
179 <name>enabled</name> 179 <name>enabled</name>
180 <bool>true</bool> 180 <bool>true</bool>
181 </property> 181 </property>
182 <property stdset="1"> 182 <property stdset="1">
183 <name>caption</name> 183 <name>caption</name>
184 <string></string> 184 <string></string>
185 </property> 185 </property>
186 <property stdset="1"> 186 <property stdset="1">
187 <name>orientation</name> 187 <name>orientation</name>
188 <enum>Horizontal</enum> 188 <enum>Horizontal</enum>
189 </property> 189 </property>
190 <property> 190 <property>
191 <name>layoutMargin</name> 191 <name>layoutMargin</name>
192 </property> 192 </property>
193 <property> 193 <property>
194 <name>layoutSpacing</name> 194 <name>layoutSpacing</name>
195 </property> 195 </property>
196 </widget> 196 </widget>
197 <widget row="7" column="0" > 197 <widget row="7" column="0" >
198 <class>QLabel</class> 198 <class>QLabel</class>
199 <property stdset="1"> 199 <property stdset="1">
200 <name>name</name> 200 <name>name</name>
201 <cstring>userLabel</cstring> 201 <cstring>userLabel</cstring>
202 </property> 202 </property>
203 <property stdset="1"> 203 <property stdset="1">
204 <name>text</name> 204 <name>text</name>
205 <string>User</string> 205 <string>User</string>
206 </property> 206 </property>
207 </widget> 207 </widget>
208 <widget row="8" column="0" > 208 <widget row="8" column="0" >
209 <class>QLabel</class> 209 <class>QLabel</class>
210 <property stdset="1"> 210 <property stdset="1">
211 <name>name</name> 211 <name>name</name>
212 <cstring>passLabel</cstring> 212 <cstring>passLabel</cstring>
213 </property> 213 </property>
214 <property stdset="1"> 214 <property stdset="1">
215 <name>text</name> 215 <name>text</name>
216 <string>Password</string> 216 <string>Password</string>
217 </property> 217 </property>
218 </widget> 218 </widget>
219 <spacer row="9" column="1" > 219 <spacer row="9" column="1" >
220 <property> 220 <property>
221 <name>name</name> 221 <name>name</name>
222 <cstring>spacer</cstring> 222 <cstring>spacer</cstring>
223 </property> 223 </property>
224 <property stdset="1"> 224 <property stdset="1">
225 <name>orientation</name> 225 <name>orientation</name>
226 <enum>Vertical</enum> 226 <enum>Vertical</enum>
227 </property> 227 </property>
228 <property stdset="1"> 228 <property stdset="1">
229 <name>sizeType</name> 229 <name>sizeType</name>
230 <enum>Expanding</enum> 230 <enum>Expanding</enum>
231 </property> 231 </property>
232 <property> 232 <property>
233 <name>sizeHint</name> 233 <name>sizeHint</name>
234 <size> 234 <size>
235 <width>20</width> 235 <width>20</width>
236 <height>20</height> 236 <height>20</height>
237 </size> 237 </size>
238 </property> 238 </property>
239 </spacer> 239 </spacer>
240 <widget row="6" column="1" > 240 <widget row="6" column="1" >
241 <class>QCheckBox</class> 241 <class>QCheckBox</class>
242 <property stdset="1"> 242 <property stdset="1">
243 <name>name</name> 243 <name>name</name>
244 <cstring>loginBox</cstring> 244 <cstring>loginBox</cstring>
245 </property> 245 </property>
246 <property stdset="1"> 246 <property stdset="1">
247 <name>text</name> 247 <name>text</name>
248 <string>Use Login</string> 248 <string>Use Login</string>
249 </property> 249 </property>
250 </widget> 250 </widget>
251 <widget row="7" column="1" > 251 <widget row="7" column="1" >
252 <class>QLineEdit</class> 252 <class>QLineEdit</class>
253 <property stdset="1"> 253 <property stdset="1">
254 <name>name</name> 254 <name>name</name>
255 <cstring>userLine</cstring> 255 <cstring>userLine</cstring>
256 </property> 256 </property>
257 <property stdset="1"> 257 <property stdset="1">
258 <name>enabled</name> 258 <name>enabled</name>
259 <bool>false</bool> 259 <bool>false</bool>
260 </property> 260 </property>
261 </widget> 261 </widget>
262 <widget row="8" column="1" > 262 <widget row="8" column="1" >
263 <class>QLineEdit</class> 263 <class>QLineEdit</class>
264 <property stdset="1"> 264 <property stdset="1">
265 <name>name</name> 265 <name>name</name>
266 <cstring>passLine</cstring> 266 <cstring>passLine</cstring>
267 </property> 267 </property>
268 <property stdset="1"> 268 <property stdset="1">
269 <name>enabled</name> 269 <name>enabled</name>
270 <bool>false</bool> 270 <bool>false</bool>
271 </property> 271 </property>
272 <property stdset="1"> 272 <property stdset="1">
273 <name>echoMode</name> 273 <name>echoMode</name>
274 <enum>Password</enum> 274 <enum>Password</enum>
275 </property> 275 </property>
276 </widget> 276 </widget>
277 </grid> 277 </grid>
278 </widget> 278 </widget>
279 <widget> 279 <widget>
280 <class>QWidget</class> 280 <class>QWidget</class>
281 <property stdset="1"> 281 <property stdset="1">
282 <name>name</name> 282 <name>name</name>
283 <cstring>tab</cstring> 283 <cstring>tab</cstring>
284 </property> 284 </property>
285 <attribute> 285 <attribute>
286 <name>title</name> 286 <name>title</name>
287 <string>Groups</string> 287 <string>Groups</string>
288 </attribute> 288 </attribute>
289 <vbox> 289 <vbox>
290 <property stdset="1"> 290 <property stdset="1">
291 <name>margin</name> 291 <name>margin</name>
292 <number>3</number> 292 <number>2</number>
293 </property> 293 </property>
294 <property stdset="1"> 294 <property stdset="1">
295 <name>spacing</name> 295 <name>spacing</name>
296 <number>3</number> 296 <number>3</number>
297 </property> 297 </property>
298 <widget> 298 <widget>
299 <class>QListView</class> 299 <class>QLayoutWidget</class>
300 <column>
301 <property>
302 <name>text</name>
303 <string>Newsgroup</string>
304 </property>
305 <property>
306 <name>clickable</name>
307 <bool>true</bool>
308 </property>
309 <property>
310 <name>resizeable</name>
311 <bool>true</bool>
312 </property>
313 </column>
314 <property stdset="1">
315 <name>name</name>
316 <cstring>ListViewGroups</cstring>
317 </property>
318 </widget>
319 <widget>
320 <class>QPushButton</class>
321 <property stdset="1"> 300 <property stdset="1">
322 <name>name</name> 301 <name>name</name>
323 <cstring>GetNGButton</cstring> 302 <cstring>Layout10</cstring>
324 </property> 303 </property>
325 <property stdset="1"> 304 <property>
326 <name>text</name> 305 <name>layoutSpacing</name>
327 <string>Get newsgroup list from server</string>
328 </property> 306 </property>
307 <vbox>
308 <property stdset="1">
309 <name>margin</name>
310 <number>0</number>
311 </property>
312 <property stdset="1">
313 <name>spacing</name>
314 <number>3</number>
315 </property>
316 <widget>
317 <class>QListView</class>
318 <column>
319 <property>
320 <name>text</name>
321 <string>Newsgroup</string>
322 </property>
323 <property>
324 <name>clickable</name>
325 <bool>true</bool>
326 </property>
327 <property>
328 <name>resizeable</name>
329 <bool>true</bool>
330 </property>
331 </column>
332 <property stdset="1">
333 <name>name</name>
334 <cstring>ListViewGroups</cstring>
335 </property>
336 </widget>
337 <widget>
338 <class>QPushButton</class>
339 <property stdset="1">
340 <name>name</name>
341 <cstring>GetNGButton</cstring>
342 </property>
343 <property stdset="1">
344 <name>text</name>
345 <string>Get newsgroup list from server</string>
346 </property>
347 </widget>
348 <widget>
349 <class>QLayoutWidget</class>
350 <property stdset="1">
351 <name>name</name>
352 <cstring>Layout9</cstring>
353 </property>
354 <hbox>
355 <property stdset="1">
356 <name>margin</name>
357 <number>0</number>
358 </property>
359 <property stdset="1">
360 <name>spacing</name>
361 <number>6</number>
362 </property>
363 <widget>
364 <class>QPushButton</class>
365 <property stdset="1">
366 <name>name</name>
367 <cstring>FilterButton</cstring>
368 </property>
369 <property stdset="1">
370 <name>text</name>
371 <string>Filter:</string>
372 </property>
373 </widget>
374 <widget>
375 <class>QLineEdit</class>
376 <property stdset="1">
377 <name>name</name>
378 <cstring>GroupFilter</cstring>
379 </property>
380 </widget>
381 <widget>
382 <class>QPushButton</class>
383 <property stdset="1">
384 <name>name</name>
385 <cstring>ShowSubcribed</cstring>
386 </property>
387 <property stdset="1">
388 <name>text</name>
389 <string>Show subscribed</string>
390 </property>
391 </widget>
392 </hbox>
393 </widget>
394 </vbox>
329 </widget> 395 </widget>
330 </vbox> 396 </vbox>
331 </widget> 397 </widget>
332 </widget> 398 </widget>
333 </vbox> 399 </vbox>
334</widget> 400</widget>
335<tabstops> 401<tabstops>
336 <tabstop>accountLine</tabstop> 402 <tabstop>accountLine</tabstop>
337 <tabstop>serverLine</tabstop> 403 <tabstop>serverLine</tabstop>
338 <tabstop>portLine</tabstop> 404 <tabstop>portLine</tabstop>
339 <tabstop>sslBox</tabstop> 405 <tabstop>sslBox</tabstop>
340 <tabstop>loginBox</tabstop> 406 <tabstop>loginBox</tabstop>
341 <tabstop>userLine</tabstop> 407 <tabstop>userLine</tabstop>
342 <tabstop>passLine</tabstop> 408 <tabstop>passLine</tabstop>
343</tabstops> 409</tabstops>
344</UI> 410</UI>
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 4e7c6be..7ccfb65 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,457 +1,465 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4#include "settingsdialog.h" 4#include "settingsdialog.h"
5#include "opiemail.h" 5#include "opiemail.h"
6#include "editaccounts.h" 6#include "editaccounts.h"
7#include "composemail.h" 7#include "composemail.h"
8#include "mailistviewitem.h" 8#include "mailistviewitem.h"
9#include "viewmail.h" 9#include "viewmail.h"
10#include "selectstore.h" 10#include "selectstore.h"
11#include "selectsmtp.h" 11#include "selectsmtp.h"
12#include "accountitem.h" 12#include "accountitem.h"
13#include "koprefsdialog.h" 13#include "koprefsdialog.h"
14 14
15#include <qmessagebox.h> 15#include <qmessagebox.h>
16#include <qtimer.h> 16#include <qtimer.h>
17#include <libkdepim/externalapphandler.h> 17#include <libkdepim/externalapphandler.h>
18 18
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <libmailwrapper/smtpwrapper.h> 20#include <libmailwrapper/smtpwrapper.h>
21#include <libmailwrapper/mailtypes.h> 21#include <libmailwrapper/mailtypes.h>
22#include <libmailwrapper/abstractmail.h> 22#include <libmailwrapper/abstractmail.h>
23/* OPIE */ 23/* OPIE */
24//#include <qpe/resource.h> 24//#include <qpe/resource.h>
25//#include <qpe/qpeapplication.h> 25//#include <qpe/qpeapplication.h>
26 26
27/* QT */ 27/* QT */
28 28
29//using namespace Opie::Core; 29//using namespace Opie::Core;
30 30
31OpieMail::OpieMail( QWidget *parent, const char *name ) 31OpieMail::OpieMail( QWidget *parent, const char *name )
32 : MainWindow( parent, name) //, WStyle_ContextHelp ) 32 : MainWindow( parent, name) //, WStyle_ContextHelp )
33{ 33{
34 settings = new Settings(); 34 settings = new Settings();
35 35
36 folderView->populate( settings->getAccounts() ); 36 folderView->populate( settings->getAccounts() );
37 37
38} 38}
39 39
40OpieMail::~OpieMail() 40OpieMail::~OpieMail()
41{ 41{
42 if (settings) delete settings; 42 if (settings) delete settings;
43} 43}
44 44
45void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 45void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
46{ 46{
47 47
48} 48}
49#include <stdlib.h> 49#include <stdlib.h>
50void OpieMail::message(const QCString &msg, const QByteArray &data) 50void OpieMail::message(const QCString &msg, const QByteArray &data)
51{ 51{
52 // copied from old mail2 52 // copied from old mail2
53 static int ii = 0; 53 static int ii = 0;
54 //qDebug("QCOP CALL ############################# %d ", ii); 54 //qDebug("QCOP CALL ############################# %d ", ii);
55 //QString mess ( msg ); 55 //QString mess ( msg );
56 //qDebug("Message = %s ",mess.latin1()); 56 //qDebug("Message = %s ",mess.latin1());
57 ++ii; 57 ++ii;
58 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 58 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
59 59
60 mPendingEmail = QString::null; 60 mPendingEmail = QString::null;
61 mPendingName = QString::null; 61 mPendingName = QString::null;
62 if (msg == "writeMail(QString,QString)") 62 if (msg == "writeMail(QString,QString)")
63 { 63 {
64 //qDebug("writeMail(QString,QString) "); 64 //qDebug("writeMail(QString,QString) ");
65 QDataStream stream(data,IO_ReadOnly); 65 QDataStream stream(data,IO_ReadOnly);
66 stream >> mPendingName >> mPendingEmail; 66 stream >> mPendingName >> mPendingEmail;
67 // removing the whitespaces at beginning and end is needed! 67 // removing the whitespaces at beginning and end is needed!
68 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 68 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
69 } 69 }
70 else if (msg == "newMail()") 70 else if (msg == "newMail()")
71 { 71 {
72 //qDebug("slotComposeMail() "); 72 //qDebug("slotComposeMail() ");
73 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 73 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
74 // and a QCOP call does not like a processevents in his execution 74 // and a QCOP call does not like a processevents in his execution
75 // with the Qtimer we call slotComposeMail() after we reached the main event loop 75 // with the Qtimer we call slotComposeMail() after we reached the main event loop
76 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 76 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
77 // slotComposeMail(); 77 // slotComposeMail();
78 } 78 }
79 else if (msg == "newMail(QString)") 79 else if (msg == "newMail(QString)")
80 { 80 {
81 //qDebug(" newMail(QString)"); 81 //qDebug(" newMail(QString)");
82 QDataStream stream(data,IO_ReadOnly); 82 QDataStream stream(data,IO_ReadOnly);
83 stream >> mPendingName; 83 stream >> mPendingName;
84 // the format is 84 // the format is
85 // NAME <EMAIL>:SUBJECT 85 // NAME <EMAIL>:SUBJECT
86 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 86 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
87 } else { 87 } else {
88 mPendingData = data; 88 mPendingData = data;
89 mPendingMessage = msg; 89 mPendingMessage = msg;
90 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 90 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
91 } 91 }
92 92
93 //qDebug("END OpieMail::message "); 93 //qDebug("END OpieMail::message ");
94} 94}
95void OpieMail::slotExtAppHandler() 95void OpieMail::slotExtAppHandler()
96{ 96{
97 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 97 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
98} 98}
99void OpieMail::slotwriteMail2(const QString& namemail ) 99void OpieMail::slotwriteMail2(const QString& namemail )
100{ 100{
101 //qDebug("OpieMail::slotwriteMail2 "); 101 //qDebug("OpieMail::slotwriteMail2 ");
102 //qApp->processEvents(); 102 //qApp->processEvents();
103 ComposeMail compose( settings, this, 0, true ); 103 ComposeMail compose( settings, this, 0, true );
104 if ( !namemail.isEmpty() ) { 104 if ( !namemail.isEmpty() ) {
105 QString to = namemail; 105 QString to = namemail;
106 if ( namemail.find( " <") > 1 ) { 106 if ( namemail.find( " <") > 1 ) {
107 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 107 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
108 } else 108 } else
109 if ( namemail.find( "<") > 1 ) { 109 if ( namemail.find( "<") > 1 ) {
110 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 110 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
111 } 111 }
112 int sub = to.find( ">:"); 112 int sub = to.find( ">:");
113 if ( sub > 0 ) { 113 if ( sub > 0 ) {
114 compose.setTo( to.left(sub+1) ); 114 compose.setTo( to.left(sub+1) );
115 compose.setSubject( to.mid(sub+2) ); 115 compose.setSubject( to.mid(sub+2) );
116 } else 116 } else
117 compose.setTo( to ); 117 compose.setTo( to );
118 } 118 }
119 compose.slotAdjustColumns(); 119 compose.slotAdjustColumns();
120 compose.showMaximized(); 120 compose.showMaximized();
121 compose.exec(); 121 compose.exec();
122 raise(); 122 raise();
123 //qDebug("retttich "); 123 //qDebug("retttich ");
124} 124}
125void OpieMail::slotwriteMail(const QString&name,const QString&email) 125void OpieMail::slotwriteMail(const QString&name,const QString&email)
126{ 126{
127 // qDebug("OpieMail::slotwriteMail "); 127 // qDebug("OpieMail::slotwriteMail ");
128 ComposeMail compose( settings, this, 0, true ); 128 ComposeMail compose( settings, this, 0, true );
129 if (!email.isEmpty()) 129 if (!email.isEmpty())
130 { 130 {
131 if (!name.isEmpty()) 131 if (!name.isEmpty())
132 { 132 {
133 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 133 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
134 } 134 }
135 else 135 else
136 { 136 {
137 compose.setTo(email); 137 compose.setTo(email);
138 } 138 }
139 } 139 }
140 compose.slotAdjustColumns(); 140 compose.slotAdjustColumns();
141 compose.showMaximized(); 141 compose.showMaximized();
142 compose.exec(); 142 compose.exec();
143 raise(); 143 raise();
144} 144}
145 145
146void OpieMail::slotComposeMail() 146void OpieMail::slotComposeMail()
147{ 147{
148 if ( mPendingEmail == QString::null && mPendingName == QString::null) 148 if ( mPendingEmail == QString::null && mPendingName == QString::null)
149 slotwriteMail2( QString () ); 149 slotwriteMail2( QString () );
150 else { 150 else {
151 if ( mPendingEmail == QString::null ) 151 if ( mPendingEmail == QString::null )
152 slotwriteMail2( mPendingName ); 152 slotwriteMail2( mPendingName );
153 else 153 else
154 slotwriteMail( mPendingName, mPendingEmail ); 154 slotwriteMail( mPendingName, mPendingEmail );
155 } 155 }
156 //slotwriteMail(0l,0l); 156 //slotwriteMail(0l,0l);
157} 157}
158 158
159void OpieMail::slotSendQueued() 159void OpieMail::slotSendQueued()
160{ 160{
161 SMTPaccount *smtp = 0; 161 SMTPaccount *smtp = 0;
162 162
163 QList<Account> list = settings->getAccounts(); 163 QList<Account> list = settings->getAccounts();
164 QList<SMTPaccount> smtpList; 164 QList<SMTPaccount> smtpList;
165 smtpList.setAutoDelete(false); 165 smtpList.setAutoDelete(false);
166 Account *it; 166 Account *it;
167 for ( it = list.first(); it; it = list.next() ) 167 for ( it = list.first(); it; it = list.next() )
168 { 168 {
169 if ( it->getType() == MAILLIB::A_SMTP ) 169 if ( it->getType() == MAILLIB::A_SMTP )
170 { 170 {
171 smtp = static_cast<SMTPaccount *>(it); 171 smtp = static_cast<SMTPaccount *>(it);
172 smtpList.append(smtp); 172 smtpList.append(smtp);
173 } 173 }
174 } 174 }
175 if (smtpList.count()==0) 175 if (smtpList.count()==0)
176 { 176 {
177 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); 177 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n"));
178 return; 178 return;
179 } 179 }
180 if (smtpList.count()==1) 180 if (smtpList.count()==1)
181 { 181 {
182 smtp = smtpList.at(0); 182 smtp = smtpList.at(0);
183 } 183 }
184 else 184 else
185 { 185 {
186 smtp = 0; 186 smtp = 0;
187 selectsmtp selsmtp; 187 selectsmtp selsmtp;
188 selsmtp.setSelectionlist(&smtpList); 188 selsmtp.setSelectionlist(&smtpList);
189 selsmtp.showMaximized(); 189 selsmtp.showMaximized();
190 if ( selsmtp.exec() == QDialog::Accepted ) 190 if ( selsmtp.exec() == QDialog::Accepted )
191 { 191 {
192 smtp = selsmtp.selected_smtp(); 192 smtp = selsmtp.selected_smtp();
193 } 193 }
194 } 194 }
195 if (smtp) 195 if (smtp)
196 { 196 {
197 SMTPwrapper * wrap = new SMTPwrapper(smtp); 197 SMTPwrapper * wrap = new SMTPwrapper(smtp);
198 if ( wrap->flushOutbox() ) 198 if ( wrap->flushOutbox() )
199 { 199 {
200 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 200 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
201 } 201 }
202 delete wrap; 202 delete wrap;
203 } 203 }
204} 204}
205 205
206void OpieMail::slotSearchMails() 206void OpieMail::slotSearchMails()
207{ 207{
208 qDebug("OpieMail::slotSearchMails():not implemented "); 208 qDebug("OpieMail::slotSearchMails():not implemented ");
209} 209}
210 210
211void OpieMail::slotEditSettings() 211void OpieMail::slotEditSettings()
212{ 212{
213#if 0 213#if 0
214 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 214 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
215 settingsDialog.showMaximized(); 215 settingsDialog.showMaximized();
216 settingsDialog.exec(); 216 settingsDialog.exec();
217#endif 217#endif
218 KOPrefsDialog settingsDialog( this, "koprefs", true ); 218 KOPrefsDialog settingsDialog( this, "koprefs", true );
219 settingsDialog.showMaximized(); 219 settingsDialog.showMaximized();
220 settingsDialog.exec(); 220 settingsDialog.exec();
221} 221}
222 222
223void OpieMail::slotEditAccounts() 223void OpieMail::slotEditAccounts()
224{ 224{
225 EditAccounts eaDialog( settings, this, 0, true ); 225 EditAccounts eaDialog( settings, this, 0, true );
226 eaDialog.slotAdjustColumns(); 226 eaDialog.slotAdjustColumns();
227 eaDialog.showMaximized(); 227 eaDialog.showMaximized();
228 eaDialog.exec(); 228 eaDialog.exec();
229 if ( settings ) delete settings; 229 if ( settings ) delete settings;
230 settings = new Settings(); 230 settings = new Settings();
231 231
232 folderView->populate( settings->getAccounts() ); 232 folderView->populate( settings->getAccounts() );
233} 233}
234 234
235void OpieMail::displayMail() 235void OpieMail::displayMail()
236{ 236{
237 QListViewItem*item = mailView->currentItem(); 237 QListViewItem*item = mailView->currentItem();
238 if (!item) return; 238 if (!item) return;
239 RecMailP mail = ((MailListViewItem*)item)->data(); 239 RecMailP mail = ((MailListViewItem*)item)->data();
240 RecBodyP body = folderView->fetchBody(mail); 240 RecBodyP body = folderView->fetchBody(mail);
241 ViewMail readMail( this,"", Qt::WType_Modal ); 241 ViewMail readMail( this,"", Qt::WType_Modal );
242 readMail.setBody( body ); 242 readMail.setBody( body );
243 readMail.setMail( mail ); 243 readMail.setMail( mail );
244 readMail.showMaximized(); 244 readMail.showMaximized();
245 readMail.exec(); 245 readMail.exec();
246 246
247 if ( readMail.deleted ) 247 if ( readMail.deleted )
248 { 248 {
249 folderView->refreshCurrent(); 249 folderView->refreshCurrent();
250 } 250 }
251 else 251 else
252 { 252 {
253 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 253 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
254 } 254 }
255} 255}
256void OpieMail::slotGetAllMail()
257{
258 QListViewItem * item = folderView->firstChild();
259 while ( item ){
260 ((AccountViewItem *)item)->contextMenuSelected( 101 );
261 item = item->nextSibling ();
262 }
263}
256void OpieMail::slotGetMail() 264void OpieMail::slotGetMail()
257{ 265{
258 QListViewItem * item = folderView->currentItem(); 266 QListViewItem * item = folderView->currentItem();
259 if ( ! item ) return; 267 if ( ! item ) return;
260 while ( item->parent () ) 268 while ( item->parent () )
261 item = item->parent (); 269 item = item->parent ();
262 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 270 ((AccountViewItem *)item)->contextMenuSelected( 101 );
263} 271}
264void OpieMail::slotDeleteMail() 272void OpieMail::slotDeleteMail()
265{ 273{
266 if (!mailView->currentItem()) return; 274 if (!mailView->currentItem()) return;
267 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 275 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
268 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 276 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
269 { 277 {
270 mail->Wrapper()->deleteMail( mail ); 278 mail->Wrapper()->deleteMail( mail );
271 folderView->refreshCurrent(); 279 folderView->refreshCurrent();
272 } 280 }
273} 281}
274void OpieMail::slotDeleteAllMail() 282void OpieMail::slotDeleteAllMail()
275{ 283{
276 284
277 QValueList<RecMailP> t; 285 QValueList<RecMailP> t;
278 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 286 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
279 { 287 {
280 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 288 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
281 while ( item ) { 289 while ( item ) {
282 if ( item->isSelected() ) { 290 if ( item->isSelected() ) {
283 t.append( item->data() ); 291 t.append( item->data() );
284 } 292 }
285 item = (MailListViewItem*)item->nextSibling(); 293 item = (MailListViewItem*)item->nextSibling();
286 } 294 }
287 } 295 }
288 else 296 else
289 return; 297 return;
290 if ( t.count() == 0 ) 298 if ( t.count() == 0 )
291 return; 299 return;
292 RecMailP mail = t.first(); 300 RecMailP mail = t.first();
293 mail->Wrapper()->deleteMailList(t); 301 mail->Wrapper()->deleteMailList(t);
294 folderView->refreshCurrent(); 302 folderView->refreshCurrent();
295 303
296 304
297} 305}
298void OpieMail::clearSelection() 306void OpieMail::clearSelection()
299{ 307{
300 mailView->clearSelection(); 308 mailView->clearSelection();
301 309
302} 310}
303 311
304void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 312void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
305{ 313{
306 if (!mailView->currentItem()) return; 314 if (!mailView->currentItem()) return;
307 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 315 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
308 /* just the RIGHT button - or hold on pda */ 316 /* just the RIGHT button - or hold on pda */
309 if (button!=2) {return;} 317 if (button!=2) {return;}
310 if (!item) return; 318 if (!item) return;
311 QPopupMenu *m = new QPopupMenu(0); 319 QPopupMenu *m = new QPopupMenu(0);
312 if (m) 320 if (m)
313 { 321 {
314 if (mailtype==MAILLIB::A_NNTP) { 322 if (mailtype==MAILLIB::A_NNTP) {
315 m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); 323 m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
316// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); 324// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
317 } else { 325 } else {
318 if (folderView->currentisDraft()) { 326 if (folderView->currentisDraft()) {
319 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); 327 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
320 } 328 }
321 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 329 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
322 m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 330 m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
323 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 331 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
324 m->insertSeparator(); 332 m->insertSeparator();
325 m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 333 m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
326 m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 334 m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
327 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); 335 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection()));
328 } 336 }
329 m->setFocus(); 337 m->setFocus();
330 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 338 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
331 delete m; 339 delete m;
332 } 340 }
333} 341}
334 342
335void OpieMail::slotShowFolders( bool show ) 343void OpieMail::slotShowFolders( bool show )
336{ 344{
337 if ( show && folderView->isHidden() ) 345 if ( show && folderView->isHidden() )
338 { 346 {
339 folderView->show(); 347 folderView->show();
340 } 348 }
341 else if ( !show && !folderView->isHidden() ) 349 else if ( !show && !folderView->isHidden() )
342 { 350 {
343 folderView->hide(); 351 folderView->hide();
344 } 352 }
345} 353}
346 354
347void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 355void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
348{ 356{
349 MailListViewItem*item = 0; 357 MailListViewItem*item = 0;
350 mailView->clear(); 358 mailView->clear();
351 359
352 QValueList<RecMailP>::ConstIterator it; 360 QValueList<RecMailP>::ConstIterator it;
353 for (it = list.begin(); it != list.end();++it) 361 for (it = list.begin(); it != list.end();++it)
354 { 362 {
355 item = new MailListViewItem(mailView,item); 363 item = new MailListViewItem(mailView,item);
356 item->storeData((*it)); 364 item->storeData((*it));
357 item->showEntry(); 365 item->showEntry();
358 } 366 }
359} 367}
360 368
361void OpieMail::mailLeftClicked( QListViewItem *item ) 369void OpieMail::mailLeftClicked( QListViewItem *item )
362{ 370{
363 mailView->clearSelection(); 371 mailView->clearSelection();
364 /* just LEFT button - or tap with stylus on pda */ 372 /* just LEFT button - or tap with stylus on pda */
365 //if (button!=1) return; 373 //if (button!=1) return;
366 if (!item) return; 374 if (!item) return;
367 if (folderView->currentisDraft()) { 375 if (folderView->currentisDraft()) {
368 reEditMail(); 376 reEditMail();
369 } else { 377 } else {
370 displayMail(); 378 displayMail();
371 } 379 }
372} 380}
373 381
374void OpieMail::slotMoveCopyMail() 382void OpieMail::slotMoveCopyMail()
375{ 383{
376 if (!mailView->currentItem()) return; 384 if (!mailView->currentItem()) return;
377 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 385 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
378 AbstractMail*targetMail = 0; 386 AbstractMail*targetMail = 0;
379 QString targetFolder = ""; 387 QString targetFolder = "";
380 Selectstore sels; 388 Selectstore sels;
381 folderView->setupFolderselect(&sels); 389 folderView->setupFolderselect(&sels);
382 if (!sels.exec()) return; 390 if (!sels.exec()) return;
383 targetMail = sels.currentMail(); 391 targetMail = sels.currentMail();
384 targetFolder = sels.currentFolder(); 392 targetFolder = sels.currentFolder();
385 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 393 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
386 targetFolder.isEmpty()) 394 targetFolder.isEmpty())
387 { 395 {
388 return; 396 return;
389 } 397 }
390 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 398 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
391 { 399 {
392 QMessageBox::critical(0,tr("Error creating new Folder"), 400 QMessageBox::critical(0,tr("Error creating new Folder"),
393 tr("<center>Error while creating<br>new folder - breaking.</center>")); 401 tr("<center>Error while creating<br>new folder - breaking.</center>"));
394 return; 402 return;
395 } 403 }
396 sels.hide(); 404 sels.hide();
397 qApp->processEvents(); 405 qApp->processEvents();
398 // qDebug("hiding sels "); 406 // qDebug("hiding sels ");
399 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 407 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
400 folderView->refreshCurrent(); 408 folderView->refreshCurrent();
401} 409}
402 410
403void OpieMail::slotMoveCopyAllMail() 411void OpieMail::slotMoveCopyAllMail()
404{ 412{
405 413
406 if (!mailView->currentItem()) return; 414 if (!mailView->currentItem()) return;
407 QValueList<RecMailP> t; 415 QValueList<RecMailP> t;
408 // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 416 // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
409 { 417 {
410 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 418 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
411 while ( item ) { 419 while ( item ) {
412 if ( item->isSelected() ) { 420 if ( item->isSelected() ) {
413 t.append( item->data() ); 421 t.append( item->data() );
414 } 422 }
415 item = (MailListViewItem*)item->nextSibling(); 423 item = (MailListViewItem*)item->nextSibling();
416 } 424 }
417 } 425 }
418 // else 426 // else
419 // return; 427 // return;
420 if ( t.count() == 0 ) 428 if ( t.count() == 0 )
421 return; 429 return;
422 RecMailP mail = t.first(); 430 RecMailP mail = t.first();
423 AbstractMail*targetMail = 0; 431 AbstractMail*targetMail = 0;
424 QString targetFolder = ""; 432 QString targetFolder = "";
425 Selectstore sels; 433 Selectstore sels;
426 folderView->setupFolderselect(&sels); 434 folderView->setupFolderselect(&sels);
427 if (!sels.exec()) return; 435 if (!sels.exec()) return;
428 targetMail = sels.currentMail(); 436 targetMail = sels.currentMail();
429 targetFolder = sels.currentFolder(); 437 targetFolder = sels.currentFolder();
430 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 438 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
431 targetFolder.isEmpty()) 439 targetFolder.isEmpty())
432 { 440 {
433 return; 441 return;
434 } 442 }
435 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 443 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
436 { 444 {
437 QMessageBox::critical(0,tr("Error creating new Folder"), 445 QMessageBox::critical(0,tr("Error creating new Folder"),
438 tr("<center>Error while creating<br>new folder - breaking.</center>")); 446 tr("<center>Error while creating<br>new folder - breaking.</center>"));
439 return; 447 return;
440 } 448 }
441 sels.hide(); 449 sels.hide();
442 qApp->processEvents(); 450 qApp->processEvents();
443 //qDebug("hiding sels "); 451 //qDebug("hiding sels ");
444 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); 452 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails());
445 folderView->refreshCurrent(); 453 folderView->refreshCurrent();
446} 454}
447 455
448void OpieMail::reEditMail() 456void OpieMail::reEditMail()
449{ 457{
450 if (!mailView->currentItem()) return; 458 if (!mailView->currentItem()) return;
451 459
452 ComposeMail compose( settings, this, 0, true ); 460 ComposeMail compose( settings, this, 0, true );
453 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 461 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
454 compose.slotAdjustColumns(); 462 compose.slotAdjustColumns();
455 compose.showMaximized(); 463 compose.showMaximized();
456 compose.exec(); 464 compose.exec();
457} 465}
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index 47264e4..9de95f8 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -1,54 +1,55 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#ifndef OPIEMAIL_H 2#ifndef OPIEMAIL_H
3#define OPIEMAIL_H 3#define OPIEMAIL_H
4 4
5#include "mainwindow.h" 5#include "mainwindow.h"
6#include <libmailwrapper/settings.h> 6#include <libmailwrapper/settings.h>
7 7
8#include <opie2/osmartpointer.h> 8#include <opie2/osmartpointer.h>
9#include <libmailwrapper/mailtypes.h> 9#include <libmailwrapper/mailtypes.h>
10 10
11class OpieMail : public MainWindow 11class OpieMail : public MainWindow
12{ 12{
13 Q_OBJECT 13 Q_OBJECT
14 14
15public: 15public:
16 OpieMail( QWidget *parent = 0, const char *name = 0 ); 16 OpieMail( QWidget *parent = 0, const char *name = 0 );
17 virtual ~OpieMail(); 17 virtual ~OpieMail();
18 static QString appName() { return QString::fromLatin1("kopiemail"); } 18 static QString appName() { return QString::fromLatin1("kopiemail"); }
19 19
20public slots: 20public slots:
21 virtual void slotwriteMail(const QString&name,const QString&email); 21 virtual void slotwriteMail(const QString&name,const QString&email);
22 virtual void slotwriteMail2(const QString&nameemail); 22 virtual void slotwriteMail2(const QString&nameemail);
23 virtual void slotComposeMail(); 23 virtual void slotComposeMail();
24 virtual void slotExtAppHandler(); 24 virtual void slotExtAppHandler();
25 virtual void appMessage(const QCString &msg, const QByteArray &data); 25 virtual void appMessage(const QCString &msg, const QByteArray &data);
26 virtual void message(const QCString &msg, const QByteArray &data); 26 virtual void message(const QCString &msg, const QByteArray &data);
27protected slots: 27protected slots:
28 virtual void slotSendQueued(); 28 virtual void slotSendQueued();
29 virtual void slotSearchMails(); 29 virtual void slotSearchMails();
30 virtual void slotEditSettings(); 30 virtual void slotEditSettings();
31 virtual void slotEditAccounts(); 31 virtual void slotEditAccounts();
32 virtual void displayMail(); 32 virtual void displayMail();
33 virtual void slotDeleteMail(); 33 virtual void slotDeleteMail();
34 virtual void slotGetMail(); 34 virtual void slotGetMail();
35 virtual void slotGetAllMail();
35 virtual void slotDeleteAllMail(); 36 virtual void slotDeleteAllMail();
36 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 37 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
37 virtual void slotShowFolders( bool show ); 38 virtual void slotShowFolders( bool show );
38 virtual void refreshMailView(const QValueList<RecMailP>&); 39 virtual void refreshMailView(const QValueList<RecMailP>&);
39 virtual void mailLeftClicked( QListViewItem * ); 40 virtual void mailLeftClicked( QListViewItem * );
40 virtual void slotMoveCopyMail(); 41 virtual void slotMoveCopyMail();
41 virtual void slotMoveCopyAllMail(); 42 virtual void slotMoveCopyAllMail();
42 virtual void reEditMail(); 43 virtual void reEditMail();
43 void clearSelection(); 44 void clearSelection();
44 45
45private: 46private:
46 QString mPendingEmail; 47 QString mPendingEmail;
47 QString mPendingName; 48 QString mPendingName;
48 QByteArray mPendingData; 49 QByteArray mPendingData;
49 QCString mPendingMessage; 50 QCString mPendingMessage;
50 Settings *settings; 51 Settings *settings;
51 52
52}; 53};
53 54
54#endif 55#endif