summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp155
-rw-r--r--noncore/net/mail/accountitem.h13
-rw-r--r--noncore/net/mail/accountview.cpp52
-rw-r--r--noncore/net/mail/accountview.h11
-rw-r--r--noncore/net/mail/defines.h27
-rw-r--r--noncore/net/mail/mainwindow.cpp35
-rw-r--r--noncore/net/mail/mainwindow.h5
-rw-r--r--noncore/net/mail/opiemail.cpp4
8 files changed, 217 insertions, 85 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index c1574fd..4869df8 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -74,33 +74,33 @@ void POP3viewItem::refresh()
74 item = new POP3folderItem( (*it), this , item ); 74 item = new POP3folderItem( (*it), this , item );
75 item->setSelectable( (*it)->may_select()); 75 item->setSelectable( (*it)->may_select());
76 } 76 }
77 delete folders; 77 delete folders;
78} 78}
79 79
80RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) 80RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
81{ 81{
82 odebug << "POP3 fetchBody" << oendl; 82 odebug << "POP3 fetchBody" << oendl;
83 return wrapper->fetchBody( mail ); 83 return wrapper->fetchBody( mail );
84} 84}
85 85
86QPopupMenu * POP3viewItem::getContextMenu() 86QPopupMenu * POP3viewItem::getContextMenu()
87{ 87{
88 QPopupMenu *m = new QPopupMenu(0); 88 QPopupMenu *m = new QPopupMenu(0);
89 if (m) 89 if (m)
90 { 90 {
91 if (!account->getOffline()) 91 if (!account->getOffline())
92 { 92 {
93 m->insertItem(QObject::tr("Disconnect",contextName),0); 93 m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT);
94 m->insertItem(QObject::tr("Set offline",contextName),1); 94 m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE);
95 } 95 }
96 else 96 else
97 { 97 {
98 m->insertItem(QObject::tr("Set online",contextName),1); 98 m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
99 } 99 }
100 } 100 }
101 return m; 101 return m;
102} 102}
103 103
104void POP3viewItem::disconnect() 104void POP3viewItem::disconnect()
105{ 105{
106 QListViewItem *child = firstChild(); 106 QListViewItem *child = firstChild();
@@ -124,20 +124,20 @@ void POP3viewItem::setOnOffline()
124 SETPIX(PIXMAP_POP3FOLDER); 124 SETPIX(PIXMAP_POP3FOLDER);
125 refresh(); 125 refresh();
126} 126}
127 127
128void POP3viewItem::contextMenuSelected(int which) 128void POP3viewItem::contextMenuSelected(int which)
129{ 129{
130 switch (which) 130 switch (which)
131 { 131 {
132 case 0: 132 case SERVER_MENU_DISCONNECT:
133 disconnect(); 133 disconnect();
134 break; 134 break;
135 case 1: 135 case SERVER_MENU_OFFLINE:
136 setOnOffline(); 136 setOnOffline();
137 break; 137 break;
138 } 138 }
139} 139}
140 140
141POP3folderItem::~POP3folderItem() 141POP3folderItem::~POP3folderItem()
142{} 142{}
143 143
@@ -167,44 +167,44 @@ RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail)
167 return pop3->getWrapper()->fetchBody(aMail); 167 return pop3->getWrapper()->fetchBody(aMail);
168} 168}
169 169
170QPopupMenu * POP3folderItem::getContextMenu() 170QPopupMenu * POP3folderItem::getContextMenu()
171{ 171{
172 QPopupMenu *m = new QPopupMenu(0); 172 QPopupMenu *m = new QPopupMenu(0);
173 if (m) 173 if (m)
174 { 174 {
175 m->insertItem(QObject::tr("Refresh header list",contextName),0); 175 m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
176 m->insertItem(QObject::tr("Delete all mails",contextName),1); 176 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
177 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); 177 m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS);
178 } 178 }
179 return m; 179 return m;
180} 180}
181 181
182void POP3folderItem::downloadMails() 182void POP3folderItem::downloadMails()
183{ 183{
184 AccountView*bl = pop3->accountView(); 184 AccountView*bl = pop3->accountView();
185 if (!bl) return; 185 if (!bl) return;
186 bl->downloadMails(folder,pop3->getWrapper()); 186 bl->downloadMails(folder,pop3->getWrapper());
187} 187}
188 188
189void POP3folderItem::contextMenuSelected(int which) 189void POP3folderItem::contextMenuSelected(int which)
190{ 190{
191 AccountView * view = (AccountView*)listView(); 191 AccountView * view = (AccountView*)listView();
192 switch (which) 192 switch (which)
193 { 193 {
194 case 0: 194 case FOLDER_MENU_REFRESH_HEADER:
195 /* must be 'cause pop3 lists are cached */ 195 /* must be 'cause pop3 lists are cached */
196 pop3->getWrapper()->logout(); 196 pop3->getWrapper()->logout();
197 view->refreshCurrent(); 197 view->refreshCurrent();
198 break; 198 break;
199 case 1: 199 case FOLDER_MENU_DELETE_ALL_MAILS:
200 deleteAllMail(pop3->getWrapper(),folder); 200 deleteAllMail(pop3->getWrapper(),folder);
201 break; 201 break;
202 case 2: 202 case FOLDER_MENU_MOVE_MAILS:
203 downloadMails(); 203 downloadMails();
204 break; 204 break;
205 default: 205 default:
206 break; 206 break;
207 } 207 }
208} 208}
209 209
210/** 210/**
@@ -265,34 +265,34 @@ void NNTPviewItem::refresh()
265 item = new NNTPfolderItem( (*it), this , item ); 265 item = new NNTPfolderItem( (*it), this , item );
266 item->setSelectable( (*it)->may_select()); 266 item->setSelectable( (*it)->may_select());
267 } 267 }
268 delete folders; 268 delete folders;
269} 269}
270 270
271RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) 271RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
272{ 272{
273 odebug << "NNTP fetchBody" << oendl; 273 odebug << "NNTP fetchBody" << oendl;
274 return wrapper->fetchBody( mail ); 274 return wrapper->fetchBody( mail );
275} 275}
276 276
277QPopupMenu * NNTPviewItem::getContextMenu() 277QPopupMenu * NNTPviewItem::getContextMenu()
278{ 278{
279 QPopupMenu *m = new QPopupMenu(0); 279 QPopupMenu *m = new QPopupMenu(0);
280 if (m) 280 if (m)
281 { 281 {
282 if (!account->getOffline()) 282 if (!account->getOffline())
283 { 283 {
284 m->insertItem(QObject::tr("Disconnect",contextName),0); 284 m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT);
285 m->insertItem(QObject::tr("Set offline",contextName),1); 285 m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE);
286 m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); 286 m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),SERVER_MENU_SUBSCRIBE);
287 } 287 }
288 else 288 else
289 { 289 {
290 m->insertItem(QObject::tr("Set online",contextName),1); 290 m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
291 } 291 }
292 } 292 }
293 return m; 293 return m;
294} 294}
295 295
296void NNTPviewItem::subscribeGroups() 296void NNTPviewItem::subscribeGroups()
297{ 297{
298 NNTPGroupsDlg dlg(account); 298 NNTPGroupsDlg dlg(account);
@@ -325,23 +325,23 @@ void NNTPviewItem::setOnOffline()
325 SETPIX(PIXMAP_POP3FOLDER); 325 SETPIX(PIXMAP_POP3FOLDER);
326 refresh(); 326 refresh();
327} 327}
328 328
329void NNTPviewItem::contextMenuSelected(int which) 329void NNTPviewItem::contextMenuSelected(int which)
330{ 330{
331 switch (which) 331 switch (which)
332 { 332 {
333 case 0: 333 case SERVER_MENU_DISCONNECT:
334 disconnect(); 334 disconnect();
335 break; 335 break;
336 case 1: 336 case SERVER_MENU_OFFLINE:
337 setOnOffline(); 337 setOnOffline();
338 break; 338 break;
339 case 2: 339 case SERVER_MENU_SUBSCRIBE:
340 subscribeGroups(); 340 subscribeGroups();
341 break; 341 break;
342 } 342 }
343} 343}
344 344
345NNTPfolderItem::~NNTPfolderItem() 345NNTPfolderItem::~NNTPfolderItem()
346{} 346{}
347 347
@@ -371,40 +371,40 @@ RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail)
371 return nntp->getWrapper()->fetchBody(aMail); 371 return nntp->getWrapper()->fetchBody(aMail);
372} 372}
373 373
374QPopupMenu * NNTPfolderItem::getContextMenu() 374QPopupMenu * NNTPfolderItem::getContextMenu()
375{ 375{
376 QPopupMenu *m = new QPopupMenu(0); 376 QPopupMenu *m = new QPopupMenu(0);
377 if (m) 377 if (m)
378 { 378 {
379 m->insertItem(QObject::tr("Refresh header list",contextName),0); 379 m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
380 m->insertItem(QObject::tr("Copy all postings",contextName),1); 380 m->insertItem(QObject::tr("Copy all postings",contextName),FOLDER_MENU_MOVE_MAILS);
381 } 381 }
382 return m; 382 return m;
383} 383}
384 384
385void NNTPfolderItem::downloadMails() 385void NNTPfolderItem::downloadMails()
386{ 386{
387 AccountView*bl = nntp->accountView(); 387 AccountView*bl = nntp->accountView();
388 if (!bl) return; 388 if (!bl) return;
389 bl->downloadMails(folder,nntp->getWrapper()); 389 bl->downloadMails(folder,nntp->getWrapper());
390} 390}
391 391
392void NNTPfolderItem::contextMenuSelected(int which) 392void NNTPfolderItem::contextMenuSelected(int which)
393{ 393{
394 AccountView * view = (AccountView*)listView(); 394 AccountView * view = (AccountView*)listView();
395 switch (which) 395 switch (which)
396 { 396 {
397 case 0: 397 case FOLDER_MENU_REFRESH_HEADER:
398 /* must be 'cause pop3 lists are cached */ 398 /* must be 'cause nntp lists are cached */
399 nntp->getWrapper()->logout(); 399 nntp->getWrapper()->logout();
400 view->refreshCurrent(); 400 view->refreshCurrent();
401 break; 401 break;
402 case 1: 402 case FOLDER_MENU_MOVE_MAILS:
403 downloadMails(); 403 downloadMails();
404 break; 404 break;
405 default: 405 default:
406 break; 406 break;
407 } 407 }
408} 408}
409 409
410/** 410/**
@@ -456,17 +456,17 @@ void IMAPviewItem::refreshFolders(bool force)
456 int pos; 456 int pos;
457 457
458 for ( it = folders->begin(); it!=folders->end(); ++it) 458 for ( it = folders->begin(); it!=folders->end(); ++it)
459 { 459 {
460 if ((*it)->getDisplayName().lower()=="inbox") 460 if ((*it)->getDisplayName().lower()=="inbox")
461 { 461 {
462 item = new IMAPfolderItem( (*it), this , item ); 462 item = new IMAPfolderItem( (*it), this , item );
463 folders->remove(it); 463 folders->remove(it);
464 odebug << "inbox found" << oendl; 464 odebug << "inbox found" << oendl;
465 break; 465 break;
466 } 466 }
467 } 467 }
468 for ( it = folders->begin(); it!=folders->end(); ++it) 468 for ( it = folders->begin(); it!=folders->end(); ++it)
469 { 469 {
470 fname = (*it)->getDisplayName(); 470 fname = (*it)->getDisplayName();
471 currentFolders.append((*it)->getName()); 471 currentFolders.append((*it)->getName());
472 pos = fname.findRev((*it)->Separator()); 472 pos = fname.findRev((*it)->Separator());
@@ -493,25 +493,25 @@ void IMAPviewItem::refreshFolders(bool force)
493 493
494QPopupMenu * IMAPviewItem::getContextMenu() 494QPopupMenu * IMAPviewItem::getContextMenu()
495{ 495{
496 QPopupMenu *m = new QPopupMenu(0); 496 QPopupMenu *m = new QPopupMenu(0);
497 if (m) 497 if (m)
498 { 498 {
499 if (!account->getOffline()) 499 if (!account->getOffline())
500 { 500 {
501 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 501 m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT);
502 m->insertItem(QObject::tr("Create new folder",contextName),1); 502 m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE);
503 m->insertSeparator(); 503 m->insertSeparator();
504 m->insertItem(QObject::tr("Disconnect",contextName),2); 504 m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER);
505 m->insertItem(QObject::tr("Set offline",contextName),3); 505 m->insertItem(QObject::tr("Create new folder",contextName),SERVER_MENU_CREATE_FOLDER);
506 } 506 }
507 else 507 else
508 { 508 {
509 m->insertItem(QObject::tr("Set online",contextName),3); 509 m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
510 } 510 }
511 } 511 }
512 return m; 512 return m;
513} 513}
514 514
515void IMAPviewItem::createNewFolder() 515void IMAPviewItem::createNewFolder()
516{ 516{
517 Newmdirdlg ndirdlg; 517 Newmdirdlg ndirdlg;
@@ -529,30 +529,30 @@ void IMAPviewItem::createNewFolder()
529 { 529 {
530 refreshFolders(true); 530 refreshFolders(true);
531 } 531 }
532 } 532 }
533} 533}
534 534
535void IMAPviewItem::contextMenuSelected(int id) 535void IMAPviewItem::contextMenuSelected(int id)
536{ 536{
537 odebug << "Id selected: " << id << "" << oendl; 537 odebug << "Id selected: " << id << "" << oendl;
538 switch (id) 538 switch (id)
539 { 539 {
540 case 0: 540 case SERVER_MENU_REFRESH_FOLDER:
541 refreshFolders(true); 541 refreshFolders(true);
542 break; 542 break;
543 case 1: 543 case SERVER_MENU_CREATE_FOLDER:
544 createNewFolder(); 544 createNewFolder();
545 break; 545 break;
546 case 2: 546 case SERVER_MENU_DISCONNECT:
547 removeChilds(); 547 removeChilds();
548 wrapper->logout(); 548 wrapper->logout();
549 break; 549 break;
550 case 3: 550 case SERVER_MENU_OFFLINE:
551 if (account->getOffline()==false) 551 if (account->getOffline()==false)
552 { 552 {
553 removeChilds(); 553 removeChilds();
554 wrapper->logout(); 554 wrapper->logout();
555 } 555 }
556 account->setOffline(!account->getOffline()); 556 account->setOffline(!account->getOffline());
557 account->save(); 557 account->save();
558 SETPIX(PIXMAP_IMAPFOLDER); 558 SETPIX(PIXMAP_IMAPFOLDER);
@@ -630,27 +630,27 @@ RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail)
630 630
631QPopupMenu * IMAPfolderItem::getContextMenu() 631QPopupMenu * IMAPfolderItem::getContextMenu()
632{ 632{
633 QPopupMenu *m = new QPopupMenu(0); 633 QPopupMenu *m = new QPopupMenu(0);
634 if (m) 634 if (m)
635 { 635 {
636 if (folder->may_select()) 636 if (folder->may_select())
637 { 637 {
638 m->insertItem(QObject::tr("Refresh header list",contextName),0); 638 m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
639 m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); 639 m->insertItem(QObject::tr("Move/Copy all mails",contextName),FOLDER_MENU_MOVE_MAILS);
640 m->insertItem(QObject::tr("Delete all mails",contextName),1); 640 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
641 } 641 }
642 if (folder->no_inferior()==false) 642 if (folder->no_inferior()==false)
643 { 643 {
644 m->insertItem(QObject::tr("Create new subfolder",contextName),2); 644 m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER);
645 } 645 }
646 if (folder->getDisplayName().lower()!="inbox") 646 if (folder->getDisplayName().lower()!="inbox")
647 { 647 {
648 m->insertItem(QObject::tr("Delete folder",contextName),3); 648 m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER);
649 } 649 }
650 } 650 }
651 return m; 651 return m;
652} 652}
653 653
654void IMAPfolderItem::createNewFolder() 654void IMAPfolderItem::createNewFolder()
655{ 655{
656 Newmdirdlg ndirdlg; 656 Newmdirdlg ndirdlg;
@@ -667,17 +667,17 @@ void IMAPfolderItem::createNewFolder()
667} 667}
668 668
669void IMAPfolderItem::deleteFolder() 669void IMAPfolderItem::deleteFolder()
670{ 670{
671 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 671 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
672 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 672 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
673 QObject::tr("Yes",contextName), 673 QObject::tr("Yes",contextName),
674 QObject::tr("No",contextName),QString::null,1,1); 674 QObject::tr("No",contextName),QString::null,1,1);
675 odebug << "Auswahl: " << yesno << "" << oendl; 675 odebug << "Auswahl: " << yesno << "" << oendl;
676 if (yesno == 0) 676 if (yesno == 0)
677 { 677 {
678 if (imap->getWrapper()->deleteMbox(folder)) 678 if (imap->getWrapper()->deleteMbox(folder))
679 { 679 {
680 QListView*v=listView(); 680 QListView*v=listView();
681 IMAPviewItem * box = imap; 681 IMAPviewItem * box = imap;
682 /* be carefull - after that this object is destroyd so don't use 682 /* be carefull - after that this object is destroyd so don't use
683 * any member of it after that call!!*/ 683 * any member of it after that call!!*/
@@ -694,33 +694,37 @@ void IMAPfolderItem::downloadMails()
694{ 694{
695 AccountView*bl = imap->accountView(); 695 AccountView*bl = imap->accountView();
696 if (!bl) return; 696 if (!bl) return;
697 bl->downloadMails(folder,imap->getWrapper()); 697 bl->downloadMails(folder,imap->getWrapper());
698} 698}
699 699
700void IMAPfolderItem::contextMenuSelected(int id) 700void IMAPfolderItem::contextMenuSelected(int id)
701{ 701{
702 odebug << "Selected id: " << id << "" << oendl; 702 odebug << "Selected id: " << id << "" << oendl;
703 AccountView * view = (AccountView*)listView(); 703 AccountView * view = (AccountView*)listView();
704 switch(id) 704 switch(id)
705 { 705 {
706 case 0: 706 case FOLDER_MENU_REFRESH_HEADER:
707 view->refreshCurrent(); 707 view->refreshCurrent();
708 break; 708 break;
709 case 1: 709 case FOLDER_MENU_DELETE_ALL_MAILS:
710 deleteAllMail(imap->getWrapper(),folder); 710 deleteAllMail(imap->getWrapper(),folder);
711 break; 711 break;
712 case 2: 712 case FOLDER_MENU_NEW_SUBFOLDER:
713 createNewFolder(); 713 if (folder->no_inferior()==false) {
714 createNewFolder();
715 }
714 break; 716 break;
715 case 3: 717 case FOLDER_MENU_DELETE_FOLDER:
716 deleteFolder(); 718 if (folder->getDisplayName().lower()!="inbox") {
719 deleteFolder();
720 }
717 break; 721 break;
718 case 4: 722 case FOLDER_MENU_MOVE_MAILS:
719 downloadMails(); 723 downloadMails();
720 break; 724 break;
721 default: 725 default:
722 break; 726 break;
723 } 727 }
724} 728}
725 729
726/** 730/**
@@ -754,16 +758,17 @@ void MHviewItem::refresh( QValueList<RecMailP> & target)
754{ 758{
755 refresh(false); 759 refresh(false);
756 getWrapper()->listMessages( "",target ); 760 getWrapper()->listMessages( "",target );
757} 761}
758 762
759void MHviewItem::refresh(bool force) 763void MHviewItem::refresh(bool force)
760{ 764{
761 if (childCount()>0 && force==false) return; 765 if (childCount()>0 && force==false) return;
766 odebug << "Refresh mh folders" << oendl;
762 removeChilds(); 767 removeChilds();
763 currentFolders.clear(); 768 currentFolders.clear();
764 QValueList<FolderP> *folders = wrapper->listFolders(); 769 QValueList<FolderP> *folders = wrapper->listFolders();
765 QValueList<FolderP>::ConstIterator it; 770 QValueList<FolderP>::ConstIterator it;
766 MHfolderItem*item = 0; 771 MHfolderItem*item = 0;
767 MHfolderItem*pmaster = 0; 772 MHfolderItem*pmaster = 0;
768 QString fname = ""; 773 QString fname = "";
769 int pos; 774 int pos;
@@ -798,29 +803,29 @@ void MHviewItem::refresh(bool force)
798 } 803 }
799 item->setSelectable((*it)->may_select()); 804 item->setSelectable((*it)->may_select());
800 } 805 }
801 delete folders; 806 delete folders;
802} 807}
803 808
804RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) 809RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
805{ 810{
806 odebug << "MH fetchBody" << oendl; 811 odebug << "MH fetchBody" << oendl;
807 return wrapper->fetchBody( mail ); 812 return wrapper->fetchBody( mail );
808} 813}
809 814
810QPopupMenu * MHviewItem::getContextMenu() 815QPopupMenu * MHviewItem::getContextMenu()
811{ 816{
812 QPopupMenu *m = new QPopupMenu(0); 817 QPopupMenu *m = new QPopupMenu(0);
813 if (m) 818 if (m)
814 { 819 {
815 m->insertItem(QObject::tr("Refresh folder list",contextName),0); 820 m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER);
816 m->insertItem(QObject::tr("Create new folder",contextName),1); 821 m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER);
817 m->insertItem(QObject::tr("Delete all mails",contextName),2); 822 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
818 m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); 823 m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS);
819 } 824 }
820 return m; 825 return m;
821} 826}
822 827
823void MHviewItem::createFolder() 828void MHviewItem::createFolder()
824{ 829{
825 Newmdirdlg ndirdlg(0,0,true); 830 Newmdirdlg ndirdlg(0,0,true);
826 if ( QPEApplication::execDialog( &ndirdlg ) ) 831 if ( QPEApplication::execDialog( &ndirdlg ) )
@@ -842,30 +847,36 @@ void MHviewItem::downloadMails()
842 847
843QStringList MHviewItem::subFolders() 848QStringList MHviewItem::subFolders()
844{ 849{
845 return currentFolders; 850 return currentFolders;
846} 851}
847 852
848void MHviewItem::contextMenuSelected(int which) 853void MHviewItem::contextMenuSelected(int which)
849{ 854{
855 AccountView*view = 0;
856
850 switch (which) 857 switch (which)
851 { 858 {
852 case 0: 859 case SERVER_MENU_REFRESH_FOLDER:
853 refresh(true); 860 refresh(true);
854 break; 861 break;
855 case 1: 862 case FOLDER_MENU_NEW_SUBFOLDER:
856 createFolder(); 863 createFolder();
857 break; 864 break;
858 case 2: 865 case FOLDER_MENU_DELETE_ALL_MAILS:
859 deleteAllMail(getWrapper(),folder); 866 deleteAllMail(getWrapper(),folder);
860 break; 867 break;
861 case 3: 868 case FOLDER_MENU_MOVE_MAILS:
862 downloadMails(); 869 downloadMails();
863 break; 870 break;
871 case FOLDER_MENU_REFRESH_HEADER:
872 view = (AccountView*)listView();
873 if (view) view->refreshCurrent();
874 break;
864 default: 875 default:
865 break; 876 break;
866 } 877 }
867} 878}
868 879
869MHfolderItem::~MHfolderItem() 880MHfolderItem::~MHfolderItem()
870{} 881{}
871 882
@@ -928,17 +939,17 @@ RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
928} 939}
929 940
930void MHfolderItem::deleteFolder() 941void MHfolderItem::deleteFolder()
931{ 942{
932 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 943 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
933 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 944 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
934 QObject::tr("Yes",contextName), 945 QObject::tr("Yes",contextName),
935 QObject::tr("No",contextName),QString::null,1,1); 946 QObject::tr("No",contextName),QString::null,1,1);
936 odebug << "Auswahl: " << yesno << "" << oendl; 947 odebug << "Auswahl: " << yesno << "" << oendl;
937 if (yesno == 0) 948 if (yesno == 0)
938 { 949 {
939 if (mbox->getWrapper()->deleteMbox(folder)) 950 if (mbox->getWrapper()->deleteMbox(folder))
940 { 951 {
941 QListView*v=listView(); 952 QListView*v=listView();
942 MHviewItem * box = mbox; 953 MHviewItem * box = mbox;
943 /* be carefull - after that this object is destroyd so don't use 954 /* be carefull - after that this object is destroyd so don't use
944 * any member of it after that call!!*/ 955 * any member of it after that call!!*/
@@ -951,20 +962,21 @@ void MHfolderItem::deleteFolder()
951 } 962 }
952} 963}
953 964
954QPopupMenu * MHfolderItem::getContextMenu() 965QPopupMenu * MHfolderItem::getContextMenu()
955{ 966{
956 QPopupMenu *m = new QPopupMenu(0); 967 QPopupMenu *m = new QPopupMenu(0);
957 if (m) 968 if (m)
958 { 969 {
959 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); 970 m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER);
960 m->insertItem(QObject::tr("Delete all mails",contextName),0); 971 m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
961 m->insertItem(QObject::tr("Create new subfolder",contextName),3); 972 m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS);
962 m->insertItem(QObject::tr("Delete folder",contextName),1); 973 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
974 m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER);
963 } 975 }
964 return m; 976 return m;
965} 977}
966 978
967void MHfolderItem::downloadMails() 979void MHfolderItem::downloadMails()
968{ 980{
969 AccountView*bl = mbox->accountView(); 981 AccountView*bl = mbox->accountView();
970 if (!bl) return; 982 if (!bl) return;
@@ -989,30 +1001,35 @@ void MHfolderItem::createFolder()
989 v->setSelected(box,true); 1001 v->setSelected(box,true);
990 } 1002 }
991 } 1003 }
992 } 1004 }
993} 1005}
994 1006
995void MHfolderItem::contextMenuSelected(int which) 1007void MHfolderItem::contextMenuSelected(int which)
996{ 1008{
1009 AccountView*view = 0;
997 switch(which) 1010 switch(which)
998 { 1011 {
999 case 0: 1012 case FOLDER_MENU_DELETE_ALL_MAILS:
1000 deleteAllMail(mbox->getWrapper(),folder); 1013 deleteAllMail(mbox->getWrapper(),folder);
1001 break; 1014 break;
1002 case 1: 1015 case FOLDER_MENU_DELETE_FOLDER:
1003 deleteFolder(); 1016 deleteFolder();
1004 break; 1017 break;
1005 case 2: 1018 case FOLDER_MENU_MOVE_MAILS:
1006 downloadMails(); 1019 downloadMails();
1007 break; 1020 break;
1008 case 3: 1021 case FOLDER_MENU_NEW_SUBFOLDER:
1009 createFolder(); 1022 createFolder();
1010 break; 1023 break;
1024 case FOLDER_MENU_REFRESH_HEADER:
1025 view = (AccountView*)listView();
1026 if (view) view->refreshCurrent();
1027 break;
1011 default: 1028 default:
1012 break; 1029 break;
1013 } 1030 }
1014} 1031}
1015 1032
1016bool MHfolderItem::isDraftfolder() 1033bool MHfolderItem::isDraftfolder()
1017{ 1034{
1018 if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; 1035 if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true;
@@ -1070,17 +1087,17 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
1070 if (!wrapper) return; 1087 if (!wrapper) return;
1071 QString fname=""; 1088 QString fname="";
1072 if (folder) fname = folder->getDisplayName(); 1089 if (folder) fname = folder->getDisplayName();
1073 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), 1090 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
1074 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). 1091 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).
1075 arg(fname), 1092 arg(fname),
1076 QObject::tr("Yes",contextName), 1093 QObject::tr("Yes",contextName),
1077 QObject::tr("No",contextName),QString::null,1,1); 1094 QObject::tr("No",contextName),QString::null,1,1);
1078 odebug << "Auswahl: " << yesno << "" << oendl; 1095 odebug << "Auswahl: " << yesno << "" << oendl;
1079 if (yesno == 0) 1096 if (yesno == 0)
1080 { 1097 {
1081 if (wrapper->deleteAllMail(folder)) 1098 if (wrapper->deleteAllMail(folder))
1082 { 1099 {
1083 AccountView * view = (AccountView*)listView(); 1100 AccountView * view = (AccountView*)listView();
1084 if (view) view->refreshCurrent(); 1101 if (view) view->refreshCurrent();
1085 } 1102 }
1086 } 1103 }
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h
index f125eeb..b2c50a1 100644
--- a/noncore/net/mail/accountitem.h
+++ b/noncore/net/mail/accountitem.h
@@ -31,16 +31,21 @@ public:
31 virtual ~AccountViewItem(); 31 virtual ~AccountViewItem();
32 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; 32 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0;
33 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; 33 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0;
34 virtual QPopupMenu * getContextMenu(){return 0;}; 34 virtual QPopupMenu * getContextMenu(){return 0;};
35 virtual void contextMenuSelected(int){} 35 virtual void contextMenuSelected(int){}
36 virtual AccountView*accountView(); 36 virtual AccountView*accountView();
37 virtual bool matchName(const QString&name)const; 37 virtual bool matchName(const QString&name)const;
38 virtual bool isDraftfolder(); 38 virtual bool isDraftfolder();
39 /* 1 - server
40 * 2 - folder
41 * 3 - beides
42 */
43 virtual int isServer()const=0;
39 44
40protected: 45protected:
41 AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); 46 AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0);
42 virtual void init(); 47 virtual void init();
43 virtual void removeChilds(); 48 virtual void removeChilds();
44 virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f); 49 virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f);
45 static const QString contextName; 50 static const QString contextName;
46 AccountView*m_Backlink; 51 AccountView*m_Backlink;
@@ -53,16 +58,17 @@ class POP3viewItem : public AccountViewItem
53public: 58public:
54 POP3viewItem( POP3account *a, AccountView *parent ); 59 POP3viewItem( POP3account *a, AccountView *parent );
55 virtual ~POP3viewItem(); 60 virtual ~POP3viewItem();
56 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); 61 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
57 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); 62 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
58 AbstractMail *getWrapper(); 63 AbstractMail *getWrapper();
59 virtual QPopupMenu * getContextMenu(); 64 virtual QPopupMenu * getContextMenu();
60 virtual void contextMenuSelected(int); 65 virtual void contextMenuSelected(int);
66 virtual int isServer()const{return 1;}
61 67
62protected: 68protected:
63 POP3account *account; 69 POP3account *account;
64 virtual void refresh(); 70 virtual void refresh();
65 AbstractMail *wrapper; 71 AbstractMail *wrapper;
66 void disconnect(); 72 void disconnect();
67 void setOnOffline(); 73 void setOnOffline();
68}; 74};
@@ -72,16 +78,17 @@ class POP3folderItem : public AccountViewItem
72 78
73public: 79public:
74 POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); 80 POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after );
75 virtual ~POP3folderItem(); 81 virtual ~POP3folderItem();
76 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); 82 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
77 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); 83 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
78 virtual QPopupMenu * getContextMenu(); 84 virtual QPopupMenu * getContextMenu();
79 virtual void contextMenuSelected(int); 85 virtual void contextMenuSelected(int);
86 virtual int isServer()const{return 2;}
80 87
81protected: 88protected:
82 void downloadMails(); 89 void downloadMails();
83 POP3viewItem *pop3; 90 POP3viewItem *pop3;
84}; 91};
85 92
86 93
87class NNTPviewItem : public AccountViewItem 94class NNTPviewItem : public AccountViewItem
@@ -90,16 +97,17 @@ class NNTPviewItem : public AccountViewItem
90public: 97public:
91 NNTPviewItem( NNTPaccount *a, AccountView *parent ); 98 NNTPviewItem( NNTPaccount *a, AccountView *parent );
92 virtual ~NNTPviewItem(); 99 virtual ~NNTPviewItem();
93 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); 100 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
94 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); 101 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
95 AbstractMail *getWrapper(); 102 AbstractMail *getWrapper();
96 virtual QPopupMenu * getContextMenu(); 103 virtual QPopupMenu * getContextMenu();
97 virtual void contextMenuSelected(int); 104 virtual void contextMenuSelected(int);
105 virtual int isServer()const{return 1;}
98 106
99protected: 107protected:
100 NNTPaccount *account; 108 NNTPaccount *account;
101 virtual void refresh(); 109 virtual void refresh();
102 AbstractMail *wrapper; 110 AbstractMail *wrapper;
103 void disconnect(); 111 void disconnect();
104 void setOnOffline(); 112 void setOnOffline();
105 void subscribeGroups(); 113 void subscribeGroups();
@@ -110,16 +118,17 @@ class NNTPfolderItem : public AccountViewItem
110 118
111public: 119public:
112 NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); 120 NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after );
113 virtual ~NNTPfolderItem(); 121 virtual ~NNTPfolderItem();
114 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); 122 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
115 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); 123 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
116 virtual QPopupMenu * getContextMenu(); 124 virtual QPopupMenu * getContextMenu();
117 virtual void contextMenuSelected(int); 125 virtual void contextMenuSelected(int);
126 virtual int isServer()const{return 2;}
118 127
119protected: 128protected:
120 void downloadMails(); 129 void downloadMails();
121 NNTPviewItem *nntp; 130 NNTPviewItem *nntp;
122}; 131};
123 132
124 133
125 134
@@ -131,16 +140,17 @@ public:
131 virtual ~IMAPviewItem(); 140 virtual ~IMAPviewItem();
132 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); 141 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
133 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); 142 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
134 AbstractMail *getWrapper(); 143 AbstractMail *getWrapper();
135 virtual QPopupMenu * getContextMenu(); 144 virtual QPopupMenu * getContextMenu();
136 virtual void contextMenuSelected(int); 145 virtual void contextMenuSelected(int);
137 const QStringList&subFolders(); 146 const QStringList&subFolders();
138 virtual void refreshFolders(bool force=false); 147 virtual void refreshFolders(bool force=false);
148 virtual int isServer()const{return 1;}
139 bool offline(); 149 bool offline();
140 150
141protected: 151protected:
142 virtual void createNewFolder(); 152 virtual void createNewFolder();
143 IMAPaccount *account; 153 IMAPaccount *account;
144 AbstractMail *wrapper; 154 AbstractMail *wrapper;
145 QStringList currentFolders; 155 QStringList currentFolders;
146}; 156};
@@ -152,16 +162,17 @@ public:
152 IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); 162 IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after );
153 IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); 163 IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master );
154 virtual ~IMAPfolderItem(); 164 virtual ~IMAPfolderItem();
155 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); 165 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
156 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); 166 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
157 virtual QPopupMenu * getContextMenu(); 167 virtual QPopupMenu * getContextMenu();
158 virtual void contextMenuSelected(int); 168 virtual void contextMenuSelected(int);
159 virtual const QString& Delemiter()const; 169 virtual const QString& Delemiter()const;
170 virtual int isServer()const{return 2;}
160protected: 171protected:
161 virtual void createNewFolder(); 172 virtual void createNewFolder();
162 virtual void deleteFolder(); 173 virtual void deleteFolder();
163 virtual void downloadMails(); 174 virtual void downloadMails();
164 IMAPviewItem *imap; 175 IMAPviewItem *imap;
165}; 176};
166 177
167class MHviewItem : public AccountViewItem 178class MHviewItem : public AccountViewItem
@@ -173,16 +184,17 @@ public:
173 virtual ~MHviewItem(); 184 virtual ~MHviewItem();
174 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); 185 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
175 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); 186 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
176 AbstractMail *getWrapper(); 187 AbstractMail *getWrapper();
177 virtual QPopupMenu * getContextMenu(); 188 virtual QPopupMenu * getContextMenu();
178 virtual void contextMenuSelected(int); 189 virtual void contextMenuSelected(int);
179 QStringList subFolders(); 190 QStringList subFolders();
180 virtual void refresh(bool force=false); 191 virtual void refresh(bool force=false);
192 virtual int isServer()const{return 3;}
181 193
182protected: 194protected:
183 void downloadMails(); 195 void downloadMails();
184 virtual void createFolder(); 196 virtual void createFolder();
185 QString m_Path; 197 QString m_Path;
186 AbstractMail *wrapper; 198 AbstractMail *wrapper;
187 QStringList currentFolders; 199 QStringList currentFolders;
188}; 200};
@@ -195,16 +207,17 @@ public:
195 MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); 207 MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master);
196 virtual ~MHfolderItem(); 208 virtual ~MHfolderItem();
197 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); 209 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
198 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); 210 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
199 virtual QPopupMenu * getContextMenu(); 211 virtual QPopupMenu * getContextMenu();
200 virtual void contextMenuSelected(int); 212 virtual void contextMenuSelected(int);
201 virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; 213 virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const;
202 virtual bool isDraftfolder(); 214 virtual bool isDraftfolder();
215 virtual int isServer()const{return 2;}
203 216
204protected: 217protected:
205 void downloadMails(); 218 void downloadMails();
206 virtual void createFolder(); 219 virtual void createFolder();
207 virtual void deleteFolder(); 220 virtual void deleteFolder();
208 void initName(); 221 void initName();
209 MHviewItem *mbox; 222 MHviewItem *mbox;
210}; 223};
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index c747a8b..d01d6bb 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -15,47 +15,89 @@
15/* QT */ 15/* QT */
16#include <qmessagebox.h> 16#include <qmessagebox.h>
17#include <qpopupmenu.h> 17#include <qpopupmenu.h>
18 18
19using namespace Opie::Core; 19using namespace Opie::Core;
20AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) 20AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
21 : QListView( parent, name, flags ) 21 : QListView( parent, name, flags )
22{ 22{
23 setSorting(0);
24 setSelectionMode(Single);
25 m_rightPressed = false;
26
23 connect( this, SIGNAL( selectionChanged(QListViewItem*) ), 27 connect( this, SIGNAL( selectionChanged(QListViewItem*) ),
24 SLOT( refresh(QListViewItem*) ) ); 28 SLOT( slotSelectionChanged(QListViewItem*) ) );
25 connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 29 connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
26 SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); 30 SLOT( slotMouseButton(int,QListViewItem*,const QPoint&,int) ) );
27 setSorting(0); 31 connect( this, SIGNAL(clicked(QListViewItem*) ),this,
32 SLOT( slotMouseClicked(QListViewItem*) ) );
33 m_currentItem = 0;
28} 34}
29 35
30AccountView::~AccountView() 36AccountView::~AccountView()
31{ 37{
32 imapAccounts.clear(); 38 imapAccounts.clear();
33 mhAccounts.clear(); 39 mhAccounts.clear();
34} 40}
35 41
42void AccountView::slotSelectionChanged(QListViewItem*item)
43{
44 odebug << "AccountView: Selection changed" << oendl;
45 if (!item) {
46 emit serverSelected(0);
47 return;
48 }
49 AccountViewItem *view = static_cast<AccountViewItem *>(item);
50
51 emit serverSelected(view->isServer());
52}
53
36void AccountView::slotContextMenu(int id) 54void AccountView::slotContextMenu(int id)
37{ 55{
38 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); 56 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
39 if (!view) return; 57 if (!view) return;
40 view->contextMenuSelected(id); 58 view->contextMenuSelected(id);
41} 59}
42 60
43void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) 61void AccountView::slotRightButton(int button, QListViewItem * item,const QPoint&,int)
44{ 62{
45 if (button==1) {return;} 63 m_rightPressed = true;
46 if (!item) return; 64 if (!item) return;
47 AccountViewItem *view = static_cast<AccountViewItem *>(item); 65 AccountViewItem *view = static_cast<AccountViewItem *>(item);
48 QPopupMenu*m = view->getContextMenu(); 66 QPopupMenu*m = view->getContextMenu();
49 if (!m) return; 67 if (!m) return;
50 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); 68 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
51 m->setFocus(); 69 m->setFocus();
52 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 70 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
53 delete m; 71 delete m;
72 setSelected(item,true);
73}
74
75void AccountView::slotLeftButton(int button, QListViewItem * item,const QPoint&,int)
76{
77 m_rightPressed = false;
78}
79
80void AccountView::slotMouseClicked(QListViewItem*item)
81{
82 if (m_rightPressed) return;
83 if (!item || m_currentItem == item) return;
84 /* ### ToDo check settings if on single tab it should open */
85 m_currentItem = item;
86 refresh(m_currentItem);
87}
88
89void AccountView::slotMouseButton(int button, QListViewItem * item,const QPoint&pos,int column)
90{
91 if (button==1) {
92 slotLeftButton(button,item,pos,column);
93 } else if (button==2) {
94 slotRightButton(button,item,pos,column);
95 }
54} 96}
55 97
56void AccountView::populate( QList<Account> list ) 98void AccountView::populate( QList<Account> list )
57{ 99{
58 clear(); 100 clear();
59 101
60 imapAccounts.clear(); 102 imapAccounts.clear();
61 mhAccounts.clear(); 103 mhAccounts.clear();
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 787b0b0..ae24dce 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -24,22 +24,31 @@ public:
24 virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); 24 virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail);
25 virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); 25 virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
26 virtual bool currentisDraft(); 26 virtual bool currentisDraft();
27 27
28public slots: 28public slots:
29 virtual void refreshAll(); 29 virtual void refreshAll();
30 virtual void refresh(QListViewItem *item); 30 virtual void refresh(QListViewItem *item);
31 virtual void refreshCurrent(); 31 virtual void refreshCurrent();
32 virtual void slotHold(int, QListViewItem *,const QPoint&,int);
33 virtual void slotContextMenu(int id); 32 virtual void slotContextMenu(int id);
33
34 void setupFolderselect(Selectstore*sels); 34 void setupFolderselect(Selectstore*sels);
35 35
36signals: 36signals:
37 void refreshMailview(const QValueList<RecMailP>& ); 37 void refreshMailview(const QValueList<RecMailP>& );
38 void serverSelected(int);
38 39
39protected: 40protected:
40 QListViewItem* m_currentItem; 41 QListViewItem* m_currentItem;
41 QValueList<IMAPviewItem*> imapAccounts; 42 QValueList<IMAPviewItem*> imapAccounts;
42 QValueList<MHviewItem*> mhAccounts; 43 QValueList<MHviewItem*> mhAccounts;
44 bool m_rightPressed:1;
45
46protected slots:
47 virtual void slotRightButton(int, QListViewItem *,const QPoint&,int);
48 virtual void slotLeftButton(int, QListViewItem *,const QPoint&,int);
49 virtual void slotMouseButton(int, QListViewItem *,const QPoint&,int);
50 virtual void slotMouseClicked(QListViewItem*);
51 virtual void slotSelectionChanged(QListViewItem*);
43}; 52};
44 53
45#endif 54#endif
diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h
index d840f09..5fcbf0f 100644
--- a/noncore/net/mail/defines.h
+++ b/noncore/net/mail/defines.h
@@ -13,23 +13,23 @@
13#define PIC_MBOXFOLDER "mail/mboxfolder" 13#define PIC_MBOXFOLDER "mail/mboxfolder"
14#define PIC_POP3FOLDER "mail/pop3folder" 14#define PIC_POP3FOLDER "mail/pop3folder"
15#define PIC_INBOXFOLDER "mail/inbox" 15#define PIC_INBOXFOLDER "mail/inbox"
16#define PIC_OUTBOXFOLDER "mail/outbox" 16#define PIC_OUTBOXFOLDER "mail/outbox"
17#define PIC_LOCALFOLDER "mail/localfolder" 17#define PIC_LOCALFOLDER "mail/localfolder"
18 18
19#define PIC_OFFLINE "mail/notconnected" 19#define PIC_OFFLINE "mail/notconnected"
20 20
21#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) ) 21#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) )
22#define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) ) 22#define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) )
23#define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) ) 23#define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) )
24#define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) ) 24#define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) )
25#define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) ) 25#define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) )
26#define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) ) 26#define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) )
27#define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) ) 27#define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) )
28 28
29#define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) ) 29#define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) )
30#define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) ) 30#define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) )
31#define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) ) 31#define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) )
32#define PIXMAP_MBOXFOLDER QPixmap( Resource::loadPixmap( PIC_MBOXFOLDER ) ) 32#define PIXMAP_MBOXFOLDER QPixmap( Resource::loadPixmap( PIC_MBOXFOLDER ) )
33#define PIXMAP_OUTBOXFOLDER QPixmap( Resource::loadPixmap( PIC_OUTBOXFOLDER) ) 33#define PIXMAP_OUTBOXFOLDER QPixmap( Resource::loadPixmap( PIC_OUTBOXFOLDER) )
34#define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) ) 34#define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) )
35#define PIXMAP_OFFLINE QPixmap( Resource::loadPixmap( PIC_OFFLINE) ) 35#define PIXMAP_OFFLINE QPixmap( Resource::loadPixmap( PIC_OFFLINE) )
@@ -49,9 +49,22 @@
49#define UTF16MASK 0x03FFUL 49#define UTF16MASK 0x03FFUL
50#define UTF16SHIFT 10 50#define UTF16SHIFT 10
51#define UTF16BASE 0x10000UL 51#define UTF16BASE 0x10000UL
52#define UTF16HIGHSTART 0xD800UL 52#define UTF16HIGHSTART 0xD800UL
53#define UTF16HIGHEND 0xDBFFUL 53#define UTF16HIGHEND 0xDBFFUL
54#define UTF16LOSTART 0xDC00UL 54#define UTF16LOSTART 0xDC00UL
55#define UTF16LOEND 0xDFFFUL 55#define UTF16LOEND 0xDFFFUL
56 56
57/* used for making menuids transparent */
58#define FOLDER_MENU_REFRESH_HEADER 0
59#define FOLDER_MENU_DELETE_ALL_MAILS 1
60#define FOLDER_MENU_NEW_SUBFOLDER 2
61#define FOLDER_MENU_DELETE_FOLDER 3
62#define FOLDER_MENU_MOVE_MAILS 4
63
64#define SERVER_MENU_DISCONNECT 5
65#define SERVER_MENU_OFFLINE 6
66#define SERVER_MENU_REFRESH_FOLDER 7
67#define SERVER_MENU_CREATE_FOLDER 8
68#define SERVER_MENU_SUBSCRIBE 9
69
57#endif 70#endif
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 0a45445..81c8fee 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -16,22 +16,46 @@ using namespace Opie::Core;
16MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 16MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
17 : QMainWindow( parent, name, flags ) 17 : QMainWindow( parent, name, flags )
18{ 18{
19 19
20 setCaption( tr( "Mail" ) ); 20 setCaption( tr( "Mail" ) );
21 setToolBarsMovable( false ); 21 setToolBarsMovable( false );
22 22
23 toolBar = new QToolBar( this ); 23 toolBar = new QToolBar( this );
24
24 menuBar = new QMenuBar( toolBar ); 25 menuBar = new QMenuBar( toolBar );
26
25 mailMenu = new QPopupMenu( menuBar ); 27 mailMenu = new QPopupMenu( menuBar );
26 menuBar->insertItem( tr( "Mail" ), mailMenu ); 28 menuBar->insertItem( tr( "Mail" ), mailMenu );
29
27 settingsMenu = new QPopupMenu( menuBar ); 30 settingsMenu = new QPopupMenu( menuBar );
28 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 31 menuBar->insertItem( tr( "Settings" ), settingsMenu );
29 32
33 serverMenu = new QPopupMenu( menuBar );
34 m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu );
35 serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT);
36 serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE);
37 serverMenu->insertSeparator();
38 serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER);
39 serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER);
40 serverMenu->insertSeparator();
41 serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE);
42
43 folderMenu = new QPopupMenu( menuBar );
44 m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu );
45 folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER);
46 folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS);
47 folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER);
48 folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER);
49 folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS);
50
51 menuBar->setItemEnabled(m_ServerMenuId,false);
52 menuBar->setItemEnabled(m_FolderMenuId,false);
53
30 addToolBar( toolBar ); 54 addToolBar( toolBar );
31 toolBar->setHorizontalStretchable( true ); 55 toolBar->setHorizontalStretchable( true );
32 56
33 QLabel *spacer = new QLabel( toolBar ); 57 QLabel *spacer = new QLabel( toolBar );
34 spacer->setBackgroundMode( QWidget::PaletteButton ); 58 spacer->setBackgroundMode( QWidget::PaletteButton );
35 toolBar->setStretchableWidget( spacer ); 59 toolBar->setStretchableWidget( spacer );
36 60
37 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 61 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
@@ -85,16 +109,20 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
85 QWidget *view = new QWidget( this ); 109 QWidget *view = new QWidget( this );
86 setCentralWidget( view ); 110 setCentralWidget( view );
87 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 111 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
88 112
89 folderView = new AccountView( view ); 113 folderView = new AccountView( view );
90 folderView->header()->hide(); 114 folderView->header()->hide();
91 folderView->setRootIsDecorated( true ); 115 folderView->setRootIsDecorated( true );
92 folderView->addColumn( tr( "Mailbox" ) ); 116 folderView->addColumn( tr( "Mailbox" ) );
117 connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int)));
118 connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
119 connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
120
93 121
94 layout->addWidget( folderView ); 122 layout->addWidget( folderView );
95 123
96 mailView = new QListView( view ); 124 mailView = new QListView( view );
97 mailView->addColumn( "" ); 125 mailView->addColumn( "" );
98 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 126 mailView->addColumn( tr( "Subject" ),QListView::Manual );
99 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 127 mailView->addColumn( tr( "Sender" ),QListView::Manual );
100 mailView->addColumn( tr( "Size" ),QListView::Manual); 128 mailView->addColumn( tr( "Size" ),QListView::Manual);
@@ -140,16 +168,23 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
140 168
141 QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) ); 169 QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) );
142} 170}
143 171
144MainWindow::~MainWindow() 172MainWindow::~MainWindow()
145{ 173{
146} 174}
147 175
176void MainWindow::serverSelected(int m_isFolder)
177{
178 mailView->clear();
179 menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1);
180 menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2);
181}
182
148void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) 183void MainWindow::systemMessage( const QCString& msg, const QByteArray& data )
149{ 184{
150 int _newrotation; 185 int _newrotation;
151 QDataStream stream( data, IO_ReadOnly ); 186 QDataStream stream( data, IO_ReadOnly );
152 if ( msg == "setCurrentRotation(int)" ) 187 if ( msg == "setCurrentRotation(int)" )
153 { 188 {
154 stream >> _newrotation; 189 stream >> _newrotation;
155 if (m_Rotate != _newrotation) { 190 if (m_Rotate != _newrotation) {
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index ad71a54..409f160 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -36,23 +36,26 @@ protected slots:
36 virtual void slotShowFolders( bool show ); 36 virtual void slotShowFolders( bool show );
37 virtual void refreshMailView(const QValueList<RecMailP>&); 37 virtual void refreshMailView(const QValueList<RecMailP>&);
38 virtual void displayMail(); 38 virtual void displayMail();
39 virtual void slotDeleteMail(); 39 virtual void slotDeleteMail();
40 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 40 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
41 virtual void slotAdjustLayout(); 41 virtual void slotAdjustLayout();
42 virtual void slotEditSettings(); 42 virtual void slotEditSettings();
43 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); 43 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
44 virtual void serverSelected(int);
44 45
45protected: 46protected:
46 QToolBar *toolBar; 47 QToolBar *toolBar;
47 QMenuBar *menuBar; 48 QMenuBar *menuBar;
48 QPopupMenu *mailMenu, *settingsMenu; 49 QPopupMenu *mailMenu, *settingsMenu,*serverMenu,*folderMenu;
50
49 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, 51 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
50 *editSettings, *editAccounts, *syncFolders; 52 *editSettings, *editAccounts, *syncFolders;
51 AccountView *folderView; 53 AccountView *folderView;
52 QListView *mailView; 54 QListView *mailView;
53 QBoxLayout *layout; 55 QBoxLayout *layout;
54 int m_Rotate; 56 int m_Rotate;
55 QCopChannel* m_sysChannel; 57 QCopChannel* m_sysChannel;
58 int m_ServerMenuId,m_FolderMenuId;
56}; 59};
57 60
58#endif 61#endif
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 9eba23e..7c6d314 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -75,18 +75,18 @@ ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const ch
75void ValueExplode::splitit() 75void ValueExplode::splitit()
76{ 76{
77 QString iLine; 77 QString iLine;
78 m_LastParsed.clear(); 78 m_LastParsed.clear();
79 if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) { 79 if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) {
80 m_LastParsed.append(tkeyvalues(m_Command,"")); 80 m_LastParsed.append(tkeyvalues(m_Command,""));
81 return; 81 return;
82 } 82 }
83 int pos,pos2,startpos; 83 int pos,pos2;
84 startpos = 0; 84 unsigned startpos = 0;
85 iLine = m_Command; 85 iLine = m_Command;
86 while ( (pos = iLine.find(mDelemiter,startpos))!=-1) { 86 while ( (pos = iLine.find(mDelemiter,startpos))!=-1) {
87 pos2 = iLine.find(m2Delemiter,startpos); 87 pos2 = iLine.find(m2Delemiter,startpos);
88 if (pos2==-1||pos2>pos) { 88 if (pos2==-1||pos2>pos) {
89 m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),"")); 89 m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),""));
90 } else { 90 } else {
91 m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1,pos-pos2-1))); 91 m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1,pos-pos2-1)));
92 } 92 }