summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp34
-rw-r--r--noncore/net/mail/accountitem.h58
-rw-r--r--noncore/net/mail/accountview.cpp12
-rw-r--r--noncore/net/mail/accountview.h11
-rw-r--r--noncore/net/mail/composemail.cpp20
-rw-r--r--noncore/net/mail/composemail.h4
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp16
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h36
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.cpp4
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.h6
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.h10
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp49
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h34
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp4
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.h15
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.h8
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp43
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.h24
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp50
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.h26
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp26
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.h14
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp32
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h14
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp18
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h6
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.h2
-rw-r--r--noncore/net/mail/mailistviewitem.cpp20
-rw-r--r--noncore/net/mail/mailistviewitem.h6
-rw-r--r--noncore/net/mail/mainwindow.cpp5
-rw-r--r--noncore/net/mail/mainwindow.h5
-rw-r--r--noncore/net/mail/opiemail.cpp22
-rw-r--r--noncore/net/mail/opiemail.h4
-rw-r--r--noncore/net/mail/viewmail.cpp36
-rw-r--r--noncore/net/mail/viewmail.h4
38 files changed, 347 insertions, 345 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index 3e12563..9a09c18 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -28,75 +28,75 @@ POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
28#if 0 28#if 0
29 if (!account->getOffline()) 29 if (!account->getOffline())
30 { 30 {
31 setPixmap( 0, ); 31 setPixmap( 0, );
32 } 32 }
33 else 33 else
34 { 34 {
35 setPixmap( 0, PIXMAP_OFFLINE ); 35 setPixmap( 0, PIXMAP_OFFLINE );
36 } 36 }
37#endif 37#endif
38 setText( 0, account->getAccountName() ); 38 setText( 0, account->getAccountName() );
39 setOpen( true ); 39 setOpen( true );
40} 40}
41 41
42POP3viewItem::~POP3viewItem() 42POP3viewItem::~POP3viewItem()
43{ 43{
44 delete wrapper; 44 delete wrapper;
45} 45}
46 46
47AbstractMail *POP3viewItem::getWrapper() 47AbstractMail *POP3viewItem::getWrapper()
48{ 48{
49 return wrapper; 49 return wrapper;
50} 50}
51 51
52void POP3viewItem::refresh( QList<RecMail> & ) 52void POP3viewItem::refresh(QValueList<Opie::OSmartPointer<RecMail> > & )
53{ 53{
54 refresh(); 54 refresh();
55} 55}
56 56
57void POP3viewItem::refresh() 57void POP3viewItem::refresh()
58{ 58{
59 if (account->getOffline()) return; 59 if (account->getOffline()) return;
60 QValueList<FolderP> *folders = wrapper->listFolders(); 60 QValueList<FolderP> *folders = wrapper->listFolders();
61 QListViewItem *child = firstChild(); 61 QListViewItem *child = firstChild();
62 while ( child ) 62 while ( child )
63 { 63 {
64 QListViewItem *tmp = child; 64 QListViewItem *tmp = child;
65 child = child->nextSibling(); 65 child = child->nextSibling();
66 delete tmp; 66 delete tmp;
67 } 67 }
68 QValueList<FolderP>::ConstIterator it; 68 QValueList<FolderP>::ConstIterator it;
69 QListViewItem*item = 0; 69 QListViewItem*item = 0;
70 for ( it = folders->begin(); it!=folders->end(); ++it) 70 for ( it = folders->begin(); it!=folders->end(); ++it)
71 { 71 {
72 item = new POP3folderItem( (*it), this , item ); 72 item = new POP3folderItem( (*it), this , item );
73 item->setSelectable( (*it)->may_select()); 73 item->setSelectable( (*it)->may_select());
74 } 74 }
75 delete folders; 75 delete folders;
76} 76}
77 77
78RecBody POP3viewItem::fetchBody( const RecMail &mail ) 78RecBody POP3viewItem::fetchBody( const RecMailP &mail )
79{ 79{
80 qDebug( "POP3 fetchBody" ); 80 qDebug( "POP3 fetchBody" );
81 return wrapper->fetchBody( mail ); 81 return wrapper->fetchBody( mail );
82} 82}
83 83
84QPopupMenu * POP3viewItem::getContextMenu() 84QPopupMenu * POP3viewItem::getContextMenu()
85{ 85{
86 QPopupMenu *m = new QPopupMenu(0); 86 QPopupMenu *m = new QPopupMenu(0);
87 if (m) 87 if (m)
88 { 88 {
89 if (!account->getOffline()) 89 if (!account->getOffline())
90 { 90 {
91 m->insertItem(QObject::tr("Disconnect",contextName),0); 91 m->insertItem(QObject::tr("Disconnect",contextName),0);
92 m->insertItem(QObject::tr("Set offline",contextName),1); 92 m->insertItem(QObject::tr("Set offline",contextName),1);
93 } 93 }
94 else 94 else
95 { 95 {
96 m->insertItem(QObject::tr("Set online",contextName),1); 96 m->insertItem(QObject::tr("Set online",contextName),1);
97 } 97 }
98 } 98 }
99 return m; 99 return m;
100} 100}
101 101
102void POP3viewItem::disconnect() 102void POP3viewItem::disconnect()
@@ -133,55 +133,55 @@ void POP3viewItem::contextMenuSelected(int which)
133 case 1: 133 case 1:
134 setOnOffline(); 134 setOnOffline();
135 break; 135 break;
136 } 136 }
137} 137}
138 138
139POP3folderItem::~POP3folderItem() 139POP3folderItem::~POP3folderItem()
140{} 140{}
141 141
142POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) 142POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after )
143 : AccountViewItem(folderInit,parent,after ) 143 : AccountViewItem(folderInit,parent,after )
144{ 144{
145 pop3 = parent; 145 pop3 = parent;
146 if (folder->getDisplayName().lower()!="inbox") 146 if (folder->getDisplayName().lower()!="inbox")
147 { 147 {
148 setPixmap( 0, PIXMAP_POP3FOLDER ); 148 setPixmap( 0, PIXMAP_POP3FOLDER );
149 } 149 }
150 else 150 else
151 { 151 {
152 setPixmap( 0, PIXMAP_INBOXFOLDER); 152 setPixmap( 0, PIXMAP_INBOXFOLDER);
153 } 153 }
154 setText( 0, folder->getDisplayName() ); 154 setText( 0, folder->getDisplayName() );
155} 155}
156 156
157void POP3folderItem::refresh(QList<RecMail>&target) 157void POP3folderItem::refresh(QValueList<RecMailP>&target)
158{ 158{
159 if (folder->may_select()) 159 if (folder->may_select())
160 pop3->getWrapper()->listMessages( folder->getName(),target ); 160 pop3->getWrapper()->listMessages( folder->getName(),target );
161} 161}
162 162
163RecBody POP3folderItem::fetchBody(const RecMail&aMail) 163RecBody POP3folderItem::fetchBody(const RecMailP&aMail)
164{ 164{
165 return pop3->getWrapper()->fetchBody(aMail); 165 return pop3->getWrapper()->fetchBody(aMail);
166} 166}
167 167
168QPopupMenu * POP3folderItem::getContextMenu() 168QPopupMenu * POP3folderItem::getContextMenu()
169{ 169{
170 QPopupMenu *m = new QPopupMenu(0); 170 QPopupMenu *m = new QPopupMenu(0);
171 if (m) 171 if (m)
172 { 172 {
173 m->insertItem(QObject::tr("Refresh header list",contextName),0); 173 m->insertItem(QObject::tr("Refresh header list",contextName),0);
174 m->insertItem(QObject::tr("Delete all mails",contextName),1); 174 m->insertItem(QObject::tr("Delete all mails",contextName),1);
175 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); 175 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
176 } 176 }
177 return m; 177 return m;
178} 178}
179 179
180void POP3folderItem::downloadMails() 180void POP3folderItem::downloadMails()
181{ 181{
182 AccountView*bl = pop3->accountView(); 182 AccountView*bl = pop3->accountView();
183 if (!bl) return; 183 if (!bl) return;
184 bl->downloadMails(folder,pop3->getWrapper()); 184 bl->downloadMails(folder,pop3->getWrapper());
185} 185}
186 186
187void POP3folderItem::contextMenuSelected(int which) 187void POP3folderItem::contextMenuSelected(int which)
@@ -218,76 +218,76 @@ NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent )
218#if 0 218#if 0
219 if (!account->getOffline()) 219 if (!account->getOffline())
220 { 220 {
221 setPixmap( 0, ); 221 setPixmap( 0, );
222 } 222 }
223 else 223 else
224 { 224 {
225 setPixmap( 0, PIXMAP_OFFLINE ); 225 setPixmap( 0, PIXMAP_OFFLINE );
226 } 226 }
227#endif 227#endif
228 setText( 0, account->getAccountName() ); 228 setText( 0, account->getAccountName() );
229 setOpen( true ); 229 setOpen( true );
230} 230}
231 231
232NNTPviewItem::~NNTPviewItem() 232NNTPviewItem::~NNTPviewItem()
233{ 233{
234 delete wrapper; 234 delete wrapper;
235} 235}
236 236
237AbstractMail *NNTPviewItem::getWrapper() 237AbstractMail *NNTPviewItem::getWrapper()
238{ 238{
239 return wrapper; 239 return wrapper;
240} 240}
241 241
242void NNTPviewItem::refresh( QList<RecMail> & ) 242void NNTPviewItem::refresh( QValueList<RecMailP> & )
243{ 243{
244 refresh(); 244 refresh();
245} 245}
246 246
247void NNTPviewItem::refresh() 247void NNTPviewItem::refresh()
248{ 248{
249 if (account->getOffline()) return; 249 if (account->getOffline()) return;
250 QValueList<FolderP> *folders = wrapper->listFolders(); 250 QValueList<FolderP> *folders = wrapper->listFolders();
251 251
252 QListViewItem *child = firstChild(); 252 QListViewItem *child = firstChild();
253 while ( child ) 253 while ( child )
254 { 254 {
255 QListViewItem *tmp = child; 255 QListViewItem *tmp = child;
256 child = child->nextSibling(); 256 child = child->nextSibling();
257 delete tmp; 257 delete tmp;
258 } 258 }
259 QValueList<FolderP>::ConstIterator it; 259 QValueList<FolderP>::ConstIterator it;
260 QListViewItem*item = 0; 260 QListViewItem*item = 0;
261 for ( it = folders->begin(); it!=folders->end(); ++it) 261 for ( it = folders->begin(); it!=folders->end(); ++it)
262 { 262 {
263 item = new NNTPfolderItem( (*it), this , item ); 263 item = new NNTPfolderItem( (*it), this , item );
264 item->setSelectable( (*it)->may_select()); 264 item->setSelectable( (*it)->may_select());
265 } 265 }
266 delete folders; 266 delete folders;
267} 267}
268 268
269RecBody NNTPviewItem::fetchBody( const RecMail &mail ) 269RecBody NNTPviewItem::fetchBody( const RecMailP &mail )
270{ 270{
271 qDebug( "NNTP fetchBody" ); 271 qDebug( "NNTP fetchBody" );
272 return wrapper->fetchBody( mail ); 272 return wrapper->fetchBody( mail );
273} 273}
274 274
275QPopupMenu * NNTPviewItem::getContextMenu() 275QPopupMenu * NNTPviewItem::getContextMenu()
276{ 276{
277 QPopupMenu *m = new QPopupMenu(0); 277 QPopupMenu *m = new QPopupMenu(0);
278 if (m) 278 if (m)
279 { 279 {
280 if (!account->getOffline()) 280 if (!account->getOffline())
281 { 281 {
282 m->insertItem(QObject::tr("Disconnect",contextName),0); 282 m->insertItem(QObject::tr("Disconnect",contextName),0);
283 m->insertItem(QObject::tr("Set offline",contextName),1); 283 m->insertItem(QObject::tr("Set offline",contextName),1);
284 m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); 284 m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2);
285 } 285 }
286 else 286 else
287 { 287 {
288 m->insertItem(QObject::tr("Set online",contextName),1); 288 m->insertItem(QObject::tr("Set online",contextName),1);
289 } 289 }
290 } 290 }
291 return m; 291 return m;
292} 292}
293 293
@@ -337,55 +337,55 @@ void NNTPviewItem::contextMenuSelected(int which)
337 case 2: 337 case 2:
338 subscribeGroups(); 338 subscribeGroups();
339 break; 339 break;
340 } 340 }
341} 341}
342 342
343NNTPfolderItem::~NNTPfolderItem() 343NNTPfolderItem::~NNTPfolderItem()
344{} 344{}
345 345
346NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) 346NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after )
347 : AccountViewItem( folderInit, parent,after ) 347 : AccountViewItem( folderInit, parent,after )
348{ 348{
349 nntp = parent; 349 nntp = parent;
350 if (folder->getDisplayName().lower()!="inbox") 350 if (folder->getDisplayName().lower()!="inbox")
351 { 351 {
352 setPixmap( 0, PIXMAP_POP3FOLDER ); 352 setPixmap( 0, PIXMAP_POP3FOLDER );
353 } 353 }
354 else 354 else
355 { 355 {
356 setPixmap( 0, PIXMAP_INBOXFOLDER); 356 setPixmap( 0, PIXMAP_INBOXFOLDER);
357 } 357 }
358 setText( 0, folder->getDisplayName() ); 358 setText( 0, folder->getDisplayName() );
359} 359}
360 360
361void NNTPfolderItem::refresh(QList<RecMail>&target) 361void NNTPfolderItem::refresh(QValueList<RecMailP>&target)
362{ 362{
363 if (folder->may_select()) 363 if (folder->may_select())
364 nntp->getWrapper()->listMessages( folder->getName(),target ); 364 nntp->getWrapper()->listMessages( folder->getName(),target );
365} 365}
366 366
367RecBody NNTPfolderItem::fetchBody(const RecMail&aMail) 367RecBody NNTPfolderItem::fetchBody(const RecMailP&aMail)
368{ 368{
369 return nntp->getWrapper()->fetchBody(aMail); 369 return nntp->getWrapper()->fetchBody(aMail);
370} 370}
371 371
372QPopupMenu * NNTPfolderItem::getContextMenu() 372QPopupMenu * NNTPfolderItem::getContextMenu()
373{ 373{
374 QPopupMenu *m = new QPopupMenu(0); 374 QPopupMenu *m = new QPopupMenu(0);
375 if (m) 375 if (m)
376 { 376 {
377 m->insertItem(QObject::tr("Refresh header list",contextName),0); 377 m->insertItem(QObject::tr("Refresh header list",contextName),0);
378 m->insertItem(QObject::tr("Copy all postings",contextName),1); 378 m->insertItem(QObject::tr("Copy all postings",contextName),1);
379 } 379 }
380 return m; 380 return m;
381} 381}
382 382
383void NNTPfolderItem::downloadMails() 383void NNTPfolderItem::downloadMails()
384{ 384{
385 AccountView*bl = nntp->accountView(); 385 AccountView*bl = nntp->accountView();
386 if (!bl) return; 386 if (!bl) return;
387 bl->downloadMails(folder,nntp->getWrapper()); 387 bl->downloadMails(folder,nntp->getWrapper());
388} 388}
389 389
390void NNTPfolderItem::contextMenuSelected(int which) 390void NNTPfolderItem::contextMenuSelected(int which)
391{ 391{
@@ -407,49 +407,49 @@ void NNTPfolderItem::contextMenuSelected(int which)
407 407
408/** 408/**
409 * IMAP Account stuff 409 * IMAP Account stuff
410 */ 410 */
411IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) 411IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
412 : AccountViewItem( parent ) 412 : AccountViewItem( parent )
413{ 413{
414 account = a; 414 account = a;
415 wrapper = AbstractMail::getWrapper( account ); 415 wrapper = AbstractMail::getWrapper( account );
416 SETPIX(PIXMAP_IMAPFOLDER); 416 SETPIX(PIXMAP_IMAPFOLDER);
417 setText( 0, account->getAccountName() ); 417 setText( 0, account->getAccountName() );
418 setOpen( true ); 418 setOpen( true );
419} 419}
420 420
421IMAPviewItem::~IMAPviewItem() 421IMAPviewItem::~IMAPviewItem()
422{ 422{
423 delete wrapper; 423 delete wrapper;
424} 424}
425 425
426AbstractMail *IMAPviewItem::getWrapper() 426AbstractMail *IMAPviewItem::getWrapper()
427{ 427{
428 return wrapper; 428 return wrapper;
429} 429}
430 430
431void IMAPviewItem::refresh(QList<RecMail>&) 431void IMAPviewItem::refresh(QValueList<RecMailP>&)
432{ 432{
433 refreshFolders(false); 433 refreshFolders(false);
434} 434}
435 435
436const QStringList&IMAPviewItem::subFolders() 436const QStringList&IMAPviewItem::subFolders()
437{ 437{
438 return currentFolders; 438 return currentFolders;
439} 439}
440 440
441void IMAPviewItem::refreshFolders(bool force) 441void IMAPviewItem::refreshFolders(bool force)
442{ 442{
443 if (childCount()>0 && force==false) return; 443 if (childCount()>0 && force==false) return;
444 if (account->getOffline()) return; 444 if (account->getOffline()) return;
445 445
446 removeChilds(); 446 removeChilds();
447 currentFolders.clear(); 447 currentFolders.clear();
448 QValueList<FolderP> * folders = wrapper->listFolders(); 448 QValueList<FolderP> * folders = wrapper->listFolders();
449 449
450 QValueList<FolderP>::Iterator it; 450 QValueList<FolderP>::Iterator it;
451 QListViewItem*item = 0; 451 QListViewItem*item = 0;
452 QListViewItem*titem = 0; 452 QListViewItem*titem = 0;
453 QString fname,del,search; 453 QString fname,del,search;
454 int pos; 454 int pos;
455 455
@@ -540,109 +540,109 @@ void IMAPviewItem::contextMenuSelected(int id)
540 break; 540 break;
541 case 1: 541 case 1:
542 createNewFolder(); 542 createNewFolder();
543 break; 543 break;
544 case 2: 544 case 2:
545 removeChilds(); 545 removeChilds();
546 wrapper->logout(); 546 wrapper->logout();
547 break; 547 break;
548 case 3: 548 case 3:
549 if (account->getOffline()==false) 549 if (account->getOffline()==false)
550 { 550 {
551 removeChilds(); 551 removeChilds();
552 wrapper->logout(); 552 wrapper->logout();
553 } 553 }
554 account->setOffline(!account->getOffline()); 554 account->setOffline(!account->getOffline());
555 account->save(); 555 account->save();
556 SETPIX(PIXMAP_IMAPFOLDER); 556 SETPIX(PIXMAP_IMAPFOLDER);
557 refreshFolders(false); 557 refreshFolders(false);
558 break; 558 break;
559 default: 559 default:
560 break; 560 break;
561 } 561 }
562} 562}
563 563
564RecBody IMAPviewItem::fetchBody(const RecMail&) 564RecBody IMAPviewItem::fetchBody(const RecMailP&)
565{ 565{
566 return RecBody(); 566 return RecBody();
567} 567}
568 568
569bool IMAPviewItem::offline() 569bool IMAPviewItem::offline()
570{ 570{
571 return account->getOffline(); 571 return account->getOffline();
572} 572}
573 573
574IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) 574IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after )
575 : AccountViewItem( folderInit, parent , after ) 575 : AccountViewItem( folderInit, parent , after )
576{ 576{
577 imap = parent; 577 imap = parent;
578 if (folder->getDisplayName().lower()!="inbox") 578 if (folder->getDisplayName().lower()!="inbox")
579 { 579 {
580 setPixmap( 0, PIXMAP_IMAPFOLDER ); 580 setPixmap( 0, PIXMAP_IMAPFOLDER );
581 } 581 }
582 else 582 else
583 { 583 {
584 setPixmap( 0, PIXMAP_INBOXFOLDER); 584 setPixmap( 0, PIXMAP_INBOXFOLDER);
585 } 585 }
586 setText( 0, folder->getDisplayName() ); 586 setText( 0, folder->getDisplayName() );
587} 587}
588 588
589IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) 589IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master )
590 : AccountViewItem(folderInit, parent,after ) 590 : AccountViewItem(folderInit, parent,after )
591{ 591{
592 imap = master; 592 imap = master;
593 if (folder->getDisplayName().lower()!="inbox") 593 if (folder->getDisplayName().lower()!="inbox")
594 { 594 {
595 setPixmap( 0, PIXMAP_IMAPFOLDER ); 595 setPixmap( 0, PIXMAP_IMAPFOLDER );
596 } 596 }
597 else 597 else
598 { 598 {
599 setPixmap( 0, PIXMAP_INBOXFOLDER); 599 setPixmap( 0, PIXMAP_INBOXFOLDER);
600 } 600 }
601 setText( 0, folder->getDisplayName() ); 601 setText( 0, folder->getDisplayName() );
602} 602}
603 603
604IMAPfolderItem::~IMAPfolderItem() 604IMAPfolderItem::~IMAPfolderItem()
605{} 605{}
606 606
607const QString& IMAPfolderItem::Delemiter()const 607const QString& IMAPfolderItem::Delemiter()const
608{ 608{
609 return folder->Separator(); 609 return folder->Separator();
610} 610}
611 611
612void IMAPfolderItem::refresh(QList<RecMail>&target) 612void IMAPfolderItem::refresh(QValueList<RecMailP>&target)
613{ 613{
614 if (folder->may_select()) 614 if (folder->may_select())
615 { 615 {
616 imap->getWrapper()->listMessages( folder->getName(),target ); 616 imap->getWrapper()->listMessages( folder->getName(),target );
617 } 617 }
618 else 618 else
619 { 619 {
620 target.clear(); 620 target.clear();
621 } 621 }
622} 622}
623 623
624RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) 624RecBody IMAPfolderItem::fetchBody(const RecMailP&aMail)
625{ 625{
626 return imap->getWrapper()->fetchBody(aMail); 626 return imap->getWrapper()->fetchBody(aMail);
627} 627}
628 628
629QPopupMenu * IMAPfolderItem::getContextMenu() 629QPopupMenu * IMAPfolderItem::getContextMenu()
630{ 630{
631 QPopupMenu *m = new QPopupMenu(0); 631 QPopupMenu *m = new QPopupMenu(0);
632 if (m) 632 if (m)
633 { 633 {
634 if (folder->may_select()) 634 if (folder->may_select())
635 { 635 {
636 m->insertItem(QObject::tr("Refresh header list",contextName),0); 636 m->insertItem(QObject::tr("Refresh header list",contextName),0);
637 m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); 637 m->insertItem(QObject::tr("Move/Copie all mails",contextName),4);
638 m->insertItem(QObject::tr("Delete all mails",contextName),1); 638 m->insertItem(QObject::tr("Delete all mails",contextName),1);
639 } 639 }
640 if (folder->no_inferior()==false) 640 if (folder->no_inferior()==false)
641 { 641 {
642 m->insertItem(QObject::tr("Create new subfolder",contextName),2); 642 m->insertItem(QObject::tr("Create new subfolder",contextName),2);
643 } 643 }
644 if (folder->getDisplayName().lower()!="inbox") 644 if (folder->getDisplayName().lower()!="inbox")
645 { 645 {
646 m->insertItem(QObject::tr("Delete folder",contextName),3); 646 m->insertItem(QObject::tr("Delete folder",contextName),3);
647 } 647 }
648 } 648 }
@@ -727,49 +727,49 @@ void IMAPfolderItem::contextMenuSelected(int id)
727/* MH is a little bit different - the top folder can contains messages other than in IMAP and 727/* MH is a little bit different - the top folder can contains messages other than in IMAP and
728 POP3 and MBOX */ 728 POP3 and MBOX */
729MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) 729MHviewItem::MHviewItem( const QString&aPath, AccountView *parent )
730 : AccountViewItem( parent ) 730 : AccountViewItem( parent )
731{ 731{
732 m_Path = aPath; 732 m_Path = aPath;
733 /* be carefull - the space within settext is wanted - thats why the string twice */ 733 /* be carefull - the space within settext is wanted - thats why the string twice */
734 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); 734 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders");
735 setPixmap( 0, PIXMAP_LOCALFOLDER ); 735 setPixmap( 0, PIXMAP_LOCALFOLDER );
736 setText( 0, " Local Folders" ); 736 setText( 0, " Local Folders" );
737 setOpen( true ); 737 setOpen( true );
738 folder = 0; 738 folder = 0;
739} 739}
740 740
741MHviewItem::~MHviewItem() 741MHviewItem::~MHviewItem()
742{ 742{
743 delete wrapper; 743 delete wrapper;
744} 744}
745 745
746AbstractMail *MHviewItem::getWrapper() 746AbstractMail *MHviewItem::getWrapper()
747{ 747{
748 return wrapper; 748 return wrapper;
749} 749}
750 750
751void MHviewItem::refresh( QList<RecMail> & target) 751void MHviewItem::refresh( QValueList<RecMailP> & target)
752{ 752{
753 refresh(false); 753 refresh(false);
754 getWrapper()->listMessages( "",target ); 754 getWrapper()->listMessages( "",target );
755} 755}
756 756
757void MHviewItem::refresh(bool force) 757void MHviewItem::refresh(bool force)
758{ 758{
759 if (childCount()>0 && force==false) return; 759 if (childCount()>0 && force==false) return;
760 removeChilds(); 760 removeChilds();
761 currentFolders.clear(); 761 currentFolders.clear();
762 QValueList<FolderP> *folders = wrapper->listFolders(); 762 QValueList<FolderP> *folders = wrapper->listFolders();
763 QValueList<FolderP>::ConstIterator it; 763 QValueList<FolderP>::ConstIterator it;
764 MHfolderItem*item = 0; 764 MHfolderItem*item = 0;
765 MHfolderItem*pmaster = 0; 765 MHfolderItem*pmaster = 0;
766 QString fname = ""; 766 QString fname = "";
767 int pos; 767 int pos;
768 for ( it = folders->begin(); it!=folders->end(); ++it) 768 for ( it = folders->begin(); it!=folders->end(); ++it)
769 { 769 {
770 fname = (*it)->getDisplayName(); 770 fname = (*it)->getDisplayName();
771 /* this folder itself */ 771 /* this folder itself */
772 if (fname=="/") 772 if (fname=="/")
773 { 773 {
774 currentFolders.append(fname); 774 currentFolders.append(fname);
775 folder = (*it); 775 folder = (*it);
@@ -778,49 +778,49 @@ void MHviewItem::refresh(bool force)
778 currentFolders.append(fname); 778 currentFolders.append(fname);
779 pos = fname.findRev("/"); 779 pos = fname.findRev("/");
780 if (pos > 0) 780 if (pos > 0)
781 { 781 {
782 fname = fname.left(pos); 782 fname = fname.left(pos);
783 pmaster = (MHfolderItem*)findSubItem(fname); 783 pmaster = (MHfolderItem*)findSubItem(fname);
784 } 784 }
785 else 785 else
786 { 786 {
787 pmaster = 0; 787 pmaster = 0;
788 } 788 }
789 if (pmaster) 789 if (pmaster)
790 { 790 {
791 item = new MHfolderItem( (*it), pmaster, item, this ); 791 item = new MHfolderItem( (*it), pmaster, item, this );
792 } 792 }
793 else 793 else
794 { 794 {
795 item = new MHfolderItem( (*it), this , item ); 795 item = new MHfolderItem( (*it), this , item );
796 } 796 }
797 item->setSelectable((*it)->may_select()); 797 item->setSelectable((*it)->may_select());
798 } 798 }
799 delete folders; 799 delete folders;
800} 800}
801 801
802RecBody MHviewItem::fetchBody( const RecMail &mail ) 802RecBody MHviewItem::fetchBody( const RecMailP &mail )
803{ 803{
804 qDebug( "MH fetchBody" ); 804 qDebug( "MH fetchBody" );
805 return wrapper->fetchBody( mail ); 805 return wrapper->fetchBody( mail );
806} 806}
807 807
808QPopupMenu * MHviewItem::getContextMenu() 808QPopupMenu * MHviewItem::getContextMenu()
809{ 809{
810 QPopupMenu *m = new QPopupMenu(0); 810 QPopupMenu *m = new QPopupMenu(0);
811 if (m) 811 if (m)
812 { 812 {
813 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 813 m->insertItem(QObject::tr("Refresh folder list",contextName),0);
814 m->insertItem(QObject::tr("Create new folder",contextName),1); 814 m->insertItem(QObject::tr("Create new folder",contextName),1);
815 m->insertItem(QObject::tr("Delete all mails",contextName),2); 815 m->insertItem(QObject::tr("Delete all mails",contextName),2);
816 m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); 816 m->insertItem(QObject::tr("Move/Copie all mails",contextName),3);
817 } 817 }
818 return m; 818 return m;
819} 819}
820 820
821void MHviewItem::createFolder() 821void MHviewItem::createFolder()
822{ 822{
823 Newmdirdlg ndirdlg(0,0,true); 823 Newmdirdlg ndirdlg(0,0,true);
824 if ( QPEApplication::execDialog( &ndirdlg ) ) 824 if ( QPEApplication::execDialog( &ndirdlg ) )
825 { 825 {
826 QString ndir = ndirdlg.Newdir(); 826 QString ndir = ndirdlg.Newdir();
@@ -893,55 +893,55 @@ void MHfolderItem::initName()
893 if (pos > 0) 893 if (pos > 0)
894 { 894 {
895 bName.replace(0,pos+1,""); 895 bName.replace(0,pos+1,"");
896 } 896 }
897 if (bName.lower() == "outgoing") 897 if (bName.lower() == "outgoing")
898 { 898 {
899 setPixmap( 0, PIXMAP_OUTBOXFOLDER ); 899 setPixmap( 0, PIXMAP_OUTBOXFOLDER );
900 } 900 }
901 else if (bName.lower() == "inbox") 901 else if (bName.lower() == "inbox")
902 { 902 {
903 setPixmap( 0, PIXMAP_INBOXFOLDER); 903 setPixmap( 0, PIXMAP_INBOXFOLDER);
904 } else if (bName.lower() == "drafts") { 904 } else if (bName.lower() == "drafts") {
905 setPixmap(0, Resource::loadPixmap("inline/edit")); 905 setPixmap(0, Resource::loadPixmap("inline/edit"));
906 } else { 906 } else {
907 setPixmap( 0, PIXMAP_MBOXFOLDER ); 907 setPixmap( 0, PIXMAP_MBOXFOLDER );
908 } 908 }
909 setText( 0, bName ); 909 setText( 0, bName );
910} 910}
911 911
912const FolderP&MHfolderItem::getFolder()const 912const FolderP&MHfolderItem::getFolder()const
913{ 913{
914 return folder; 914 return folder;
915} 915}
916 916
917void MHfolderItem::refresh(QList<RecMail>&target) 917void MHfolderItem::refresh(QValueList<RecMailP>&target)
918{ 918{
919 if (folder->may_select()) 919 if (folder->may_select())
920 mbox->getWrapper()->listMessages( folder->getName(),target ); 920 mbox->getWrapper()->listMessages( folder->getName(),target );
921} 921}
922 922
923RecBody MHfolderItem::fetchBody(const RecMail&aMail) 923RecBody MHfolderItem::fetchBody(const RecMailP&aMail)
924{ 924{
925 return mbox->getWrapper()->fetchBody(aMail); 925 return mbox->getWrapper()->fetchBody(aMail);
926} 926}
927 927
928void MHfolderItem::deleteFolder() 928void MHfolderItem::deleteFolder()
929{ 929{
930 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 930 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
931 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 931 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
932 QObject::tr("Yes",contextName), 932 QObject::tr("Yes",contextName),
933 QObject::tr("No",contextName),QString::null,1,1); 933 QObject::tr("No",contextName),QString::null,1,1);
934 qDebug("Auswahl: %i",yesno); 934 qDebug("Auswahl: %i",yesno);
935 if (yesno == 0) 935 if (yesno == 0)
936 { 936 {
937 if (mbox->getWrapper()->deleteMbox(folder)) 937 if (mbox->getWrapper()->deleteMbox(folder))
938 { 938 {
939 QListView*v=listView(); 939 QListView*v=listView();
940 MHviewItem * box = mbox; 940 MHviewItem * box = mbox;
941 /* be carefull - after that this object is destroyd so don't use 941 /* be carefull - after that this object is destroyd so don't use
942 * any member of it after that call!!*/ 942 * any member of it after that call!!*/
943 mbox->refresh(true); 943 mbox->refresh(true);
944 if (v) 944 if (v)
945 { 945 {
946 v->setSelected(box,true); 946 v->setSelected(box,true);
947 } 947 }
@@ -1021,49 +1021,49 @@ bool MHfolderItem::isDraftfolder()
1021 * Generic stuff 1021 * Generic stuff
1022 */ 1022 */
1023 1023
1024const QString AccountViewItem::contextName="AccountViewItem"; 1024const QString AccountViewItem::contextName="AccountViewItem";
1025 1025
1026AccountViewItem::AccountViewItem( AccountView *parent ) 1026AccountViewItem::AccountViewItem( AccountView *parent )
1027 : QListViewItem( parent ) 1027 : QListViewItem( parent )
1028{ 1028{
1029 init(); 1029 init();
1030 m_Backlink = parent; 1030 m_Backlink = parent;
1031} 1031}
1032 1032
1033AccountViewItem::AccountViewItem( QListViewItem *parent) 1033AccountViewItem::AccountViewItem( QListViewItem *parent)
1034 : QListViewItem( parent),folder(0) 1034 : QListViewItem( parent),folder(0)
1035{ 1035{
1036 init(); 1036 init();
1037} 1037}
1038 1038
1039AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) 1039AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
1040 :QListViewItem( parent,after ),folder(0) 1040 :QListViewItem( parent,after ),folder(0)
1041{ 1041{
1042 init(); 1042 init();
1043} 1043}
1044 1044
1045AccountViewItem::AccountViewItem( const Opie::osmart_pointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) 1045AccountViewItem::AccountViewItem( const Opie::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after )
1046 :QListViewItem( parent,after ),folder(folderInit) 1046 :QListViewItem( parent,after ),folder(folderInit)
1047{ 1047{
1048 init(); 1048 init();
1049} 1049}
1050 1050
1051void AccountViewItem::init() 1051void AccountViewItem::init()
1052{ 1052{
1053 m_Backlink = 0; 1053 m_Backlink = 0;
1054} 1054}
1055 1055
1056AccountViewItem::~AccountViewItem() 1056AccountViewItem::~AccountViewItem()
1057{ 1057{
1058 folder = 0; 1058 folder = 0;
1059} 1059}
1060 1060
1061AccountView*AccountViewItem::accountView() 1061AccountView*AccountViewItem::accountView()
1062{ 1062{
1063 return m_Backlink; 1063 return m_Backlink;
1064} 1064}
1065 1065
1066void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) 1066void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
1067{ 1067{
1068 if (!wrapper) return; 1068 if (!wrapper) return;
1069 QString fname=""; 1069 QString fname="";
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h
index 8f712f5..276eae0 100644
--- a/noncore/net/mail/accountitem.h
+++ b/noncore/net/mail/accountitem.h
@@ -1,210 +1,210 @@
1#ifndef __ACCOUNT_ITEM 1#ifndef __ACCOUNT_ITEM
2#define __ACCOUNT_ITEM 2#define __ACCOUNT_ITEM
3 3
4#include <qlistview.h> 4#include <qlistview.h>
5#include <qlist.h> 5#include <qlist.h>
6#include <opie2/osmart_pointer.h> 6#include <opie2/osmartpointer.h>
7 7
8class POP3wrapper; 8class POP3wrapper;
9class RecMail; 9class RecMail;
10class RecBody; 10class RecBody;
11class QPopupMenu; 11class QPopupMenu;
12class Selectstore; 12class Selectstore;
13class AccountView; 13class AccountView;
14class POP3account; 14class POP3account;
15class NNTPaccount; 15class NNTPaccount;
16class IMAPaccount; 16class IMAPaccount;
17class AbstractMail; 17class AbstractMail;
18class Folder; 18class Folder;
19 19
20class AccountViewItem : public QListViewItem 20class AccountViewItem : public QListViewItem
21{ 21{
22 22
23public: 23public:
24 AccountViewItem( AccountView *parent ); 24 AccountViewItem( AccountView *parent );
25 AccountViewItem( QListViewItem *parent); 25 AccountViewItem( QListViewItem *parent);
26 AccountViewItem( QListViewItem *parent , QListViewItem*after ); 26 AccountViewItem( QListViewItem *parent , QListViewItem*after );
27 AccountViewItem( const Opie::osmart_pointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); 27 AccountViewItem( const Opie::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after );
28 28
29 virtual ~AccountViewItem(); 29 virtual ~AccountViewItem();
30 virtual void refresh(QList<RecMail>&)=0; 30 virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&)=0;
31 virtual RecBody fetchBody(const RecMail&)=0; 31 virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&)=0;
32 virtual QPopupMenu * getContextMenu(){return 0;}; 32 virtual QPopupMenu * getContextMenu(){return 0;};
33 virtual void contextMenuSelected(int){} 33 virtual void contextMenuSelected(int){}
34 virtual AccountView*accountView(); 34 virtual AccountView*accountView();
35 virtual bool matchName(const QString&name)const; 35 virtual bool matchName(const QString&name)const;
36 virtual bool isDraftfolder(); 36 virtual bool isDraftfolder();
37 37
38protected: 38protected:
39 AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); 39 AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0);
40 virtual void init(); 40 virtual void init();
41 virtual void removeChilds(); 41 virtual void removeChilds();
42 virtual void deleteAllMail(AbstractMail*wrapper,const Opie::osmart_pointer<Folder>&f); 42 virtual void deleteAllMail(AbstractMail*wrapper,const Opie::OSmartPointer<Folder>&f);
43 static const QString contextName; 43 static const QString contextName;
44 AccountView*m_Backlink; 44 AccountView*m_Backlink;
45 Opie::osmart_pointer<Folder> folder; 45 Opie::OSmartPointer<Folder> folder;
46}; 46};
47 47
48class POP3viewItem : public AccountViewItem 48class POP3viewItem : public AccountViewItem
49{ 49{
50 50
51public: 51public:
52 POP3viewItem( POP3account *a, AccountView *parent ); 52 POP3viewItem( POP3account *a, AccountView *parent );
53 virtual ~POP3viewItem(); 53 virtual ~POP3viewItem();
54 virtual void refresh( QList<RecMail> &target ); 54 virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&target );
55 virtual RecBody fetchBody( const RecMail &mail ); 55 virtual RecBody fetchBody( const Opie::OSmartPointer<RecMail> &mail );
56 AbstractMail *getWrapper(); 56 AbstractMail *getWrapper();
57 virtual QPopupMenu * getContextMenu(); 57 virtual QPopupMenu * getContextMenu();
58 virtual void contextMenuSelected(int); 58 virtual void contextMenuSelected(int);
59 59
60protected: 60protected:
61 POP3account *account; 61 POP3account *account;
62 virtual void refresh(); 62 virtual void refresh();
63 AbstractMail *wrapper; 63 AbstractMail *wrapper;
64 void disconnect(); 64 void disconnect();
65 void setOnOffline(); 65 void setOnOffline();
66}; 66};
67 67
68class POP3folderItem : public AccountViewItem 68class POP3folderItem : public AccountViewItem
69{ 69{
70 70
71public: 71public:
72 POP3folderItem( const Opie::osmart_pointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); 72 POP3folderItem( const Opie::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after );
73 virtual ~POP3folderItem(); 73 virtual ~POP3folderItem();
74 virtual void refresh(QList<RecMail>&); 74 virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&);
75 virtual RecBody fetchBody(const RecMail&); 75 virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&);
76 virtual QPopupMenu * getContextMenu(); 76 virtual QPopupMenu * getContextMenu();
77 virtual void contextMenuSelected(int); 77 virtual void contextMenuSelected(int);
78 78
79protected: 79protected:
80 void downloadMails(); 80 void downloadMails();
81 POP3viewItem *pop3; 81 POP3viewItem *pop3;
82}; 82};
83 83
84 84
85class NNTPviewItem : public AccountViewItem 85class NNTPviewItem : public AccountViewItem
86{ 86{
87 87
88public: 88public:
89 NNTPviewItem( NNTPaccount *a, AccountView *parent ); 89 NNTPviewItem( NNTPaccount *a, AccountView *parent );
90 virtual ~NNTPviewItem(); 90 virtual ~NNTPviewItem();
91 virtual void refresh( QList<RecMail> &target ); 91 virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&target );
92 virtual RecBody fetchBody( const RecMail &mail ); 92 virtual RecBody fetchBody( const Opie::OSmartPointer<RecMail> &mail );
93 AbstractMail *getWrapper(); 93 AbstractMail *getWrapper();
94 virtual QPopupMenu * getContextMenu(); 94 virtual QPopupMenu * getContextMenu();
95 virtual void contextMenuSelected(int); 95 virtual void contextMenuSelected(int);
96 96
97protected: 97protected:
98 NNTPaccount *account; 98 NNTPaccount *account;
99 virtual void refresh(); 99 virtual void refresh();
100 AbstractMail *wrapper; 100 AbstractMail *wrapper;
101 void disconnect(); 101 void disconnect();
102 void setOnOffline(); 102 void setOnOffline();
103 void subscribeGroups(); 103 void subscribeGroups();
104}; 104};
105 105
106class NNTPfolderItem : public AccountViewItem 106class NNTPfolderItem : public AccountViewItem
107{ 107{
108 108
109public: 109public:
110 NNTPfolderItem(const Opie::osmart_pointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); 110 NNTPfolderItem(const Opie::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after );
111 virtual ~NNTPfolderItem(); 111 virtual ~NNTPfolderItem();
112 virtual void refresh(QList<RecMail>&); 112 virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&);
113 virtual RecBody fetchBody(const RecMail&); 113 virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&);
114 virtual QPopupMenu * getContextMenu(); 114 virtual QPopupMenu * getContextMenu();
115 virtual void contextMenuSelected(int); 115 virtual void contextMenuSelected(int);
116 116
117protected: 117protected:
118 void downloadMails(); 118 void downloadMails();
119 NNTPviewItem *nntp; 119 NNTPviewItem *nntp;
120}; 120};
121 121
122 122
123 123
124class IMAPviewItem : public AccountViewItem 124class IMAPviewItem : public AccountViewItem
125{ 125{
126 friend class IMAPfolderItem; 126 friend class IMAPfolderItem;
127public: 127public:
128 IMAPviewItem( IMAPaccount *a, AccountView *parent ); 128 IMAPviewItem( IMAPaccount *a, AccountView *parent );
129 virtual ~IMAPviewItem(); 129 virtual ~IMAPviewItem();
130 virtual void refresh(QList<RecMail>&); 130 virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&);
131 virtual RecBody fetchBody(const RecMail&); 131 virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&);
132 AbstractMail *getWrapper(); 132 AbstractMail *getWrapper();
133 virtual QPopupMenu * getContextMenu(); 133 virtual QPopupMenu * getContextMenu();
134 virtual void contextMenuSelected(int); 134 virtual void contextMenuSelected(int);
135 const QStringList&subFolders(); 135 const QStringList&subFolders();
136 virtual void refreshFolders(bool force=false); 136 virtual void refreshFolders(bool force=false);
137 bool offline(); 137 bool offline();
138 138
139protected: 139protected:
140 virtual void createNewFolder(); 140 virtual void createNewFolder();
141 IMAPaccount *account; 141 IMAPaccount *account;
142 AbstractMail *wrapper; 142 AbstractMail *wrapper;
143 QStringList currentFolders; 143 QStringList currentFolders;
144}; 144};
145 145
146class IMAPfolderItem : public AccountViewItem 146class IMAPfolderItem : public AccountViewItem
147{ 147{
148 148
149public: 149public:
150 IMAPfolderItem( const Opie::osmart_pointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); 150 IMAPfolderItem( const Opie::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after );
151 IMAPfolderItem( const Opie::osmart_pointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); 151 IMAPfolderItem( const Opie::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master );
152 virtual ~IMAPfolderItem(); 152 virtual ~IMAPfolderItem();
153 virtual void refresh(QList<RecMail>&); 153 virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&);
154 virtual RecBody fetchBody(const RecMail&); 154 virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&);
155 virtual QPopupMenu * getContextMenu(); 155 virtual QPopupMenu * getContextMenu();
156 virtual void contextMenuSelected(int); 156 virtual void contextMenuSelected(int);
157 virtual const QString& Delemiter()const; 157 virtual const QString& Delemiter()const;
158protected: 158protected:
159 virtual void createNewFolder(); 159 virtual void createNewFolder();
160 virtual void deleteFolder(); 160 virtual void deleteFolder();
161 virtual void downloadMails(); 161 virtual void downloadMails();
162 IMAPviewItem *imap; 162 IMAPviewItem *imap;
163}; 163};
164 164
165class MHviewItem : public AccountViewItem 165class MHviewItem : public AccountViewItem
166{ 166{
167 friend class MHfolderItem; 167 friend class MHfolderItem;
168 168
169public: 169public:
170 MHviewItem( const QString&aMboxPath, AccountView *parent ); 170 MHviewItem( const QString&aMboxPath, AccountView *parent );
171 virtual ~MHviewItem(); 171 virtual ~MHviewItem();
172 virtual void refresh( QList<RecMail> &target ); 172 virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&target );
173 virtual RecBody fetchBody( const RecMail &mail ); 173 virtual RecBody fetchBody( const Opie::OSmartPointer<RecMail> &mail );
174 AbstractMail *getWrapper(); 174 AbstractMail *getWrapper();
175 virtual QPopupMenu * getContextMenu(); 175 virtual QPopupMenu * getContextMenu();
176 virtual void contextMenuSelected(int); 176 virtual void contextMenuSelected(int);
177 QStringList subFolders(); 177 QStringList subFolders();
178 virtual void refresh(bool force=false); 178 virtual void refresh(bool force=false);
179 179
180protected: 180protected:
181 void downloadMails(); 181 void downloadMails();
182 virtual void createFolder(); 182 virtual void createFolder();
183 QString m_Path; 183 QString m_Path;
184 AbstractMail *wrapper; 184 AbstractMail *wrapper;
185 QStringList currentFolders; 185 QStringList currentFolders;
186}; 186};
187 187
188class MHfolderItem : public AccountViewItem 188class MHfolderItem : public AccountViewItem
189{ 189{
190 190
191public: 191public:
192 MHfolderItem( const Opie::osmart_pointer<Folder>&folder, MHviewItem *parent , QListViewItem*after ); 192 MHfolderItem( const Opie::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after );
193 MHfolderItem( const Opie::osmart_pointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); 193 MHfolderItem( const Opie::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master);
194 virtual ~MHfolderItem(); 194 virtual ~MHfolderItem();
195 virtual void refresh(QList<RecMail>&); 195 virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&);
196 virtual RecBody fetchBody(const RecMail&); 196 virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&);
197 virtual QPopupMenu * getContextMenu(); 197 virtual QPopupMenu * getContextMenu();
198 virtual void contextMenuSelected(int); 198 virtual void contextMenuSelected(int);
199 virtual const Opie::osmart_pointer<Folder>&getFolder()const; 199 virtual const Opie::OSmartPointer<Folder>&getFolder()const;
200 virtual bool isDraftfolder(); 200 virtual bool isDraftfolder();
201 201
202protected: 202protected:
203 void downloadMails(); 203 void downloadMails();
204 virtual void createFolder(); 204 virtual void createFolder();
205 virtual void deleteFolder(); 205 virtual void deleteFolder();
206 void initName(); 206 void initName();
207 MHviewItem *mbox; 207 MHviewItem *mbox;
208}; 208};
209 209
210#endif 210#endif
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 297f553..26107ff 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -71,72 +71,70 @@ void AccountView::populate( QList<Account> list )
71 else if ( it->getType() == MAILLIB::A_POP3 ) 71 else if ( it->getType() == MAILLIB::A_POP3 )
72 { 72 {
73 POP3account *pop3 = static_cast<POP3account *>(it); 73 POP3account *pop3 = static_cast<POP3account *>(it);
74 qDebug( "added POP3 " + pop3->getAccountName() ); 74 qDebug( "added POP3 " + pop3->getAccountName() );
75 /* must not be hold 'cause it isn't required */ 75 /* must not be hold 'cause it isn't required */
76 (void) new POP3viewItem( pop3, this ); 76 (void) new POP3viewItem( pop3, this );
77 } 77 }
78 else if ( it->getType() == MAILLIB::A_NNTP ) 78 else if ( it->getType() == MAILLIB::A_NNTP )
79 { 79 {
80 NNTPaccount *nntp = static_cast<NNTPaccount *>(it); 80 NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
81 qDebug( "added NNTP " + nntp->getAccountName() ); 81 qDebug( "added NNTP " + nntp->getAccountName() );
82 /* must not be hold 'cause it isn't required */ 82 /* must not be hold 'cause it isn't required */
83 (void) new NNTPviewItem( nntp, this ); 83 (void) new NNTPviewItem( nntp, this );
84 } 84 }
85 } 85 }
86} 86}
87 87
88void AccountView::refresh(QListViewItem *item) 88void AccountView::refresh(QListViewItem *item)
89{ 89{
90 90
91 qDebug("AccountView refresh..."); 91 qDebug("AccountView refresh...");
92 if ( item ) 92 if ( item )
93 { 93 {
94 m_currentItem = item; 94 m_currentItem = item;
95 QList<RecMail> headerlist; 95 QValueList<RecMailP> headerlist;
96 headerlist.setAutoDelete(true);
97 AccountViewItem *view = static_cast<AccountViewItem *>(item); 96 AccountViewItem *view = static_cast<AccountViewItem *>(item);
98 view->refresh(headerlist); 97 view->refresh(headerlist);
99 emit refreshMailview(&headerlist); 98 emit refreshMailview(headerlist);
100 } 99 }
101} 100}
102 101
103void AccountView::refreshCurrent() 102void AccountView::refreshCurrent()
104{ 103{
105 m_currentItem = currentItem(); 104 m_currentItem = currentItem();
106 if ( !m_currentItem ) return; 105 if ( !m_currentItem ) return;
107 QList<RecMail> headerlist; 106 QValueList<RecMailP> headerlist;
108 headerlist.setAutoDelete(true);
109 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 107 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
110 view->refresh(headerlist); 108 view->refresh(headerlist);
111 emit refreshMailview(&headerlist); 109 emit refreshMailview(headerlist);
112} 110}
113 111
114void AccountView::refreshAll() 112void AccountView::refreshAll()
115{ 113{
116} 114}
117 115
118RecBody AccountView::fetchBody(const RecMail&aMail) 116RecBody AccountView::fetchBody(const RecMailP&aMail)
119{ 117{
120 QListViewItem*item = selectedItem (); 118 QListViewItem*item = selectedItem ();
121 if (!item) return RecBody(); 119 if (!item) return RecBody();
122 AccountViewItem *view = static_cast<AccountViewItem *>(item); 120 AccountViewItem *view = static_cast<AccountViewItem *>(item);
123 return view->fetchBody(aMail); 121 return view->fetchBody(aMail);
124} 122}
125 123
126void AccountView::setupFolderselect(Selectstore*sels) 124void AccountView::setupFolderselect(Selectstore*sels)
127{ 125{
128 QPEApplication::showDialog( sels ); 126 QPEApplication::showDialog( sels );
129 QStringList sFolders; 127 QStringList sFolders;
130 unsigned int i = 0; 128 unsigned int i = 0;
131 for (i=0; i < mhAccounts.count();++i) 129 for (i=0; i < mhAccounts.count();++i)
132 { 130 {
133 mhAccounts[i]->refresh(false); 131 mhAccounts[i]->refresh(false);
134 sFolders = mhAccounts[i]->subFolders(); 132 sFolders = mhAccounts[i]->subFolders();
135 sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); 133 sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders);
136 } 134 }
137 for (i=0; i < imapAccounts.count();++i) 135 for (i=0; i < imapAccounts.count();++i)
138 { 136 {
139 if (imapAccounts[i]->offline()) 137 if (imapAccounts[i]->offline())
140 continue; 138 continue;
141 imapAccounts[i]->refreshFolders(false); 139 imapAccounts[i]->refreshFolders(false);
142 sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); 140 sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders());
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 3478c0b..d236058 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -1,46 +1,45 @@
1#ifndef ACCOUNTVIEW_H 1#ifndef ACCOUNTVIEW_H
2#define ACCOUNTVIEW_H 2#define ACCOUNTVIEW_H
3 3
4#include <qlistview.h> 4#include <qlistview.h>
5#include <qlist.h> 5#include <qlist.h>
6#include <opie2/osmart_pointer.h> 6#include <opie2/osmartpointer.h>
7#include <libmailwrapper/mailtypes.h>
7 8
8class Selectstore; 9class Selectstore;
9class RecMail;
10class RecBody;
11class Folder; 10class Folder;
12class AbstractMail; 11class AbstractMail;
13class Account; 12class Account;
14class IMAPviewItem; 13class IMAPviewItem;
15class MHviewItem; 14class MHviewItem;
16 15
17class AccountView : public QListView 16class AccountView : public QListView
18{ 17{
19 Q_OBJECT 18 Q_OBJECT
20 19
21public: 20public:
22 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 21 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
23 virtual ~AccountView(); 22 virtual ~AccountView();
24 virtual void populate( QList<Account> list ); 23 virtual void populate( QList<Account> list );
25 virtual RecBody fetchBody(const RecMail&aMail); 24 virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&aMail);
26 virtual void downloadMails(const Opie::osmart_pointer<Folder>&fromFolder,AbstractMail*fromWrapper); 25 virtual void downloadMails(const Opie::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
27 virtual bool currentisDraft(); 26 virtual bool currentisDraft();
28 27
29public slots: 28public slots:
30 virtual void refreshAll(); 29 virtual void refreshAll();
31 virtual void refresh(QListViewItem *item); 30 virtual void refresh(QListViewItem *item);
32 virtual void refreshCurrent(); 31 virtual void refreshCurrent();
33 virtual void slotHold(int, QListViewItem *,const QPoint&,int); 32 virtual void slotHold(int, QListViewItem *,const QPoint&,int);
34 virtual void slotContextMenu(int id); 33 virtual void slotContextMenu(int id);
35 void setupFolderselect(Selectstore*sels); 34 void setupFolderselect(Selectstore*sels);
36 35
37signals: 36signals:
38 void refreshMailview(QList<RecMail>*); 37 void refreshMailview(const QValueList<RecMailP>& );
39 38
40protected: 39protected:
41 QListViewItem* m_currentItem; 40 QListViewItem* m_currentItem;
42 QValueList<IMAPviewItem*> imapAccounts; 41 QValueList<IMAPviewItem*> imapAccounts;
43 QValueList<MHviewItem*> mhAccounts; 42 QValueList<MHviewItem*> mhAccounts;
44}; 43};
45 44
46#endif 45#endif
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 445cc5e..74ccc7b 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -167,134 +167,134 @@ void ComposeMail::addAttachment()
167 } 167 }
168} 168}
169 169
170void ComposeMail::removeAttachment() 170void ComposeMail::removeAttachment()
171{ 171{
172 if ( !attList->currentItem() ) { 172 if ( !attList->currentItem() ) {
173 QMessageBox::information( this, tr( "Error" ), 173 QMessageBox::information( this, tr( "Error" ),
174 tr( "<p>Please select a File.</p>" ), 174 tr( "<p>Please select a File.</p>" ),
175 tr( "Ok" ) ); 175 tr( "Ok" ) );
176 } else { 176 } else {
177 attList->takeItem( attList->currentItem() ); 177 attList->takeItem( attList->currentItem() );
178 } 178 }
179} 179}
180 180
181void ComposeMail::accept() 181void ComposeMail::accept()
182{ 182{
183 if ( checkBoxLater->isChecked() ) { 183 if ( checkBoxLater->isChecked() ) {
184 qDebug( "Send later" ); 184 qDebug( "Send later" );
185 } 185 }
186 186
187#if 0 187#if 0
188 qDebug( "Sending Mail with " + 188 qDebug( "Sending Mail with " +
189 smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); 189 smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() );
190#endif 190#endif
191 Opie::osmart_pointer<Mail> mail=new Mail; 191 Opie::OSmartPointer<Mail> mail=new Mail;
192 192
193 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 193 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
194 mail->setMail(fromBox->currentText()); 194 mail->setMail(fromBox->currentText());
195 195
196 if ( !toLine->text().isEmpty() ) { 196 if ( !toLine->text().isEmpty() ) {
197 mail->setTo( toLine->text() ); 197 mail->setTo( toLine->text() );
198 } else { 198 } else {
199 QMessageBox::warning(0,tr("Sending mail"), 199 QMessageBox::warning(0,tr("Sending mail"),
200 tr("No Receiver spezified" ) ); 200 tr("No Receiver spezified" ) );
201 return; 201 return;
202 } 202 }
203 mail->setName(senderNameEdit->text()); 203 mail->setName(senderNameEdit->text());
204 mail->setCC( ccLine->text() ); 204 mail->setCC( ccLine->text() );
205 mail->setBCC( bccLine->text() ); 205 mail->setBCC( bccLine->text() );
206 mail->setReply( replyLine->text() ); 206 mail->setReply( replyLine->text() );
207 mail->setSubject( subjectLine->text() ); 207 mail->setSubject( subjectLine->text() );
208 if (!m_replyid.isEmpty()) { 208 if (!m_replyid.isEmpty()) {
209 QStringList ids; 209 QStringList ids;
210 ids.append(m_replyid); 210 ids.append(m_replyid);
211 mail->setInreply(ids); 211 mail->setInreply(ids);
212 } 212 }
213 QString txt = message->text(); 213 QString txt = message->text();
214 if ( !sigMultiLine->text().isEmpty() ) { 214 if ( !sigMultiLine->text().isEmpty() ) {
215 txt.append( "\n--\n" ); 215 txt.append( "\n--\n" );
216 txt.append( sigMultiLine->text() ); 216 txt.append( sigMultiLine->text() );
217 } 217 }
218 mail->setMessage( txt ); 218 mail->setMessage( txt );
219 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 219 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
220 while ( it != NULL ) { 220 while ( it != NULL ) {
221 mail->addAttachment( it->getAttachment() ); 221 mail->addAttachment( it->getAttachment() );
222 it = (AttachViewItem *) it->nextSibling(); 222 it = (AttachViewItem *) it->nextSibling();
223 } 223 }
224 224
225 SMTPwrapper wrapper( smtp ); 225 SMTPwrapper wrapper( smtp );
226 wrapper.sendMail( mail,checkBoxLater->isChecked() ); 226 wrapper.sendMail( mail,checkBoxLater->isChecked() );
227 227
228 QDialog::accept(); 228 QDialog::accept();
229} 229}
230 230
231void ComposeMail::reject() 231void ComposeMail::reject()
232{ 232{
233 int yesno = QMessageBox::warning(0,tr("Store message"), 233 int yesno = QMessageBox::warning(0,tr("Store message"),
234 tr("Store message into drafts?"), 234 tr("Store message into drafts?"),
235 tr("Yes"), 235 tr("Yes"),
236 tr("No"),QString::null,0,1); 236 tr("No"),QString::null,0,1);
237 237
238 if (yesno == 0) { 238 if (yesno == 0) {
239 Opie::osmart_pointer<Mail> mail=new Mail(); 239 Opie::OSmartPointer<Mail> mail=new Mail();
240 mail->setMail(fromBox->currentText()); 240 mail->setMail(fromBox->currentText());
241 mail->setTo( toLine->text() ); 241 mail->setTo( toLine->text() );
242 mail->setName(senderNameEdit->text()); 242 mail->setName(senderNameEdit->text());
243 mail->setCC( ccLine->text() ); 243 mail->setCC( ccLine->text() );
244 mail->setBCC( bccLine->text() ); 244 mail->setBCC( bccLine->text() );
245 mail->setReply( replyLine->text() ); 245 mail->setReply( replyLine->text() );
246 mail->setSubject( subjectLine->text() ); 246 mail->setSubject( subjectLine->text() );
247 if (!m_replyid.isEmpty()) { 247 if (!m_replyid.isEmpty()) {
248 QStringList ids; 248 QStringList ids;
249 ids.append(m_replyid); 249 ids.append(m_replyid);
250 mail->setInreply(ids); 250 mail->setInreply(ids);
251 } 251 }
252 QString txt = message->text(); 252 QString txt = message->text();
253 if ( !sigMultiLine->text().isEmpty() ) { 253 if ( !sigMultiLine->text().isEmpty() ) {
254 txt.append( "\n--\n" ); 254 txt.append( "\n--\n" );
255 txt.append( sigMultiLine->text() ); 255 txt.append( sigMultiLine->text() );
256 } 256 }
257 qDebug(txt); 257 qDebug(txt);
258 mail->setMessage( txt ); 258 mail->setMessage( txt );
259 259
260 /* only use the default drafts folder name! */ 260 /* only use the default drafts folder name! */
261 Storemail wrapper(AbstractMail::draftFolder()); 261 Storemail wrapper(AbstractMail::draftFolder());
262 wrapper.storeMail(mail); 262 wrapper.storeMail(mail);
263 263
264 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 264 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
265 /* attachments we will ignore! */ 265 /* attachments we will ignore! */
266 if ( it != NULL ) { 266 if ( it != NULL ) {
267 QMessageBox::warning(0,tr("Store message"), 267 QMessageBox::warning(0,tr("Store message"),
268 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 268 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
269 } 269 }
270 } 270 }
271 QDialog::reject(); 271 QDialog::reject();
272} 272}
273 273
274ComposeMail::~ComposeMail() 274ComposeMail::~ComposeMail()
275{ 275{
276} 276}
277 277
278void ComposeMail::reEditMail(const RecMail&current) 278void ComposeMail::reEditMail(const RecMailP&current)
279{ 279{
280 RecMail data = current; 280 RecMailP data = current;
281 message->setText(data.Wrapper()->fetchBody(current).Bodytext()); 281 message->setText(data->Wrapper()->fetchBody(current).Bodytext());
282 subjectLine->setText( data.getSubject()); 282 subjectLine->setText( data->getSubject());
283 toLine->setText(data.To().join(",")); 283 toLine->setText(data->To().join(","));
284 ccLine->setText(data.CC().join(",")); 284 ccLine->setText(data->CC().join(","));
285 bccLine->setText(data.Bcc().join(",")); 285 bccLine->setText(data->Bcc().join(","));
286 replyLine->setText(data.Replyto()); 286 replyLine->setText(data->Replyto());
287} 287}
288 288
289AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 289AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
290 : QListViewItem( parent ) 290 : QListViewItem( parent )
291{ 291{
292 attachment = att; 292 attachment = att;
293 qDebug( att->getMimeType() ); 293 qDebug( att->getMimeType() );
294 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? 294 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
295 Resource::loadPixmap( "UnknownDocument-14" ) : 295 Resource::loadPixmap( "UnknownDocument-14" ) :
296 attachment->getDocLnk().pixmap() ); 296 attachment->getDocLnk().pixmap() );
297 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 297 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
298 setText( 1, QString::number( att->getSize() ) ); 298 setText( 1, QString::number( att->getSize() ) );
299} 299}
300 300
diff --git a/noncore/net/mail/composemail.h b/noncore/net/mail/composemail.h
index 1b9fc79..c12eb30 100644
--- a/noncore/net/mail/composemail.h
+++ b/noncore/net/mail/composemail.h
@@ -1,62 +1,64 @@
1#ifndef COMPOSEMAIL_H 1#ifndef COMPOSEMAIL_H
2#define COMPOSEMAIL_H 2#define COMPOSEMAIL_H
3 3
4#include <qlineedit.h> 4#include <qlineedit.h>
5#include <qlistview.h> 5#include <qlistview.h>
6 6
7#include "composemailui.h" 7#include "composemailui.h"
8#include "addresspickerui.h" 8#include "addresspickerui.h"
9#include <libmailwrapper/settings.h> 9#include <libmailwrapper/settings.h>
10#include <libmailwrapper/mailwrapper.h> 10#include <libmailwrapper/mailwrapper.h>
11 11
12class RecMail;
12 13
14#include <opie2/osmartpointer.h>
13 15
14class AddressPicker : public AddressPickerUI 16class AddressPicker : public AddressPickerUI
15{ 17{
16 Q_OBJECT 18 Q_OBJECT
17 19
18public: 20public:
19 AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); 21 AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
20 static QString getNames(); 22 static QString getNames();
21 23
22protected: 24protected:
23 QString selectedNames; 25 QString selectedNames;
24 void accept(); 26 void accept();
25 27
26}; 28};
27 29
28class RecMail; 30class RecMail;
29 31
30class ComposeMail : public ComposeMailUI 32class ComposeMail : public ComposeMailUI
31{ 33{
32 Q_OBJECT 34 Q_OBJECT
33 35
34public: 36public:
35 ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); 37 ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
36 virtual ~ComposeMail(); 38 virtual ~ComposeMail();
37 39
38 void reEditMail(const RecMail&current); 40 void reEditMail(const Opie::OSmartPointer<RecMail>&current);
39 41
40public slots: 42public slots:
41 void slotAdjustColumns(); 43 void slotAdjustColumns();
42 44
43 void setTo( const QString & to ); 45 void setTo( const QString & to );
44 void setSubject( const QString & subject ); 46 void setSubject( const QString & subject );
45 void setInReplyTo( const QString & messageId ); 47 void setInReplyTo( const QString & messageId );
46 void setMessage( const QString & text ); 48 void setMessage( const QString & text );
47 49
48protected slots: 50protected slots:
49 void accept(); 51 void accept();
50 void reject(); 52 void reject();
51 53
52private slots: 54private slots:
53 void fillValues( int current ); 55 void fillValues( int current );
54 void pickAddress( QLineEdit *line ); 56 void pickAddress( QLineEdit *line );
55 void pickAddressTo(); 57 void pickAddressTo();
56 void pickAddressCC(); 58 void pickAddressCC();
57 void pickAddressBCC(); 59 void pickAddressBCC();
58 void pickAddressReply(); 60 void pickAddressReply();
59 void addAttachment(); 61 void addAttachment();
60 void removeAttachment(); 62 void removeAttachment();
61 63
62protected: 64protected:
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 7e6d383..68a7a4d 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -60,108 +60,108 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin
60 int mimetype = MAILMIME_MECHANISM_7BIT; 60 int mimetype = MAILMIME_MECHANISM_7BIT;
61 if (enc.lower()=="quoted-printable") { 61 if (enc.lower()=="quoted-printable") {
62 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 62 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
63 } else if (enc.lower()=="base64") { 63 } else if (enc.lower()=="base64") {
64 mimetype = MAILMIME_MECHANISM_BASE64; 64 mimetype = MAILMIME_MECHANISM_BASE64;
65 } else if (enc.lower()=="8bit") { 65 } else if (enc.lower()=="8bit") {
66 mimetype = MAILMIME_MECHANISM_8BIT; 66 mimetype = MAILMIME_MECHANISM_8BIT;
67 } else if (enc.lower()=="binary") { 67 } else if (enc.lower()=="binary") {
68 mimetype = MAILMIME_MECHANISM_BINARY; 68 mimetype = MAILMIME_MECHANISM_BINARY;
69 } 69 }
70 70
71 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, 71 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
72 &result_text,&target_length); 72 &result_text,&target_length);
73 73
74 encodedString* result = new encodedString(); 74 encodedString* result = new encodedString();
75 if (err == MAILIMF_NO_ERROR) { 75 if (err == MAILIMF_NO_ERROR) {
76 result->setContent(result_text,target_length); 76 result->setContent(result_text,target_length);
77 } 77 }
78 qDebug("Decode string finished"); 78 qDebug("Decode string finished");
79 return result; 79 return result;
80} 80}
81 81
82QString AbstractMail::convert_String(const char*text) 82QString AbstractMail::convert_String(const char*text)
83{ 83{
84 size_t index = 0; 84 //size_t index = 0;
85 char*res = 0; 85 char*res = 0;
86 int err = MAILIMF_NO_ERROR; 86 int err = MAILIMF_NO_ERROR;
87 87
88 QString result(text); 88 QString result(text);
89 89
90 /* due a bug in libetpan it isn't usable this moment */ 90 /* due a bug in libetpan it isn't usable this moment */
91/* int err = mailmime_encoded_phrase_parse("iso-8859-1", 91/* int err = mailmime_encoded_phrase_parse("iso-8859-1",
92 text, strlen(text),&index, "iso-8859-1",&res);*/ 92 text, strlen(text),&index, "iso-8859-1",&res);*/
93 //qDebug("Input: %s",text); 93 //qDebug("Input: %s",text);
94 if (err == MAILIMF_NO_ERROR && res && strlen(res)) { 94 if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
95// result = QString(res); 95// result = QString(res);
96// qDebug("Res: %s, length: %i",res,strlen(res)); 96// qDebug("Res: %s, length: %i",res,strlen(res));
97 } 97 }
98 if (res) free(res); 98 if (res) free(res);
99 return result; 99 return result;
100} 100}
101 101
102/* cp & paste from launcher */ 102/* cp & paste from launcher */
103QString AbstractMail::gen_attachment_id() 103QString AbstractMail::gen_attachment_id()
104{ 104{
105 QFile file( "/proc/sys/kernel/random/uuid" ); 105 QFile file( "/proc/sys/kernel/random/uuid" );
106 if (!file.open(IO_ReadOnly ) ) 106 if (!file.open(IO_ReadOnly ) )
107 return QString::null; 107 return QString::null;
108 108
109 QTextStream stream(&file); 109 QTextStream stream(&file);
110 110
111 return "{" + stream.read().stripWhiteSpace() + "}"; 111 return "{" + stream.read().stripWhiteSpace() + "}";
112} 112}
113 113
114int AbstractMail::createMbox(const QString&,const FolderP&,const QString& delemiter,bool) 114int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool)
115{ 115{
116 return 0; 116 return 0;
117} 117}
118 118
119QString AbstractMail::defaultLocalfolder() 119QString AbstractMail::defaultLocalfolder()
120{ 120{
121 QString f = getenv( "HOME" ); 121 QString f = getenv( "HOME" );
122 f += "/Applications/opiemail/localmail"; 122 f += "/Applications/opiemail/localmail";
123 return f; 123 return f;
124} 124}
125 125
126QString AbstractMail::draftFolder() 126QString AbstractMail::draftFolder()
127{ 127{
128 return QString("Drafts"); 128 return QString("Drafts");
129} 129}
130 130
131/* temporary - will be removed when implemented in all classes */ 131/* temporary - will be removed when implemented in all classes */
132void AbstractMail::deleteMails(const QString &,QList<RecMail> &) 132void AbstractMail::deleteMails(const QString &,const QValueList<Opie::OSmartPointer<RecMail> > &)
133{ 133{
134} 134}
135 135
136void AbstractMail::mvcpAllMails(const FolderP&fromFolder, 136void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
137 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 137 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
138{ 138{
139 QList<RecMail> t; 139 QValueList<RecMailP> t;
140 listMessages(fromFolder->getName(),t); 140 listMessages(fromFolder->getName(),t);
141 encodedString*st = 0; 141 encodedString*st = 0;
142 while (t.count()>0) { 142 while (t.count()>0) {
143 RecMail*r = t.at(0); 143 RecMailP r = (*t.begin());
144 st = fetchRawBody(*r); 144 st = fetchRawBody(r);
145 if (st) { 145 if (st) {
146 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); 146 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
147 delete st; 147 delete st;
148 } 148 }
149 t.removeFirst(); 149 t.remove(t.begin());
150 } 150 }
151 if (moveit) { 151 if (moveit) {
152 deleteAllMail(fromFolder); 152 deleteAllMail(fromFolder);
153 } 153 }
154} 154}
155 155
156void AbstractMail::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 156void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
157{ 157{
158 encodedString*st = 0; 158 encodedString*st = 0;
159 st = fetchRawBody(mail); 159 st = fetchRawBody(mail);
160 if (st) { 160 if (st) {
161 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); 161 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
162 delete st; 162 delete st;
163 } 163 }
164 if (moveit) { 164 if (moveit) {
165 deleteMail(mail); 165 deleteMail(mail);
166 } 166 }
167} 167}
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index d911468..b03d757 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -1,74 +1,72 @@
1#ifndef __abstract_mail_ 1#ifndef __abstract_mail_
2#define __abstract_mail_ 2#define __abstract_mail_
3 3
4#include "maildefines.h" 4#include "maildefines.h"
5 5
6#include "settings.h" 6#include "settings.h"
7 7
8#include <qobject.h> 8#include <qobject.h>
9#include <opie2/osmart_pointer.h> 9#include <opie2/osmartpointer.h>
10#include "mailtypes.h"
10 11
11class RecMail;
12class RecBody;
13class RecPart;
14class IMAPwrapper; 12class IMAPwrapper;
15class POP3wrapper; 13class POP3wrapper;
16class Folder; 14class Folder;
17class encodedString; 15class encodedString;
18struct folderStat; 16struct folderStat;
19 17
20class AbstractMail:public QObject 18class AbstractMail:public QObject
21{ 19{
22 Q_OBJECT 20 Q_OBJECT
23public: 21public:
24 AbstractMail(){}; 22 AbstractMail(){};
25 virtual ~AbstractMail(){} 23 virtual ~AbstractMail(){}
26 virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders()=0; 24 virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders()=0;
27 virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; 25 virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target )=0;
28 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; 26 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0;
29 virtual RecBody fetchBody(const RecMail&mail)=0; 27 virtual RecBody fetchBody(const RecMailP&mail)=0;
30 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; 28 virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part)=0;
31 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; 29 virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part)=0;
32 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; 30 virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part)=0;
33 virtual encodedString* fetchRawBody(const RecMail&mail)=0; 31 virtual encodedString* fetchRawBody(const RecMailP&mail)=0;
34 32
35 virtual void deleteMail(const RecMail&mail)=0; 33 virtual void deleteMail(const RecMailP&mail)=0;
36 virtual void answeredMail(const RecMail&mail)=0; 34 virtual void answeredMail(const RecMailP&mail)=0;
37 virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&)=0; 35 virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&)=0;
38 virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); 36 virtual void deleteMails(const QString & FolderName,const QValueList<Opie::OSmartPointer<RecMail> >&target);
39 virtual int deleteMbox(const Opie::osmart_pointer<Folder>&)=0; 37 virtual int deleteMbox(const Opie::OSmartPointer<Folder>&)=0;
40 virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; 38 virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0;
41 39
42 virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder, 40 virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder,
43 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 41 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
44 virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 42 virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
45 43
46 virtual void cleanMimeCache(){}; 44 virtual void cleanMimeCache(){};
47 /* mail box methods */ 45 /* mail box methods */
48 /* parameter is the box to create. 46 /* parameter is the box to create.
49 * if the implementing subclass has prefixes, 47 * if the implementing subclass has prefixes,
50 * them has to be appended automatic. 48 * them has to be appended automatic.
51 */ 49 */
52 virtual int createMbox(const QString&,const Opie::osmart_pointer<Folder>&parentfolder=0, 50 virtual int createMbox(const QString&,const Opie::OSmartPointer<Folder>&parentfolder=0,
53 const QString& delemiter="/",bool getsubfolder=false); 51 const QString& delemiter="/",bool getsubfolder=false);
54 virtual void logout()=0; 52 virtual void logout()=0;
55 53
56 static AbstractMail* getWrapper(IMAPaccount *a); 54 static AbstractMail* getWrapper(IMAPaccount *a);
57 static AbstractMail* getWrapper(POP3account *a); 55 static AbstractMail* getWrapper(POP3account *a);
58 static AbstractMail* getWrapper(NNTPaccount *a); 56 static AbstractMail* getWrapper(NNTPaccount *a);
59 /* mbox only! */ 57 /* mbox only! */
60 static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); 58 static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders");
61 static AbstractMail* getWrapper(Account*a); 59 static AbstractMail* getWrapper(Account*a);
62 60
63 static QString defaultLocalfolder(); 61 static QString defaultLocalfolder();
64 static QString draftFolder(); 62 static QString draftFolder();
65 63
66 virtual MAILLIB::ATYPE getType()const=0; 64 virtual MAILLIB::ATYPE getType()const=0;
67 virtual const QString&getName()const=0; 65 virtual const QString&getName()const=0;
68 66
69protected: 67protected:
70 static encodedString*decode_String(const encodedString*text,const QString&enc); 68 static encodedString*decode_String(const encodedString*text,const QString&enc);
71 static QString convert_String(const char*text); 69 static QString convert_String(const char*text);
72 static QString gen_attachment_id(); 70 static QString gen_attachment_id();
73}; 71};
74#endif 72#endif
diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp
index 4f7ec0c..cb7ccc0 100644
--- a/noncore/net/mail/libmailwrapper/generatemail.cpp
+++ b/noncore/net/mail/libmailwrapper/generatemail.cpp
@@ -258,49 +258,49 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) {
258 if ( err != MAILIMF_NO_ERROR ) 258 if ( err != MAILIMF_NO_ERROR )
259 goto err_free_txtPart; 259 goto err_free_txtPart;
260 260
261 return txtPart; // Success :) 261 return txtPart; // Success :)
262 262
263err_free_txtPart: 263err_free_txtPart:
264 mailmime_free( txtPart ); 264 mailmime_free( txtPart );
265err_free_fields: 265err_free_fields:
266 mailmime_fields_free( fields ); 266 mailmime_fields_free( fields );
267err_free_content: 267err_free_content:
268 mailmime_content_free( content ); 268 mailmime_content_free( content );
269err_free_param: 269err_free_param:
270 mailmime_parameter_free( param ); 270 mailmime_parameter_free( param );
271err_free: 271err_free:
272 qDebug( "buildTxtPart - error" ); 272 qDebug( "buildTxtPart - error" );
273 273
274 return NULL; // Error :( 274 return NULL; // Error :(
275} 275}
276 276
277mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { 277mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) {
278 return mailimf_mailbox_new( strdup( name.latin1() ), 278 return mailimf_mailbox_new( strdup( name.latin1() ),
279 strdup( mail.latin1() ) ); 279 strdup( mail.latin1() ) );
280} 280}
281 281
282mailimf_fields *Generatemail::createImfFields(const Opie::osmart_pointer<Mail>&mail ) 282mailimf_fields *Generatemail::createImfFields(const Opie::OSmartPointer<Mail>&mail )
283{ 283{
284 mailimf_fields *fields = NULL; 284 mailimf_fields *fields = NULL;
285 mailimf_field *xmailer = NULL; 285 mailimf_field *xmailer = NULL;
286 mailimf_mailbox *sender=0,*fromBox=0; 286 mailimf_mailbox *sender=0,*fromBox=0;
287 mailimf_mailbox_list *from=0; 287 mailimf_mailbox_list *from=0;
288 mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; 288 mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
289 clist*in_reply_to = 0; 289 clist*in_reply_to = 0;
290 char *subject = strdup( mail->getSubject().latin1() ); 290 char *subject = strdup( mail->getSubject().latin1() );
291 int err; 291 int err;
292 int res = 1; 292 int res = 1;
293 293
294 sender = newMailbox( mail->getName(), mail->getMail() ); 294 sender = newMailbox( mail->getName(), mail->getMail() );
295 if ( sender == NULL ) { 295 if ( sender == NULL ) {
296 res = 0; 296 res = 0;
297 } 297 }
298 298
299 if (res) { 299 if (res) {
300 fromBox = newMailbox( mail->getName(), mail->getMail() ); 300 fromBox = newMailbox( mail->getName(), mail->getMail() );
301 } 301 }
302 if ( fromBox == NULL ) { 302 if ( fromBox == NULL ) {
303 res = 0; 303 res = 0;
304 } 304 }
305 305
306 if (res) { 306 if (res) {
@@ -378,49 +378,49 @@ mailimf_fields *Generatemail::createImfFields(const Opie::osmart_pointer<Mail>&m
378 if (reply) 378 if (reply)
379 mailimf_address_list_free( reply ); 379 mailimf_address_list_free( reply );
380 if (bcc) 380 if (bcc)
381 mailimf_address_list_free( bcc ); 381 mailimf_address_list_free( bcc );
382 if (cc) 382 if (cc)
383 mailimf_address_list_free( cc ); 383 mailimf_address_list_free( cc );
384 if (to) 384 if (to)
385 mailimf_address_list_free( to ); 385 mailimf_address_list_free( to );
386 if (fromBox) { 386 if (fromBox) {
387 mailimf_mailbox_free( fromBox ); 387 mailimf_mailbox_free( fromBox );
388 } else if (from) { 388 } else if (from) {
389 mailimf_mailbox_list_free( from ); 389 mailimf_mailbox_list_free( from );
390 } 390 }
391 if (sender) { 391 if (sender) {
392 mailimf_mailbox_free( sender ); 392 mailimf_mailbox_free( sender );
393 } 393 }
394 if (subject) { 394 if (subject) {
395 free( subject ); 395 free( subject );
396 } 396 }
397 } 397 }
398 } 398 }
399 return fields; 399 return fields;
400} 400}
401 401
402mailmime *Generatemail::createMimeMail(const Opie::osmart_pointer<Mail> &mail ) { 402mailmime *Generatemail::createMimeMail(const Opie::OSmartPointer<Mail> &mail ) {
403 mailmime *message, *txtPart; 403 mailmime *message, *txtPart;
404 mailimf_fields *fields; 404 mailimf_fields *fields;
405 int err; 405 int err;
406 406
407 fields = createImfFields( mail ); 407 fields = createImfFields( mail );
408 if ( fields == NULL ) 408 if ( fields == NULL )
409 goto err_free; 409 goto err_free;
410 410
411 message = mailmime_new_message_data( NULL ); 411 message = mailmime_new_message_data( NULL );
412 if ( message == NULL ) 412 if ( message == NULL )
413 goto err_free_fields; 413 goto err_free_fields;
414 414
415 mailmime_set_imf_fields( message, fields ); 415 mailmime_set_imf_fields( message, fields );
416 416
417 txtPart = buildTxtPart( mail->getMessage() ); 417 txtPart = buildTxtPart( mail->getMessage() );
418 418
419 if ( txtPart == NULL ) 419 if ( txtPart == NULL )
420 goto err_free_message; 420 goto err_free_message;
421 421
422 err = mailmime_smart_add_part( message, txtPart ); 422 err = mailmime_smart_add_part( message, txtPart );
423 if ( err != MAILIMF_NO_ERROR ) 423 if ( err != MAILIMF_NO_ERROR )
424 goto err_free_txtPart; 424 goto err_free_txtPart;
425 425
426 addFileParts( message, mail->getAttachments() ); 426 addFileParts( message, mail->getAttachments() );
diff --git a/noncore/net/mail/libmailwrapper/generatemail.h b/noncore/net/mail/libmailwrapper/generatemail.h
index 409a55e..c246a2a 100644
--- a/noncore/net/mail/libmailwrapper/generatemail.h
+++ b/noncore/net/mail/libmailwrapper/generatemail.h
@@ -1,46 +1,46 @@
1#ifndef __GENERATE_MAIL_H 1#ifndef __GENERATE_MAIL_H
2#define __GENERATE_MAIL_H 2#define __GENERATE_MAIL_H
3 3
4#include <qpe/applnk.h> 4#include <qpe/applnk.h>
5 5
6#include <qobject.h> 6#include <qobject.h>
7#include <libetpan/clist.h> 7#include <libetpan/clist.h>
8 8
9#include <opie2/osmart_pointer.h> 9#include <opie2/osmartpointer.h>
10 10
11class Mail; 11class Mail;
12class RecMail; 12class RecMail;
13class Attachment; 13class Attachment;
14struct mailimf_fields; 14struct mailimf_fields;
15struct mailimf_field; 15struct mailimf_field;
16struct mailimf_mailbox; 16struct mailimf_mailbox;
17struct mailmime; 17struct mailmime;
18struct mailimf_address_list; 18struct mailimf_address_list;
19class progressMailSend; 19class progressMailSend;
20struct mailsmtp; 20struct mailsmtp;
21 21
22class Generatemail : public QObject 22class Generatemail : public QObject
23{ 23{
24 Q_OBJECT 24 Q_OBJECT
25public: 25public:
26 Generatemail(); 26 Generatemail();
27 virtual ~Generatemail(); 27 virtual ~Generatemail();
28 28
29protected: 29protected:
30 static void addRcpts( clist *list, mailimf_address_list *addr_list ); 30 static void addRcpts( clist *list, mailimf_address_list *addr_list );
31 static char *getFrom( mailmime *mail ); 31 static char *getFrom( mailmime *mail );
32 static char *getFrom( mailimf_field *ffrom); 32 static char *getFrom( mailimf_field *ffrom);
33 static mailimf_field *getField( mailimf_fields *fields, int type ); 33 static mailimf_field *getField( mailimf_fields *fields, int type );
34 mailimf_address_list *parseAddresses(const QString&addr ); 34 mailimf_address_list *parseAddresses(const QString&addr );
35 void addFileParts( mailmime *message,const QList<Attachment>&files ); 35 void addFileParts( mailmime *message,const QList<Attachment>&files );
36 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); 36 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content);
37 mailmime *buildTxtPart(const QString&str ); 37 mailmime *buildTxtPart(const QString&str );
38 mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); 38 mailimf_mailbox *newMailbox(const QString&name,const QString&mail );
39 mailimf_fields *createImfFields(const Opie::osmart_pointer<Mail> &mail ); 39 mailimf_fields *createImfFields(const Opie::OSmartPointer<Mail> &mail );
40 mailmime *createMimeMail(const Opie::osmart_pointer<Mail>&mail ); 40 mailmime *createMimeMail(const Opie::OSmartPointer<Mail>&mail );
41 clist *createRcptList( mailimf_fields *fields ); 41 clist *createRcptList( mailimf_fields *fields );
42 42
43 static const char* USER_AGENT; 43 static const char* USER_AGENT;
44}; 44};
45 45
46#endif 46#endif
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index 6c8a5a1..ee2c8cd 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -310,133 +310,133 @@ QString Genericwrapper::parseMailbox( mailimf_mailbox *box )
310 310
311 return result; 311 return result;
312} 312}
313 313
314QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) 314QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list )
315{ 315{
316 QString result( "" ); 316 QString result( "" );
317 317
318 bool first = true; 318 bool first = true;
319 for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { 319 for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) {
320 mailimf_mailbox *box = (mailimf_mailbox *) current->data; 320 mailimf_mailbox *box = (mailimf_mailbox *) current->data;
321 321
322 if ( !first ) { 322 if ( !first ) {
323 result.append( "," ); 323 result.append( "," );
324 } else { 324 } else {
325 first = false; 325 first = false;
326 } 326 }
327 327
328 result.append( parseMailbox( box ) ); 328 result.append( parseMailbox( box ) );
329 } 329 }
330 330
331 return result; 331 return result;
332} 332}
333 333
334encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) 334encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPart&part)
335{ 335{
336 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); 336 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier());
337 if (it==bodyCache.end()) return new encodedString(); 337 if (it==bodyCache.end()) return new encodedString();
338 encodedString*t = decode_String(it.data(),part.Encoding()); 338 encodedString*t = decode_String(it.data(),part.Encoding());
339 return t; 339 return t;
340} 340}
341 341
342encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) 342encodedString* Genericwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part)
343{ 343{
344 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); 344 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier());
345 if (it==bodyCache.end()) return new encodedString(); 345 if (it==bodyCache.end()) return new encodedString();
346 encodedString*t = it.data(); 346 encodedString*t = it.data();
347 return t; 347 return t;
348} 348}
349 349
350QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) 350QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part)
351{ 351{
352 encodedString*t = fetchDecodedPart(mail,part); 352 encodedString*t = fetchDecodedPart(mail,part);
353 QString text=t->Content(); 353 QString text=t->Content();
354 delete t; 354 delete t;
355 return text; 355 return text;
356} 356}
357 357
358void Genericwrapper::cleanMimeCache() 358void Genericwrapper::cleanMimeCache()
359{ 359{
360 QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); 360 QMap<QString,encodedString*>::Iterator it = bodyCache.begin();
361 for (;it!=bodyCache.end();++it) { 361 for (;it!=bodyCache.end();++it) {
362 encodedString*t = it.data(); 362 encodedString*t = it.data();
363 //it.setValue(0); 363 //it.setValue(0);
364 if (t) delete t; 364 if (t) delete t;
365 } 365 }
366 bodyCache.clear(); 366 bodyCache.clear();
367 qDebug("Genericwrapper: cache cleaned"); 367 qDebug("Genericwrapper: cache cleaned");
368} 368}
369 369
370QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) 370QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
371{ 371{
372 QStringList res; 372 QStringList res;
373 if (!in_replies || !in_replies->mid_list) return res; 373 if (!in_replies || !in_replies->mid_list) return res;
374 clistiter * current = 0; 374 clistiter * current = 0;
375 for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { 375 for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) {
376 QString h((char*)current->data); 376 QString h((char*)current->data);
377 while (h.length()>0 && h[0]=='<') { 377 while (h.length()>0 && h[0]=='<') {
378 h.remove(0,1); 378 h.remove(0,1);
379 } 379 }
380 while (h.length()>0 && h[h.length()-1]=='>') { 380 while (h.length()>0 && h[h.length()-1]=='>') {
381 h.remove(h.length()-1,1); 381 h.remove(h.length()-1,1);
382 } 382 }
383 if (h.length()>0) { 383 if (h.length()>0) {
384 res.append(h); 384 res.append(h);
385 } 385 }
386 } 386 }
387 return res; 387 return res;
388} 388}
389 389
390void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to) 390void Genericwrapper::parseList(QValueList<Opie::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to)
391{ 391{
392 int r; 392 int r;
393 mailmessage_list * env_list = 0; 393 mailmessage_list * env_list = 0;
394 r = mailsession_get_messages_list(session,&env_list); 394 r = mailsession_get_messages_list(session,&env_list);
395 if (r != MAIL_NO_ERROR) { 395 if (r != MAIL_NO_ERROR) {
396 qDebug("Error message list"); 396 qDebug("Error message list");
397 return; 397 return;
398 } 398 }
399 r = mailsession_get_envelopes_list(session, env_list); 399 r = mailsession_get_envelopes_list(session, env_list);
400 if (r != MAIL_NO_ERROR) { 400 if (r != MAIL_NO_ERROR) {
401 qDebug("Error filling message list"); 401 qDebug("Error filling message list");
402 if (env_list) { 402 if (env_list) {
403 mailmessage_list_free(env_list); 403 mailmessage_list_free(env_list);
404 } 404 }
405 return; 405 return;
406 } 406 }
407 mailimf_references * refs = 0; 407 mailimf_references * refs = 0;
408 mailimf_in_reply_to * in_replies = 0; 408 mailimf_in_reply_to * in_replies = 0;
409 uint32_t i = 0; 409 uint32_t i = 0;
410 for(; i < carray_count(env_list->msg_tab) ; ++i) { 410 for(; i < carray_count(env_list->msg_tab) ; ++i) {
411 mailmessage * msg; 411 mailmessage * msg;
412 QBitArray mFlags(7); 412 QBitArray mFlags(7);
413 msg = (mailmessage*)carray_get(env_list->msg_tab, i); 413 msg = (mailmessage*)carray_get(env_list->msg_tab, i);
414 if (msg->msg_fields == NULL) { 414 if (msg->msg_fields == NULL) {
415 //qDebug("could not fetch envelope of message %i", i); 415 //qDebug("could not fetch envelope of message %i", i);
416 continue; 416 continue;
417 } 417 }
418 RecMail * mail = new RecMail(); 418 RecMailP mail = new RecMail();
419 mail->setWrapper(this); 419 mail->setWrapper(this);
420 mail_flags * flag_result = 0; 420 mail_flags * flag_result = 0;
421 r = mailmessage_get_flags(msg,&flag_result); 421 r = mailmessage_get_flags(msg,&flag_result);
422 if (r == MAIL_ERROR_NOT_IMPLEMENTED) { 422 if (r == MAIL_ERROR_NOT_IMPLEMENTED) {
423 mFlags.setBit(FLAG_SEEN); 423 mFlags.setBit(FLAG_SEEN);
424 } 424 }
425 mailimf_single_fields single_fields; 425 mailimf_single_fields single_fields;
426 mailimf_single_fields_init(&single_fields, msg->msg_fields); 426 mailimf_single_fields_init(&single_fields, msg->msg_fields);
427 mail->setMsgsize(msg->msg_size); 427 mail->setMsgsize(msg->msg_size);
428 mail->setFlags(mFlags); 428 mail->setFlags(mFlags);
429 mail->setMbox(mailbox); 429 mail->setMbox(mailbox);
430 mail->setNumber(msg->msg_index); 430 mail->setNumber(msg->msg_index);
431 if (single_fields.fld_subject) 431 if (single_fields.fld_subject)
432 mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); 432 mail->setSubject( convert_String(single_fields.fld_subject->sbj_value));
433 if (single_fields.fld_from) 433 if (single_fields.fld_from)
434 mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); 434 mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list));
435 if (!mbox_as_to) { 435 if (!mbox_as_to) {
436 if (single_fields.fld_to) 436 if (single_fields.fld_to)
437 mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); 437 mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) );
438 } else { 438 } else {
439 mail->setTo(mailbox); 439 mail->setTo(mailbox);
440 } 440 }
441 if (single_fields.fld_cc) 441 if (single_fields.fld_cc)
442 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); 442 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h
index d0db45a..f9968d1 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.h
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.h
@@ -13,55 +13,55 @@ struct mailpop3;
13struct mailmessage; 13struct mailmessage;
14struct mailmime; 14struct mailmime;
15struct mailmime_mechanism; 15struct mailmime_mechanism;
16struct mailimf_mailbox_list; 16struct mailimf_mailbox_list;
17struct mailimf_mailbox; 17struct mailimf_mailbox;
18struct mailimf_date_time; 18struct mailimf_date_time;
19struct mailimf_group; 19struct mailimf_group;
20struct mailimf_address_list; 20struct mailimf_address_list;
21struct mailsession; 21struct mailsession;
22struct mailstorage; 22struct mailstorage;
23struct mailfolder; 23struct mailfolder;
24struct mailimf_in_reply_to; 24struct mailimf_in_reply_to;
25 25
26/* this class hold just the funs shared between 26/* this class hold just the funs shared between
27 * mbox and pop3 (later mh, too) mail access. 27 * mbox and pop3 (later mh, too) mail access.
28 * it is not desigend to make a instance of it! 28 * it is not desigend to make a instance of it!
29 */ 29 */
30class Genericwrapper : public AbstractMail 30class Genericwrapper : public AbstractMail
31{ 31{
32 Q_OBJECT 32 Q_OBJECT
33public: 33public:
34 Genericwrapper(); 34 Genericwrapper();
35 virtual ~Genericwrapper(); 35 virtual ~Genericwrapper();
36 36
37 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); 37 virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part);
38 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); 38 virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part);
39 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); 39 virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part);
40 virtual void cleanMimeCache(); 40 virtual void cleanMimeCache();
41 virtual int deleteMbox(const Opie::osmart_pointer<Folder>&){return 1;} 41 virtual int deleteMbox(const Opie::OSmartPointer<Folder>&){return 1;}
42 virtual void logout(){}; 42 virtual void logout(){};
43 virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; 43 virtual void storeMessage(const char*msg,size_t length, const QString&folder){};
44 44
45protected: 45protected:
46 RecBody parseMail( mailmessage * msg ); 46 RecBody parseMail( mailmessage * msg );
47 QString parseMailboxList( mailimf_mailbox_list *list ); 47 QString parseMailboxList( mailimf_mailbox_list *list );
48 QString parseMailbox( mailimf_mailbox *box ); 48 QString parseMailbox( mailimf_mailbox *box );
49 QString parseGroup( mailimf_group *group ); 49 QString parseGroup( mailimf_group *group );
50 QString parseAddressList( mailimf_address_list *list ); 50 QString parseAddressList( mailimf_address_list *list );
51 QString parseDateTime( mailimf_date_time *date ); 51 QString parseDateTime( mailimf_date_time *date );
52 52
53 void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); 53 void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1);
54 static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); 54 static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime);
55 static void fillParameters(RecPart&target,clist*parameters); 55 static void fillParameters(RecPart&target,clist*parameters);
56 static QString getencoding(mailmime_mechanism*aEnc); 56 static QString getencoding(mailmime_mechanism*aEnc);
57 virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); 57 virtual void parseList(QValueList<Opie::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false);
58 QStringList parseInreplies(mailimf_in_reply_to * in_replies); 58 QStringList parseInreplies(mailimf_in_reply_to * in_replies);
59 59
60 QString msgTempName; 60 QString msgTempName;
61 unsigned int last_msg_id; 61 unsigned int last_msg_id;
62 QMap<QString,encodedString*> bodyCache; 62 QMap<QString,encodedString*> bodyCache;
63 mailstorage * m_storage; 63 mailstorage * m_storage;
64 mailfolder*m_folder; 64 mailfolder*m_folder;
65}; 65};
66 66
67#endif 67#endif
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 3b3be0f..071e734 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -184,49 +184,49 @@ void IMAPwrapper::login()
184 err = mailimap_login_simple( m_imap, (char*)user, (char*)pass ); 184 err = mailimap_login_simple( m_imap, (char*)user, (char*)pass );
185 if ( err != MAILIMAP_NO_ERROR ) { 185 if ( err != MAILIMAP_NO_ERROR ) {
186 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); 186 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response));
187 ok = false; 187 ok = false;
188 } 188 }
189 } 189 }
190 if (!ok) { 190 if (!ok) {
191 err = mailimap_close( m_imap ); 191 err = mailimap_close( m_imap );
192 mailimap_free( m_imap ); 192 mailimap_free( m_imap );
193 m_imap = 0; 193 m_imap = 0;
194 } 194 }
195} 195}
196 196
197void IMAPwrapper::logout() 197void IMAPwrapper::logout()
198{ 198{
199 int err = MAILIMAP_NO_ERROR; 199 int err = MAILIMAP_NO_ERROR;
200 if (!m_imap) return; 200 if (!m_imap) return;
201 err = mailimap_logout( m_imap ); 201 err = mailimap_logout( m_imap );
202 err = mailimap_close( m_imap ); 202 err = mailimap_close( m_imap );
203 mailimap_free( m_imap ); 203 mailimap_free( m_imap );
204 m_imap = 0; 204 m_imap = 0;
205 m_Lastmbox = ""; 205 m_Lastmbox = "";
206} 206}
207 207
208void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) 208void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::OSmartPointer<RecMail> > &target )
209{ 209{
210 int err = MAILIMAP_NO_ERROR; 210 int err = MAILIMAP_NO_ERROR;
211 clist *result = 0; 211 clist *result = 0;
212 clistcell *current; 212 clistcell *current;
213 mailimap_fetch_type *fetchType = 0; 213 mailimap_fetch_type *fetchType = 0;
214 mailimap_set *set = 0; 214 mailimap_set *set = 0;
215 215
216 login(); 216 login();
217 if (!m_imap) { 217 if (!m_imap) {
218 return; 218 return;
219 } 219 }
220 /* select mailbox READONLY for operations */ 220 /* select mailbox READONLY for operations */
221 err = selectMbox(mailbox); 221 err = selectMbox(mailbox);
222 if ( err != MAILIMAP_NO_ERROR ) { 222 if ( err != MAILIMAP_NO_ERROR ) {
223 return; 223 return;
224 } 224 }
225 225
226 int last = m_imap->imap_selection_info->sel_exists; 226 int last = m_imap->imap_selection_info->sel_exists;
227 227
228 if (last == 0) { 228 if (last == 0) {
229 Global::statusMessage(tr("Mailbox has no mails")); 229 Global::statusMessage(tr("Mailbox has no mails"));
230 return; 230 return;
231 } else { 231 } else {
232 } 232 }
@@ -245,49 +245,49 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
245 245
246 QString date,subject,from; 246 QString date,subject,from;
247 247
248 if ( err == MAILIMAP_NO_ERROR ) { 248 if ( err == MAILIMAP_NO_ERROR ) {
249 mailimap_msg_att * msg_att; 249 mailimap_msg_att * msg_att;
250 int i = 0; 250 int i = 0;
251 for (current = clist_begin(result); current != 0; current=clist_next(current)) { 251 for (current = clist_begin(result); current != 0; current=clist_next(current)) {
252 ++i; 252 ++i;
253 msg_att = (mailimap_msg_att*)current->data; 253 msg_att = (mailimap_msg_att*)current->data;
254 RecMail*m = parse_list_result(msg_att); 254 RecMail*m = parse_list_result(msg_att);
255 if (m) { 255 if (m) {
256 m->setNumber(i); 256 m->setNumber(i);
257 m->setMbox(mailbox); 257 m->setMbox(mailbox);
258 m->setWrapper(this); 258 m->setWrapper(this);
259 target.append(m); 259 target.append(m);
260 } 260 }
261 } 261 }
262 Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); 262 Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count()));
263 } else { 263 } else {
264 Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); 264 Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response));
265 } 265 }
266 if (result) mailimap_fetch_list_free(result); 266 if (result) mailimap_fetch_list_free(result);
267} 267}
268 268
269QValueList<Opie::osmart_pointer<Folder> >* IMAPwrapper::listFolders() 269QValueList<Opie::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
270{ 270{
271 const char *path, *mask; 271 const char *path, *mask;
272 int err = MAILIMAP_NO_ERROR; 272 int err = MAILIMAP_NO_ERROR;
273 clist *result = 0; 273 clist *result = 0;
274 clistcell *current = 0; 274 clistcell *current = 0;
275 clistcell*cur_flag = 0; 275 clistcell*cur_flag = 0;
276 mailimap_mbx_list_flags*bflags = 0; 276 mailimap_mbx_list_flags*bflags = 0;
277 277
278 QValueList<FolderP>* folders = new QValueList<FolderP>(); 278 QValueList<FolderP>* folders = new QValueList<FolderP>();
279 login(); 279 login();
280 if (!m_imap) { 280 if (!m_imap) {
281 return folders; 281 return folders;
282 } 282 }
283 283
284/* 284/*
285 * First we have to check for INBOX 'cause it sometimes it's not inside the path. 285 * First we have to check for INBOX 'cause it sometimes it's not inside the path.
286 * We must not forget to filter them out in next loop! 286 * We must not forget to filter them out in next loop!
287 * it seems like ugly code. and yes - it is ugly code. but the best way. 287 * it seems like ugly code. and yes - it is ugly code. but the best way.
288 */ 288 */
289 QString temp; 289 QString temp;
290 mask = "INBOX" ; 290 mask = "INBOX" ;
291 mailimap_mailbox_list *list; 291 mailimap_mailbox_list *list;
292 err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); 292 err = mailimap_list( m_imap, (char*)"", (char*)mask, &result );
293 QString del; 293 QString del;
@@ -461,73 +461,73 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
461 } 461 }
462 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { 462 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
463#if 0 463#if 0
464 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; 464 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
465 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); 465 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
466 qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); 466 qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec);
467 qDebug(da.toString()); 467 qDebug(da.toString());
468#endif 468#endif
469 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { 469 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) {
470 size = item->att_data.att_static->att_data.att_rfc822_size; 470 size = item->att_data.att_static->att_data.att_rfc822_size;
471 } 471 }
472 } 472 }
473 /* msg is already deleted */ 473 /* msg is already deleted */
474 if (mFlags.testBit(FLAG_DELETED) && m) { 474 if (mFlags.testBit(FLAG_DELETED) && m) {
475 delete m; 475 delete m;
476 m = 0; 476 m = 0;
477 } 477 }
478 if (m) { 478 if (m) {
479 m->setFlags(mFlags); 479 m->setFlags(mFlags);
480 m->setMsgsize(size); 480 m->setMsgsize(size);
481 } 481 }
482 return m; 482 return m;
483} 483}
484 484
485RecBody IMAPwrapper::fetchBody(const RecMail&mail) 485RecBody IMAPwrapper::fetchBody(const RecMailP&mail)
486{ 486{
487 RecBody body; 487 RecBody body;
488 const char *mb; 488 const char *mb;
489 int err = MAILIMAP_NO_ERROR; 489 int err = MAILIMAP_NO_ERROR;
490 clist *result = 0; 490 clist *result = 0;
491 clistcell *current; 491 clistcell *current;
492 mailimap_fetch_att *fetchAtt = 0; 492 mailimap_fetch_att *fetchAtt = 0;
493 mailimap_fetch_type *fetchType = 0; 493 mailimap_fetch_type *fetchType = 0;
494 mailimap_set *set = 0; 494 mailimap_set *set = 0;
495 mailimap_body*body_desc = 0; 495 mailimap_body*body_desc = 0;
496 496
497 mb = mail.getMbox().latin1(); 497 mb = mail->getMbox().latin1();
498 498
499 login(); 499 login();
500 if (!m_imap) { 500 if (!m_imap) {
501 return body; 501 return body;
502 } 502 }
503 err = selectMbox(mail.getMbox()); 503 err = selectMbox(mail->getMbox());
504 if ( err != MAILIMAP_NO_ERROR ) { 504 if ( err != MAILIMAP_NO_ERROR ) {
505 return body; 505 return body;
506 } 506 }
507 507
508 /* the range has to start at 1!!! not with 0!!!! */ 508 /* the range has to start at 1!!! not with 0!!!! */
509 set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); 509 set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() );
510 fetchAtt = mailimap_fetch_att_new_bodystructure(); 510 fetchAtt = mailimap_fetch_att_new_bodystructure();
511 fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); 511 fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
512 err = mailimap_fetch( m_imap, set, fetchType, &result ); 512 err = mailimap_fetch( m_imap, set, fetchType, &result );
513 mailimap_set_free( set ); 513 mailimap_set_free( set );
514 mailimap_fetch_type_free( fetchType ); 514 mailimap_fetch_type_free( fetchType );
515 515
516 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { 516 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
517 mailimap_msg_att * msg_att; 517 mailimap_msg_att * msg_att;
518 msg_att = (mailimap_msg_att*)current->data; 518 msg_att = (mailimap_msg_att*)current->data;
519 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; 519 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
520 QValueList<int> path; 520 QValueList<int> path;
521 body_desc = item->att_data.att_static->att_data.att_body; 521 body_desc = item->att_data.att_static->att_data.att_body;
522 traverseBody(mail,body_desc,body,0,path); 522 traverseBody(mail,body_desc,body,0,path);
523 } else { 523 } else {
524 qDebug("error fetching body: %s",m_imap->imap_response); 524 qDebug("error fetching body: %s",m_imap->imap_response);
525 } 525 }
526 if (result) mailimap_fetch_list_free(result); 526 if (result) mailimap_fetch_list_free(result);
527 return body; 527 return body;
528} 528}
529 529
530QStringList IMAPwrapper::address_list_to_stringlist(clist*list) 530QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
531{ 531{
532 QStringList l; 532 QStringList l;
533 QString from; 533 QString from;
@@ -547,71 +547,71 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
547 from+=" "; 547 from+=" ";
548 named_from = true; 548 named_from = true;
549 } 549 }
550 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { 550 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
551 from+="<"; 551 from+="<";
552 } 552 }
553 if (current_address->ad_mailbox_name) { 553 if (current_address->ad_mailbox_name) {
554 from+=QString(current_address->ad_mailbox_name); 554 from+=QString(current_address->ad_mailbox_name);
555 from+="@"; 555 from+="@";
556 } 556 }
557 if (current_address->ad_host_name) { 557 if (current_address->ad_host_name) {
558 from+=QString(current_address->ad_host_name); 558 from+=QString(current_address->ad_host_name);
559 } 559 }
560 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { 560 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
561 from+=">"; 561 from+=">";
562 } 562 }
563 l.append(QString(from)); 563 l.append(QString(from));
564 if (++count > 99) { 564 if (++count > 99) {
565 break; 565 break;
566 } 566 }
567 } 567 }
568 return l; 568 return l;
569} 569}
570 570
571encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) 571encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call)
572{ 572{
573 encodedString*res=new encodedString; 573 encodedString*res=new encodedString;
574 int err; 574 int err;
575 mailimap_fetch_type *fetchType; 575 mailimap_fetch_type *fetchType;
576 mailimap_set *set; 576 mailimap_set *set;
577 clistcell*current,*cur; 577 clistcell*current,*cur;
578 mailimap_section_part * section_part = 0; 578 mailimap_section_part * section_part = 0;
579 mailimap_section_spec * section_spec = 0; 579 mailimap_section_spec * section_spec = 0;
580 mailimap_section * section = 0; 580 mailimap_section * section = 0;
581 mailimap_fetch_att * fetch_att = 0; 581 mailimap_fetch_att * fetch_att = 0;
582 582
583 login(); 583 login();
584 if (!m_imap) { 584 if (!m_imap) {
585 return res; 585 return res;
586 } 586 }
587 if (!internal_call) { 587 if (!internal_call) {
588 err = selectMbox(mail.getMbox()); 588 err = selectMbox(mail->getMbox());
589 if ( err != MAILIMAP_NO_ERROR ) { 589 if ( err != MAILIMAP_NO_ERROR ) {
590 return res; 590 return res;
591 } 591 }
592 } 592 }
593 set = mailimap_set_new_single(mail.getNumber()); 593 set = mailimap_set_new_single(mail->getNumber());
594 594
595 clist*id_list = 0; 595 clist*id_list = 0;
596 596
597 /* if path == empty then its a request for the whole rfc822 mail and generates 597 /* if path == empty then its a request for the whole rfc822 mail and generates
598 a "fetch <id> (body[])" statement on imap server */ 598 a "fetch <id> (body[])" statement on imap server */
599 if (path.count()>0 ) { 599 if (path.count()>0 ) {
600 id_list = clist_new(); 600 id_list = clist_new();
601 for (unsigned j=0; j < path.count();++j) { 601 for (unsigned j=0; j < path.count();++j) {
602 uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); 602 uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id));
603 *p_id = path[j]; 603 *p_id = path[j];
604 clist_append(id_list,p_id); 604 clist_append(id_list,p_id);
605 } 605 }
606 section_part = mailimap_section_part_new(id_list); 606 section_part = mailimap_section_part_new(id_list);
607 section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); 607 section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL);
608 } 608 }
609 609
610 section = mailimap_section_new(section_spec); 610 section = mailimap_section_new(section_spec);
611 fetch_att = mailimap_fetch_att_new_body_section(section); 611 fetch_att = mailimap_fetch_att_new_body_section(section);
612 fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); 612 fetchType = mailimap_fetch_type_new_fetch_att(fetch_att);
613 613
614 clist*result = 0; 614 clist*result = 0;
615 615
616 err = mailimap_fetch( m_imap, set, fetchType, &result ); 616 err = mailimap_fetch( m_imap, set, fetchType, &result );
617 mailimap_set_free( set ); 617 mailimap_set_free( set );
@@ -620,49 +620,49 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>
620 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { 620 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
621 mailimap_msg_att * msg_att; 621 mailimap_msg_att * msg_att;
622 msg_att = (mailimap_msg_att*)current->data; 622 msg_att = (mailimap_msg_att*)current->data;
623 mailimap_msg_att_item*msg_att_item; 623 mailimap_msg_att_item*msg_att_item;
624 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { 624 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
625 msg_att_item = (mailimap_msg_att_item*)clist_content(cur); 625 msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
626 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { 626 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
627 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { 627 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
628 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; 628 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
629 /* detach - we take over the content */ 629 /* detach - we take over the content */
630 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; 630 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
631 res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); 631 res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length);
632 } 632 }
633 } 633 }
634 } 634 }
635 } else { 635 } else {
636 qDebug("error fetching text: %s",m_imap->imap_response); 636 qDebug("error fetching text: %s",m_imap->imap_response);
637 } 637 }
638 if (result) mailimap_fetch_list_free(result); 638 if (result) mailimap_fetch_list_free(result);
639 return res; 639 return res;
640} 640}
641 641
642/* current_recursion is for recursive calls. 642/* current_recursion is for recursive calls.
643 current_count means the position inside the internal loop! */ 643 current_count means the position inside the internal loop! */
644void IMAPwrapper::traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body, 644void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body,
645 int current_recursion,QValueList<int>recList,int current_count) 645 int current_recursion,QValueList<int>recList,int current_count)
646{ 646{
647 if (!body || current_recursion>=10) { 647 if (!body || current_recursion>=10) {
648 return; 648 return;
649 } 649 }
650 switch (body->bd_type) { 650 switch (body->bd_type) {
651 case MAILIMAP_BODY_1PART: 651 case MAILIMAP_BODY_1PART:
652 { 652 {
653 QValueList<int>countlist = recList; 653 QValueList<int>countlist = recList;
654 countlist.append(current_count); 654 countlist.append(current_count);
655 RecPart currentPart; 655 RecPart currentPart;
656 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; 656 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part;
657 QString id(""); 657 QString id("");
658 currentPart.setPositionlist(countlist); 658 currentPart.setPositionlist(countlist);
659 for (unsigned int j = 0; j < countlist.count();++j) { 659 for (unsigned int j = 0; j < countlist.count();++j) {
660 id+=(j>0?" ":""); 660 id+=(j>0?" ":"");
661 id+=QString("%1").arg(countlist[j]); 661 id+=QString("%1").arg(countlist[j]);
662 } 662 }
663 qDebug("ID = %s",id.latin1()); 663 qDebug("ID = %s",id.latin1());
664 currentPart.setIdentifier(id); 664 currentPart.setIdentifier(id);
665 fillSinglePart(currentPart,part1); 665 fillSinglePart(currentPart,part1);
666 /* important: Check for is NULL 'cause a body can be empty! 666 /* important: Check for is NULL 'cause a body can be empty!
667 And we put it only into the mail if it is the FIRST part */ 667 And we put it only into the mail if it is the FIRST part */
668 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body.Bodytext().isNull() && countlist[0]==1) { 668 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body.Bodytext().isNull() && countlist[0]==1) {
@@ -848,140 +848,140 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which)
848 encoding="binary"; 848 encoding="binary";
849 break; 849 break;
850 case MAILIMAP_BODY_FLD_ENC_BASE64: 850 case MAILIMAP_BODY_FLD_ENC_BASE64:
851 encoding="base64"; 851 encoding="base64";
852 break; 852 break;
853 case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: 853 case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE:
854 encoding="quoted-printable"; 854 encoding="quoted-printable";
855 break; 855 break;
856 case MAILIMAP_BODY_FLD_ENC_OTHER: 856 case MAILIMAP_BODY_FLD_ENC_OTHER:
857 default: 857 default:
858 if (enc->enc_value) { 858 if (enc->enc_value) {
859 char*t=enc->enc_value; 859 char*t=enc->enc_value;
860 encoding=QString(enc->enc_value); 860 encoding=QString(enc->enc_value);
861 enc->enc_value=0L; 861 enc->enc_value=0L;
862 free(t); 862 free(t);
863 } 863 }
864 } 864 }
865 if (which->bd_description) { 865 if (which->bd_description) {
866 target_part.setDescription(QString(which->bd_description)); 866 target_part.setDescription(QString(which->bd_description));
867 } 867 }
868 target_part.setEncoding(encoding); 868 target_part.setEncoding(encoding);
869 target_part.setSize(which->bd_size); 869 target_part.setSize(which->bd_size);
870} 870}
871 871
872void IMAPwrapper::deleteMail(const RecMail&mail) 872void IMAPwrapper::deleteMail(const RecMailP&mail)
873{ 873{
874 mailimap_flag_list*flist; 874 mailimap_flag_list*flist;
875 mailimap_set *set; 875 mailimap_set *set;
876 mailimap_store_att_flags * store_flags; 876 mailimap_store_att_flags * store_flags;
877 int err; 877 int err;
878 login(); 878 login();
879 if (!m_imap) { 879 if (!m_imap) {
880 return; 880 return;
881 } 881 }
882 err = selectMbox(mail.getMbox()); 882 err = selectMbox(mail->getMbox());
883 if ( err != MAILIMAP_NO_ERROR ) { 883 if ( err != MAILIMAP_NO_ERROR ) {
884 return; 884 return;
885 } 885 }
886 flist = mailimap_flag_list_new_empty(); 886 flist = mailimap_flag_list_new_empty();
887 mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); 887 mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
888 store_flags = mailimap_store_att_flags_new_set_flags(flist); 888 store_flags = mailimap_store_att_flags_new_set_flags(flist);
889 set = mailimap_set_new_single(mail.getNumber()); 889 set = mailimap_set_new_single(mail->getNumber());
890 err = mailimap_store(m_imap,set,store_flags); 890 err = mailimap_store(m_imap,set,store_flags);
891 mailimap_set_free( set ); 891 mailimap_set_free( set );
892 mailimap_store_att_flags_free(store_flags); 892 mailimap_store_att_flags_free(store_flags);
893 893
894 if (err != MAILIMAP_NO_ERROR) { 894 if (err != MAILIMAP_NO_ERROR) {
895 qDebug("error deleting mail: %s",m_imap->imap_response); 895 qDebug("error deleting mail: %s",m_imap->imap_response);
896 return; 896 return;
897 } 897 }
898 qDebug("deleting mail: %s",m_imap->imap_response); 898 qDebug("deleting mail: %s",m_imap->imap_response);
899 /* should we realy do that at this moment? */ 899 /* should we realy do that at this moment? */
900 err = mailimap_expunge(m_imap); 900 err = mailimap_expunge(m_imap);
901 if (err != MAILIMAP_NO_ERROR) { 901 if (err != MAILIMAP_NO_ERROR) {
902 qDebug("error deleting mail: %s",m_imap->imap_response); 902 qDebug("error deleting mail: %s",m_imap->imap_response);
903 } 903 }
904 qDebug("Delete successfull %s",m_imap->imap_response); 904 qDebug("Delete successfull %s",m_imap->imap_response);
905} 905}
906 906
907void IMAPwrapper::answeredMail(const RecMail&mail) 907void IMAPwrapper::answeredMail(const RecMailP&mail)
908{ 908{
909 mailimap_flag_list*flist; 909 mailimap_flag_list*flist;
910 mailimap_set *set; 910 mailimap_set *set;
911 mailimap_store_att_flags * store_flags; 911 mailimap_store_att_flags * store_flags;
912 int err; 912 int err;
913 login(); 913 login();
914 if (!m_imap) { 914 if (!m_imap) {
915 return; 915 return;
916 } 916 }
917 err = selectMbox(mail.getMbox()); 917 err = selectMbox(mail->getMbox());
918 if ( err != MAILIMAP_NO_ERROR ) { 918 if ( err != MAILIMAP_NO_ERROR ) {
919 return; 919 return;
920 } 920 }
921 flist = mailimap_flag_list_new_empty(); 921 flist = mailimap_flag_list_new_empty();
922 mailimap_flag_list_add(flist,mailimap_flag_new_answered()); 922 mailimap_flag_list_add(flist,mailimap_flag_new_answered());
923 store_flags = mailimap_store_att_flags_new_add_flags(flist); 923 store_flags = mailimap_store_att_flags_new_add_flags(flist);
924 set = mailimap_set_new_single(mail.getNumber()); 924 set = mailimap_set_new_single(mail->getNumber());
925 err = mailimap_store(m_imap,set,store_flags); 925 err = mailimap_store(m_imap,set,store_flags);
926 mailimap_set_free( set ); 926 mailimap_set_free( set );
927 mailimap_store_att_flags_free(store_flags); 927 mailimap_store_att_flags_free(store_flags);
928 928
929 if (err != MAILIMAP_NO_ERROR) { 929 if (err != MAILIMAP_NO_ERROR) {
930 qDebug("error marking mail: %s",m_imap->imap_response); 930 qDebug("error marking mail: %s",m_imap->imap_response);
931 return; 931 return;
932 } 932 }
933} 933}
934 934
935QString IMAPwrapper::fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call,const QString&enc) 935QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
936{ 936{
937 QString body(""); 937 QString body("");
938 encodedString*res = fetchRawPart(mail,path,internal_call); 938 encodedString*res = fetchRawPart(mail,path,internal_call);
939 encodedString*r = decode_String(res,enc); 939 encodedString*r = decode_String(res,enc);
940 delete res; 940 delete res;
941 if (r) { 941 if (r) {
942 if (r->Length()>0) { 942 if (r->Length()>0) {
943 body = r->Content(); 943 body = r->Content();
944 } 944 }
945 delete r; 945 delete r;
946 } 946 }
947 return body; 947 return body;
948} 948}
949 949
950QString IMAPwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) 950QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part)
951{ 951{
952 return fetchTextPart(mail,part.Positionlist(),false,part.Encoding()); 952 return fetchTextPart(mail,part.Positionlist(),false,part.Encoding());
953} 953}
954 954
955encodedString* IMAPwrapper::fetchDecodedPart(const RecMail&mail,const RecPart&part) 955encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPart&part)
956{ 956{
957 encodedString*res = fetchRawPart(mail,part.Positionlist(),false); 957 encodedString*res = fetchRawPart(mail,part.Positionlist(),false);
958 encodedString*r = decode_String(res,part.Encoding()); 958 encodedString*r = decode_String(res,part.Encoding());
959 delete res; 959 delete res;
960 return r; 960 return r;
961} 961}
962 962
963encodedString* IMAPwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) 963encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part)
964{ 964{
965 return fetchRawPart(mail,part.Positionlist(),false); 965 return fetchRawPart(mail,part.Positionlist(),false);
966} 966}
967 967
968int IMAPwrapper::deleteAllMail(const FolderP&folder) 968int IMAPwrapper::deleteAllMail(const FolderP&folder)
969{ 969{
970 login(); 970 login();
971 if (!m_imap) { 971 if (!m_imap) {
972 return 0; 972 return 0;
973 } 973 }
974 mailimap_flag_list*flist; 974 mailimap_flag_list*flist;
975 mailimap_set *set; 975 mailimap_set *set;
976 mailimap_store_att_flags * store_flags; 976 mailimap_store_att_flags * store_flags;
977 int err = selectMbox(folder->getName()); 977 int err = selectMbox(folder->getName());
978 if ( err != MAILIMAP_NO_ERROR ) { 978 if ( err != MAILIMAP_NO_ERROR ) {
979 return 0; 979 return 0;
980 } 980 }
981 981
982 int last = m_imap->imap_selection_info->sel_exists; 982 int last = m_imap->imap_selection_info->sel_exists;
983 if (last == 0) { 983 if (last == 0) {
984 Global::statusMessage(tr("Mailbox has no mails!")); 984 Global::statusMessage(tr("Mailbox has no mails!"));
985 return 0; 985 return 0;
986 } 986 }
987 flist = mailimap_flag_list_new_empty(); 987 flist = mailimap_flag_list_new_empty();
@@ -1034,49 +1034,48 @@ int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,cons
1034 return 0; 1034 return 0;
1035 } 1035 }
1036 return 1; 1036 return 1;
1037} 1037}
1038 1038
1039int IMAPwrapper::deleteMbox(const FolderP&folder) 1039int IMAPwrapper::deleteMbox(const FolderP&folder)
1040{ 1040{
1041 if (!folder) return 0; 1041 if (!folder) return 0;
1042 login(); 1042 login();
1043 if (!m_imap) {return 0;} 1043 if (!m_imap) {return 0;}
1044 int res = mailimap_delete(m_imap,folder->getName()); 1044 int res = mailimap_delete(m_imap,folder->getName());
1045 if (res != MAILIMAP_NO_ERROR) { 1045 if (res != MAILIMAP_NO_ERROR) {
1046 Global::statusMessage(tr("%1").arg(m_imap->imap_response)); 1046 Global::statusMessage(tr("%1").arg(m_imap->imap_response));
1047 return 0; 1047 return 0;
1048 } 1048 }
1049 return 1; 1049 return 1;
1050} 1050}
1051 1051
1052void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 1052void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
1053{ 1053{
1054 mailimap_status_att_list * att_list =0; 1054 mailimap_status_att_list * att_list =0;
1055 mailimap_mailbox_data_status * status=0; 1055 mailimap_mailbox_data_status * status=0;
1056 clistiter * cur = 0; 1056 clistiter * cur = 0;
1057 int r = 0; 1057 int r = 0;
1058 int res = 0;
1059 target_stat.message_count = 0; 1058 target_stat.message_count = 0;
1060 target_stat.message_unseen = 0; 1059 target_stat.message_unseen = 0;
1061 target_stat.message_recent = 0; 1060 target_stat.message_recent = 0;
1062 login(); 1061 login();
1063 if (!m_imap) { 1062 if (!m_imap) {
1064 return; 1063 return;
1065 } 1064 }
1066 att_list = mailimap_status_att_list_new_empty(); 1065 att_list = mailimap_status_att_list_new_empty();
1067 if (!att_list) return; 1066 if (!att_list) return;
1068 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES); 1067 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES);
1069 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT); 1068 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT);
1070 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); 1069 r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN);
1071 r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); 1070 r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status);
1072 if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) { 1071 if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) {
1073 for (cur = clist_begin(status->st_info_list); 1072 for (cur = clist_begin(status->st_info_list);
1074 cur != NULL ; cur = clist_next(cur)) { 1073 cur != NULL ; cur = clist_next(cur)) {
1075 mailimap_status_info * status_info; 1074 mailimap_status_info * status_info;
1076 status_info = (mailimap_status_info *)clist_content(cur); 1075 status_info = (mailimap_status_info *)clist_content(cur);
1077 switch (status_info->st_att) { 1076 switch (status_info->st_att) {
1078 case MAILIMAP_STATUS_ATT_MESSAGES: 1077 case MAILIMAP_STATUS_ATT_MESSAGES:
1079 target_stat.message_count = status_info->st_value; 1078 target_stat.message_count = status_info->st_value;
1080 break; 1079 break;
1081 case MAILIMAP_STATUS_ATT_RECENT: 1080 case MAILIMAP_STATUS_ATT_RECENT:
1082 target_stat.message_recent = status_info->st_value; 1081 target_stat.message_recent = status_info->st_value;
@@ -1094,92 +1093,92 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
1094} 1093}
1095 1094
1096void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) 1095void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
1097{ 1096{
1098 login(); 1097 login();
1099 if (!m_imap) return; 1098 if (!m_imap) return;
1100 if (!msg) return; 1099 if (!msg) return;
1101 int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); 1100 int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length);
1102 if (r != MAILIMAP_NO_ERROR) { 1101 if (r != MAILIMAP_NO_ERROR) {
1103 Global::statusMessage("Error storing mail!"); 1102 Global::statusMessage("Error storing mail!");
1104 } 1103 }
1105} 1104}
1106 1105
1107MAILLIB::ATYPE IMAPwrapper::getType()const 1106MAILLIB::ATYPE IMAPwrapper::getType()const
1108{ 1107{
1109 return account->getType(); 1108 return account->getType();
1110} 1109}
1111 1110
1112const QString&IMAPwrapper::getName()const 1111const QString&IMAPwrapper::getName()const
1113{ 1112{
1114 qDebug("Get name: %s",account->getAccountName().latin1()); 1113 qDebug("Get name: %s",account->getAccountName().latin1());
1115 return account->getAccountName(); 1114 return account->getAccountName();
1116} 1115}
1117 1116
1118encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) 1117encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail)
1119{ 1118{
1120 // dummy 1119 // dummy
1121 QValueList<int> path; 1120 QValueList<int> path;
1122 return fetchRawPart(mail,path,false); 1121 return fetchRawPart(mail,path,false);
1123} 1122}
1124 1123
1125void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, 1124void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
1126 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 1125 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
1127{ 1126{
1128 if (targetWrapper != this) { 1127 if (targetWrapper != this) {
1129 AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); 1128 AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
1130 qDebug("Using generic"); 1129 qDebug("Using generic");
1131 return; 1130 return;
1132 } 1131 }
1133 mailimap_set *set = 0; 1132 mailimap_set *set = 0;
1134 login(); 1133 login();
1135 if (!m_imap) { 1134 if (!m_imap) {
1136 return; 1135 return;
1137 } 1136 }
1138 int err = selectMbox(fromFolder->getName()); 1137 int err = selectMbox(fromFolder->getName());
1139 if ( err != MAILIMAP_NO_ERROR ) { 1138 if ( err != MAILIMAP_NO_ERROR ) {
1140 return; 1139 return;
1141 } 1140 }
1142 int last = m_imap->imap_selection_info->sel_exists; 1141 int last = m_imap->imap_selection_info->sel_exists;
1143 set = mailimap_set_new_interval( 1, last ); 1142 set = mailimap_set_new_interval( 1, last );
1144 err = mailimap_copy(m_imap,set,targetFolder.latin1()); 1143 err = mailimap_copy(m_imap,set,targetFolder.latin1());
1145 mailimap_set_free( set ); 1144 mailimap_set_free( set );
1146 if ( err != MAILIMAP_NO_ERROR ) { 1145 if ( err != MAILIMAP_NO_ERROR ) {
1147 QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response); 1146 QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response);
1148 Global::statusMessage(error_msg); 1147 Global::statusMessage(error_msg);
1149 qDebug(error_msg); 1148 qDebug(error_msg);
1150 return; 1149 return;
1151 } 1150 }
1152 if (moveit) { 1151 if (moveit) {
1153 deleteAllMail(fromFolder); 1152 deleteAllMail(fromFolder);
1154 } 1153 }
1155} 1154}
1156 1155
1157void IMAPwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 1156void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
1158{ 1157{
1159 if (targetWrapper != this) { 1158 if (targetWrapper != this) {
1160 qDebug("Using generic"); 1159 qDebug("Using generic");
1161 AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); 1160 AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit);
1162 return; 1161 return;
1163 } 1162 }
1164 mailimap_set *set = 0; 1163 mailimap_set *set = 0;
1165 login(); 1164 login();
1166 if (!m_imap) { 1165 if (!m_imap) {
1167 return; 1166 return;
1168 } 1167 }
1169 int err = selectMbox(mail.getMbox()); 1168 int err = selectMbox(mail->getMbox());
1170 if ( err != MAILIMAP_NO_ERROR ) { 1169 if ( err != MAILIMAP_NO_ERROR ) {
1171 return; 1170 return;
1172 } 1171 }
1173 set = mailimap_set_new_single(mail.getNumber()); 1172 set = mailimap_set_new_single(mail->getNumber());
1174 err = mailimap_copy(m_imap,set,targetFolder.latin1()); 1173 err = mailimap_copy(m_imap,set,targetFolder.latin1());
1175 mailimap_set_free( set ); 1174 mailimap_set_free( set );
1176 if ( err != MAILIMAP_NO_ERROR ) { 1175 if ( err != MAILIMAP_NO_ERROR ) {
1177 QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); 1176 QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response);
1178 Global::statusMessage(error_msg); 1177 Global::statusMessage(error_msg);
1179 qDebug(error_msg); 1178 qDebug(error_msg);
1180 return; 1179 return;
1181 } 1180 }
1182 if (moveit) { 1181 if (moveit) {
1183 deleteMail(mail); 1182 deleteMail(mail);
1184 } 1183 }
1185} 1184}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index 15f049f..3bd5967 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -2,79 +2,79 @@
2#define __IMAPWRAPPER 2#define __IMAPWRAPPER
3 3
4#include <qlist.h> 4#include <qlist.h>
5#include "mailwrapper.h" 5#include "mailwrapper.h"
6#include "abstractmail.h" 6#include "abstractmail.h"
7#include <libetpan/clist.h> 7#include <libetpan/clist.h>
8 8
9struct mailimap; 9struct mailimap;
10struct mailimap_body; 10struct mailimap_body;
11struct mailimap_body_type_1part; 11struct mailimap_body_type_1part;
12struct mailimap_body_type_text; 12struct mailimap_body_type_text;
13struct mailimap_body_type_basic; 13struct mailimap_body_type_basic;
14struct mailimap_body_type_msg; 14struct mailimap_body_type_msg;
15struct mailimap_body_type_mpart; 15struct mailimap_body_type_mpart;
16struct mailimap_body_fields; 16struct mailimap_body_fields;
17struct mailimap_msg_att; 17struct mailimap_msg_att;
18class encodedString; 18class encodedString;
19 19
20class IMAPwrapper : public AbstractMail 20class IMAPwrapper : public AbstractMail
21{ 21{
22 Q_OBJECT 22 Q_OBJECT
23public: 23public:
24 IMAPwrapper( IMAPaccount *a ); 24 IMAPwrapper( IMAPaccount *a );
25 virtual ~IMAPwrapper(); 25 virtual ~IMAPwrapper();
26 virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); 26 virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders();
27 virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); 27 virtual void listMessages(const QString & mailbox,QValueList<Opie::OSmartPointer<RecMail> >&target );
28 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); 28 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
29 29
30 virtual void deleteMail(const RecMail&mail); 30 virtual void deleteMail(const RecMailP&mail);
31 virtual void answeredMail(const RecMail&mail); 31 virtual void answeredMail(const RecMailP&mail);
32 virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&folder); 32 virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&folder);
33 virtual void storeMessage(const char*msg,size_t length, const QString&folder); 33 virtual void storeMessage(const char*msg,size_t length, const QString&folder);
34 virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder, 34 virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder,
35 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 35 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
36 virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 36 virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
37 37
38 virtual RecBody fetchBody(const RecMail&mail); 38 virtual RecBody fetchBody(const RecMailP&mail);
39 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); 39 virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part);
40 virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); 40 virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part);
41 virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); 41 virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part);
42 virtual encodedString* fetchRawBody(const RecMail&mail); 42 virtual encodedString* fetchRawBody(const RecMailP&mail);
43 43
44 virtual int createMbox(const QString&,const Opie::osmart_pointer<Folder>&parentfolder=0, 44 virtual int createMbox(const QString&,const Opie::OSmartPointer<Folder>&parentfolder=0,
45 const QString& delemiter="/",bool getsubfolder=false); 45 const QString& delemiter="/",bool getsubfolder=false);
46 virtual int deleteMbox(const Opie::osmart_pointer<Folder>&folder); 46 virtual int deleteMbox(const Opie::OSmartPointer<Folder>&folder);
47 47
48 static void imap_progress( size_t current, size_t maximum ); 48 static void imap_progress( size_t current, size_t maximum );
49 49
50 virtual void logout(); 50 virtual void logout();
51 virtual MAILLIB::ATYPE getType()const; 51 virtual MAILLIB::ATYPE getType()const;
52 virtual const QString&getName()const; 52 virtual const QString&getName()const;
53 53
54protected: 54protected:
55 RecMail*parse_list_result(mailimap_msg_att*); 55 RecMail*parse_list_result(mailimap_msg_att*);
56 void login(); 56 void login();
57 bool start_tls(bool force=true); 57 bool start_tls(bool force=true);
58 58
59 virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); 59 virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc="");
60 virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); 60 virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call);
61 int selectMbox(const QString&mbox); 61 int selectMbox(const QString&mbox);
62 62
63 void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); 63 void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description);
64 void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); 64 void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which);
65 void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); 65 void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which);
66 void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); 66 void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which);
67 void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); 67 void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which);
68 void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); 68 void traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1);
69 69
70 /* just helpers */ 70 /* just helpers */
71 static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); 71 static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which);
72 static QStringList address_list_to_stringlist(clist*list); 72 static QStringList address_list_to_stringlist(clist*list);
73 73
74 74
75 IMAPaccount *account; 75 IMAPaccount *account;
76 mailimap *m_imap; 76 mailimap *m_imap;
77 QString m_Lastmbox; 77 QString m_Lastmbox;
78}; 78};
79 79
80#endif 80#endif
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp
index 49b3caa..7dd7e58 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.cpp
+++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp
@@ -1,35 +1,35 @@
1#include "mailtypes.h" 1#include "mailtypes.h"
2#include <stdlib.h> 2#include <stdlib.h>
3 3
4RecMail::RecMail() 4RecMail::RecMail()
5 :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) 5 :Opie::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7)
6{ 6{
7 init(); 7 init();
8} 8}
9 9
10RecMail::RecMail(const RecMail&old) 10RecMail::RecMail(const RecMail&old)
11 :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) 11 :Opie::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7)
12{ 12{
13 init(); 13 init();
14 copy_old(old); 14 copy_old(old);
15 qDebug("Copy constructor RecMail"); 15 qDebug("Copy constructor RecMail");
16} 16}
17 17
18RecMail::~RecMail() 18RecMail::~RecMail()
19{ 19{
20 wrapper = 0; 20 wrapper = 0;
21} 21}
22 22
23void RecMail::copy_old(const RecMail&old) 23void RecMail::copy_old(const RecMail&old)
24{ 24{
25 subject = old.subject; 25 subject = old.subject;
26 date = old.date; 26 date = old.date;
27 mbox = old.mbox; 27 mbox = old.mbox;
28 msg_id = old.msg_id; 28 msg_id = old.msg_id;
29 msg_size = old.msg_size; 29 msg_size = old.msg_size;
30 msg_number = old.msg_number; 30 msg_number = old.msg_number;
31 from = old.from; 31 from = old.from;
32 msg_flags = old.msg_flags; 32 msg_flags = old.msg_flags;
33 to = old.to; 33 to = old.to;
34 cc = old.cc; 34 cc = old.cc;
35 bcc = old.bcc; 35 bcc = old.bcc;
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h
index 10d367f..dc10de6 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.h
+++ b/noncore/net/mail/libmailwrapper/mailtypes.h
@@ -1,105 +1,108 @@
1#ifndef __MAIL_TYPES_H 1#ifndef __MAIL_TYPES_H
2#define __MAIL_TYPES_H 2#define __MAIL_TYPES_H
3 3
4#define FLAG_ANSWERED 0 4#define FLAG_ANSWERED 0
5#define FLAG_FLAGGED 1 5#define FLAG_FLAGGED 1
6#define FLAG_DELETED 2 6#define FLAG_DELETED 2
7#define FLAG_SEEN 3 7#define FLAG_SEEN 3
8#define FLAG_DRAFT 4 8#define FLAG_DRAFT 4
9#define FLAG_RECENT 5 9#define FLAG_RECENT 5
10 10
11#include <opie2/osmartpointer.h>
12
11#include <qbitarray.h> 13#include <qbitarray.h>
12#include <qstring.h> 14#include <qstring.h>
13#include <qstringlist.h> 15#include <qstringlist.h>
14#include <qmap.h> 16#include <qmap.h>
15#include <qvaluelist.h> 17#include <qvaluelist.h>
16 18
17class AbstractMail; 19class AbstractMail;
18/* a class to describe mails in a mailbox */ 20/* a class to describe mails in a mailbox */
19/* Attention! 21/* Attention!
20 From programmers point of view it would make sense to 22 From programmers point of view it would make sense to
21 store the mail body into this class, too. 23 store the mail body into this class, too.
22 But: not from the point of view of the device. 24 But: not from the point of view of the device.
23 Mailbodies can be real large. So we request them when 25 Mailbodies can be real large. So we request them when
24 needed from the mail-wrapper class direct from the server itself 26 needed from the mail-wrapper class direct from the server itself
25 (imap) or from a file-based cache (pop3?) 27 (imap) or from a file-based cache (pop3?)
26 So there is no interface "const QString&body()" but you should 28 So there is no interface "const QString&body()" but you should
27 make a request to the mailwrapper with this class as parameter to 29 make a request to the mailwrapper with this class as parameter to
28 get the body. Same words for the attachments. 30 get the body. Same words for the attachments.
29*/ 31*/
30class RecMail 32class RecMail:public Opie::ORefCount
31{ 33{
32public: 34public:
33 RecMail(); 35 RecMail();
34 RecMail(const RecMail&old); 36 RecMail(const RecMail&old);
35 virtual ~RecMail(); 37 virtual ~RecMail();
36 38
37 const int getNumber()const{return msg_number;} 39 const unsigned int getNumber()const{return msg_number;}
38 void setNumber(int number){msg_number=number;} 40 void setNumber(unsigned int number){msg_number=number;}
39 const QString&getDate()const{ return date; } 41 const QString&getDate()const{ return date; }
40 void setDate( const QString&a ) { date = a; } 42 void setDate( const QString&a ) { date = a; }
41 const QString&getFrom()const{ return from; } 43 const QString&getFrom()const{ return from; }
42 void setFrom( const QString&a ) { from = a; } 44 void setFrom( const QString&a ) { from = a; }
43 const QString&getSubject()const { return subject; } 45 const QString&getSubject()const { return subject; }
44 void setSubject( const QString&s ) { subject = s; } 46 void setSubject( const QString&s ) { subject = s; }
45 const QString&getMbox()const{return mbox;} 47 const QString&getMbox()const{return mbox;}
46 void setMbox(const QString&box){mbox = box;} 48 void setMbox(const QString&box){mbox = box;}
47 void setMsgid(const QString&id){msg_id=id;} 49 void setMsgid(const QString&id){msg_id=id;}
48 const QString&Msgid()const{return msg_id;} 50 const QString&Msgid()const{return msg_id;}
49 void setReplyto(const QString&reply){replyto=reply;} 51 void setReplyto(const QString&reply){replyto=reply;}
50 const QString&Replyto()const{return replyto;} 52 const QString&Replyto()const{return replyto;}
51 void setMsgsize(int size){msg_size = size;} 53 void setMsgsize(unsigned int size){msg_size = size;}
52 const int Msgsize()const{return msg_size;} 54 const unsigned int Msgsize()const{return msg_size;}
53 55
54 56
55 void setTo(const QStringList&list); 57 void setTo(const QStringList&list);
56 const QStringList&To()const; 58 const QStringList&To()const;
57 void setCC(const QStringList&list); 59 void setCC(const QStringList&list);
58 const QStringList&CC()const; 60 const QStringList&CC()const;
59 void setBcc(const QStringList&list); 61 void setBcc(const QStringList&list);
60 const QStringList&Bcc()const; 62 const QStringList&Bcc()const;
61 void setInreply(const QStringList&list); 63 void setInreply(const QStringList&list);
62 const QStringList&Inreply()const; 64 const QStringList&Inreply()const;
63 void setReferences(const QStringList&list); 65 void setReferences(const QStringList&list);
64 const QStringList&References()const; 66 const QStringList&References()const;
65 67
66 const QBitArray&getFlags()const{return msg_flags;} 68 const QBitArray&getFlags()const{return msg_flags;}
67 void setFlags(const QBitArray&flags){msg_flags = flags;} 69 void setFlags(const QBitArray&flags){msg_flags = flags;}
68 70
69 void setWrapper(AbstractMail*wrapper); 71 void setWrapper(AbstractMail*wrapper);
70 AbstractMail* Wrapper(); 72 AbstractMail* Wrapper();
71 73
72protected: 74protected:
73 QString subject,date,from,mbox,msg_id,replyto; 75 QString subject,date,from,mbox,msg_id,replyto;
74 int msg_number,msg_size; 76 unsigned int msg_number,msg_size;
75 QBitArray msg_flags; 77 QBitArray msg_flags;
76 QStringList to,cc,bcc,in_reply_to,references; 78 QStringList to,cc,bcc,in_reply_to,references;
77 AbstractMail*wrapper; 79 AbstractMail*wrapper;
78 void init(); 80 void init();
79 void copy_old(const RecMail&old); 81 void copy_old(const RecMail&old);
80}; 82};
81 83
84typedef Opie::OSmartPointer<RecMail> RecMailP;
82typedef QMap<QString,QString> part_plist_t; 85typedef QMap<QString,QString> part_plist_t;
83 86
84class RecPart 87class RecPart
85{ 88{
86protected: 89protected:
87 QString m_type,m_subtype,m_identifier,m_encoding,m_description; 90 QString m_type,m_subtype,m_identifier,m_encoding,m_description;
88 unsigned int m_lines,m_size; 91 unsigned int m_lines,m_size;
89 part_plist_t m_Parameters; 92 part_plist_t m_Parameters;
90 /* describes the position in the mail */ 93 /* describes the position in the mail */
91 QValueList<int> m_poslist; 94 QValueList<int> m_poslist;
92 95
93public: 96public:
94 RecPart(); 97 RecPart();
95 virtual ~RecPart(); 98 virtual ~RecPart();
96 99
97 const QString&Type()const; 100 const QString&Type()const;
98 void setType(const QString&type); 101 void setType(const QString&type);
99 const QString&Subtype()const; 102 const QString&Subtype()const;
100 void setSubtype(const QString&subtype); 103 void setSubtype(const QString&subtype);
101 const QString&Identifier()const; 104 const QString&Identifier()const;
102 void setIdentifier(const QString&identifier); 105 void setIdentifier(const QString&identifier);
103 const QString&Encoding()const; 106 const QString&Encoding()const;
104 void setEncoding(const QString&encoding); 107 void setEncoding(const QString&encoding);
105 const QString&Description()const; 108 const QString&Description()const;
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
index c71d69f..9bf2fd3 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
@@ -134,45 +134,45 @@ QString IMAPFolder::decodeFolderName( const QString &name )
134 i = 3; 134 i = 3;
135 } else { 135 } else {
136 utf8[0] = 0xf0 | (ucs4 >> 18); 136 utf8[0] = 0xf0 | (ucs4 >> 18);
137 utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f); 137 utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f);
138 utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f); 138 utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f);
139 utf8[3] = 0x80 | (ucs4 & 0x3f); 139 utf8[3] = 0x80 | (ucs4 & 0x3f);
140 i = 4; 140 i = 4;
141 } 141 }
142 /* copy it */ 142 /* copy it */
143 for (c = 0; c < i; ++c) { 143 for (c = 0; c < i; ++c) {
144 dst += utf8[c]; 144 dst += utf8[c];
145 } 145 }
146 } 146 }
147 } 147 }
148 /* skip over trailing '-' in modified UTF-7 encoding */ 148 /* skip over trailing '-' in modified UTF-7 encoding */
149 if (src[srcPtr] == '-') 149 if (src[srcPtr] == '-')
150 ++srcPtr; 150 ++srcPtr;
151 } 151 }
152 } 152 }
153 153
154 return QString::fromUtf8( dst.data() ); 154 return QString::fromUtf8( dst.data() );
155} 155}
156 156
157Mail::Mail() 157Mail::Mail()
158 :Opie::oref_count(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") 158 :Opie::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("")
159{ 159{
160} 160}
161 161
162MHFolder::MHFolder(const QString&disp_name,const QString&mbox) 162MHFolder::MHFolder(const QString&disp_name,const QString&mbox)
163 : Folder( disp_name,"/" ) 163 : Folder( disp_name,"/" )
164{ 164{
165 separator = "/"; 165 separator = "/";
166 name = mbox; 166 name = mbox;
167 if (!disp_name.startsWith("/") && disp_name.length()>0) 167 if (!disp_name.startsWith("/") && disp_name.length()>0)
168 name+="/"; 168 name+="/";
169 name+=disp_name; 169 name+=disp_name;
170 if (disp_name.length()==0) { 170 if (disp_name.length()==0) {
171 nameDisplay = separator; 171 nameDisplay = separator;
172 } 172 }
173 prefix = mbox; 173 prefix = mbox;
174} 174}
175 175
176MHFolder::~MHFolder() 176MHFolder::~MHFolder()
177{ 177{
178} 178}
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h
index 3b3bb32..6bf0078 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.h
@@ -1,106 +1,106 @@
1#ifndef MAILWRAPPER_H 1#ifndef MAILWRAPPER_H
2#define MAILWRAPPER_H 2#define MAILWRAPPER_H
3 3
4#include <qpe/applnk.h> 4#include <qpe/applnk.h>
5 5
6#include <qbitarray.h> 6#include <qbitarray.h>
7#include <qdatetime.h> 7#include <qdatetime.h>
8 8
9#include "settings.h" 9#include "settings.h"
10 10
11#include <opie2/osmart_pointer.h> 11#include <opie2/osmartpointer.h>
12 12
13class Attachment 13class Attachment
14{ 14{
15public: 15public:
16 Attachment( DocLnk lnk ); 16 Attachment( DocLnk lnk );
17 virtual ~Attachment(){} 17 virtual ~Attachment(){}
18 const QString getFileName()const{ return doc.file(); } 18 const QString getFileName()const{ return doc.file(); }
19 const QString getName()const{ return doc.name(); } 19 const QString getName()const{ return doc.name(); }
20 const QString getMimeType()const{ return doc.type(); } 20 const QString getMimeType()const{ return doc.type(); }
21 const QPixmap getPixmap()const{ return doc.pixmap(); } 21 const QPixmap getPixmap()const{ return doc.pixmap(); }
22 const int getSize()const { return size; } 22 const int getSize()const { return size; }
23 DocLnk getDocLnk() { return doc; } 23 DocLnk getDocLnk() { return doc; }
24 24
25protected: 25protected:
26 DocLnk doc; 26 DocLnk doc;
27 int size; 27 int size;
28 28
29}; 29};
30 30
31class Mail:public Opie::oref_count 31class Mail:public Opie::ORefCount
32{ 32{
33public: 33public:
34 Mail(); 34 Mail();
35 /* Possible that this destructor must not be declared virtual 35 /* Possible that this destructor must not be declared virtual
36 * 'cause it seems that it will never have some child classes. 36 * 'cause it seems that it will never have some child classes.
37 * in this case this object will not get a virtual table -> memory and 37 * in this case this object will not get a virtual table -> memory and
38 * speed will be a little bit better? 38 * speed will be a little bit better?
39 */ 39 */
40 virtual ~Mail(){} 40 virtual ~Mail(){}
41 void addAttachment( Attachment *att ) { attList.append( att ); } 41 void addAttachment( Attachment *att ) { attList.append( att ); }
42 const QList<Attachment>& getAttachments()const { return attList; } 42 const QList<Attachment>& getAttachments()const { return attList; }
43 void removeAttachment( Attachment *att ) { attList.remove( att ); } 43 void removeAttachment( Attachment *att ) { attList.remove( att ); }
44 const QString&getName()const { return name; } 44 const QString&getName()const { return name; }
45 void setName( QString s ) { name = s; } 45 void setName( QString s ) { name = s; }
46 const QString&getMail()const{ return mail; } 46 const QString&getMail()const{ return mail; }
47 void setMail( const QString&s ) { mail = s; } 47 void setMail( const QString&s ) { mail = s; }
48 const QString&getTo()const{ return to; } 48 const QString&getTo()const{ return to; }
49 void setTo( const QString&s ) { to = s; } 49 void setTo( const QString&s ) { to = s; }
50 const QString&getCC()const{ return cc; } 50 const QString&getCC()const{ return cc; }
51 void setCC( const QString&s ) { cc = s; } 51 void setCC( const QString&s ) { cc = s; }
52 const QString&getBCC()const { return bcc; } 52 const QString&getBCC()const { return bcc; }
53 void setBCC( const QString&s ) { bcc = s; } 53 void setBCC( const QString&s ) { bcc = s; }
54 const QString&getMessage()const { return message; } 54 const QString&getMessage()const { return message; }
55 void setMessage( const QString&s ) { message = s; } 55 void setMessage( const QString&s ) { message = s; }
56 const QString&getSubject()const { return subject; } 56 const QString&getSubject()const { return subject; }
57 void setSubject( const QString&s ) { subject = s; } 57 void setSubject( const QString&s ) { subject = s; }
58 const QString&getReply()const{ return reply; } 58 const QString&getReply()const{ return reply; }
59 void setReply( const QString&a ) { reply = a; } 59 void setReply( const QString&a ) { reply = a; }
60 void setInreply(const QStringList&list){m_in_reply_to = list;} 60 void setInreply(const QStringList&list){m_in_reply_to = list;}
61 const QStringList&Inreply()const{return m_in_reply_to;} 61 const QStringList&Inreply()const{return m_in_reply_to;}
62 62
63private: 63private:
64 QList<Attachment> attList; 64 QList<Attachment> attList;
65 QString name, mail, to, cc, bcc, reply, subject, message; 65 QString name, mail, to, cc, bcc, reply, subject, message;
66 QStringList m_in_reply_to; 66 QStringList m_in_reply_to;
67}; 67};
68 68
69class Folder:public Opie::oref_count 69class Folder:public Opie::ORefCount
70{ 70{
71public: 71public:
72 Folder( const QString&init_name,const QString&sep ); 72 Folder( const QString&init_name,const QString&sep );
73 virtual ~Folder(); 73 virtual ~Folder();
74 const QString&getDisplayName()const { return nameDisplay; } 74 const QString&getDisplayName()const { return nameDisplay; }
75 const QString&getName()const { return name; } 75 const QString&getName()const { return name; }
76 const QString&getPrefix()const{return prefix; } 76 const QString&getPrefix()const{return prefix; }
77 virtual bool may_select()const{return true;} 77 virtual bool may_select()const{return true;}
78 virtual bool no_inferior()const{return true;} 78 virtual bool no_inferior()const{return true;}
79 const QString&Separator()const; 79 const QString&Separator()const;
80 80
81protected: 81protected:
82 QString nameDisplay, name, separator,prefix; 82 QString nameDisplay, name, separator,prefix;
83}; 83};
84 84
85typedef Opie::osmart_pointer<Folder> FolderP; 85typedef Opie::OSmartPointer<Folder> FolderP;
86 86
87class MHFolder : public Folder 87class MHFolder : public Folder
88{ 88{
89public: 89public:
90 MHFolder(const QString&disp_name,const QString&mbox); 90 MHFolder(const QString&disp_name,const QString&mbox);
91 virtual ~MHFolder(); 91 virtual ~MHFolder();
92}; 92};
93 93
94class IMAPFolder : public Folder 94class IMAPFolder : public Folder
95{ 95{
96 public: 96 public:
97 IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" ); 97 IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" );
98 virtual ~IMAPFolder(); 98 virtual ~IMAPFolder();
99 virtual bool may_select()const{return m_MaySelect;} 99 virtual bool may_select()const{return m_MaySelect;}
100 virtual bool no_inferior()const{return m_NoInferior;} 100 virtual bool no_inferior()const{return m_NoInferior;}
101 private: 101 private:
102 static QString decodeFolderName( const QString &name ); 102 static QString decodeFolderName( const QString &name );
103 bool m_MaySelect,m_NoInferior; 103 bool m_MaySelect,m_NoInferior;
104}; 104};
105 105
106#endif 106#endif
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
index 9ff3de2..5e6b714 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
@@ -1,142 +1,142 @@
1#include "mboxwrapper.h" 1#include "mboxwrapper.h"
2#include "mailtypes.h" 2#include "mailtypes.h"
3#include "mailwrapper.h" 3#include "mailwrapper.h"
4#include <libetpan/libetpan.h> 4#include <libetpan/libetpan.h>
5#include <qdir.h> 5#include <qdir.h>
6#include <stdlib.h> 6#include <stdlib.h>
7#include <qpe/global.h> 7#include <qpe/global.h>
8 8
9MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) 9MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name)
10 : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name) 10 : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name)
11{ 11{
12 QDir dir(MBOXPath); 12 QDir dir(MBOXPath);
13 if (!dir.exists()) { 13 if (!dir.exists()) {
14 dir.mkdir(MBOXPath); 14 dir.mkdir(MBOXPath);
15 } 15 }
16} 16}
17 17
18MBOXwrapper::~MBOXwrapper() 18MBOXwrapper::~MBOXwrapper()
19{ 19{
20} 20}
21 21
22void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) 22void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target )
23{ 23{
24 mailstorage*storage = mailstorage_new(NULL); 24 mailstorage*storage = mailstorage_new(NULL);
25 QString p = MBOXPath+"/"; 25 QString p = MBOXPath+"/";
26 p+=mailbox; 26 p+=mailbox;
27 27
28 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 28 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
29 mailfolder*folder; 29 mailfolder*folder;
30 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 30 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
31 r = mailfolder_connect(folder); 31 r = mailfolder_connect(folder);
32 if (r != MAIL_NO_ERROR) { 32 if (r != MAIL_NO_ERROR) {
33 qDebug("Error initializing mbox"); 33 qDebug("Error initializing mbox");
34 mailfolder_free(folder); 34 mailfolder_free(folder);
35 mailstorage_free(storage); 35 mailstorage_free(storage);
36 return; 36 return;
37 } 37 }
38 38
39 parseList(target,folder->fld_session,mailbox); 39 parseList(target,folder->fld_session,mailbox);
40 40
41 mailfolder_disconnect(folder); 41 mailfolder_disconnect(folder);
42 mailfolder_free(folder); 42 mailfolder_free(folder);
43 mailstorage_free(storage); 43 mailstorage_free(storage);
44 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); 44 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
45} 45}
46 46
47QValueList<Opie::osmart_pointer<Folder> >* MBOXwrapper::listFolders() 47QValueList<Opie::OSmartPointer<Folder> >* MBOXwrapper::listFolders()
48{ 48{
49 QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); 49 QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >();
50 QDir dir(MBOXPath); 50 QDir dir(MBOXPath);
51 if (!dir.exists()) return folders; 51 if (!dir.exists()) return folders;
52 dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable); 52 dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable);
53 QStringList entries = dir.entryList(); 53 QStringList entries = dir.entryList();
54 QStringList::ConstIterator it = entries.begin(); 54 QStringList::ConstIterator it = entries.begin();
55 for (;it!=entries.end();++it) { 55 for (;it!=entries.end();++it) {
56 FolderP inb=new Folder(*it,"/"); 56 FolderP inb=new Folder(*it,"/");
57 folders->append(inb); 57 folders->append(inb);
58 } 58 }
59 return folders; 59 return folders;
60} 60}
61 61
62void MBOXwrapper::deleteMail(const RecMail&mail) 62void MBOXwrapper::deleteMail(const RecMailP & mail)
63{ 63{
64 mailstorage*storage = mailstorage_new(NULL); 64 mailstorage*storage = mailstorage_new(NULL);
65 QString p = MBOXPath+"/"; 65 QString p = MBOXPath+"/";
66 p+=mail.getMbox(); 66 p+=mail->getMbox();
67 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 67 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
68 mailfolder*folder; 68 mailfolder*folder;
69 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 69 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
70 r = mailfolder_connect(folder); 70 r = mailfolder_connect(folder);
71 if (r != MAIL_NO_ERROR) { 71 if (r != MAIL_NO_ERROR) {
72 qDebug("Error initializing mbox"); 72 qDebug("Error initializing mbox");
73 mailfolder_free(folder); 73 mailfolder_free(folder);
74 mailstorage_free(storage); 74 mailstorage_free(storage);
75 return; 75 return;
76 } 76 }
77 r = mailsession_remove_message(folder->fld_session,mail.getNumber()); 77 r = mailsession_remove_message(folder->fld_session,mail->getNumber());
78 if (r != MAIL_NO_ERROR) { 78 if (r != MAIL_NO_ERROR) {
79 qDebug("error deleting mail"); 79 qDebug("error deleting mail");
80 } 80 }
81 mailfolder_free(folder); 81 mailfolder_free(folder);
82 mailstorage_free(storage); 82 mailstorage_free(storage);
83} 83}
84 84
85void MBOXwrapper::answeredMail(const RecMail&) 85void MBOXwrapper::answeredMail(const RecMailP&)
86{ 86{
87} 87}
88 88
89RecBody MBOXwrapper::fetchBody( const RecMail &mail ) 89RecBody MBOXwrapper::fetchBody( const RecMailP &mail )
90{ 90{
91 RecBody body; 91 RecBody body;
92 mailstorage*storage = mailstorage_new(NULL); 92 mailstorage*storage = mailstorage_new(NULL);
93 QString p = MBOXPath+"/"; 93 QString p = MBOXPath+"/";
94 p+=mail.getMbox(); 94 p+=mail->getMbox();
95 mailmessage * msg; 95 mailmessage * msg;
96 char*data=0; 96 char*data=0;
97 size_t size; 97 size_t size;
98 98
99 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 99 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
100 mailfolder*folder; 100 mailfolder*folder;
101 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 101 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
102 r = mailfolder_connect(folder); 102 r = mailfolder_connect(folder);
103 if (r != MAIL_NO_ERROR) { 103 if (r != MAIL_NO_ERROR) {
104 qDebug("Error initializing mbox"); 104 qDebug("Error initializing mbox");
105 mailfolder_free(folder); 105 mailfolder_free(folder);
106 mailstorage_free(storage); 106 mailstorage_free(storage);
107 return body; 107 return body;
108 } 108 }
109 r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); 109 r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg);
110 if (r != MAIL_NO_ERROR) { 110 if (r != MAIL_NO_ERROR) {
111 qDebug("Error fetching mail %i",mail.getNumber()); 111 qDebug("Error fetching mail %i",mail->getNumber());
112 mailfolder_free(folder); 112 mailfolder_free(folder);
113 mailstorage_free(storage); 113 mailstorage_free(storage);
114 return body; 114 return body;
115 } 115 }
116 r = mailmessage_fetch(msg,&data,&size); 116 r = mailmessage_fetch(msg,&data,&size);
117 if (r != MAIL_NO_ERROR) { 117 if (r != MAIL_NO_ERROR) {
118 qDebug("Error fetching mail %i",mail.getNumber()); 118 qDebug("Error fetching mail %i",mail->getNumber());
119 mailfolder_free(folder); 119 mailfolder_free(folder);
120 mailstorage_free(storage); 120 mailstorage_free(storage);
121 mailmessage_free(msg); 121 mailmessage_free(msg);
122 return body; 122 return body;
123 } 123 }
124 body = parseMail(msg); 124 body = parseMail(msg);
125 mailmessage_fetch_result_free(msg,data); 125 mailmessage_fetch_result_free(msg,data);
126 mailfolder_free(folder); 126 mailfolder_free(folder);
127 mailstorage_free(storage); 127 mailstorage_free(storage);
128 128
129 return body; 129 return body;
130} 130}
131 131
132void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) 132void MBOXwrapper::mbox_progress( size_t current, size_t maximum )
133{ 133{
134 qDebug("MBOX %i von %i",current,maximum); 134 qDebug("MBOX %i von %i",current,maximum);
135} 135}
136 136
137int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool ) 137int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool )
138{ 138{
139 QString p = MBOXPath+"/"; 139 QString p = MBOXPath+"/";
140 p+=folder; 140 p+=folder;
141 QFileInfo fi(p); 141 QFileInfo fi(p);
142 if (fi.exists()) { 142 if (fi.exists()) {
@@ -148,111 +148,112 @@ int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,b
148 Global::statusMessage(tr("Error init folder")); 148 Global::statusMessage(tr("Error init folder"));
149 return 0; 149 return 0;
150 } 150 }
151 if (f) mailmbox_done(f); 151 if (f) mailmbox_done(f);
152 return 1; 152 return 1;
153} 153}
154 154
155void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folder) 155void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
156{ 156{
157 QString p = MBOXPath+"/"; 157 QString p = MBOXPath+"/";
158 p+=folder; 158 p+=folder;
159 mailmbox_folder*f = 0; 159 mailmbox_folder*f = 0;
160 int r = mailmbox_init(p.latin1(),0,1,0,&f); 160 int r = mailmbox_init(p.latin1(),0,1,0,&f);
161 if (r != MAIL_NO_ERROR) { 161 if (r != MAIL_NO_ERROR) {
162 Global::statusMessage(tr("Error init folder")); 162 Global::statusMessage(tr("Error init folder"));
163 return; 163 return;
164 } 164 }
165 r = mailmbox_append_message(f,msg,length); 165 r = mailmbox_append_message(f,msg,length);
166 if (r != MAIL_NO_ERROR) { 166 if (r != MAIL_NO_ERROR) {
167 Global::statusMessage(tr("Error writing to message folder")); 167 Global::statusMessage(tr("Error writing to message folder"));
168 } 168 }
169 mailmbox_done(f); 169 mailmbox_done(f);
170} 170}
171 171
172encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail) 172encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail)
173{ 173{
174 RecBody body; 174 RecBody body;
175 mailstorage*storage = mailstorage_new(NULL); 175 mailstorage*storage = mailstorage_new(NULL);
176 QString p = MBOXPath+"/"; 176 QString p = MBOXPath+"/";
177 p+=mail.getMbox(); 177 p+=mail->getMbox();
178 mailmessage * msg; 178 mailmessage * msg;
179 char*data=0; 179 char*data=0;
180 size_t size; 180 size_t size;
181 181
182 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 182 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
183 mailfolder*folder; 183 mailfolder*folder;
184 folder = mailfolder_new( storage,(char*)p.latin1(),NULL); 184 folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
185 r = mailfolder_connect(folder); 185 r = mailfolder_connect(folder);
186 if (r != MAIL_NO_ERROR) { 186 if (r != MAIL_NO_ERROR) {
187 Global::statusMessage(tr("Error initializing mbox")); 187 Global::statusMessage(tr("Error initializing mbox"));
188 mailfolder_free(folder); 188 mailfolder_free(folder);
189 mailstorage_free(storage); 189 mailstorage_free(storage);
190 return 0; 190 return 0;
191 } 191 }
192 r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); 192 r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg);
193 if (r != MAIL_NO_ERROR) { 193 if (r != MAIL_NO_ERROR) {
194 Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); 194 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
195 mailfolder_free(folder); 195 mailfolder_free(folder);
196 mailstorage_free(storage); 196 mailstorage_free(storage);
197 return 0; 197 return 0;
198 } 198 }
199 r = mailmessage_fetch(msg,&data,&size); 199 r = mailmessage_fetch(msg,&data,&size);
200 if (r != MAIL_NO_ERROR) { 200 if (r != MAIL_NO_ERROR) {
201 Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); 201 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
202 mailfolder_free(folder); 202 mailfolder_free(folder);
203 mailstorage_free(storage); 203 mailstorage_free(storage);
204 mailmessage_free(msg); 204 mailmessage_free(msg);
205 return 0; 205 return 0;
206 } 206 }
207 encodedString*result = new encodedString(data,size); 207 encodedString*result = new encodedString(data,size);
208 208
209 mailfolder_free(folder); 209 mailfolder_free(folder);
210 mailstorage_free(storage); 210 mailstorage_free(storage);
211 mailmessage_free(msg); 211 mailmessage_free(msg);
212 return result; 212 return result;
213} 213}
214 214
215void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) 215void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
216{ 216{
217 QString p = MBOXPath+"/"; 217 QString p = MBOXPath+"/";
218 p+=mailbox; 218 p+=mailbox;
219 mailmbox_folder*f = 0; 219 mailmbox_folder*f = 0;
220 int r = mailmbox_init(p.latin1(),0,1,0,&f); 220 int r = mailmbox_init(p.latin1(),0,1,0,&f);
221 if (r != MAIL_NO_ERROR) { 221 if (r != MAIL_NO_ERROR) {
222 qDebug("Error init folder"); 222 qDebug("Error init folder");
223 return; 223 return;
224 } 224 }
225 deleteMails(f,target); 225 deleteMails(f,target);
226 mailmbox_done(f); 226 mailmbox_done(f);
227} 227}
228 228
229void MBOXwrapper::deleteMails(mailmbox_folder*f,QList<RecMail> &target) 229void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target)
230{ 230{
231 if (!f) return; 231 if (!f) return;
232 int r; 232 int r;
233 for (unsigned int i=0; i < target.count();++i) { 233 QValueList<RecMailP>::ConstIterator it;
234 r = mailmbox_delete_msg(f,target.at(i)->getNumber()); 234 for (it=target.begin(); it != target.end();++it) {
235 r = mailmbox_delete_msg(f,(*it)->getNumber());
235 if (r!=MAILMBOX_NO_ERROR) { 236 if (r!=MAILMBOX_NO_ERROR) {
236 qDebug("error delete mail"); 237 qDebug("error delete mail");
237 } 238 }
238 } 239 }
239 r = mailmbox_expunge(f); 240 r = mailmbox_expunge(f);
240 if (r != MAILMBOX_NO_ERROR) { 241 if (r != MAILMBOX_NO_ERROR) {
241 qDebug("error expunge mailbox"); 242 qDebug("error expunge mailbox");
242 } 243 }
243} 244}
244 245
245int MBOXwrapper::deleteAllMail(const FolderP&tfolder) 246int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
246{ 247{
247 if (!tfolder) return 0; 248 if (!tfolder) return 0;
248 QString p = MBOXPath+"/"+tfolder->getDisplayName(); 249 QString p = MBOXPath+"/"+tfolder->getDisplayName();
249 int res = 1; 250 int res = 1;
250 251
251 mailfolder*folder = 0; 252 mailfolder*folder = 0;
252 mailmessage_list*l=0; 253 mailmessage_list*l=0;
253 mailstorage*storage = mailstorage_new(NULL); 254 mailstorage*storage = mailstorage_new(NULL);
254 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); 255 int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
255 if (r != MAIL_NO_ERROR) { 256 if (r != MAIL_NO_ERROR) {
256 Global::statusMessage(tr("Error initializing mbox")); 257 Global::statusMessage(tr("Error initializing mbox"));
257 res = 0; 258 res = 0;
258 } 259 }
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h
index c3d9b50..33eeb1e 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h
@@ -1,48 +1,46 @@
1#ifndef __MBOX_WRAPPER_H 1#ifndef __MBOX_WRAPPER_H
2#define __MBOX_WRAPPER_H 2#define __MBOX_WRAPPER_H
3 3
4#include "genericwrapper.h" 4#include "genericwrapper.h"
5#include <qstring.h> 5#include <qstring.h>
6 6
7class RecMail;
8class RecBody;
9class encodedString; 7class encodedString;
10struct mailmbox_folder; 8struct mailmbox_folder;
11 9
12class MBOXwrapper : public Genericwrapper 10class MBOXwrapper : public Genericwrapper
13{ 11{
14 Q_OBJECT 12 Q_OBJECT
15 13
16public: 14public:
17 MBOXwrapper(const QString & dir,const QString&name); 15 MBOXwrapper(const QString & dir,const QString&name);
18 virtual ~MBOXwrapper(); 16 virtual ~MBOXwrapper();
19 17
20 virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); 18 virtual void listMessages(const QString & mailbox, QValueList<RecMailP>&target );
21 virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); 19 virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders();
22 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); 20 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
23 21
24 virtual void deleteMail(const RecMail&mail); 22 virtual void deleteMail(const RecMailP&mail);
25 virtual void answeredMail(const RecMail&mail); 23 virtual void answeredMail(const RecMailP&mail);
26 24
27 virtual int createMbox(const QString&folder,const Opie::osmart_pointer<Folder>&f=0, 25 virtual int createMbox(const QString&folder,const Opie::OSmartPointer<Folder>&f=0,
28 const QString&d="",bool s=false); 26 const QString&d="",bool s=false);
29 virtual int deleteMbox(const Opie::osmart_pointer<Folder>&); 27 virtual int deleteMbox(const Opie::OSmartPointer<Folder>&);
30 28
31 virtual void storeMessage(const char*msg,size_t length, const QString&folder); 29 virtual void storeMessage(const char*msg,size_t length, const QString&folder);
32 30
33 virtual RecBody fetchBody( const RecMail &mail ); 31 virtual RecBody fetchBody( const RecMailP &mail );
34 static void mbox_progress( size_t current, size_t maximum ); 32 static void mbox_progress( size_t current, size_t maximum );
35 33
36 virtual encodedString* fetchRawBody(const RecMail&mail); 34 virtual encodedString* fetchRawBody(const RecMailP&mail);
37 virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); 35 virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target);
38 virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); 36 virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&);
39 virtual MAILLIB::ATYPE getType()const; 37 virtual MAILLIB::ATYPE getType()const;
40 virtual const QString&getName()const; 38 virtual const QString&getName()const;
41 39
42protected: 40protected:
43 static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); 41 static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target);
44 QString MBOXPath; 42 QString MBOXPath;
45 QString MBOXName; 43 QString MBOXName;
46}; 44};
47 45
48#endif 46#endif
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index aaaa20a..0b00a2e 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
@@ -39,129 +39,128 @@ void MHwrapper::init_storage()
39 } 39 }
40 } 40 }
41 r = mailstorage_connect(m_storage); 41 r = mailstorage_connect(m_storage);
42 if (r!=MAIL_NO_ERROR) { 42 if (r!=MAIL_NO_ERROR) {
43 qDebug("error connecting storage"); 43 qDebug("error connecting storage");
44 mailstorage_free(m_storage); 44 mailstorage_free(m_storage);
45 m_storage = 0; 45 m_storage = 0;
46 } 46 }
47} 47}
48 48
49void MHwrapper::clean_storage() 49void MHwrapper::clean_storage()
50{ 50{
51 if (m_storage) { 51 if (m_storage) {
52 mailstorage_disconnect(m_storage); 52 mailstorage_disconnect(m_storage);
53 mailstorage_free(m_storage); 53 mailstorage_free(m_storage);
54 m_storage = 0; 54 m_storage = 0;
55 } 55 }
56} 56}
57 57
58MHwrapper::~MHwrapper() 58MHwrapper::~MHwrapper()
59{ 59{
60 clean_storage(); 60 clean_storage();
61} 61}
62 62
63void MHwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) 63void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target )
64{ 64{
65 init_storage(); 65 init_storage();
66 if (!m_storage) { 66 if (!m_storage) {
67 return; 67 return;
68 } 68 }
69 QString f = buildPath(mailbox); 69 QString f = buildPath(mailbox);
70 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 70 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
71 if (r!=MAIL_NO_ERROR) { 71 if (r!=MAIL_NO_ERROR) {
72 qDebug("listMessages: error selecting folder!"); 72 qDebug("listMessages: error selecting folder!");
73 return; 73 return;
74 } 74 }
75 parseList(target,m_storage->sto_session,f); 75 parseList(target,m_storage->sto_session,f);
76 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); 76 Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
77} 77}
78 78
79QValueList<Opie::osmart_pointer<Folder> >* MHwrapper::listFolders() 79QValueList<Opie::OSmartPointer<Folder> >* MHwrapper::listFolders()
80{ 80{
81 QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); 81 QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >();
82 /* this is needed! */ 82 /* this is needed! */
83 if (m_storage) mailstorage_disconnect(m_storage); 83 if (m_storage) mailstorage_disconnect(m_storage);
84 init_storage(); 84 init_storage();
85 if (!m_storage) { 85 if (!m_storage) {
86 return folders; 86 return folders;
87 } 87 }
88 mail_list*flist = 0; 88 mail_list*flist = 0;
89 clistcell*current=0; 89 clistcell*current=0;
90 int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); 90 int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist);
91 if (r != MAIL_NO_ERROR || !flist) { 91 if (r != MAIL_NO_ERROR || !flist) {
92 qDebug("error getting folder list"); 92 qDebug("error getting folder list");
93 return folders; 93 return folders;
94 } 94 }
95 for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) { 95 for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) {
96 QString t = (char*)current->data; 96 QString t = (char*)current->data;
97 t.replace(0,MHPath.length(),""); 97 t.replace(0,MHPath.length(),"");
98 folders->append(new MHFolder(t,MHPath)); 98 folders->append(new MHFolder(t,MHPath));
99 } 99 }
100 mail_list_free(flist); 100 mail_list_free(flist);
101 return folders; 101 return folders;
102} 102}
103 103
104void MHwrapper::deleteMail(const RecMail&mail) 104void MHwrapper::deleteMail(const RecMailP&mail)
105{ 105{
106 init_storage(); 106 init_storage();
107 if (!m_storage) { 107 if (!m_storage) {
108 return; 108 return;
109 } 109 }
110 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); 110 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
111 if (r!=MAIL_NO_ERROR) { 111 if (r!=MAIL_NO_ERROR) {
112 qDebug("error selecting folder!"); 112 qDebug("error selecting folder!");
113 return; 113 return;
114 } 114 }
115 r = mailsession_remove_message(m_storage->sto_session,mail.getNumber()); 115 r = mailsession_remove_message(m_storage->sto_session,mail->getNumber());
116 if (r != MAIL_NO_ERROR) { 116 if (r != MAIL_NO_ERROR) {
117 qDebug("error deleting mail"); 117 qDebug("error deleting mail");
118 } 118 }
119} 119}
120 120
121void MHwrapper::answeredMail(const RecMail&) 121void MHwrapper::answeredMail(const RecMailP&)
122{ 122{
123} 123}
124 124
125RecBody MHwrapper::fetchBody( const RecMail &mail ) 125RecBody MHwrapper::fetchBody( const RecMailP &mail )
126{ 126{
127 RecBody body; 127 RecBody body;
128 init_storage(); 128 init_storage();
129 if (!m_storage) { 129 if (!m_storage) {
130 return body; 130 return body;
131 } 131 }
132 mailmessage * msg; 132 mailmessage * msg;
133 char*data=0; 133 char*data=0;
134 size_t size;
135 134
136 /* mail should hold the complete path! */ 135 /* mail should hold the complete path! */
137 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); 136 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
138 if (r != MAIL_NO_ERROR) { 137 if (r != MAIL_NO_ERROR) {
139 return body; 138 return body;
140 } 139 }
141 r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg); 140 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
142 if (r != MAIL_NO_ERROR) { 141 if (r != MAIL_NO_ERROR) {
143 qDebug("Error fetching mail %i",mail.getNumber()); 142 qDebug("Error fetching mail %i",mail->getNumber());
144 return body; 143 return body;
145 } 144 }
146 body = parseMail(msg); 145 body = parseMail(msg);
147 mailmessage_fetch_result_free(msg,data); 146 mailmessage_fetch_result_free(msg,data);
148 return body; 147 return body;
149} 148}
150 149
151void MHwrapper::mbox_progress( size_t current, size_t maximum ) 150void MHwrapper::mbox_progress( size_t current, size_t maximum )
152{ 151{
153 qDebug("MH %i von %i",current,maximum); 152 qDebug("MH %i von %i",current,maximum);
154} 153}
155 154
156QString MHwrapper::buildPath(const QString&p) 155QString MHwrapper::buildPath(const QString&p)
157{ 156{
158 QString f=""; 157 QString f="";
159 if (p.length()==0||p=="/") 158 if (p.length()==0||p=="/")
160 return MHPath; 159 return MHPath;
161 if (!p.startsWith(MHPath)) { 160 if (!p.startsWith(MHPath)) {
162 f+=MHPath; 161 f+=MHPath;
163 } 162 }
164 if (!p.startsWith("/")) { 163 if (!p.startsWith("/")) {
165 f+="/"; 164 f+="/";
166 } 165 }
167 f+=p; 166 f+=p;
@@ -191,91 +190,90 @@ int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QStri
191 } 190 }
192 qDebug("Folder created"); 191 qDebug("Folder created");
193 return 1; 192 return 1;
194} 193}
195 194
196void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) 195void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
197{ 196{
198 init_storage(); 197 init_storage();
199 if (!m_storage) { 198 if (!m_storage) {
200 return; 199 return;
201 } 200 }
202 QString f = buildPath(Folder); 201 QString f = buildPath(Folder);
203 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 202 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
204 if (r!=MAIL_NO_ERROR) { 203 if (r!=MAIL_NO_ERROR) {
205 qDebug("error selecting folder!"); 204 qDebug("error selecting folder!");
206 return; 205 return;
207 } 206 }
208 r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); 207 r = mailsession_append_message(m_storage->sto_session,(char*)msg,length);
209 if (r!=MAIL_NO_ERROR) { 208 if (r!=MAIL_NO_ERROR) {
210 qDebug("error storing mail"); 209 qDebug("error storing mail");
211 } 210 }
212 return; 211 return;
213} 212}
214 213
215encodedString* MHwrapper::fetchRawBody(const RecMail&mail) 214encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
216{ 215{
217 encodedString*result = 0; 216 encodedString*result = 0;
218 init_storage(); 217 init_storage();
219 if (!m_storage) { 218 if (!m_storage) {
220 return result; 219 return result;
221 } 220 }
222 mailmessage * msg = 0; 221 mailmessage * msg = 0;
223 char*data=0; 222 char*data=0;
224 size_t size; 223 size_t size;
225 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); 224 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
226 if (r!=MAIL_NO_ERROR) { 225 if (r!=MAIL_NO_ERROR) {
227 qDebug("error selecting folder!"); 226 qDebug("error selecting folder!");
228 return result; 227 return result;
229 } 228 }
230 r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg); 229 r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
231 if (r != MAIL_NO_ERROR) { 230 if (r != MAIL_NO_ERROR) {
232 Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); 231 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
233 return 0; 232 return 0;
234 } 233 }
235 r = mailmessage_fetch(msg,&data,&size); 234 r = mailmessage_fetch(msg,&data,&size);
236 if (r != MAIL_NO_ERROR) { 235 if (r != MAIL_NO_ERROR) {
237 Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); 236 Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
238 if (msg) mailmessage_free(msg); 237 if (msg) mailmessage_free(msg);
239 return 0; 238 return 0;
240 } 239 }
241 result = new encodedString(data,size); 240 result = new encodedString(data,size);
242 if (msg) mailmessage_free(msg); 241 if (msg) mailmessage_free(msg);
243 return result; 242 return result;
244} 243}
245 244
246void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) 245void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
247{ 246{
248 QString f = buildPath(mailbox); 247 QString f = buildPath(mailbox);
249 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); 248 int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
250 if (r!=MAIL_NO_ERROR) { 249 if (r!=MAIL_NO_ERROR) {
251 qDebug("deleteMails: error selecting folder!"); 250 qDebug("deleteMails: error selecting folder!");
252 return; 251 return;
253 } 252 }
254 RecMail*c = 0; 253 QValueList<RecMailP>::ConstIterator it;
255 for (unsigned int i=0; i < target.count();++i) { 254 for (it=target.begin(); it!=target.end();++it) {
256 c = target.at(i); 255 r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
257 r = mailsession_remove_message(m_storage->sto_session,c->getNumber());
258 if (r != MAIL_NO_ERROR) { 256 if (r != MAIL_NO_ERROR) {
259 qDebug("error deleting mail"); 257 qDebug("error deleting mail");
260 break; 258 break;
261 } 259 }
262 } 260 }
263} 261}
264 262
265int MHwrapper::deleteAllMail(const FolderP&tfolder) 263int MHwrapper::deleteAllMail(const FolderP&tfolder)
266{ 264{
267 init_storage(); 265 init_storage();
268 if (!m_storage) { 266 if (!m_storage) {
269 return 0; 267 return 0;
270 } 268 }
271 int res = 1; 269 int res = 1;
272 if (!tfolder) return 0; 270 if (!tfolder) return 0;
273 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); 271 int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
274 if (r!=MAIL_NO_ERROR) { 272 if (r!=MAIL_NO_ERROR) {
275 qDebug("error selecting folder!"); 273 qDebug("error selecting folder!");
276 return 0; 274 return 0;
277 } 275 }
278 mailmessage_list*l=0; 276 mailmessage_list*l=0;
279 r = mailsession_get_messages_list(m_storage->sto_session,&l); 277 r = mailsession_get_messages_list(m_storage->sto_session,&l);
280 if (r != MAIL_NO_ERROR) { 278 if (r != MAIL_NO_ERROR) {
281 qDebug("Error message list"); 279 qDebug("Error message list");
@@ -351,70 +349,70 @@ void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
351 init_storage(); 349 init_storage();
352 if (!m_storage) { 350 if (!m_storage) {
353 return; 351 return;
354 } 352 }
355 target_stat.message_count = 0; 353 target_stat.message_count = 0;
356 target_stat.message_unseen = 0; 354 target_stat.message_unseen = 0;
357 target_stat.message_recent = 0; 355 target_stat.message_recent = 0;
358 QString f = buildPath(mailbox); 356 QString f = buildPath(mailbox);
359 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, 357 int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count,
360 &target_stat.message_recent,&target_stat.message_unseen); 358 &target_stat.message_recent,&target_stat.message_unseen);
361 if (r != MAIL_NO_ERROR) { 359 if (r != MAIL_NO_ERROR) {
362 Global::statusMessage(tr("Error retrieving status")); 360 Global::statusMessage(tr("Error retrieving status"));
363 } 361 }
364} 362}
365 363
366MAILLIB::ATYPE MHwrapper::getType()const 364MAILLIB::ATYPE MHwrapper::getType()const
367{ 365{
368 return MAILLIB::A_MH; 366 return MAILLIB::A_MH;
369} 367}
370 368
371const QString&MHwrapper::getName()const 369const QString&MHwrapper::getName()const
372{ 370{
373 return MHName; 371 return MHName;
374} 372}
375void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 373void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
376{ 374{
377 init_storage(); 375 init_storage();
378 if (!m_storage) { 376 if (!m_storage) {
379 return; 377 return;
380 } 378 }
381 if (targetWrapper != this) { 379 if (targetWrapper != this) {
382 qDebug("Using generic"); 380 qDebug("Using generic");
383 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); 381 Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
384 return; 382 return;
385 } 383 }
386 qDebug("Using internal routines for move/copy"); 384 qDebug("Using internal routines for move/copy");
387 QString tf = buildPath(targetFolder); 385 QString tf = buildPath(targetFolder);
388 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); 386 int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
389 if (r != MAIL_NO_ERROR) { 387 if (r != MAIL_NO_ERROR) {
390 qDebug("Error selecting source mailbox"); 388 qDebug("Error selecting source mailbox");
391 return; 389 return;
392 } 390 }
393 if (moveit) { 391 if (moveit) {
394 r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); 392 r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
395 } else { 393 } else {
396 r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); 394 r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
397 } 395 }
398 if (r != MAIL_NO_ERROR) { 396 if (r != MAIL_NO_ERROR) {
399 qDebug("Error copy/moving mail internal (%i)",r); 397 qDebug("Error copy/moving mail internal (%i)",r);
400 } 398 }
401} 399}
402 400
403void MHwrapper::mvcpAllMails(const FolderP&fromFolder, 401void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
404 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 402 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
405{ 403{
406 init_storage(); 404 init_storage();
407 if (!m_storage) { 405 if (!m_storage) {
408 return; 406 return;
409 } 407 }
410 if (targetWrapper != this) { 408 if (targetWrapper != this) {
411 qDebug("Using generic"); 409 qDebug("Using generic");
412 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); 410 Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
413 return; 411 return;
414 } 412 }
415 if (!fromFolder) return; 413 if (!fromFolder) return;
416 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); 414 int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1());
417 if (r!=MAIL_NO_ERROR) { 415 if (r!=MAIL_NO_ERROR) {
418 qDebug("error selecting source folder!"); 416 qDebug("error selecting source folder!");
419 return; 417 return;
420 } 418 }
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h
index c7c8183..208cf2f 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.h
@@ -1,62 +1,60 @@
1#ifndef __MH_WRAPPER_H 1#ifndef __MH_WRAPPER_H
2#define __MH_WRAPPER_H 2#define __MH_WRAPPER_H
3 3
4#include "maildefines.h" 4#include "maildefines.h"
5 5
6#include "genericwrapper.h" 6#include "genericwrapper.h"
7#include <qstring.h> 7#include <qstring.h>
8 8
9class RecMail;
10class RecBody;
11class encodedString; 9class encodedString;
12struct mailmbox_folder; 10struct mailmbox_folder;
13class OProcess; 11class OProcess;
14 12
15class MHwrapper : public Genericwrapper 13class MHwrapper : public Genericwrapper
16{ 14{
17 Q_OBJECT 15 Q_OBJECT
18public: 16public:
19 MHwrapper(const QString & dir,const QString&name); 17 MHwrapper(const QString & dir,const QString&name);
20 virtual ~MHwrapper(); 18 virtual ~MHwrapper();
21 19
22 virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); 20 virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target );
23 virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); 21 virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders();
24 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); 22 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
25 23
26 virtual void deleteMail(const RecMail&mail); 24 virtual void deleteMail(const RecMailP&mail);
27 virtual void answeredMail(const RecMail&mail); 25 virtual void answeredMail(const RecMailP&mail);
28 virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 26 virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
29 virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder, 27 virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder,
30 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 28 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
31 29
32 virtual int createMbox(const QString&folder,const Opie::osmart_pointer<Folder>&f=0, 30 virtual int createMbox(const QString&folder,const Opie::OSmartPointer<Folder>&f=0,
33 const QString&d="",bool s=false); 31 const QString&d="",bool s=false);
34 virtual int deleteMbox(const Opie::osmart_pointer<Folder>&); 32 virtual int deleteMbox(const Opie::OSmartPointer<Folder>&);
35 33
36 virtual void storeMessage(const char*msg,size_t length, const QString&folder); 34 virtual void storeMessage(const char*msg,size_t length, const QString&folder);
37 35
38 virtual RecBody fetchBody( const RecMail &mail ); 36 virtual RecBody fetchBody( const RecMailP &mail );
39 static void mbox_progress( size_t current, size_t maximum ); 37 static void mbox_progress( size_t current, size_t maximum );
40 38
41 virtual encodedString* fetchRawBody(const RecMail&mail); 39 virtual encodedString* fetchRawBody(const RecMailP&mail);
42 virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); 40 virtual void deleteMails(const QString & FolderName,const QValueList<Opie::OSmartPointer<RecMail> > &target);
43 virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); 41 virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&);
44 virtual MAILLIB::ATYPE getType()const; 42 virtual MAILLIB::ATYPE getType()const;
45 virtual const QString&getName()const; 43 virtual const QString&getName()const;
46 44
47public slots: 45public slots:
48 /* for deleting maildirs we are using a system call */ 46 /* for deleting maildirs we are using a system call */
49 virtual void oprocessStderr(OProcess*, char *buffer, int ); 47 virtual void oprocessStderr(OProcess*, char *buffer, int );
50 virtual void processEnded(OProcess *); 48 virtual void processEnded(OProcess *);
51protected: 49protected:
52 QString buildPath(const QString&p); 50 QString buildPath(const QString&p);
53 QString MHPath; 51 QString MHPath;
54 QString MHName; 52 QString MHName;
55 53
56 void init_storage(); 54 void init_storage();
57 void clean_storage(); 55 void clean_storage();
58 56
59 bool removeMboxfailed; 57 bool removeMboxfailed;
60}; 58};
61 59
62#endif 60#endif
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
index 2ec052c..c0b3eec 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
@@ -11,113 +11,113 @@
11 11
12#define HARD_MSG_SIZE_LIMIT 5242880 12#define HARD_MSG_SIZE_LIMIT 5242880
13 13
14NNTPwrapper::NNTPwrapper( NNTPaccount *a ) 14NNTPwrapper::NNTPwrapper( NNTPaccount *a )
15: Genericwrapper() { 15: Genericwrapper() {
16 account = a; 16 account = a;
17 m_nntp = NULL; 17 m_nntp = NULL;
18 msgTempName = a->getFileName()+"_msg_cache"; 18 msgTempName = a->getFileName()+"_msg_cache";
19 last_msg_id = 0; 19 last_msg_id = 0;
20} 20}
21 21
22NNTPwrapper::~NNTPwrapper() { 22NNTPwrapper::~NNTPwrapper() {
23 logout(); 23 logout();
24 QFile msg_cache(msgTempName); 24 QFile msg_cache(msgTempName);
25 if (msg_cache.exists()) { 25 if (msg_cache.exists()) {
26 msg_cache.remove(); 26 msg_cache.remove();
27 } 27 }
28} 28}
29 29
30void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { 30void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) {
31 qDebug( "NNTP: %i of %i", current, maximum ); 31 qDebug( "NNTP: %i of %i", current, maximum );
32} 32}
33 33
34 34
35RecBody NNTPwrapper::fetchBody( const RecMail &mail ) { 35RecBody NNTPwrapper::fetchBody( const RecMailP &mail ) {
36 int err = NEWSNNTP_NO_ERROR; 36 int err = NEWSNNTP_NO_ERROR;
37 char *message = 0; 37 char *message = 0;
38 size_t length = 0; 38 size_t length = 0;
39 39
40 login(); 40 login();
41 if ( !m_nntp ) { 41 if ( !m_nntp ) {
42 return RecBody(); 42 return RecBody();
43 } 43 }
44 44
45 RecBody body; 45 RecBody body;
46 mailmessage * mailmsg; 46 mailmessage * mailmsg;
47 if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { 47 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
48 qDebug("Message to large: %i",mail.Msgsize()); 48 qDebug("Message to large: %i",mail->Msgsize());
49 return body; 49 return body;
50 } 50 }
51 51
52 QFile msg_cache(msgTempName); 52 QFile msg_cache(msgTempName);
53 53
54 cleanMimeCache(); 54 cleanMimeCache();
55 55
56 if (mail.getNumber()!=last_msg_id) { 56 if (mail->getNumber()!=last_msg_id) {
57 if (msg_cache.exists()) { 57 if (msg_cache.exists()) {
58 msg_cache.remove(); 58 msg_cache.remove();
59 } 59 }
60 msg_cache.open(IO_ReadWrite|IO_Truncate); 60 msg_cache.open(IO_ReadWrite|IO_Truncate);
61 last_msg_id = mail.getNumber(); 61 last_msg_id = mail->getNumber();
62 err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); 62 err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg);
63 err = mailmessage_fetch(mailmsg,&message,&length); 63 err = mailmessage_fetch(mailmsg,&message,&length);
64 msg_cache.writeBlock(message,length); 64 msg_cache.writeBlock(message,length);
65 } else { 65 } else {
66 QString msg=""; 66 QString msg="";
67 msg_cache.open(IO_ReadOnly); 67 msg_cache.open(IO_ReadOnly);
68 message = new char[4096]; 68 message = new char[4096];
69 memset(message,0,4096); 69 memset(message,0,4096);
70 while (msg_cache.readBlock(message,4095)>0) { 70 while (msg_cache.readBlock(message,4095)>0) {
71 msg+=message; 71 msg+=message;
72 memset(message,0,4096); 72 memset(message,0,4096);
73 } 73 }
74 delete message; 74 delete message;
75 message = (char*)malloc(msg.length()+1*sizeof(char)); 75 message = (char*)malloc(msg.length()+1*sizeof(char));
76 memset(message,0,msg.length()+1); 76 memset(message,0,msg.length()+1);
77 memcpy(message,msg.latin1(),msg.length()); 77 memcpy(message,msg.latin1(),msg.length());
78 /* transform to libetpan stuff */ 78 /* transform to libetpan stuff */
79 mailmsg = mailmessage_new(); 79 mailmsg = mailmessage_new();
80 mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); 80 mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message));
81 generic_message_t * msg_data; 81 generic_message_t * msg_data;
82 msg_data = (generic_message_t *)mailmsg->msg_data; 82 msg_data = (generic_message_t *)mailmsg->msg_data;
83 msg_data->msg_fetched = 1; 83 msg_data->msg_fetched = 1;
84 msg_data->msg_message = message; 84 msg_data->msg_message = message;
85 msg_data->msg_length = strlen(message); 85 msg_data->msg_length = strlen(message);
86 } 86 }
87 body = parseMail(mailmsg); 87 body = parseMail(mailmsg);
88 88
89 /* clean up */ 89 /* clean up */
90 if (mailmsg) 90 if (mailmsg)
91 mailmessage_free(mailmsg); 91 mailmessage_free(mailmsg);
92 if (message) 92 if (message)
93 free(message); 93 free(message);
94 94
95 return body; 95 return body;
96} 96}
97 97
98 98
99void NNTPwrapper::listMessages(const QString & which, QList<RecMail> &target ) 99void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::OSmartPointer<RecMail> > &target )
100{ 100{
101 login(); 101 login();
102 if (!m_nntp) 102 if (!m_nntp)
103 return; 103 return;
104 uint32_t res_messages,res_recent,res_unseen; 104 uint32_t res_messages,res_recent,res_unseen;
105 mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen); 105 mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen);
106 parseList(target,m_nntp->sto_session,which,true); 106 parseList(target,m_nntp->sto_session,which,true);
107} 107}
108 108
109void NNTPwrapper::login() 109void NNTPwrapper::login()
110{ 110{
111 if (account->getOffline()) 111 if (account->getOffline())
112 return; 112 return;
113 /* we'll hold the line */ 113 /* we'll hold the line */
114 if ( m_nntp != NULL ) 114 if ( m_nntp != NULL )
115 return; 115 return;
116 116
117 const char *server, *user, *pass; 117 const char *server, *user, *pass;
118 QString User,Pass; 118 QString User,Pass;
119 uint16_t port; 119 uint16_t port;
120 int err = NEWSNNTP_NO_ERROR; 120 int err = NEWSNNTP_NO_ERROR;
121 121
122 server = account->getServer().latin1(); 122 server = account->getServer().latin1();
123 port = account->getPort().toUInt(); 123 port = account->getPort().toUInt();
@@ -167,117 +167,117 @@ void NNTPwrapper::login()
167 nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, 167 nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN,
168 (char*)user,(char*)pass,0,0,0); 168 (char*)user,(char*)pass,0,0,0);
169 169
170 err = mailstorage_connect( m_nntp ); 170 err = mailstorage_connect( m_nntp );
171 171
172 if (err != NEWSNNTP_NO_ERROR) { 172 if (err != NEWSNNTP_NO_ERROR) {
173 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); 173 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) );
174 // Global::statusMessage(tr("Error initializing folder")); 174 // Global::statusMessage(tr("Error initializing folder"));
175 mailstorage_free(m_nntp); 175 mailstorage_free(m_nntp);
176 m_nntp = 0; 176 m_nntp = 0;
177 177
178 } 178 }
179 179
180} 180}
181 181
182void NNTPwrapper::logout() 182void NNTPwrapper::logout()
183{ 183{
184 int err = NEWSNNTP_NO_ERROR; 184 int err = NEWSNNTP_NO_ERROR;
185 if ( m_nntp == NULL ) 185 if ( m_nntp == NULL )
186 return; 186 return;
187 mailstorage_free(m_nntp); 187 mailstorage_free(m_nntp);
188 m_nntp = 0; 188 m_nntp = 0;
189} 189}
190 190
191QValueList<Opie::osmart_pointer<Folder> >* NNTPwrapper::listFolders() { 191QValueList<Opie::OSmartPointer<Folder> >* NNTPwrapper::listFolders() {
192 192
193 QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); 193 QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >();
194 QStringList groups; 194 QStringList groups;
195 if (account) { 195 if (account) {
196 groups = account->getGroups(); 196 groups = account->getGroups();
197 } 197 }
198 for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) { 198 for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) {
199 folders->append(new Folder((*it),".")); 199 folders->append(new Folder((*it),"."));
200 } 200 }
201 return folders; 201 return folders;
202} 202}
203 203
204/* we made this method in raw nntp access of etpan and not via generic interface 204/* we made this method in raw nntp access of etpan and not via generic interface
205 * 'cause in that case there will be doubled copy operations. eg. the etpan would 205 * 'cause in that case there will be doubled copy operations. eg. the etpan would
206 * copy that stuff into its own structures and we must copy it into useable c++ 206 * copy that stuff into its own structures and we must copy it into useable c++
207 * structures for our frontend. this would not make sense, so it is better to reimplement 207 * structures for our frontend. this would not make sense, so it is better to reimplement
208 * the stuff from generic interface of etpan but copy it direct to qt classes. 208 * the stuff from generic interface of etpan but copy it direct to qt classes.
209 */ 209 */
210QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) { 210QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) {
211 login(); 211 login();
212 QStringList res; 212 QStringList res;
213 clist *result = 0; 213 clist *result = 0;
214 clistcell *current = 0; 214 clistcell *current = 0;
215 newsnntp_group_description *group; 215 newsnntp_group_description *group;
216 216
217 if ( m_nntp ) { 217 if ( m_nntp ) {
218 mailsession * session = m_nntp->sto_session; 218 mailsession * session = m_nntp->sto_session;
219 newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; 219 newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
220 int err = NEWSNNTP_NO_ERROR; 220 int err = NEWSNNTP_NO_ERROR;
221 if (mask.isEmpty()) { 221 if (mask.isEmpty()) {
222 err = newsnntp_list(news, &result); 222 err = newsnntp_list(news, &result);
223 } else { 223 } else {
224 /* taken from generic wrapper of etpan */ 224 /* taken from generic wrapper of etpan */
225 QString nmask = mask+".*"; 225 QString nmask = mask+".*";
226 err = newsnntp_list_active(news, nmask.latin1(), &result); 226 err = newsnntp_list_active(news, nmask.latin1(), &result);
227 } 227 }
228 if ( err == NEWSNNTP_NO_ERROR && result) { 228 if ( err == NEWSNNTP_NO_ERROR && result) {
229 for ( current=clist_begin(result);current!=NULL;current=clist_next(current) ) { 229 for ( current=clist_begin(result);current!=NULL;current=clist_next(current) ) {
230 group = ( newsnntp_group_description* ) current->data; 230 group = ( newsnntp_group_description* ) current->data;
231 if (!group||!group->grp_name||strlen(group->grp_name)==0) continue; 231 if (!group||!group->grp_name||strlen(group->grp_name)==0) continue;
232 res.append(group->grp_name); 232 res.append(group->grp_name);
233 } 233 }
234 } 234 }
235 } 235 }
236 if (result) { 236 if (result) {
237 newsnntp_list_free(result); 237 newsnntp_list_free(result);
238 } 238 }
239 return res; 239 return res;
240} 240}
241 241
242void NNTPwrapper::answeredMail(const RecMail&) {} 242void NNTPwrapper::answeredMail(const RecMailP&) {}
243 243
244void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) { 244void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) {
245 login(); 245 login();
246 target_stat.message_count = 0; 246 target_stat.message_count = 0;
247 target_stat.message_unseen = 0; 247 target_stat.message_unseen = 0;
248 target_stat.message_recent = 0; 248 target_stat.message_recent = 0;
249 if (!m_nntp) 249 if (!m_nntp)
250 return; 250 return;
251 int r = mailsession_status_folder(m_nntp->sto_session,0,&target_stat.message_count, 251 int r = mailsession_status_folder(m_nntp->sto_session,0,&target_stat.message_count,
252 &target_stat.message_recent,&target_stat.message_unseen); 252 &target_stat.message_recent,&target_stat.message_unseen);
253} 253}
254 254
255 255
256encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) { 256encodedString* NNTPwrapper::fetchRawBody(const RecMailP&mail) {
257 char*target=0; 257 char*target=0;
258 size_t length=0; 258 size_t length=0;
259 encodedString*res = 0; 259 encodedString*res = 0;
260 mailmessage * mailmsg = 0; 260 mailmessage * mailmsg = 0;
261 int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); 261 int err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg);
262 err = mailmessage_fetch(mailmsg,&target,&length); 262 err = mailmessage_fetch(mailmsg,&target,&length);
263 if (mailmsg) 263 if (mailmsg)
264 mailmessage_free(mailmsg); 264 mailmessage_free(mailmsg);
265 if (target) { 265 if (target) {
266 res = new encodedString(target,length); 266 res = new encodedString(target,length);
267 } 267 }
268 return res; 268 return res;
269} 269}
270 270
271MAILLIB::ATYPE NNTPwrapper::getType()const { 271MAILLIB::ATYPE NNTPwrapper::getType()const {
272 return account->getType(); 272 return account->getType();
273} 273}
274 274
275const QString&NNTPwrapper::getName()const{ 275const QString&NNTPwrapper::getName()const{
276 return account->getAccountName(); 276 return account->getAccountName();
277} 277}
278 278
279void NNTPwrapper::deleteMail(const RecMail&) { 279void NNTPwrapper::deleteMail(const RecMailP&) {
280} 280}
281 281
282int NNTPwrapper::deleteAllMail(const FolderP&) { 282int NNTPwrapper::deleteAllMail(const FolderP&) {
283} 283}
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h
index d3a384a..a7e4b95 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h
@@ -1,48 +1,48 @@
1#ifndef __NNTPWRAPPER 1#ifndef __NNTPWRAPPER
2#define __NNTPWRAPPER 2#define __NNTPWRAPPER
3 3
4#include "mailwrapper.h" 4#include "mailwrapper.h"
5#include "genericwrapper.h" 5#include "genericwrapper.h"
6#include <qstring.h> 6#include <qstring.h>
7#include <libetpan/clist.h> 7#include <libetpan/clist.h>
8 8
9class encodedString; 9class encodedString;
10struct mailstorage; 10struct mailstorage;
11struct mailfolder; 11struct mailfolder;
12 12
13class NNTPwrapper : public Genericwrapper 13class NNTPwrapper : public Genericwrapper
14{ 14{
15 15
16 Q_OBJECT 16 Q_OBJECT
17 17
18public: 18public:
19 NNTPwrapper( NNTPaccount *a ); 19 NNTPwrapper( NNTPaccount *a );
20 virtual ~NNTPwrapper(); 20 virtual ~NNTPwrapper();
21 21
22 /* mailbox will be ignored */ 22 /* mailbox will be ignored */
23 virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); 23 virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target );
24 /* should only get the subscribed one */ 24 /* should only get the subscribed one */
25 virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); 25 virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders();
26 /* mailbox will be ignored */ 26 /* mailbox will be ignored */
27 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); 27 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
28 QStringList listAllNewsgroups(const QString&mask = QString::null); 28 QStringList listAllNewsgroups(const QString&mask = QString::null);
29 virtual void deleteMail(const RecMail&mail); 29 virtual void deleteMail(const RecMailP&mail);
30 virtual void answeredMail(const RecMail&mail); 30 virtual void answeredMail(const RecMailP&mail);
31 virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); 31 virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&);
32 32
33 virtual RecBody fetchBody( const RecMail &mail ); 33 virtual RecBody fetchBody( const RecMailP &mail );
34 virtual encodedString* fetchRawBody(const RecMail&mail); 34 virtual encodedString* fetchRawBody(const RecMailP&mail);
35 virtual void logout(); 35 virtual void logout();
36 virtual MAILLIB::ATYPE getType()const; 36 virtual MAILLIB::ATYPE getType()const;
37 virtual const QString&getName()const; 37 virtual const QString&getName()const;
38 static void nntp_progress( size_t current, size_t maximum ); 38 static void nntp_progress( size_t current, size_t maximum );
39 39
40protected: 40protected:
41 void login(); 41 void login();
42 NNTPaccount *account; 42 NNTPaccount *account;
43 mailstorage* m_nntp; 43 mailstorage* m_nntp;
44 44
45 45
46}; 46};
47 47
48#endif 48#endif
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 7bf7ed2..6737d6c 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -9,112 +9,112 @@
9 9
10/* we don't fetch messages larger than 5 MB */ 10/* we don't fetch messages larger than 5 MB */
11#define HARD_MSG_SIZE_LIMIT 5242880 11#define HARD_MSG_SIZE_LIMIT 5242880
12 12
13POP3wrapper::POP3wrapper( POP3account *a ) 13POP3wrapper::POP3wrapper( POP3account *a )
14: Genericwrapper() { 14: Genericwrapper() {
15 account = a; 15 account = a;
16 m_pop3 = NULL; 16 m_pop3 = NULL;
17 msgTempName = a->getFileName()+"_msg_cache"; 17 msgTempName = a->getFileName()+"_msg_cache";
18 last_msg_id = 0; 18 last_msg_id = 0;
19} 19}
20 20
21POP3wrapper::~POP3wrapper() { 21POP3wrapper::~POP3wrapper() {
22 logout(); 22 logout();
23 QFile msg_cache(msgTempName); 23 QFile msg_cache(msgTempName);
24 if (msg_cache.exists()) { 24 if (msg_cache.exists()) {
25 msg_cache.remove(); 25 msg_cache.remove();
26 } 26 }
27} 27}
28 28
29void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { 29void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
30 qDebug( "POP3: %i of %i", current, maximum ); 30 qDebug( "POP3: %i of %i", current, maximum );
31} 31}
32 32
33RecBody POP3wrapper::fetchBody( const RecMail &mail ) { 33RecBody POP3wrapper::fetchBody( const RecMailP &mail ) {
34 int err = MAILPOP3_NO_ERROR; 34 int err = MAILPOP3_NO_ERROR;
35 char *message = 0; 35 char *message = 0;
36 size_t length = 0; 36 size_t length = 0;
37 37
38 login(); 38 login();
39 if ( !m_pop3 ) { 39 if ( !m_pop3 ) {
40 return RecBody(); 40 return RecBody();
41 } 41 }
42 42
43 RecBody body; 43 RecBody body;
44 mailmessage * mailmsg; 44 mailmessage * mailmsg;
45 if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { 45 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
46 qDebug("Message to large: %i",mail.Msgsize()); 46 qDebug("Message to large: %i",mail->Msgsize());
47 return body; 47 return body;
48 } 48 }
49 49
50 QFile msg_cache(msgTempName); 50 QFile msg_cache(msgTempName);
51 51
52 cleanMimeCache(); 52 cleanMimeCache();
53 53
54 if (mail.getNumber()!=last_msg_id) { 54 if (mail->getNumber()!=last_msg_id) {
55 if (msg_cache.exists()) { 55 if (msg_cache.exists()) {
56 msg_cache.remove(); 56 msg_cache.remove();
57 } 57 }
58 msg_cache.open(IO_ReadWrite|IO_Truncate); 58 msg_cache.open(IO_ReadWrite|IO_Truncate);
59 last_msg_id = mail.getNumber(); 59 last_msg_id = mail->getNumber();
60 err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); 60 err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
61 err = mailmessage_fetch(mailmsg,&message,&length); 61 err = mailmessage_fetch(mailmsg,&message,&length);
62 msg_cache.writeBlock(message,length); 62 msg_cache.writeBlock(message,length);
63 } else { 63 } else {
64 QString msg=""; 64 QString msg="";
65 msg_cache.open(IO_ReadOnly); 65 msg_cache.open(IO_ReadOnly);
66 message = new char[4096]; 66 message = new char[4096];
67 memset(message,0,4096); 67 memset(message,0,4096);
68 while (msg_cache.readBlock(message,4095)>0) { 68 while (msg_cache.readBlock(message,4095)>0) {
69 msg+=message; 69 msg+=message;
70 memset(message,0,4096); 70 memset(message,0,4096);
71 } 71 }
72 delete message; 72 delete message;
73 message = (char*)malloc(msg.length()+1*sizeof(char)); 73 message = (char*)malloc(msg.length()+1*sizeof(char));
74 memset(message,0,msg.length()+1); 74 memset(message,0,msg.length()+1);
75 memcpy(message,msg.latin1(),msg.length()); 75 memcpy(message,msg.latin1(),msg.length());
76 /* transform to libetpan stuff */ 76 /* transform to libetpan stuff */
77 mailmsg = mailmessage_new(); 77 mailmsg = mailmessage_new();
78 mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); 78 mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message));
79 generic_message_t * msg_data; 79 generic_message_t * msg_data;
80 msg_data = (generic_message_t *)mailmsg->msg_data; 80 msg_data = (generic_message_t *)mailmsg->msg_data;
81 msg_data->msg_fetched = 1; 81 msg_data->msg_fetched = 1;
82 msg_data->msg_message = message; 82 msg_data->msg_message = message;
83 msg_data->msg_length = strlen(message); 83 msg_data->msg_length = strlen(message);
84 } 84 }
85 body = parseMail(mailmsg); 85 body = parseMail(mailmsg);
86 86
87 /* clean up */ 87 /* clean up */
88 if (mailmsg) 88 if (mailmsg)
89 mailmessage_free(mailmsg); 89 mailmessage_free(mailmsg);
90 if (message) 90 if (message)
91 free(message); 91 free(message);
92 92
93 return body; 93 return body;
94} 94}
95 95
96void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) 96void POP3wrapper::listMessages(const QString &, QValueList<Opie::OSmartPointer<RecMail> > &target )
97{ 97{
98 login(); 98 login();
99 if (!m_pop3) 99 if (!m_pop3)
100 return; 100 return;
101 uint32_t res_messages,res_recent,res_unseen; 101 uint32_t res_messages,res_recent,res_unseen;
102 mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); 102 mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen);
103 parseList(target,m_pop3->sto_session,"INBOX"); 103 parseList(target,m_pop3->sto_session,"INBOX");
104 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); 104 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages));
105} 105}
106 106
107void POP3wrapper::login() 107void POP3wrapper::login()
108{ 108{
109 if (account->getOffline()) 109 if (account->getOffline())
110 return; 110 return;
111 /* we'll hold the line */ 111 /* we'll hold the line */
112 if ( m_pop3 != NULL ) 112 if ( m_pop3 != NULL )
113 return; 113 return;
114 114
115 const char *server, *user, *pass; 115 const char *server, *user, *pass;
116 uint16_t port; 116 uint16_t port;
117 int err = MAILPOP3_NO_ERROR; 117 int err = MAILPOP3_NO_ERROR;
118 118
119 server = account->getServer().latin1(); 119 server = account->getServer().latin1();
120 port = account->getPort().toUInt(); 120 port = account->getPort().toUInt();
@@ -148,107 +148,109 @@ void POP3wrapper::login()
148 conntype = CONNECTION_TYPE_TLS; 148 conntype = CONNECTION_TYPE_TLS;
149 } else if ( conntypeset == 1 ) { 149 } else if ( conntypeset == 1 ) {
150 conntype = CONNECTION_TYPE_STARTTLS; 150 conntype = CONNECTION_TYPE_STARTTLS;
151 } else if ( conntypeset == 0 ) { 151 } else if ( conntypeset == 0 ) {
152 conntype = CONNECTION_TYPE_TRY_STARTTLS; 152 conntype = CONNECTION_TYPE_TRY_STARTTLS;
153 } 153 }
154 154
155 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); 155 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
156 156
157 pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, 157 pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
158 (char*)user,(char*)pass,0,0,0); 158 (char*)user,(char*)pass,0,0,0);
159 159
160 160
161 err = mailstorage_connect(m_pop3); 161 err = mailstorage_connect(m_pop3);
162 if (err != MAIL_NO_ERROR) { 162 if (err != MAIL_NO_ERROR) {
163 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); 163 qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) );
164 Global::statusMessage(tr("Error initializing folder")); 164 Global::statusMessage(tr("Error initializing folder"));
165 mailstorage_free(m_pop3); 165 mailstorage_free(m_pop3);
166 m_pop3 = 0; 166 m_pop3 = 0;
167 } 167 }
168} 168}
169 169
170void POP3wrapper::logout() 170void POP3wrapper::logout()
171{ 171{
172 int err = MAILPOP3_NO_ERROR;
173 if ( m_pop3 == NULL ) 172 if ( m_pop3 == NULL )
174 return; 173 return;
175 mailstorage_free(m_pop3); 174 mailstorage_free(m_pop3);
176 m_pop3 = 0; 175 m_pop3 = 0;
177} 176}
178 177
179 178
180QValueList<Opie::osmart_pointer<Folder> >* POP3wrapper::listFolders() { 179QValueList<Opie::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
181 QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<FolderP>(); 180 QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<FolderP>();
182 FolderP inb=new Folder("INBOX","/"); 181 FolderP inb=new Folder("INBOX","/");
183 folders->append(inb); 182 folders->append(inb);
184 return folders; 183 return folders;
185} 184}
186 185
187void POP3wrapper::deleteMail(const RecMail&mail) { 186void POP3wrapper::deleteMail(const RecMailP&mail) {
188 login(); 187 login();
189 if (!m_pop3) 188 if (!m_pop3)
190 return; 189 return;
191 int err = mailsession_remove_message(m_pop3->sto_session,mail.getNumber()); 190 int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
192 if (err != MAIL_NO_ERROR) { 191 if (err != MAIL_NO_ERROR) {
193 Global::statusMessage(tr("error deleting mail")); 192 Global::statusMessage(tr("error deleting mail"));
194 } 193 }
195} 194}
196 195
197void POP3wrapper::answeredMail(const RecMail&) {} 196void POP3wrapper::answeredMail(const RecMailP&) {}
198 197
199int POP3wrapper::deleteAllMail(const FolderP&) { 198int POP3wrapper::deleteAllMail(const FolderP&) {
200 login(); 199 login();
201 if (!m_pop3) 200 if (!m_pop3)
202 return 0; 201 return 0;
203 int res = 1; 202 int res = 1;
204 203
205 uint32_t result = 0; 204 uint32_t result = 0;
206 int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); 205 int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result);
207 if (err != MAIL_NO_ERROR) { 206 if (err != MAIL_NO_ERROR) {
208 Global::statusMessage(tr("Error getting folder info")); 207 Global::statusMessage(tr("Error getting folder info"));
209 return 0; 208 return 0;
210 } 209 }
211 for (unsigned int i = 0; i < result; ++i) { 210 for (unsigned int i = 0; i < result; ++i) {
212 err = mailsession_remove_message(m_pop3->sto_session,i+1); 211 err = mailsession_remove_message(m_pop3->sto_session,i+1);
213 if (err != MAIL_NO_ERROR) { 212 if (err != MAIL_NO_ERROR) {
214 Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); 213 Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
215 res=0; 214 res=0;
216 } 215 }
217 break; 216 break;
218 } 217 }
219 return res; 218 return res;
220} 219}
221 220
222void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { 221void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
223 login(); 222 login();
224 target_stat.message_count = 0; 223 target_stat.message_count = 0;
225 target_stat.message_unseen = 0; 224 target_stat.message_unseen = 0;
226 target_stat.message_recent = 0; 225 target_stat.message_recent = 0;
227 if (!m_pop3) 226 if (!m_pop3)
228 return; 227 return;
229 int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, 228 int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count,
230 &target_stat.message_recent,&target_stat.message_unseen); 229 &target_stat.message_recent,&target_stat.message_unseen);
230 if (r != MAIL_NO_ERROR) {
231 qDebug("error getting folter status.");
232 }
231} 233}
232 234
233encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) { 235encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) {
234 char*target=0; 236 char*target=0;
235 size_t length=0; 237 size_t length=0;
236 encodedString*res = 0; 238 encodedString*res = 0;
237 mailmessage * mailmsg = 0; 239 mailmessage * mailmsg = 0;
238 int err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); 240 int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
239 err = mailmessage_fetch(mailmsg,&target,&length); 241 err = mailmessage_fetch(mailmsg,&target,&length);
240 if (mailmsg) 242 if (mailmsg)
241 mailmessage_free(mailmsg); 243 mailmessage_free(mailmsg);
242 if (target) { 244 if (target) {
243 res = new encodedString(target,length); 245 res = new encodedString(target,length);
244 } 246 }
245 return res; 247 return res;
246} 248}
247 249
248MAILLIB::ATYPE POP3wrapper::getType()const { 250MAILLIB::ATYPE POP3wrapper::getType()const {
249 return account->getType(); 251 return account->getType();
250} 252}
251 253
252const QString&POP3wrapper::getName()const{ 254const QString&POP3wrapper::getName()const{
253 return account->getAccountName(); 255 return account->getAccountName();
254} 256}
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index e4afb94..31eb6f1 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -1,42 +1,42 @@
1#ifndef __POP3WRAPPER 1#ifndef __POP3WRAPPER
2#define __POP3WRAPPER 2#define __POP3WRAPPER
3 3
4#include "mailwrapper.h" 4#include "mailwrapper.h"
5#include "genericwrapper.h" 5#include "genericwrapper.h"
6#include <qstring.h> 6#include <qstring.h>
7 7
8class encodedString; 8class encodedString;
9struct mailstorage; 9struct mailstorage;
10struct mailfolder; 10struct mailfolder;
11 11
12class POP3wrapper : public Genericwrapper 12class POP3wrapper : public Genericwrapper
13{ 13{
14 Q_OBJECT 14 Q_OBJECT
15 15
16public: 16public:
17 POP3wrapper( POP3account *a ); 17 POP3wrapper( POP3account *a );
18 virtual ~POP3wrapper(); 18 virtual ~POP3wrapper();
19 /* mailbox will be ignored */ 19 /* mailbox will be ignored */
20 virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); 20 virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target );
21 virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); 21 virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders();
22 /* mailbox will be ignored */ 22 /* mailbox will be ignored */
23 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); 23 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
24 24
25 virtual void deleteMail(const RecMail&mail); 25 virtual void deleteMail(const RecMailP&mail);
26 virtual void answeredMail(const RecMail&mail); 26 virtual void answeredMail(const RecMailP&mail);
27 virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); 27 virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&);
28 28
29 virtual RecBody fetchBody( const RecMail &mail ); 29 virtual RecBody fetchBody( const RecMailP &mail );
30 virtual encodedString* fetchRawBody(const RecMail&mail); 30 virtual encodedString* fetchRawBody(const RecMailP&mail);
31 virtual void logout(); 31 virtual void logout();
32 virtual MAILLIB::ATYPE getType()const; 32 virtual MAILLIB::ATYPE getType()const;
33 virtual const QString&getName()const; 33 virtual const QString&getName()const;
34 static void pop3_progress( size_t current, size_t maximum ); 34 static void pop3_progress( size_t current, size_t maximum );
35 35
36protected: 36protected:
37 void login(); 37 void login();
38 POP3account *account; 38 POP3account *account;
39 mailstorage*m_pop3; 39 mailstorage*m_pop3;
40}; 40};
41 41
42#endif 42#endif
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index afc5618..86673aa 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -291,77 +291,77 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
291 QString failuretext = ""; 291 QString failuretext = "";
292 292
293 connect_server(); 293 connect_server();
294 294
295 result = 1; 295 result = 1;
296 if (m_smtp) { 296 if (m_smtp) {
297 err = mailsmtp_send( m_smtp, from, rcpts, data, size ); 297 err = mailsmtp_send( m_smtp, from, rcpts, data, size );
298 if ( err != MAILSMTP_NO_ERROR ) { 298 if ( err != MAILSMTP_NO_ERROR ) {
299 failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); 299 failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err));
300 result = 0; 300 result = 0;
301 } 301 }
302 } else { 302 } else {
303 result = 0; 303 result = 0;
304 } 304 }
305 305
306 if (!result) { 306 if (!result) {
307 storeFailedMail(data,size,failuretext); 307 storeFailedMail(data,size,failuretext);
308 } else { 308 } else {
309 qDebug( "Mail sent." ); 309 qDebug( "Mail sent." );
310 storeMail(data,size,"Sent"); 310 storeMail(data,size,"Sent");
311 } 311 }
312 return result; 312 return result;
313} 313}
314 314
315void SMTPwrapper::sendMail(const Opie::osmart_pointer<Mail>&mail,bool later ) 315void SMTPwrapper::sendMail(const Opie::OSmartPointer<Mail>&mail,bool later )
316{ 316{
317 mailmime * mimeMail; 317 mailmime * mimeMail;
318 318
319 mimeMail = createMimeMail(mail ); 319 mimeMail = createMimeMail(mail );
320 if ( mimeMail == NULL ) { 320 if ( mimeMail == NULL ) {
321 qDebug( "sendMail: error creating mime mail" ); 321 qDebug( "sendMail: error creating mime mail" );
322 } else { 322 } else {
323 sendProgress = new progressMailSend(); 323 sendProgress = new progressMailSend();
324 sendProgress->show(); 324 sendProgress->show();
325 sendProgress->setMaxMails(1); 325 sendProgress->setMaxMails(1);
326 smtpSend( mimeMail,later); 326 smtpSend( mimeMail,later);
327 qDebug("Clean up done"); 327 qDebug("Clean up done");
328 sendProgress->hide(); 328 sendProgress->hide();
329 delete sendProgress; 329 delete sendProgress;
330 sendProgress = 0; 330 sendProgress = 0;
331 mailmime_free( mimeMail ); 331 mailmime_free( mimeMail );
332 } 332 }
333} 333}
334 334
335int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,RecMail*which) { 335int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
336 size_t curTok = 0; 336 size_t curTok = 0;
337 mailimf_fields *fields = 0; 337 mailimf_fields *fields = 0;
338 mailimf_field*ffrom = 0; 338 mailimf_field*ffrom = 0;
339 clist *rcpts = 0; 339 clist *rcpts = 0;
340 char*from = 0; 340 char*from = 0;
341 int res = 0; 341 int res = 0;
342 342
343 encodedString * data = wrap->fetchRawBody(*which); 343 encodedString * data = wrap->fetchRawBody(which);
344 if (!data) 344 if (!data)
345 return 0; 345 return 0;
346 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); 346 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
347 if (err != MAILIMF_NO_ERROR) { 347 if (err != MAILIMF_NO_ERROR) {
348 delete data; 348 delete data;
349 delete wrap; 349 delete wrap;
350 return 0; 350 return 0;
351 } 351 }
352 352
353 rcpts = createRcptList( fields ); 353 rcpts = createRcptList( fields );
354 ffrom = getField(fields, MAILIMF_FIELD_FROM ); 354 ffrom = getField(fields, MAILIMF_FIELD_FROM );
355 from = getFrom(ffrom); 355 from = getFrom(ffrom);
356 356
357 if (rcpts && from) { 357 if (rcpts && from) {
358 res = smtpSend(from,rcpts,data->Content(),data->Length()); 358 res = smtpSend(from,rcpts,data->Content(),data->Length());
359 } 359 }
360 if (fields) { 360 if (fields) {
361 mailimf_fields_free(fields); 361 mailimf_fields_free(fields);
362 fields = 0; 362 fields = 0;
363 } 363 }
364 if (data) { 364 if (data) {
365 delete data; 365 delete data;
366 } 366 }
367 if (from) { 367 if (from) {
@@ -370,87 +370,85 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,RecMail*which) {
370 if (rcpts) { 370 if (rcpts) {
371 smtp_address_list_free( rcpts ); 371 smtp_address_list_free( rcpts );
372 } 372 }
373 return res; 373 return res;
374} 374}
375 375
376/* this is a special fun */ 376/* this is a special fun */
377bool SMTPwrapper::flushOutbox() { 377bool SMTPwrapper::flushOutbox() {
378 bool returnValue = true; 378 bool returnValue = true;
379 379
380 qDebug("Sending the queue"); 380 qDebug("Sending the queue");
381 if (!m_SmtpAccount) { 381 if (!m_SmtpAccount) {
382 qDebug("No smtp account given"); 382 qDebug("No smtp account given");
383 return false; 383 return false;
384 } 384 }
385 385
386 bool reset_user_value = false; 386 bool reset_user_value = false;
387 QString localfolders = AbstractMail::defaultLocalfolder(); 387 QString localfolders = AbstractMail::defaultLocalfolder();
388 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 388 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
389 if (!wrap) { 389 if (!wrap) {
390 qDebug("memory error"); 390 qDebug("memory error");
391 return false; 391 return false;
392 } 392 }
393 QString oldPw, oldUser; 393 QString oldPw, oldUser;
394 QList<RecMail> mailsToSend; 394 QValueList<RecMailP> mailsToSend;
395 QList<RecMail> mailsToRemove; 395 QValueList<RecMailP> mailsToRemove;
396 QString mbox("Outgoing"); 396 QString mbox("Outgoing");
397 wrap->listMessages(mbox,mailsToSend); 397 wrap->listMessages(mbox,mailsToSend);
398 if (mailsToSend.count()==0) { 398 if (mailsToSend.count()==0) {
399 delete wrap; 399 delete wrap;
400 qDebug("No mails to send"); 400 qDebug("No mails to send");
401 return false; 401 return false;
402 } 402 }
403 403
404 oldPw = m_SmtpAccount->getPassword(); 404 oldPw = m_SmtpAccount->getPassword();
405 oldUser = m_SmtpAccount->getUser(); 405 oldUser = m_SmtpAccount->getUser();
406 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { 406 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
407 // get'em 407 // get'em
408 QString user,pass; 408 QString user,pass;
409 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); 409 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
410 login.show(); 410 login.show();
411 if ( QDialog::Accepted == login.exec() ) { 411 if ( QDialog::Accepted == login.exec() ) {
412 // ok 412 // ok
413 user = login.getUser().latin1(); 413 user = login.getUser().latin1();
414 pass = login.getPassword().latin1(); 414 pass = login.getPassword().latin1();
415 reset_user_value = true; 415 reset_user_value = true;
416 m_SmtpAccount->setUser(user); 416 m_SmtpAccount->setUser(user);
417 m_SmtpAccount->setPassword(pass); 417 m_SmtpAccount->setPassword(pass);
418 } else { 418 } else {
419 return true; 419 return true;
420 } 420 }
421 } 421 }
422 422
423 423
424 mailsToSend.setAutoDelete(false);
425 sendProgress = new progressMailSend(); 424 sendProgress = new progressMailSend();
426 sendProgress->show(); 425 sendProgress->show();
427 sendProgress->setMaxMails(mailsToSend.count()); 426 sendProgress->setMaxMails(mailsToSend.count());
428 427
429 while (mailsToSend.count()>0) { 428 while (mailsToSend.count()>0) {
430 if (sendQueuedMail(wrap,mailsToSend.at(0))==0) { 429 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
431 QMessageBox::critical(0,tr("Error sending mail"), 430 QMessageBox::critical(0,tr("Error sending mail"),
432 tr("Error sending queued mail - breaking")); 431 tr("Error sending queued mail - breaking"));
433 returnValue = false; 432 returnValue = false;
434 break; 433 break;
435 } 434 }
436 mailsToRemove.append(mailsToSend.at(0)); 435 mailsToRemove.append((*mailsToSend.begin()));
437 mailsToSend.removeFirst(); 436 mailsToSend.remove(mailsToSend.begin());
438 sendProgress->setCurrentMails(mailsToRemove.count()); 437 sendProgress->setCurrentMails(mailsToRemove.count());
439 } 438 }
440 if (reset_user_value) { 439 if (reset_user_value) {
441 m_SmtpAccount->setUser(oldUser); 440 m_SmtpAccount->setUser(oldUser);
442 m_SmtpAccount->setPassword(oldPw); 441 m_SmtpAccount->setPassword(oldPw);
443 } 442 }
444 Config cfg( "mail" ); 443 Config cfg( "mail" );
445 cfg.setGroup( "Status" ); 444 cfg.setGroup( "Status" );
446 m_queuedMail = 0; 445 m_queuedMail = 0;
447 cfg.writeEntry( "outgoing", m_queuedMail ); 446 cfg.writeEntry( "outgoing", m_queuedMail );
448 emit queuedMails( m_queuedMail ); 447 emit queuedMails( m_queuedMail );
449 sendProgress->hide(); 448 sendProgress->hide();
450 delete sendProgress; 449 delete sendProgress;
451 sendProgress = 0; 450 sendProgress = 0;
452 wrap->deleteMails(mbox,mailsToRemove); 451 wrap->deleteMails(mbox,mailsToRemove);
453 mailsToSend.setAutoDelete(true);
454 delete wrap; 452 delete wrap;
455 return returnValue; 453 return returnValue;
456} 454}
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index 08bde74..71ae35c 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -1,63 +1,63 @@
1// -*- Mode: C++; -*- 1// -*- Mode: C++; -*-
2#ifndef SMTPwrapper_H 2#ifndef SMTPwrapper_H
3#define SMTPwrapper_H 3#define SMTPwrapper_H
4 4
5#include <qpe/applnk.h> 5#include <qpe/applnk.h>
6 6
7#include <qbitarray.h> 7#include <qbitarray.h>
8#include <qdatetime.h> 8#include <qdatetime.h>
9#include <libetpan/clist.h> 9#include <libetpan/clist.h>
10 10
11#include "settings.h" 11#include "settings.h"
12#include "generatemail.h" 12#include "generatemail.h"
13 13
14#include <opie2/osmart_pointer.h> 14#include <opie2/osmartpointer.h>
15 15
16class SMTPaccount; 16class SMTPaccount;
17class AbstractMail; 17class AbstractMail;
18 18
19class SMTPwrapper : public Generatemail 19class SMTPwrapper : public Generatemail
20{ 20{
21 Q_OBJECT 21 Q_OBJECT
22 22
23public: 23public:
24 SMTPwrapper(SMTPaccount * aSmtp); 24 SMTPwrapper(SMTPaccount * aSmtp);
25 virtual ~SMTPwrapper(); 25 virtual ~SMTPwrapper();
26 void sendMail(const Opie::osmart_pointer<Mail>& mail,bool later=false ); 26 void sendMail(const Opie::OSmartPointer<Mail>& mail,bool later=false );
27 bool flushOutbox(); 27 bool flushOutbox();
28 28
29 static progressMailSend*sendProgress; 29 static progressMailSend*sendProgress;
30 30
31signals: 31signals:
32 void queuedMails( int ); 32 void queuedMails( int );
33 33
34protected: 34protected:
35 mailsmtp *m_smtp; 35 mailsmtp *m_smtp;
36 SMTPaccount * m_SmtpAccount; 36 SMTPaccount * m_SmtpAccount;
37 37
38 void connect_server(); 38 void connect_server();
39 void disc_server(); 39 void disc_server();
40 int start_smtp_tls(); 40 int start_smtp_tls();
41 41
42 42
43 void smtpSend( mailmime *mail,bool later); 43 void smtpSend( mailmime *mail,bool later);
44 44
45 static void storeMail(const char*mail, size_t length, const QString&box); 45 static void storeMail(const char*mail, size_t length, const QString&box);
46 static QString mailsmtpError( int err ); 46 static QString mailsmtpError( int err );
47 static void progress( size_t current, size_t maximum ); 47 static void progress( size_t current, size_t maximum );
48 48
49 int smtpSend(char*from,clist*rcpts,const char*data,size_t size); 49 int smtpSend(char*from,clist*rcpts,const char*data,size_t size);
50 50
51 void storeMail(mailmime*mail, const QString&box); 51 void storeMail(mailmime*mail, const QString&box);
52 52
53 int sendQueuedMail(AbstractMail*wrap,RecMail*which); 53 int sendQueuedMail(AbstractMail*wrap,const Opie::OSmartPointer<RecMail>&which);
54 void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); 54 void storeFailedMail(const char*data,unsigned int size, const char*failuremessage);
55 55
56 int m_queuedMail; 56 int m_queuedMail;
57 57
58protected slots: 58protected slots:
59 void emitQCop( int queued ); 59 void emitQCop( int queued );
60 60
61}; 61};
62 62
63#endif 63#endif
diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp
index 052e0f1..595e7fc 100644
--- a/noncore/net/mail/libmailwrapper/storemail.cpp
+++ b/noncore/net/mail/libmailwrapper/storemail.cpp
@@ -28,49 +28,49 @@ Storemail::Storemail(const QString&dir,const QString&aFolder)
28 m_Account = 0; 28 m_Account = 0;
29 m_tfolder = aFolder; 29 m_tfolder = aFolder;
30 wrapper = AbstractMail::getWrapper(dir); 30 wrapper = AbstractMail::getWrapper(dir);
31 if (wrapper) { 31 if (wrapper) {
32 wrapper->createMbox(m_tfolder); 32 wrapper->createMbox(m_tfolder);
33 } 33 }
34} 34}
35 35
36Storemail::Storemail(const QString&aFolder) 36Storemail::Storemail(const QString&aFolder)
37 : Generatemail() 37 : Generatemail()
38{ 38{
39 wrapper = 0; 39 wrapper = 0;
40 m_Account = 0; 40 m_Account = 0;
41 m_tfolder = aFolder; 41 m_tfolder = aFolder;
42 wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder()); 42 wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder());
43 if (wrapper) { 43 if (wrapper) {
44 wrapper->createMbox(m_tfolder); 44 wrapper->createMbox(m_tfolder);
45 } 45 }
46} 46}
47 47
48Storemail::~Storemail() 48Storemail::~Storemail()
49{ 49{
50} 50}
51 51
52int Storemail::storeMail(const Opie::osmart_pointer<Mail>&mail) 52int Storemail::storeMail(const Opie::OSmartPointer<Mail>&mail)
53{ 53{
54 if (!wrapper) return 0; 54 if (!wrapper) return 0;
55 int ret = 1; 55 int ret = 1;
56 56
57 mailmime * mimeMail = 0; 57 mailmime * mimeMail = 0;
58 mimeMail = createMimeMail(mail ); 58 mimeMail = createMimeMail(mail );
59 if ( mimeMail == NULL ) { 59 if ( mimeMail == NULL ) {
60 qDebug( "storeMail: error creating mime mail" ); 60 qDebug( "storeMail: error creating mime mail" );
61 return 0; 61 return 0;
62 } 62 }
63 char *data; 63 char *data;
64 size_t size; 64 size_t size;
65 data = 0; 65 data = 0;
66 66
67 mailmessage * msg = 0; 67 mailmessage * msg = 0;
68 msg = mime_message_init(mimeMail); 68 msg = mime_message_init(mimeMail);
69 mime_message_set_tmpdir(msg,getenv( "HOME" )); 69 mime_message_set_tmpdir(msg,getenv( "HOME" ));
70 int r = mailmessage_fetch(msg,&data,&size); 70 int r = mailmessage_fetch(msg,&data,&size);
71 mime_message_detach_mime(msg); 71 mime_message_detach_mime(msg);
72 mailmessage_free(msg); 72 mailmessage_free(msg);
73 msg = 0; 73 msg = 0;
74 if (r != MAIL_NO_ERROR || !data) { 74 if (r != MAIL_NO_ERROR || !data) {
75 qDebug("Error fetching mime..."); 75 qDebug("Error fetching mime...");
76 ret = 0; 76 ret = 0;
diff --git a/noncore/net/mail/libmailwrapper/storemail.h b/noncore/net/mail/libmailwrapper/storemail.h
index 7d8ea3d..80c7431 100644
--- a/noncore/net/mail/libmailwrapper/storemail.h
+++ b/noncore/net/mail/libmailwrapper/storemail.h
@@ -1,29 +1,29 @@
1#ifndef __STORE_MAIL_H 1#ifndef __STORE_MAIL_H
2#define __STORE_MAIL_H 2#define __STORE_MAIL_H
3 3
4#include <qpe/applnk.h> 4#include <qpe/applnk.h>
5 5
6#include "generatemail.h" 6#include "generatemail.h"
7 7
8class Account; 8class Account;
9class Mail; 9class Mail;
10class AbstractMail; 10class AbstractMail;
11 11
12class Storemail : public Generatemail 12class Storemail : public Generatemail
13{ 13{
14 Q_OBJECT 14 Q_OBJECT
15public: 15public:
16 Storemail(Account*aAccount,const QString&aFolder); 16 Storemail(Account*aAccount,const QString&aFolder);
17 Storemail(const QString&dir,const QString&aFolder); 17 Storemail(const QString&dir,const QString&aFolder);
18 Storemail(const QString&aFolder); 18 Storemail(const QString&aFolder);
19 virtual ~Storemail(); 19 virtual ~Storemail();
20 20
21 int storeMail(const Opie::osmart_pointer<Mail>&mail); 21 int storeMail(const Opie::OSmartPointer<Mail>&mail);
22 22
23protected: 23protected:
24 Account* m_Account; 24 Account* m_Account;
25 QString m_tfolder; 25 QString m_tfolder;
26 AbstractMail*wrapper; 26 AbstractMail*wrapper;
27}; 27};
28 28
29#endif 29#endif
diff --git a/noncore/net/mail/mailistviewitem.cpp b/noncore/net/mail/mailistviewitem.cpp
index 75633ef..0b926da 100644
--- a/noncore/net/mail/mailistviewitem.cpp
+++ b/noncore/net/mail/mailistviewitem.cpp
@@ -1,72 +1,72 @@
1#include "mailistviewitem.h" 1#include "mailistviewitem.h"
2#include <libmailwrapper/abstractmail.h> 2#include <libmailwrapper/abstractmail.h>
3#include <qtextstream.h> 3#include <qtextstream.h>
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5 5
6MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 6MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
7 :QListViewItem(parent,item),mail_data() 7 :QListViewItem(parent,item),mail_data()
8{ 8{
9} 9}
10 10
11void MailListViewItem::showEntry() 11void MailListViewItem::showEntry()
12{ 12{
13 if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) { 13 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
14 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); 14 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") );
15 } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { 15 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
16 /* I think it looks nicer if there are not such a log of icons but only on mails 16 /* I think it looks nicer if there are not such a log of icons but only on mails
17 replied or new - Alwin*/ 17 replied or new - Alwin*/
18 //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); 18 //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") );
19 } else { 19 } else {
20 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") ); 20 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") );
21 } 21 }
22 double s = mail_data.Msgsize(); 22 double s = mail_data->Msgsize();
23 int w; 23 int w;
24 w=0; 24 w=0;
25 25
26 while (s>1024) { 26 while (s>1024) {
27 s/=1024; 27 s/=1024;
28 ++w; 28 ++w;
29 if (w>=2) break; 29 if (w>=2) break;
30 } 30 }
31 31
32 QString q=""; 32 QString q="";
33 QString fsize=""; 33 QString fsize="";
34 switch(w) { 34 switch(w) {
35 case 1: 35 case 1:
36 q="k"; 36 q="k";
37 break; 37 break;
38 case 2: 38 case 2:
39 q="M"; 39 q="M";
40 break; 40 break;
41 default: 41 default:
42 break; 42 break;
43 } 43 }
44 44
45 { 45 {
46 QTextOStream o(&fsize); 46 QTextOStream o(&fsize);
47 if (w>0) o.precision(2); else o.precision(0); 47 if (w>0) o.precision(2); else o.precision(0);
48 o.setf(QTextStream::fixed); 48 o.setf(QTextStream::fixed);
49 o << s << " " << q << "Byte"; 49 o << s << " " << q << "Byte";
50 } 50 }
51 51
52 setText(1,mail_data.getSubject()); 52 setText(1,mail_data->getSubject());
53 setText(2,mail_data.getFrom()); 53 setText(2,mail_data->getFrom());
54 setText(3,fsize); 54 setText(3,fsize);
55 setText(4,mail_data.getDate()); 55 setText(4,mail_data->getDate());
56} 56}
57 57
58void MailListViewItem::storeData(const RecMail&data) 58void MailListViewItem::storeData(const RecMailP&data)
59{ 59{
60 mail_data = data; 60 mail_data = data;
61} 61}
62 62
63const RecMail& MailListViewItem::data()const 63const RecMailP& MailListViewItem::data()const
64{ 64{
65 return mail_data; 65 return mail_data;
66} 66}
67 67
68MAILLIB::ATYPE MailListViewItem::wrapperType() 68MAILLIB::ATYPE MailListViewItem::wrapperType()
69{ 69{
70 if (!mail_data.Wrapper()) return MAILLIB::A_UNDEFINED; 70 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
71 return mail_data.Wrapper()->getType(); 71 return mail_data->Wrapper()->getType();
72} 72}
diff --git a/noncore/net/mail/mailistviewitem.h b/noncore/net/mail/mailistviewitem.h
index f736de0..d953d83 100644
--- a/noncore/net/mail/mailistviewitem.h
+++ b/noncore/net/mail/mailistviewitem.h
@@ -1,23 +1,23 @@
1#ifndef __MAILLISTVIEWITEM_H 1#ifndef __MAILLISTVIEWITEM_H
2#define __MAILLISTVIEWITEM_H 2#define __MAILLISTVIEWITEM_H
3 3
4#include <qlistview.h> 4#include <qlistview.h>
5#include <libmailwrapper/mailtypes.h> 5#include <libmailwrapper/mailtypes.h>
6#include <libmailwrapper/maildefines.h> 6#include <libmailwrapper/maildefines.h>
7 7
8class MailListViewItem:public QListViewItem 8class MailListViewItem:public QListViewItem
9{ 9{
10public: 10public:
11 MailListViewItem(QListView * parent, MailListViewItem * after ); 11 MailListViewItem(QListView * parent, MailListViewItem * after );
12 virtual ~MailListViewItem(){} 12 virtual ~MailListViewItem(){}
13 13
14 void storeData(const RecMail&data); 14 void storeData(const RecMailP&data);
15 const RecMail&data()const; 15 const RecMailP&data()const;
16 void showEntry(); 16 void showEntry();
17 MAILLIB::ATYPE wrapperType(); 17 MAILLIB::ATYPE wrapperType();
18 18
19protected: 19protected:
20 RecMail mail_data; 20 RecMailP mail_data;
21}; 21};
22 22
23#endif 23#endif
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index bcf0866..c23ad3f 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -98,49 +98,50 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
98 mailView->addColumn( tr( "" ) ); 98 mailView->addColumn( tr( "" ) );
99 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 99 mailView->addColumn( tr( "Subject" ),QListView::Manual );
100 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 100 mailView->addColumn( tr( "Sender" ),QListView::Manual );
101 mailView->addColumn( tr( "Size" ),QListView::Manual); 101 mailView->addColumn( tr( "Size" ),QListView::Manual);
102 mailView->addColumn( tr( "Date" )); 102 mailView->addColumn( tr( "Date" ));
103 mailView->setAllColumnsShowFocus(true); 103 mailView->setAllColumnsShowFocus(true);
104 mailView->setSorting(-1); 104 mailView->setSorting(-1);
105 105
106 statusWidget = new StatusWidget( wrapperBox ); 106 statusWidget = new StatusWidget( wrapperBox );
107 statusWidget->hide(); 107 statusWidget->hide();
108 108
109 layout->addWidget( mailView ); 109 layout->addWidget( mailView );
110 layout->setStretchFactor( folderView, 1 ); 110 layout->setStretchFactor( folderView, 1 );
111 layout->setStretchFactor( mailView, 2 ); 111 layout->setStretchFactor( mailView, 2 );
112 112
113 slotAdjustLayout(); 113 slotAdjustLayout();
114 114
115 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 115 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
116 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 116 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
117 117
118 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, 118 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
119 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); 119 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
120 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 120 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
121 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 121 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
122 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); 122 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
123 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
123 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 124 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
124 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 125 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
125// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 126// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
126 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 127 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
127 // Added by Stefan Eilers to allow starting by addressbook.. 128 // Added by Stefan Eilers to allow starting by addressbook..
128 // copied from old mail2 129 // copied from old mail2
129#if !defined(QT_NO_COP) 130#if !defined(QT_NO_COP)
130 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), 131 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
131 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 132 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
132#endif 133#endif
133 134
134 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 135 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
135} 136}
136 137
137MainWindow::~MainWindow() 138MainWindow::~MainWindow()
138{ 139{
139} 140}
140 141
141void MainWindow::appMessage(const QCString &, const QByteArray &) 142void MainWindow::appMessage(const QCString &, const QByteArray &)
142{ 143{
143 qDebug("appMessage not reached"); 144 qDebug("appMessage not reached");
144} 145}
145 146
146void MainWindow::slotAdjustLayout() { 147void MainWindow::slotAdjustLayout() {
@@ -156,49 +157,49 @@ void MainWindow::slotAdjustLayout() {
156 157
157void MainWindow::slotAdjustColumns() 158void MainWindow::slotAdjustColumns()
158{ 159{
159 bool hidden = folderView->isHidden(); 160 bool hidden = folderView->isHidden();
160 if ( hidden ) folderView->show(); 161 if ( hidden ) folderView->show();
161 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 162 folderView->setColumnWidth( 0, folderView->visibleWidth() );
162 if ( hidden ) folderView->hide(); 163 if ( hidden ) folderView->hide();
163 164
164 mailView->setColumnWidth( 0, 10 ); 165 mailView->setColumnWidth( 0, 10 );
165 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 166 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
166 mailView->setColumnWidth( 2, 80 ); 167 mailView->setColumnWidth( 2, 80 );
167 mailView->setColumnWidth( 3, 50 ); 168 mailView->setColumnWidth( 3, 50 );
168 mailView->setColumnWidth( 4, 50 ); 169 mailView->setColumnWidth( 4, 50 );
169} 170}
170 171
171void MainWindow::slotEditSettings() 172void MainWindow::slotEditSettings()
172{ 173{
173} 174}
174 175
175void MainWindow::slotShowFolders( bool ) 176void MainWindow::slotShowFolders( bool )
176{ 177{
177 qDebug( "slotShowFolders not reached" ); 178 qDebug( "slotShowFolders not reached" );
178} 179}
179 180
180void MainWindow::refreshMailView(QList<RecMail>*) 181void MainWindow::refreshMailView(const QValueList<RecMailP>&)
181{ 182{
182 qDebug( "refreshMailView not reached" ); 183 qDebug( "refreshMailView not reached" );
183} 184}
184 185
185void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) 186void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
186{ 187{
187 qDebug( "mailLeftClicked not reached" ); 188 qDebug( "mailLeftClicked not reached" );
188} 189}
189 190
190void MainWindow::displayMail() 191void MainWindow::displayMail()
191{ 192{
192 qDebug("displayMail not reached"); 193 qDebug("displayMail not reached");
193} 194}
194 195
195void MainWindow::slotDeleteMail() 196void MainWindow::slotDeleteMail()
196{ 197{
197 qDebug("deleteMail not reached"); 198 qDebug("deleteMail not reached");
198} 199}
199 200
200void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 201void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
201{ 202{
202 qDebug("mailHold not reached"); 203 qDebug("mailHold not reached");
203} 204}
204 205
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index 1ba6299..8d004c6 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -1,53 +1,56 @@
1#ifndef MAINWINDOW_H 1#ifndef MAINWINDOW_H
2#define MAINWINDOW_H 2#define MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qlistview.h> 5#include <qlistview.h>
6#include <qaction.h> 6#include <qaction.h>
7 7
8#include <qtoolbar.h> 8#include <qtoolbar.h>
9#include <qmenubar.h> 9#include <qmenubar.h>
10 10
11#include "accountview.h" 11#include "accountview.h"
12#include "statuswidget.h" 12#include "statuswidget.h"
13 13
14#include <libmailwrapper/mailtypes.h>
15#include <opie2/osmartpointer.h>
16
14class RecMail; 17class RecMail;
15 18
16class MainWindow : public QMainWindow 19class MainWindow : public QMainWindow
17{ 20{
18 Q_OBJECT 21 Q_OBJECT
19 22
20public: 23public:
21 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 24 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
22 virtual ~MainWindow(); 25 virtual ~MainWindow();
23 26
24public slots: 27public slots:
25 virtual void slotAdjustColumns(); 28 virtual void slotAdjustColumns();
26 virtual void appMessage(const QCString &msg, const QByteArray &data); 29 virtual void appMessage(const QCString &msg, const QByteArray &data);
27 virtual void slotComposeMail(); 30 virtual void slotComposeMail();
28 31
29protected slots: 32protected slots:
30 virtual void slotSendQueued(); 33 virtual void slotSendQueued();
31 virtual void slotEditAccounts(); 34 virtual void slotEditAccounts();
32 virtual void slotShowFolders( bool show ); 35 virtual void slotShowFolders( bool show );
33 virtual void refreshMailView(QList<RecMail>*); 36 virtual void refreshMailView(const QValueList<RecMailP>&);
34 virtual void displayMail(); 37 virtual void displayMail();
35 virtual void slotDeleteMail(); 38 virtual void slotDeleteMail();
36 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 39 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
37 virtual void slotAdjustLayout(); 40 virtual void slotAdjustLayout();
38 virtual void slotEditSettings(); 41 virtual void slotEditSettings();
39 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); 42 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
40 43
41protected: 44protected:
42 QToolBar *toolBar; 45 QToolBar *toolBar;
43 StatusWidget *statusWidget; 46 StatusWidget *statusWidget;
44 QMenuBar *menuBar; 47 QMenuBar *menuBar;
45 QPopupMenu *mailMenu, *settingsMenu; 48 QPopupMenu *mailMenu, *settingsMenu;
46 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, 49 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
47 *editSettings, *editAccounts, *syncFolders; 50 *editSettings, *editAccounts, *syncFolders;
48 AccountView *folderView; 51 AccountView *folderView;
49 QListView *mailView; 52 QListView *mailView;
50 QBoxLayout *layout; 53 QBoxLayout *layout;
51}; 54};
52 55
53#endif 56#endif
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index d95b3c9..dd305df 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -124,155 +124,157 @@ void OpieMail::slotSearchMails()
124} 124}
125 125
126void OpieMail::slotEditSettings() 126void OpieMail::slotEditSettings()
127{ 127{
128 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 128 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
129 QPEApplication::execDialog( &settingsDialog ); 129 QPEApplication::execDialog( &settingsDialog );
130} 130}
131 131
132void OpieMail::slotEditAccounts() 132void OpieMail::slotEditAccounts()
133{ 133{
134 qDebug( "Edit Accounts" ); 134 qDebug( "Edit Accounts" );
135 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); 135 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
136 eaDialog.slotAdjustColumns(); 136 eaDialog.slotAdjustColumns();
137 QPEApplication::execDialog( &eaDialog ); 137 QPEApplication::execDialog( &eaDialog );
138 if ( settings ) delete settings; 138 if ( settings ) delete settings;
139 settings = new Settings(); 139 settings = new Settings();
140 140
141 folderView->populate( settings->getAccounts() ); 141 folderView->populate( settings->getAccounts() );
142} 142}
143 143
144void OpieMail::displayMail() 144void OpieMail::displayMail()
145{ 145{
146 QListViewItem*item = mailView->currentItem(); 146 QListViewItem*item = mailView->currentItem();
147 if (!item) return; 147 if (!item) return;
148 RecMail mail = ((MailListViewItem*)item)->data(); 148 RecMailP mail = ((MailListViewItem*)item)->data();
149 RecBody body = folderView->fetchBody(mail); 149 RecBody body = folderView->fetchBody(mail);
150 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); 150 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp );
151 readMail.setBody( body ); 151 readMail.setBody( body );
152 readMail.setMail( mail ); 152 readMail.setMail( mail );
153 readMail.showMaximized(); 153 readMail.showMaximized();
154 readMail.exec(); 154 readMail.exec();
155 155
156 if ( readMail.deleted ) 156 if ( readMail.deleted )
157 { 157 {
158 folderView->refreshCurrent(); 158 folderView->refreshCurrent();
159 } 159 }
160 else 160 else
161 { 161 {
162 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); 162 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) );
163 } 163 }
164} 164}
165 165
166void OpieMail::slotDeleteMail() 166void OpieMail::slotDeleteMail()
167{ 167{
168 if (!mailView->currentItem()) return; 168 if (!mailView->currentItem()) return;
169 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); 169 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
170 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 ) 170 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 )
171 { 171 {
172 mail.Wrapper()->deleteMail( mail ); 172 mail->Wrapper()->deleteMail( mail );
173 folderView->refreshCurrent(); 173 folderView->refreshCurrent();
174 } 174 }
175} 175}
176 176
177void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 177void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
178{ 178{
179 if (!mailView->currentItem()) return; 179 if (!mailView->currentItem()) return;
180 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 180 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
181 /* just the RIGHT button - or hold on pda */ 181 /* just the RIGHT button - or hold on pda */
182 if (button!=2) {return;} 182 if (button!=2) {return;}
183 qDebug("Event right/hold"); 183 qDebug("Event right/hold");
184 if (!item) return; 184 if (!item) return;
185 QPopupMenu *m = new QPopupMenu(0); 185 QPopupMenu *m = new QPopupMenu(0);
186 if (m) 186 if (m)
187 { 187 {
188 if (mailtype==MAILLIB::A_NNTP) { 188 if (mailtype==MAILLIB::A_NNTP) {
189 m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); 189 m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
190// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); 190// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
191 } else { 191 } else {
192 if (folderView->currentisDraft()) { 192 if (folderView->currentisDraft()) {
193 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); 193 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
194 } 194 }
195 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 195 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
196 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 196 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
197 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); 197 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail()));
198 } 198 }
199 m->setFocus(); 199 m->setFocus();
200 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 200 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
201 delete m; 201 delete m;
202 } 202 }
203} 203}
204 204
205void OpieMail::slotShowFolders( bool show ) 205void OpieMail::slotShowFolders( bool show )
206{ 206{
207 qDebug( "Show Folders" ); 207 qDebug( "Show Folders" );
208 if ( show && folderView->isHidden() ) 208 if ( show && folderView->isHidden() )
209 { 209 {
210 qDebug( "-> showing" ); 210 qDebug( "-> showing" );
211 folderView->show(); 211 folderView->show();
212 } 212 }
213 else if ( !show && !folderView->isHidden() ) 213 else if ( !show && !folderView->isHidden() )
214 { 214 {
215 qDebug( "-> hiding" ); 215 qDebug( "-> hiding" );
216 folderView->hide(); 216 folderView->hide();
217 } 217 }
218} 218}
219 219
220void OpieMail::refreshMailView(QList<RecMail>*list) 220void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
221{ 221{
222 MailListViewItem*item = 0; 222 MailListViewItem*item = 0;
223 mailView->clear(); 223 mailView->clear();
224 for (unsigned int i = 0; i < list->count();++i) 224
225 QValueList<RecMailP>::ConstIterator it;
226 for (it = list.begin(); it != list.end();++it)
225 { 227 {
226 item = new MailListViewItem(mailView,item); 228 item = new MailListViewItem(mailView,item);
227 item->storeData(*(list->at(i))); 229 item->storeData((*it));
228 item->showEntry(); 230 item->showEntry();
229 } 231 }
230} 232}
231 233
232void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) 234void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int )
233{ 235{
234 /* just LEFT button - or tap with stylus on pda */ 236 /* just LEFT button - or tap with stylus on pda */
235 if (button!=1) return; 237 if (button!=1) return;
236 if (!item) return; 238 if (!item) return;
237 if (folderView->currentisDraft()) { 239 if (folderView->currentisDraft()) {
238 reEditMail(); 240 reEditMail();
239 } else { 241 } else {
240 displayMail(); 242 displayMail();
241 } 243 }
242} 244}
243 245
244void OpieMail::slotMoveCopyMail() 246void OpieMail::slotMoveCopyMail()
245{ 247{
246 if (!mailView->currentItem()) return; 248 if (!mailView->currentItem()) return;
247 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); 249 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
248 AbstractMail*targetMail = 0; 250 AbstractMail*targetMail = 0;
249 QString targetFolder = ""; 251 QString targetFolder = "";
250 Selectstore sels; 252 Selectstore sels;
251 folderView->setupFolderselect(&sels); 253 folderView->setupFolderselect(&sels);
252 if (!sels.exec()) return; 254 if (!sels.exec()) return;
253 targetMail = sels.currentMail(); 255 targetMail = sels.currentMail();
254 targetFolder = sels.currentFolder(); 256 targetFolder = sels.currentFolder();
255 if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || 257 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
256 targetFolder.isEmpty()) 258 targetFolder.isEmpty())
257 { 259 {
258 return; 260 return;
259 } 261 }
260 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 262 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
261 { 263 {
262 QMessageBox::critical(0,tr("Error creating new Folder"), 264 QMessageBox::critical(0,tr("Error creating new Folder"),
263 tr("<center>Error while creating<br>new folder - breaking.</center>")); 265 tr("<center>Error while creating<br>new folder - breaking.</center>"));
264 return; 266 return;
265 } 267 }
266 mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 268 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
267 folderView->refreshCurrent(); 269 folderView->refreshCurrent();
268} 270}
269 271
270void OpieMail::reEditMail() 272void OpieMail::reEditMail()
271{ 273{
272 if (!mailView->currentItem()) return; 274 if (!mailView->currentItem()) return;
273 275
274 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 276 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
275 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 277 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
276 compose.slotAdjustColumns(); 278 compose.slotAdjustColumns();
277 QPEApplication::execDialog( &compose ); 279 QPEApplication::execDialog( &compose );
278} 280}
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h
index 88c7ea1..b93bd60 100644
--- a/noncore/net/mail/opiemail.h
+++ b/noncore/net/mail/opiemail.h
@@ -1,40 +1,42 @@
1#ifndef OPIEMAIL_H 1#ifndef OPIEMAIL_H
2#define OPIEMAIL_H 2#define OPIEMAIL_H
3 3
4#include "mainwindow.h" 4#include "mainwindow.h"
5#include <libmailwrapper/settings.h> 5#include <libmailwrapper/settings.h>
6 6
7#include <opie2/osmartpointer.h>
8#include <libmailwrapper/mailtypes.h>
7 9
8class OpieMail : public MainWindow 10class OpieMail : public MainWindow
9{ 11{
10 Q_OBJECT 12 Q_OBJECT
11 13
12public: 14public:
13 OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 15 OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
14 virtual ~OpieMail(); 16 virtual ~OpieMail();
15 static QString appName() { return QString::fromLatin1("opiemail"); } 17 static QString appName() { return QString::fromLatin1("opiemail"); }
16 18
17public slots: 19public slots:
18 virtual void slotwriteMail(const QString&name,const QString&email); 20 virtual void slotwriteMail(const QString&name,const QString&email);
19 virtual void slotComposeMail(); 21 virtual void slotComposeMail();
20 virtual void appMessage(const QCString &msg, const QByteArray &data); 22 virtual void appMessage(const QCString &msg, const QByteArray &data);
21protected slots: 23protected slots:
22 virtual void slotSendQueued(); 24 virtual void slotSendQueued();
23 virtual void slotSearchMails(); 25 virtual void slotSearchMails();
24 virtual void slotEditSettings(); 26 virtual void slotEditSettings();
25 virtual void slotEditAccounts(); 27 virtual void slotEditAccounts();
26 virtual void displayMail(); 28 virtual void displayMail();
27 virtual void slotDeleteMail(); 29 virtual void slotDeleteMail();
28 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 30 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
29 virtual void slotShowFolders( bool show ); 31 virtual void slotShowFolders( bool show );
30 virtual void refreshMailView(QList<RecMail>*); 32 virtual void refreshMailView(const QValueList<RecMailP>&);
31 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); 33 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
32 virtual void slotMoveCopyMail(); 34 virtual void slotMoveCopyMail();
33 virtual void reEditMail(); 35 virtual void reEditMail();
34 36
35private: 37private:
36 Settings *settings; 38 Settings *settings;
37 39
38}; 40};
39 41
40#endif 42#endif
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 78652d7..894a386 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -204,92 +204,92 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
204 } 204 }
205 QPopupMenu *menu = new QPopupMenu(); 205 QPopupMenu *menu = new QPopupMenu();
206 int ret=0; 206 int ret=0;
207 207
208 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 208 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
209 { 209 {
210 menu->insertItem( tr( "Show Text" ), 1 ); 210 menu->insertItem( tr( "Show Text" ), 1 );
211 } 211 }
212 menu->insertItem( tr( "Save Attachment" ), 0 ); 212 menu->insertItem( tr( "Save Attachment" ), 0 );
213 menu->insertSeparator(1); 213 menu->insertSeparator(1);
214 214
215 ret = menu->exec( point, 0 ); 215 ret = menu->exec( point, 0 );
216 216
217 switch(ret) 217 switch(ret)
218 { 218 {
219 case 0: 219 case 0:
220 { 220 {
221 MimeTypes types; 221 MimeTypes types;
222 types.insert( "all", "*" ); 222 types.insert( "all", "*" );
223 QString str = Opie::OFileDialog::getSaveFileName( 1, 223 QString str = Opie::OFileDialog::getSaveFileName( 1,
224 "/", item->text( 2 ) , types, 0 ); 224 "/", item->text( 2 ) , types, 0 );
225 225
226 if( !str.isEmpty() ) 226 if( !str.isEmpty() )
227 { 227 {
228 encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 228 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
229 if (content) 229 if (content)
230 { 230 {
231 QFile output(str); 231 QFile output(str);
232 output.open(IO_WriteOnly); 232 output.open(IO_WriteOnly);
233 output.writeBlock(content->Content(),content->Length()); 233 output.writeBlock(content->Content(),content->Length());
234 output.close(); 234 output.close();
235 delete content; 235 delete content;
236 } 236 }
237 } 237 }
238 } 238 }
239 break ; 239 break ;
240 240
241 case 1: 241 case 1:
242 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 242 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
243 { 243 {
244 setText(); 244 setText();
245 } 245 }
246 else 246 else
247 { 247 {
248 if ( m_recMail.Wrapper() != 0l ) 248 if ( m_recMail->Wrapper() != 0l )
249 { // make sure that there is a wrapper , even after delete or simular actions 249 { // make sure that there is a wrapper , even after delete or simular actions
250 browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 250 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
251 } 251 }
252 } 252 }
253 break; 253 break;
254 } 254 }
255 delete menu; 255 delete menu;
256} 256}
257 257
258 258
259void ViewMail::setMail( RecMail mail ) 259void ViewMail::setMail( RecMailP mail )
260{ 260{
261 261
262 m_recMail = mail; 262 m_recMail = mail;
263 263
264 m_mail[0] = mail.getFrom(); 264 m_mail[0] = mail->getFrom();
265 m_mail[1] = mail.getSubject(); 265 m_mail[1] = mail->getSubject();
266 m_mail[3] = mail.getDate(); 266 m_mail[3] = mail->getDate();
267 m_mail[4] = mail.Msgid(); 267 m_mail[4] = mail->Msgid();
268 268
269 m_mail2[0] = mail.To(); 269 m_mail2[0] = mail->To();
270 m_mail2[1] = mail.CC(); 270 m_mail2[1] = mail->CC();
271 m_mail2[2] = mail.Bcc(); 271 m_mail2[2] = mail->Bcc();
272 272
273 setText(); 273 setText();
274} 274}
275 275
276 276
277 277
278ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 278ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
279 : ViewMailBase(parent, name, fl), _inLoop(false) 279 : ViewMailBase(parent, name, fl), _inLoop(false)
280{ 280{
281 m_gotBody = false; 281 m_gotBody = false;
282 deleted = false; 282 deleted = false;
283 283
284 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 284 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
285 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 285 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
286 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 286 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
287 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 287 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
288 288
289 attachments->setEnabled(m_gotBody); 289 attachments->setEnabled(m_gotBody);
290 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 290 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
291 291
292 readConfig(); 292 readConfig();
293 attachments->setSorting(-1); 293 attachments->setSorting(-1);
294} 294}
295 295
@@ -327,49 +327,49 @@ void ViewMail::setText()
327 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 327 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
328 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 328 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
329 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 329 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
330 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 330 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
331 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 331 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
332 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 332 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
333 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + 333 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] +
334 "</td></tr></table><font face=fixed>"; 334 "</td></tr></table><font face=fixed>";
335 335
336 if ( !m_showHtml ) 336 if ( !m_showHtml )
337 { 337 {
338 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); 338 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
339 } 339 }
340 else 340 else
341 { 341 {
342 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); 342 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
343 } 343 }
344 // remove later in favor of a real handling 344 // remove later in favor of a real handling
345 m_gotBody = true; 345 m_gotBody = true;
346} 346}
347 347
348 348
349ViewMail::~ViewMail() 349ViewMail::~ViewMail()
350{ 350{
351 m_recMail.Wrapper()->cleanMimeCache(); 351 m_recMail->Wrapper()->cleanMimeCache();
352 hide(); 352 hide();
353} 353}
354 354
355void ViewMail::hide() 355void ViewMail::hide()
356{ 356{
357 QWidget::hide(); 357 QWidget::hide();
358 358
359 if (_inLoop) 359 if (_inLoop)
360 { 360 {
361 _inLoop = false; 361 _inLoop = false;
362 qApp->exit_loop(); 362 qApp->exit_loop();
363 363
364 } 364 }
365 365
366} 366}
367 367
368void ViewMail::exec() 368void ViewMail::exec()
369{ 369{
370 show(); 370 show();
371 371
372 if (!_inLoop) 372 if (!_inLoop)
373 { 373 {
374 _inLoop = true; 374 _inLoop = true;
375 qApp->enter_loop(); 375 qApp->enter_loop();
@@ -394,83 +394,83 @@ void ViewMail::slotReply()
394 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); 394 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok"));
395 return; 395 return;
396 } 396 }
397 397
398 QString rtext; 398 QString rtext;
399 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 399 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
400 .arg( m_mail[0] ) 400 .arg( m_mail[0] )
401 .arg( m_mail[3] ); 401 .arg( m_mail[3] );
402 402
403 QString text = m_mail[2]; 403 QString text = m_mail[2];
404 QStringList lines = QStringList::split(QRegExp("\\n"), text); 404 QStringList lines = QStringList::split(QRegExp("\\n"), text);
405 QStringList::Iterator it; 405 QStringList::Iterator it;
406 for (it = lines.begin(); it != lines.end(); it++) 406 for (it = lines.begin(); it != lines.end(); it++)
407 { 407 {
408 rtext += "> " + *it + "\n"; 408 rtext += "> " + *it + "\n";
409 } 409 }
410 rtext += "\n"; 410 rtext += "\n";
411 411
412 QString prefix; 412 QString prefix;
413 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; 413 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
414 else prefix = "Re: "; // no i18n on purpose 414 else prefix = "Re: "; // no i18n on purpose
415 415
416 Settings *settings = new Settings(); 416 Settings *settings = new Settings();
417 ComposeMail composer( settings ,this, 0, true); 417 ComposeMail composer( settings ,this, 0, true);
418 if (m_recMail.Replyto().isEmpty()) { 418 if (m_recMail->Replyto().isEmpty()) {
419 composer.setTo( m_recMail.getFrom()); 419 composer.setTo( m_recMail->getFrom());
420 } else { 420 } else {
421 composer.setTo( m_recMail.Replyto()); 421 composer.setTo( m_recMail->Replyto());
422 } 422 }
423 composer.setSubject( prefix + m_mail[1] ); 423 composer.setSubject( prefix + m_mail[1] );
424 composer.setMessage( rtext ); 424 composer.setMessage( rtext );
425 composer.setInReplyTo(m_recMail.Msgid()); 425 composer.setInReplyTo(m_recMail->Msgid());
426 426
427 if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) 427 if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) )
428 { 428 {
429 m_recMail.Wrapper()->answeredMail(m_recMail); 429 m_recMail->Wrapper()->answeredMail(m_recMail);
430 } 430 }
431} 431}
432 432
433void ViewMail::slotForward() 433void ViewMail::slotForward()
434{ 434{
435 if (!m_gotBody) 435 if (!m_gotBody)
436 { 436 {
437 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); 437 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok"));
438 return; 438 return;
439 } 439 }
440 440
441 QString ftext; 441 QString ftext;
442 ftext += QString("\n----- Forwarded message from %1 -----\n\n") 442 ftext += QString("\n----- Forwarded message from %1 -----\n\n")
443 .arg( m_mail[0] ); 443 .arg( m_mail[0] );
444 if (!m_mail[3].isNull()) 444 if (!m_mail[3].isNull())
445 ftext += QString("Date: %1\n") 445 ftext += QString("Date: %1\n")
446 .arg( m_mail[3] ); 446 .arg( m_mail[3] );
447 if (!m_mail[0].isNull()) 447 if (!m_mail[0].isNull())
448 ftext += QString("From: %1\n") 448 ftext += QString("From: %1\n")
449 .arg( m_mail[0] ); 449 .arg( m_mail[0] );
450 if (!m_mail[1].isNull()) 450 if (!m_mail[1].isNull())
451 ftext += QString("Subject: %1\n") 451 ftext += QString("Subject: %1\n")
452 .arg( m_mail[1] ); 452 .arg( m_mail[1] );
453 453
454 ftext += QString("\n%1\n") 454 ftext += QString("\n%1\n")
455 .arg( m_mail[2]); 455 .arg( m_mail[2]);
456 456
457 ftext += QString("----- End forwarded message -----\n"); 457 ftext += QString("----- End forwarded message -----\n");
458 458
459 Settings *settings = new Settings(); 459 Settings *settings = new Settings();
460 ComposeMail composer( settings ,this, 0, true); 460 ComposeMail composer( settings ,this, 0, true);
461 composer.setSubject( "Fwd: " + m_mail[1] ); 461 composer.setSubject( "Fwd: " + m_mail[1] );
462 composer.setMessage( ftext ); 462 composer.setMessage( ftext );
463 if ( QDialog::Accepted == QPEApplication::execDialog( &composer )) 463 if ( QDialog::Accepted == QPEApplication::execDialog( &composer ))
464 { 464 {
465 } 465 }
466} 466}
467 467
468void ViewMail::slotDeleteMail( ) 468void ViewMail::slotDeleteMail( )
469{ 469{
470 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 470 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
471 { 471 {
472 m_recMail.Wrapper()->deleteMail( m_recMail ); 472 m_recMail->Wrapper()->deleteMail( m_recMail );
473 hide(); 473 hide();
474 deleted = true; 474 deleted = true;
475 } 475 }
476} 476}
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index abbd5b3..6875e3c 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -15,59 +15,59 @@ class AttachItem : public QListViewItem
15public: 15public:
16 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 16 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
17 const QString&fsize,int num,const QValueList<int>&path); 17 const QString&fsize,int num,const QValueList<int>&path);
18 AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 18 AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
19 const QString&fsize,int num,const QValueList<int>&path); 19 const QString&fsize,int num,const QValueList<int>&path);
20 int Partnumber() { return _partNum; } 20 int Partnumber() { return _partNum; }
21 bool isParentof(const QValueList<int>&path); 21 bool isParentof(const QValueList<int>&path);
22 22
23private: 23private:
24 int _partNum; 24 int _partNum;
25 /* needed for a better display of attachments */ 25 /* needed for a better display of attachments */
26 QValueList<int> _path; 26 QValueList<int> _path;
27}; 27};
28 28
29class ViewMail : public ViewMailBase 29class ViewMail : public ViewMailBase
30{ 30{
31 Q_OBJECT 31 Q_OBJECT
32 32
33public: 33public:
34 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 34 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
35 ~ViewMail(); 35 ~ViewMail();
36 36
37 void hide(); 37 void hide();
38 void exec(); 38 void exec();
39 void setMail( RecMail mail ); 39 void setMail( RecMailP mail );
40 void setBody( RecBody body ); 40 void setBody( RecBody body );
41 bool deleted; 41 bool deleted;
42 42
43protected: 43protected:
44 QString deHtml(const QString &string); 44 QString deHtml(const QString &string);
45 AttachItem* searchParent(const QValueList<int>&path); 45 AttachItem* searchParent(const QValueList<int>&path);
46 AttachItem* lastChild(AttachItem*parent); 46 AttachItem* lastChild(AttachItem*parent);
47 47
48protected slots: 48protected slots:
49 void slotReply(); 49 void slotReply();
50 void slotForward(); 50 void slotForward();
51 void setText(); 51 void setText();
52 void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); 52 void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
53 void slotDeleteMail( ); 53 void slotDeleteMail( );
54 void slotShowHtml( bool ); 54 void slotShowHtml( bool );
55 55
56private: 56private:
57 void readConfig(); 57 void readConfig();
58 58
59 bool _inLoop; 59 bool _inLoop;
60 QString m_mailHtml; 60 QString m_mailHtml;
61 bool m_gotBody; 61 bool m_gotBody;
62 RecBody m_body; 62 RecBody m_body;
63 RecMail m_recMail; 63 RecMailP m_recMail;
64 bool m_showHtml; 64 bool m_showHtml;
65 65
66 // 0 from 1 subject 2 bodytext 3 date 66 // 0 from 1 subject 2 bodytext 3 date
67 QMap <int,QString> m_mail; 67 QMap <int,QString> m_mail;
68 // 0 to 1 cc 2 bcc 68 // 0 to 1 cc 2 bcc
69 QMap <int,QStringList> m_mail2; 69 QMap <int,QStringList> m_mail2;
70 70
71}; 71};
72 72
73#endif 73#endif