summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp240
-rw-r--r--noncore/net/mail/accountitem.h50
-rw-r--r--noncore/net/mail/accountview.cpp29
-rw-r--r--noncore/net/mail/accountview.h8
-rw-r--r--noncore/net/mail/mainwindow.cpp23
-rw-r--r--noncore/net/mail/mainwindow.h12
-rw-r--r--noncore/net/mail/opiemail.cpp41
-rw-r--r--noncore/net/mail/opiemail.h8
8 files changed, 249 insertions, 162 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index 10db2c6..f7fdccd 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -78,32 +78,26 @@ void POP3viewItem::refresh()
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() 86QMap<int,QString> POP3viewItem::serverMenu()
87{ 87{
88 QPopupMenu *m = new QPopupMenu(0); 88 QMap<int,QString> _entries;
89 if (m) 89 if (!account->getOffline()) {
90 { 90 _entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName);
91 if (!account->getOffline()) 91 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName);
92 { 92 } else {
93 m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); 93 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName);
94 m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE);
95 }
96 else
97 {
98 m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
99 }
100 } 94 }
101 return m; 95 return _entries;
102} 96}
103 97
104void POP3viewItem::disconnect() 98void POP3viewItem::disconnect()
105{ 99{
106 QListViewItem *child = firstChild(); 100 QListViewItem *child = firstChild();
107 while ( child ) 101 while ( child )
108 { 102 {
109 QListViewItem *tmp = child; 103 QListViewItem *tmp = child;
@@ -120,27 +114,28 @@ void POP3viewItem::setOnOffline()
120 disconnect(); 114 disconnect();
121 } 115 }
122 account->setOffline(!account->getOffline()); 116 account->setOffline(!account->getOffline());
123 account->save(); 117 account->save();
124 SETPIX(PIXMAP_POP3FOLDER); 118 SETPIX(PIXMAP_POP3FOLDER);
125 refresh(); 119 refresh();
126} 120}
127 121
128void POP3viewItem::contextMenuSelected(int which) 122bool POP3viewItem::contextMenuSelected(int which)
129{ 123{
130 switch (which) 124 switch (which)
131 { 125 {
132 case SERVER_MENU_DISCONNECT: 126 case SERVER_MENU_DISCONNECT:
133 disconnect(); 127 disconnect();
134 break; 128 break;
135 case SERVER_MENU_OFFLINE: 129 case SERVER_MENU_OFFLINE:
136 setOnOffline(); 130 setOnOffline();
137 break; 131 break;
138 } 132 }
133 return false;
139} 134}
140 135
141POP3folderItem::~POP3folderItem() 136POP3folderItem::~POP3folderItem()
142{} 137{}
143 138
144POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) 139POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after )
145 : AccountViewItem(folderInit,parent,after ) 140 : AccountViewItem(folderInit,parent,after )
146{ 141{
@@ -162,36 +157,33 @@ void POP3folderItem::refresh(QValueList<RecMailP>&target)
162 pop3->getWrapper()->listMessages( folder->getName(),target ); 157 pop3->getWrapper()->listMessages( folder->getName(),target );
163} 158}
164 159
165RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) 160RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail)
166{ 161{
167 return pop3->getWrapper()->fetchBody(aMail); 162 return pop3->getWrapper()->fetchBody(aMail);
168} 163}
169 164
170QPopupMenu * POP3folderItem::getContextMenu() 165QMap<int,QString> POP3folderItem::folderMenu()
171{ 166{
172 QPopupMenu *m = new QPopupMenu(0); 167 QMap<int,QString> _entries;
173 if (m) 168 _entries[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
174 { 169 _entries[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
175 m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); 170 _entries[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
176 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); 171 return _entries;
177 m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS);
178 }
179 return m;
180} 172}
181 173
182void POP3folderItem::downloadMails() 174void POP3folderItem::downloadMails()
183{ 175{
184 AccountView*bl = pop3->accountView(); 176 AccountView*bl = pop3->accountView();
185 if (!bl) return; 177 if (!bl) return;
186 bl->downloadMails(folder,pop3->getWrapper()); 178 bl->downloadMails(folder,pop3->getWrapper());
187} 179}
188 180
189void POP3folderItem::contextMenuSelected(int which) 181bool POP3folderItem::contextMenuSelected(int which)
190{ 182{
191 AccountView * view = (AccountView*)listView(); 183 AccountView * view = (AccountView*)listView();
192 switch (which) 184 switch (which)
193 { 185 {
194 case FOLDER_MENU_REFRESH_HEADER: 186 case FOLDER_MENU_REFRESH_HEADER:
195 /* must be 'cause pop3 lists are cached */ 187 /* must be 'cause pop3 lists are cached */
196 pop3->getWrapper()->logout(); 188 pop3->getWrapper()->logout();
197 view->refreshCurrent(); 189 view->refreshCurrent();
@@ -200,16 +192,17 @@ void POP3folderItem::contextMenuSelected(int which)
200 deleteAllMail(pop3->getWrapper(),folder); 192 deleteAllMail(pop3->getWrapper(),folder);
201 break; 193 break;
202 case FOLDER_MENU_MOVE_MAILS: 194 case FOLDER_MENU_MOVE_MAILS:
203 downloadMails(); 195 downloadMails();
204 break; 196 break;
205 default: 197 default:
206 break; 198 break;
207 } 199 }
200 return false;
208} 201}
209 202
210/** 203/**
211 * NNTP Account stuff 204 * NNTP Account stuff
212 */ 205 */
213NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) 206NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent )
214 : AccountViewItem( parent ) 207 : AccountViewItem( parent )
215{ 208{
@@ -269,33 +262,28 @@ void NNTPviewItem::refresh()
269} 262}
270 263
271RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) 264RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
272{ 265{
273 odebug << "NNTP fetchBody" << oendl; 266 odebug << "NNTP fetchBody" << oendl;
274 return wrapper->fetchBody( mail ); 267 return wrapper->fetchBody( mail );
275} 268}
276 269
277QPopupMenu * NNTPviewItem::getContextMenu() 270QMap<int,QString> NNTPviewItem::serverMenu()
278{ 271{
279 QPopupMenu *m = new QPopupMenu(0); 272 QMap<int,QString> _entries;
280 if (m) 273 if (!account->getOffline())
281 { 274 {
282 if (!account->getOffline()) 275 _entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName);
283 { 276 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName);
284 m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); 277 _entries[SERVER_MENU_SUBSCRIBE]=QObject::tr("(Un-)Subscribe groups",contextName);
285 m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); 278 } else {
286 m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),SERVER_MENU_SUBSCRIBE); 279 _entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName);
287 }
288 else
289 {
290 m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
291 }
292 } 280 }
293 return m; 281 return _entries;
294} 282}
295 283
296void NNTPviewItem::subscribeGroups() 284void NNTPviewItem::subscribeGroups()
297{ 285{
298 NNTPGroupsDlg dlg(account); 286 NNTPGroupsDlg dlg(account);
299 if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){ 287 if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){
300 refresh(); 288 refresh();
301 } 289 }
@@ -321,30 +309,31 @@ void NNTPviewItem::setOnOffline()
321 } 309 }
322 account->setOffline(!account->getOffline()); 310 account->setOffline(!account->getOffline());
323 account->save(); 311 account->save();
324 //FIXME 312 //FIXME
325 SETPIX(PIXMAP_POP3FOLDER); 313 SETPIX(PIXMAP_POP3FOLDER);
326 refresh(); 314 refresh();
327} 315}
328 316
329void NNTPviewItem::contextMenuSelected(int which) 317bool NNTPviewItem::contextMenuSelected(int which)
330{ 318{
331 switch (which) 319 switch (which)
332 { 320 {
333 case SERVER_MENU_DISCONNECT: 321 case SERVER_MENU_DISCONNECT:
334 disconnect(); 322 disconnect();
335 break; 323 break;
336 case SERVER_MENU_OFFLINE: 324 case SERVER_MENU_OFFLINE:
337 setOnOffline(); 325 setOnOffline();
338 break; 326 break;
339 case SERVER_MENU_SUBSCRIBE: 327 case SERVER_MENU_SUBSCRIBE:
340 subscribeGroups(); 328 subscribeGroups();
341 break; 329 break;
342 } 330 }
331 return false;
343} 332}
344 333
345NNTPfolderItem::~NNTPfolderItem() 334NNTPfolderItem::~NNTPfolderItem()
346{} 335{}
347 336
348NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) 337NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after )
349 : AccountViewItem( folderInit, parent,after ) 338 : AccountViewItem( folderInit, parent,after )
350{ 339{
@@ -366,50 +355,48 @@ void NNTPfolderItem::refresh(QValueList<RecMailP>&target)
366 nntp->getWrapper()->listMessages( folder->getName(),target ); 355 nntp->getWrapper()->listMessages( folder->getName(),target );
367} 356}
368 357
369RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) 358RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail)
370{ 359{
371 return nntp->getWrapper()->fetchBody(aMail); 360 return nntp->getWrapper()->fetchBody(aMail);
372} 361}
373 362
374QPopupMenu * NNTPfolderItem::getContextMenu() 363QMap<int,QString> NNTPfolderItem::folderMenu()
375{ 364{
376 QPopupMenu *m = new QPopupMenu(0); 365 QMap<int,QString> _entries;
377 if (m) 366 _entries[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
378 { 367 _entries[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Copy all postings",contextName);
379 m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); 368 return _entries;
380 m->insertItem(QObject::tr("Copy all postings",contextName),FOLDER_MENU_MOVE_MAILS);
381 }
382 return m;
383} 369}
384 370
385void NNTPfolderItem::downloadMails() 371void NNTPfolderItem::downloadMails()
386{ 372{
387 AccountView*bl = nntp->accountView(); 373 AccountView*bl = nntp->accountView();
388 if (!bl) return; 374 if (!bl) return;
389 bl->downloadMails(folder,nntp->getWrapper()); 375 bl->downloadMails(folder,nntp->getWrapper());
390} 376}
391 377
392void NNTPfolderItem::contextMenuSelected(int which) 378bool NNTPfolderItem::contextMenuSelected(int which)
393{ 379{
394 AccountView * view = (AccountView*)listView(); 380 AccountView * view = (AccountView*)listView();
395 switch (which) 381 switch (which)
396 { 382 {
397 case FOLDER_MENU_REFRESH_HEADER: 383 case FOLDER_MENU_REFRESH_HEADER:
398 /* must be 'cause nntp lists are cached */ 384 /* must be 'cause nntp lists are cached */
399 nntp->getWrapper()->logout(); 385 nntp->getWrapper()->logout();
400 view->refreshCurrent(); 386 view->refreshCurrent();
401 break; 387 break;
402 case FOLDER_MENU_MOVE_MAILS: 388 case FOLDER_MENU_MOVE_MAILS:
403 downloadMails(); 389 downloadMails();
404 break; 390 break;
405 default: 391 default:
406 break; 392 break;
407 } 393 }
394 return false;
408} 395}
409 396
410/** 397/**
411 * IMAP Account stuff 398 * IMAP Account stuff
412 */ 399 */
413IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) 400IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
414 : AccountViewItem( parent ) 401 : AccountViewItem( parent )
415{ 402{
@@ -486,35 +473,28 @@ void IMAPviewItem::refreshFolders(bool force)
486 else 473 else
487 { 474 {
488 item = new IMAPfolderItem( (*it), this , item ); 475 item = new IMAPfolderItem( (*it), this , item );
489 } 476 }
490 } 477 }
491 delete folders; 478 delete folders;
492} 479}
493 480
494QPopupMenu * IMAPviewItem::getContextMenu() 481QMap<int,QString> IMAPviewItem::serverMenu()
495{ 482{
496 QPopupMenu *m = new QPopupMenu(0); 483 QMap<int,QString> e;
497 if (m) 484 if (!account->getOffline()) {
498 { 485 e[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName);
499 if (!account->getOffline()) 486 e[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName);
500 { 487 e[SERVER_MENU_REFRESH_FOLDER]=QObject::tr("Refresh folder list",contextName);
501 m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); 488 e[SERVER_MENU_CREATE_FOLDER]=QObject::tr("Create new folder",contextName);
502 m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); 489 } else {
503 m->insertSeparator(); 490 e[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName);
504 m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER);
505 m->insertItem(QObject::tr("Create new folder",contextName),SERVER_MENU_CREATE_FOLDER);
506 }
507 else
508 {
509 m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE);
510 }
511 } 491 }
512 return m; 492 return e;
513} 493}
514 494
515void IMAPviewItem::createNewFolder() 495void IMAPviewItem::createNewFolder()
516{ 496{
517 Newmdirdlg ndirdlg; 497 Newmdirdlg ndirdlg;
518 if ( QPEApplication::execDialog( &ndirdlg )) 498 if ( QPEApplication::execDialog( &ndirdlg ))
519 { 499 {
520 QString ndir = ndirdlg.Newdir(); 500 QString ndir = ndirdlg.Newdir();
@@ -527,17 +507,17 @@ void IMAPviewItem::createNewFolder()
527 } 507 }
528 if (wrapper->createMbox(ndir,0,delemiter,makesubs)) 508 if (wrapper->createMbox(ndir,0,delemiter,makesubs))
529 { 509 {
530 refreshFolders(true); 510 refreshFolders(true);
531 } 511 }
532 } 512 }
533} 513}
534 514
535void IMAPviewItem::contextMenuSelected(int id) 515bool IMAPviewItem::contextMenuSelected(int id)
536{ 516{
537 odebug << "Id selected: " << id << "" << oendl; 517 odebug << "Id selected: " << id << "" << oendl;
538 switch (id) 518 switch (id)
539 { 519 {
540 case SERVER_MENU_REFRESH_FOLDER: 520 case SERVER_MENU_REFRESH_FOLDER:
541 refreshFolders(true); 521 refreshFolders(true);
542 break; 522 break;
543 case SERVER_MENU_CREATE_FOLDER: 523 case SERVER_MENU_CREATE_FOLDER:
@@ -556,16 +536,17 @@ void IMAPviewItem::contextMenuSelected(int id)
556 account->setOffline(!account->getOffline()); 536 account->setOffline(!account->getOffline());
557 account->save(); 537 account->save();
558 SETPIX(PIXMAP_IMAPFOLDER); 538 SETPIX(PIXMAP_IMAPFOLDER);
559 refreshFolders(false); 539 refreshFolders(false);
560 break; 540 break;
561 default: 541 default:
562 break; 542 break;
563 } 543 }
544 return false;
564} 545}
565 546
566RECBODYP IMAPviewItem::fetchBody(const RecMailP&) 547RECBODYP IMAPviewItem::fetchBody(const RecMailP&)
567{ 548{
568 return new RecBody(); 549 return new RecBody();
569} 550}
570 551
571bool IMAPviewItem::offline() 552bool IMAPviewItem::offline()
@@ -623,37 +604,31 @@ void IMAPfolderItem::refresh(QValueList<RecMailP>&target)
623 } 604 }
624} 605}
625 606
626RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) 607RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail)
627{ 608{
628 return imap->getWrapper()->fetchBody(aMail); 609 return imap->getWrapper()->fetchBody(aMail);
629} 610}
630 611
631QPopupMenu * IMAPfolderItem::getContextMenu() 612QMap<int,QString> IMAPfolderItem::folderMenu()
632{ 613{
633 QPopupMenu *m = new QPopupMenu(0); 614 QMap<int,QString> e;
634 if (m) 615 if (folder->may_select()) {
635 { 616 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
636 if (folder->may_select()) 617 e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copy all mails",contextName);
637 { 618 e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
638 m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
639 m->insertItem(QObject::tr("Move/Copy all mails",contextName),FOLDER_MENU_MOVE_MAILS);
640 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
641 }
642 if (folder->no_inferior()==false)
643 {
644 m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER);
645 }
646 if (folder->getDisplayName().lower()!="inbox")
647 {
648 m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER);
649 }
650 } 619 }
651 return m; 620 if (folder->no_inferior()==false) {
621 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName);
622 }
623 if (folder->getDisplayName().lower()!="inbox") {
624 e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName);
625 }
626 return e;
652} 627}
653 628
654void IMAPfolderItem::createNewFolder() 629void IMAPfolderItem::createNewFolder()
655{ 630{
656 Newmdirdlg ndirdlg; 631 Newmdirdlg ndirdlg;
657 if ( QPEApplication::execDialog( &ndirdlg ) ) 632 if ( QPEApplication::execDialog( &ndirdlg ) )
658 { 633 {
659 QString ndir = ndirdlg.Newdir(); 634 QString ndir = ndirdlg.Newdir();
@@ -661,17 +636,17 @@ void IMAPfolderItem::createNewFolder()
661 QString delemiter = Delemiter(); 636 QString delemiter = Delemiter();
662 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) 637 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
663 { 638 {
664 imap->refreshFolders(true); 639 imap->refreshFolders(true);
665 } 640 }
666 } 641 }
667} 642}
668 643
669void IMAPfolderItem::deleteFolder() 644bool IMAPfolderItem::deleteFolder()
670{ 645{
671 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 646 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()), 647 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), 648 QObject::tr("Yes",contextName),
674 QObject::tr("No",contextName),QString::null,1,1); 649 QObject::tr("No",contextName),QString::null,1,1);
675 odebug << "Auswahl: " << yesno << "" << oendl; 650 odebug << "Auswahl: " << yesno << "" << oendl;
676 if (yesno == 0) 651 if (yesno == 0)
677 { 652 {
@@ -681,28 +656,30 @@ void IMAPfolderItem::deleteFolder()
681 IMAPviewItem * box = imap; 656 IMAPviewItem * box = imap;
682 /* be carefull - after that this object is destroyd so don't use 657 /* be carefull - after that this object is destroyd so don't use
683 * any member of it after that call!!*/ 658 * any member of it after that call!!*/
684 imap->refreshFolders(true); 659 imap->refreshFolders(true);
685 if (v) 660 if (v)
686 { 661 {
687 v->setSelected(box,true); 662 v->setSelected(box,true);
688 } 663 }
664 return true;
689 } 665 }
690 } 666 }
667 return false;
691} 668}
692 669
693void IMAPfolderItem::downloadMails() 670void IMAPfolderItem::downloadMails()
694{ 671{
695 AccountView*bl = imap->accountView(); 672 AccountView*bl = imap->accountView();
696 if (!bl) return; 673 if (!bl) return;
697 bl->downloadMails(folder,imap->getWrapper()); 674 bl->downloadMails(folder,imap->getWrapper());
698} 675}
699 676
700void IMAPfolderItem::contextMenuSelected(int id) 677bool IMAPfolderItem::contextMenuSelected(int id)
701{ 678{
702 odebug << "Selected id: " << id << "" << oendl; 679 odebug << "Selected id: " << id << "" << oendl;
703 AccountView * view = (AccountView*)listView(); 680 AccountView * view = (AccountView*)listView();
704 switch(id) 681 switch(id)
705 { 682 {
706 case FOLDER_MENU_REFRESH_HEADER: 683 case FOLDER_MENU_REFRESH_HEADER:
707 view->refreshCurrent(); 684 view->refreshCurrent();
708 break; 685 break;
@@ -711,25 +688,26 @@ void IMAPfolderItem::contextMenuSelected(int id)
711 break; 688 break;
712 case FOLDER_MENU_NEW_SUBFOLDER: 689 case FOLDER_MENU_NEW_SUBFOLDER:
713 if (folder->no_inferior()==false) { 690 if (folder->no_inferior()==false) {
714 createNewFolder(); 691 createNewFolder();
715 } 692 }
716 break; 693 break;
717 case FOLDER_MENU_DELETE_FOLDER: 694 case FOLDER_MENU_DELETE_FOLDER:
718 if (folder->getDisplayName().lower()!="inbox") { 695 if (folder->getDisplayName().lower()!="inbox") {
719 deleteFolder(); 696 return deleteFolder();
720 } 697 }
721 break; 698 break;
722 case FOLDER_MENU_MOVE_MAILS: 699 case FOLDER_MENU_MOVE_MAILS:
723 downloadMails(); 700 downloadMails();
724 break; 701 break;
725 default: 702 default:
726 break; 703 break;
727 } 704 }
705 return false;
728} 706}
729 707
730/** 708/**
731 * MH Account stuff 709 * MH Account stuff
732 */ 710 */
733/* MH is a little bit different - the top folder can contains messages other than in IMAP and 711/* MH is a little bit different - the top folder can contains messages other than in IMAP and
734 POP3 and MBOX */ 712 POP3 and MBOX */
735MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) 713MHviewItem::MHviewItem( const QString&aPath, AccountView *parent )
@@ -807,27 +785,31 @@ void MHviewItem::refresh(bool force)
807} 785}
808 786
809RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) 787RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
810{ 788{
811 odebug << "MH fetchBody" << oendl; 789 odebug << "MH fetchBody" << oendl;
812 return wrapper->fetchBody( mail ); 790 return wrapper->fetchBody( mail );
813} 791}
814 792
815QPopupMenu * MHviewItem::getContextMenu() 793QMap<int,QString> MHviewItem::serverMenu()
816{ 794{
817 QPopupMenu *m = new QPopupMenu(0); 795 QMap<int,QString> e;
818 if (m) 796 e[SERVER_MENU_REFRESH_FOLDER]=QObject::tr("Refresh folder list",contextName);
819 { 797 return e;
820 m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); 798}
821 m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER); 799
822 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); 800QMap<int,QString> MHviewItem::folderMenu()
823 m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); 801{
824 } 802 QMap<int,QString> e;
825 return m; 803 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
804 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new folder",contextName);
805 e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
806 e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
807 return e;
826} 808}
827 809
828void MHviewItem::createFolder() 810void MHviewItem::createFolder()
829{ 811{
830 Newmdirdlg ndirdlg(0,0,true); 812 Newmdirdlg ndirdlg(0,0,true);
831 if ( QPEApplication::execDialog( &ndirdlg ) ) 813 if ( QPEApplication::execDialog( &ndirdlg ) )
832 { 814 {
833 QString ndir = ndirdlg.Newdir(); 815 QString ndir = ndirdlg.Newdir();
@@ -845,17 +827,17 @@ void MHviewItem::downloadMails()
845 bl->downloadMails(folder,getWrapper()); 827 bl->downloadMails(folder,getWrapper());
846} 828}
847 829
848QStringList MHviewItem::subFolders() 830QStringList MHviewItem::subFolders()
849{ 831{
850 return currentFolders; 832 return currentFolders;
851} 833}
852 834
853void MHviewItem::contextMenuSelected(int which) 835bool MHviewItem::contextMenuSelected(int which)
854{ 836{
855 AccountView*view = 0; 837 AccountView*view = 0;
856 838
857 switch (which) 839 switch (which)
858 { 840 {
859 case SERVER_MENU_REFRESH_FOLDER: 841 case SERVER_MENU_REFRESH_FOLDER:
860 refresh(true); 842 refresh(true);
861 break; 843 break;
@@ -870,16 +852,17 @@ void MHviewItem::contextMenuSelected(int which)
870 break; 852 break;
871 case FOLDER_MENU_REFRESH_HEADER: 853 case FOLDER_MENU_REFRESH_HEADER:
872 view = (AccountView*)listView(); 854 view = (AccountView*)listView();
873 if (view) view->refreshCurrent(); 855 if (view) view->refreshCurrent();
874 break; 856 break;
875 default: 857 default:
876 break; 858 break;
877 } 859 }
860 return false;
878} 861}
879 862
880MHfolderItem::~MHfolderItem() 863MHfolderItem::~MHfolderItem()
881{} 864{}
882 865
883MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) 866MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after )
884 : AccountViewItem(folderInit, parent,after ) 867 : AccountViewItem(folderInit, parent,after )
885{ 868{
@@ -933,17 +916,17 @@ void MHfolderItem::refresh(QValueList<RecMailP>&target)
933 mbox->getWrapper()->listMessages( folder->getName(),target ); 916 mbox->getWrapper()->listMessages( folder->getName(),target );
934} 917}
935 918
936RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) 919RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
937{ 920{
938 return mbox->getWrapper()->fetchBody(aMail); 921 return mbox->getWrapper()->fetchBody(aMail);
939} 922}
940 923
941void MHfolderItem::deleteFolder() 924bool MHfolderItem::deleteFolder()
942{ 925{
943 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 926 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
944 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 927 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
945 QObject::tr("Yes",contextName), 928 QObject::tr("Yes",contextName),
946 QObject::tr("No",contextName),QString::null,1,1); 929 QObject::tr("No",contextName),QString::null,1,1);
947 odebug << "Auswahl: " << yesno << "" << oendl; 930 odebug << "Auswahl: " << yesno << "" << oendl;
948 if (yesno == 0) 931 if (yesno == 0)
949 { 932 {
@@ -953,32 +936,31 @@ void MHfolderItem::deleteFolder()
953 MHviewItem * box = mbox; 936 MHviewItem * box = mbox;
954 /* be carefull - after that this object is destroyd so don't use 937 /* be carefull - after that this object is destroyd so don't use
955 * any member of it after that call!!*/ 938 * any member of it after that call!!*/
956 mbox->refresh(true); 939 mbox->refresh(true);
957 if (v) 940 if (v)
958 { 941 {
959 v->setSelected(box,true); 942 v->setSelected(box,true);
960 } 943 }
944 return true;
961 } 945 }
962 } 946 }
947 return false;
963} 948}
964 949
965QPopupMenu * MHfolderItem::getContextMenu() 950QMap<int,QString> MHfolderItem::folderMenu()
966{ 951{
967 QPopupMenu *m = new QPopupMenu(0); 952 QMap<int,QString> e;
968 if (m) 953 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName);
969 { 954 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
970 m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); 955 e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
971 m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); 956 e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
972 m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); 957 e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName);
973 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); 958 return e;
974 m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER);
975 }
976 return m;
977} 959}
978 960
979void MHfolderItem::downloadMails() 961void MHfolderItem::downloadMails()
980{ 962{
981 AccountView*bl = mbox->accountView(); 963 AccountView*bl = mbox->accountView();
982 if (!bl) return; 964 if (!bl) return;
983 bl->downloadMails(folder,mbox->getWrapper()); 965 bl->downloadMails(folder,mbox->getWrapper());
984} 966}
@@ -999,40 +981,41 @@ void MHfolderItem::createFolder()
999 if (v) 981 if (v)
1000 { 982 {
1001 v->setSelected(box,true); 983 v->setSelected(box,true);
1002 } 984 }
1003 } 985 }
1004 } 986 }
1005} 987}
1006 988
1007void MHfolderItem::contextMenuSelected(int which) 989bool MHfolderItem::contextMenuSelected(int which)
1008{ 990{
1009 AccountView*view = 0; 991 AccountView*view = 0;
1010 switch(which) 992 switch(which)
1011 { 993 {
1012 case FOLDER_MENU_DELETE_ALL_MAILS: 994 case FOLDER_MENU_DELETE_ALL_MAILS:
1013 deleteAllMail(mbox->getWrapper(),folder); 995 deleteAllMail(mbox->getWrapper(),folder);
1014 break; 996 break;
1015 case FOLDER_MENU_DELETE_FOLDER: 997 case FOLDER_MENU_DELETE_FOLDER:
1016 deleteFolder(); 998 return deleteFolder();
1017 break; 999 break;
1018 case FOLDER_MENU_MOVE_MAILS: 1000 case FOLDER_MENU_MOVE_MAILS:
1019 downloadMails(); 1001 downloadMails();
1020 break; 1002 break;
1021 case FOLDER_MENU_NEW_SUBFOLDER: 1003 case FOLDER_MENU_NEW_SUBFOLDER:
1022 createFolder(); 1004 createFolder();
1023 break; 1005 break;
1024 case FOLDER_MENU_REFRESH_HEADER: 1006 case FOLDER_MENU_REFRESH_HEADER:
1025 view = (AccountView*)listView(); 1007 view = (AccountView*)listView();
1026 if (view) view->refreshCurrent(); 1008 if (view) view->refreshCurrent();
1027 break; 1009 break;
1028 default: 1010 default:
1029 break; 1011 break;
1030 } 1012 }
1013 return false;
1031} 1014}
1032 1015
1033bool MHfolderItem::isDraftfolder() 1016bool MHfolderItem::isDraftfolder()
1034{ 1017{
1035 if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; 1018 if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true;
1036 return false; 1019 return false;
1037} 1020}
1038 1021
@@ -1145,8 +1128,37 @@ AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*
1145 } 1128 }
1146 return pitem; 1129 return pitem;
1147} 1130}
1148 1131
1149bool AccountViewItem::isDraftfolder() 1132bool AccountViewItem::isDraftfolder()
1150{ 1133{
1151 return false; 1134 return false;
1152} 1135}
1136
1137QMap<int,QString> AccountViewItem::serverMenu()
1138{
1139 return QMap<int,QString>();
1140}
1141
1142QMap<int,QString> AccountViewItem::folderMenu()
1143{
1144 return QMap<int,QString>();
1145}
1146
1147QPopupMenu * AccountViewItem::getContextMenu()
1148{
1149 QPopupMenu *m = new QPopupMenu(0);
1150 if (m)
1151 {
1152 QMap<int,QString> entries;
1153 entries = folderMenu();
1154 QMap<int,QString>::Iterator it;
1155 for (it=entries.begin();it!=entries.end();++it) {
1156 m->insertItem(it.data(),it.key());
1157 }
1158 entries = serverMenu();
1159 for (it=entries.begin();it!=entries.end();++it) {
1160 m->insertItem(it.data(),it.key());
1161 }
1162 }
1163 return m;
1164}
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h
index b2c50a1..6518899 100644
--- a/noncore/net/mail/accountitem.h
+++ b/noncore/net/mail/accountitem.h
@@ -1,14 +1,16 @@
1#ifndef __ACCOUNT_ITEM 1#ifndef __ACCOUNT_ITEM
2#define __ACCOUNT_ITEM 2#define __ACCOUNT_ITEM
3 3
4#include <opie2/osmartpointer.h>
5
4#include <qlistview.h> 6#include <qlistview.h>
5#include <qlist.h> 7#include <qlist.h>
6#include <opie2/osmartpointer.h> 8#include <qmap.h>
7 9
8class POP3wrapper; 10class POP3wrapper;
9class RecMail; 11class RecMail;
10class RecBody; 12class RecBody;
11class QPopupMenu; 13class QPopupMenu;
12class Selectstore; 14class Selectstore;
13class AccountView; 15class AccountView;
14class POP3account; 16class POP3account;
@@ -26,26 +28,28 @@ public:
26 AccountViewItem( AccountView *parent ); 28 AccountViewItem( AccountView *parent );
27 AccountViewItem( QListViewItem *parent); 29 AccountViewItem( QListViewItem *parent);
28 AccountViewItem( QListViewItem *parent , QListViewItem*after ); 30 AccountViewItem( QListViewItem *parent , QListViewItem*after );
29 AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); 31 AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after );
30 32
31 virtual ~AccountViewItem(); 33 virtual ~AccountViewItem();
32 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; 34 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0;
33 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; 35 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0;
34 virtual QPopupMenu * getContextMenu(){return 0;}; 36 virtual QPopupMenu * getContextMenu();
35 virtual void contextMenuSelected(int){} 37 virtual bool contextMenuSelected(int){return false;}
36 virtual AccountView*accountView(); 38 virtual AccountView*accountView();
37 virtual bool matchName(const QString&name)const; 39 virtual bool matchName(const QString&name)const;
38 virtual bool isDraftfolder(); 40 virtual bool isDraftfolder();
39 /* 1 - server 41 /* 1 - server
40 * 2 - folder 42 * 2 - folder
41 * 3 - beides 43 * 3 - both
42 */ 44 */
43 virtual int isServer()const=0; 45 virtual int isServer()const=0;
46 virtual QMap<int,QString> serverMenu();
47 virtual QMap<int,QString> folderMenu();
44 48
45protected: 49protected:
46 AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); 50 AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0);
47 virtual void init(); 51 virtual void init();
48 virtual void removeChilds(); 52 virtual void removeChilds();
49 virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f); 53 virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f);
50 static const QString contextName; 54 static const QString contextName;
51 AccountView*m_Backlink; 55 AccountView*m_Backlink;
@@ -56,19 +60,19 @@ class POP3viewItem : public AccountViewItem
56{ 60{
57 61
58public: 62public:
59 POP3viewItem( POP3account *a, AccountView *parent ); 63 POP3viewItem( POP3account *a, AccountView *parent );
60 virtual ~POP3viewItem(); 64 virtual ~POP3viewItem();
61 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); 65 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
62 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); 66 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
63 AbstractMail *getWrapper(); 67 AbstractMail *getWrapper();
64 virtual QPopupMenu * getContextMenu(); 68 virtual bool contextMenuSelected(int);
65 virtual void contextMenuSelected(int);
66 virtual int isServer()const{return 1;} 69 virtual int isServer()const{return 1;}
70 virtual QMap<int,QString> serverMenu();
67 71
68protected: 72protected:
69 POP3account *account; 73 POP3account *account;
70 virtual void refresh(); 74 virtual void refresh();
71 AbstractMail *wrapper; 75 AbstractMail *wrapper;
72 void disconnect(); 76 void disconnect();
73 void setOnOffline(); 77 void setOnOffline();
74}; 78};
@@ -76,38 +80,38 @@ protected:
76class POP3folderItem : public AccountViewItem 80class POP3folderItem : public AccountViewItem
77{ 81{
78 82
79public: 83public:
80 POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); 84 POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after );
81 virtual ~POP3folderItem(); 85 virtual ~POP3folderItem();
82 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); 86 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
83 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); 87 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
84 virtual QPopupMenu * getContextMenu(); 88 virtual bool contextMenuSelected(int);
85 virtual void contextMenuSelected(int);
86 virtual int isServer()const{return 2;} 89 virtual int isServer()const{return 2;}
90 virtual QMap<int,QString> folderMenu();
87 91
88protected: 92protected:
89 void downloadMails(); 93 void downloadMails();
90 POP3viewItem *pop3; 94 POP3viewItem *pop3;
91}; 95};
92 96
93 97
94class NNTPviewItem : public AccountViewItem 98class NNTPviewItem : public AccountViewItem
95{ 99{
96 100
97public: 101public:
98 NNTPviewItem( NNTPaccount *a, AccountView *parent ); 102 NNTPviewItem( NNTPaccount *a, AccountView *parent );
99 virtual ~NNTPviewItem(); 103 virtual ~NNTPviewItem();
100 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); 104 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
101 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); 105 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
102 AbstractMail *getWrapper(); 106 AbstractMail *getWrapper();
103 virtual QPopupMenu * getContextMenu(); 107 virtual bool contextMenuSelected(int);
104 virtual void contextMenuSelected(int);
105 virtual int isServer()const{return 1;} 108 virtual int isServer()const{return 1;}
109 virtual QMap<int,QString> serverMenu();
106 110
107protected: 111protected:
108 NNTPaccount *account; 112 NNTPaccount *account;
109 virtual void refresh(); 113 virtual void refresh();
110 AbstractMail *wrapper; 114 AbstractMail *wrapper;
111 void disconnect(); 115 void disconnect();
112 void setOnOffline(); 116 void setOnOffline();
113 void subscribeGroups(); 117 void subscribeGroups();
@@ -116,42 +120,41 @@ protected:
116class NNTPfolderItem : public AccountViewItem 120class NNTPfolderItem : public AccountViewItem
117{ 121{
118 122
119public: 123public:
120 NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); 124 NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after );
121 virtual ~NNTPfolderItem(); 125 virtual ~NNTPfolderItem();
122 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); 126 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
123 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); 127 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
124 virtual QPopupMenu * getContextMenu(); 128 virtual bool contextMenuSelected(int);
125 virtual void contextMenuSelected(int);
126 virtual int isServer()const{return 2;} 129 virtual int isServer()const{return 2;}
127 130 virtual QMap<int,QString> folderMenu();
128protected: 131protected:
129 void downloadMails(); 132 void downloadMails();
130 NNTPviewItem *nntp; 133 NNTPviewItem *nntp;
131}; 134};
132 135
133 136
134 137
135class IMAPviewItem : public AccountViewItem 138class IMAPviewItem : public AccountViewItem
136{ 139{
137 friend class IMAPfolderItem; 140 friend class IMAPfolderItem;
138public: 141public:
139 IMAPviewItem( IMAPaccount *a, AccountView *parent ); 142 IMAPviewItem( IMAPaccount *a, AccountView *parent );
140 virtual ~IMAPviewItem(); 143 virtual ~IMAPviewItem();
141 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); 144 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
142 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); 145 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
143 AbstractMail *getWrapper(); 146 AbstractMail *getWrapper();
144 virtual QPopupMenu * getContextMenu(); 147 virtual bool contextMenuSelected(int);
145 virtual void contextMenuSelected(int);
146 const QStringList&subFolders(); 148 const QStringList&subFolders();
147 virtual void refreshFolders(bool force=false); 149 virtual void refreshFolders(bool force=false);
148 virtual int isServer()const{return 1;} 150 virtual int isServer()const{return 1;}
149 bool offline(); 151 bool offline();
152 virtual QMap<int,QString> serverMenu();
150 153
151protected: 154protected:
152 virtual void createNewFolder(); 155 virtual void createNewFolder();
153 IMAPaccount *account; 156 IMAPaccount *account;
154 AbstractMail *wrapper; 157 AbstractMail *wrapper;
155 QStringList currentFolders; 158 QStringList currentFolders;
156}; 159};
157 160
@@ -159,42 +162,43 @@ class IMAPfolderItem : public AccountViewItem
159{ 162{
160 163
161public: 164public:
162 IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); 165 IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after );
163 IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); 166 IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master );
164 virtual ~IMAPfolderItem(); 167 virtual ~IMAPfolderItem();
165 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); 168 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
166 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); 169 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
167 virtual QPopupMenu * getContextMenu(); 170 virtual bool contextMenuSelected(int);
168 virtual void contextMenuSelected(int);
169 virtual const QString& Delemiter()const; 171 virtual const QString& Delemiter()const;
170 virtual int isServer()const{return 2;} 172 virtual int isServer()const{return 2;}
173 virtual QMap<int,QString> folderMenu();
171protected: 174protected:
172 virtual void createNewFolder(); 175 virtual void createNewFolder();
173 virtual void deleteFolder(); 176 virtual bool deleteFolder();
174 virtual void downloadMails(); 177 virtual void downloadMails();
175 IMAPviewItem *imap; 178 IMAPviewItem *imap;
176}; 179};
177 180
178class MHviewItem : public AccountViewItem 181class MHviewItem : public AccountViewItem
179{ 182{
180 friend class MHfolderItem; 183 friend class MHfolderItem;
181 184
182public: 185public:
183 MHviewItem( const QString&aMboxPath, AccountView *parent ); 186 MHviewItem( const QString&aMboxPath, AccountView *parent );
184 virtual ~MHviewItem(); 187 virtual ~MHviewItem();
185 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); 188 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
186 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); 189 virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
187 AbstractMail *getWrapper(); 190 AbstractMail *getWrapper();
188 virtual QPopupMenu * getContextMenu(); 191 virtual bool contextMenuSelected(int);
189 virtual void contextMenuSelected(int);
190 QStringList subFolders(); 192 QStringList subFolders();
191 virtual void refresh(bool force=false); 193 virtual void refresh(bool force=false);
192 virtual int isServer()const{return 3;} 194 virtual int isServer()const{return 3;}
195 virtual QMap<int,QString> serverMenu();
196 virtual QMap<int,QString> folderMenu();
193 197
194protected: 198protected:
195 void downloadMails(); 199 void downloadMails();
196 virtual void createFolder(); 200 virtual void createFolder();
197 QString m_Path; 201 QString m_Path;
198 AbstractMail *wrapper; 202 AbstractMail *wrapper;
199 QStringList currentFolders; 203 QStringList currentFolders;
200}; 204};
@@ -203,23 +207,23 @@ class MHfolderItem : public AccountViewItem
203{ 207{
204 208
205public: 209public:
206 MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after ); 210 MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after );
207 MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); 211 MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master);
208 virtual ~MHfolderItem(); 212 virtual ~MHfolderItem();
209 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); 213 virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
210 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); 214 virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
211 virtual QPopupMenu * getContextMenu(); 215 virtual bool contextMenuSelected(int);
212 virtual void contextMenuSelected(int);
213 virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; 216 virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const;
214 virtual bool isDraftfolder(); 217 virtual bool isDraftfolder();
215 virtual int isServer()const{return 2;} 218 virtual int isServer()const{return 2;}
219 virtual QMap<int,QString> folderMenu();
216 220
217protected: 221protected:
218 void downloadMails(); 222 void downloadMails();
219 virtual void createFolder(); 223 virtual void createFolder();
220 virtual void deleteFolder(); 224 virtual bool deleteFolder();
221 void initName(); 225 void initName();
222 MHviewItem *mbox; 226 MHviewItem *mbox;
223}; 227};
224 228
225#endif 229#endif
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index faa42c3..1183704 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -36,47 +36,66 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
36AccountView::~AccountView() 36AccountView::~AccountView()
37{ 37{
38 imapAccounts.clear(); 38 imapAccounts.clear();
39 mhAccounts.clear(); 39 mhAccounts.clear();
40} 40}
41 41
42void AccountView::slotSelectionChanged(QListViewItem*item) 42void AccountView::slotSelectionChanged(QListViewItem*item)
43{ 43{
44 odebug << "AccountView: Selection changed" << oendl;
45 if (!item) { 44 if (!item) {
46 emit serverSelected(0); 45 emit serverSelected(0);
47 return; 46 return;
48 } 47 }
49 AccountViewItem *view = static_cast<AccountViewItem *>(item); 48 AccountViewItem *view = static_cast<AccountViewItem *>(item);
50
51 emit serverSelected(view->isServer()); 49 emit serverSelected(view->isServer());
52} 50}
53 51
52QMap<int,QString> AccountView::currentServerMenu()const
53{
54 QMap<int,QString> smap;
55 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
56 if (!view)return smap;
57 smap = view->serverMenu();
58 return smap;
59}
60
61QMap<int,QString> AccountView::currentFolderMenu()const
62{
63 QMap<int,QString> fmap;
64 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
65 if (!view)return fmap;
66 fmap = view->folderMenu();
67 return fmap;
68}
69
54void AccountView::slotContextMenu(int id) 70void AccountView::slotContextMenu(int id)
55{ 71{
56 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); 72 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
57 if (!view) return; 73 if (!view) return;
58 view->contextMenuSelected(id); 74 bool del = view->contextMenuSelected(id);
75 if (!del && view->isServer()!=2) {
76 emit refreshMenues(view->isServer());
77 }
59} 78}
60 79
61void AccountView::slotRightButton(int button, QListViewItem * item,const QPoint&,int) 80void AccountView::slotRightButton(int, QListViewItem * item,const QPoint&,int)
62{ 81{
63 m_rightPressed = true; 82 m_rightPressed = true;
64 if (!item) return; 83 if (!item) return;
65 AccountViewItem *view = static_cast<AccountViewItem *>(item); 84 AccountViewItem *view = static_cast<AccountViewItem *>(item);
66 QPopupMenu*m = view->getContextMenu(); 85 QPopupMenu*m = view->getContextMenu();
67 if (!m) return; 86 if (!m) return;
68 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); 87 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
69 m->setFocus(); 88 m->setFocus();
70 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 89 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
71 delete m; 90 delete m;
72} 91}
73 92
74void AccountView::slotLeftButton(int button, QListViewItem * item,const QPoint&,int) 93void AccountView::slotLeftButton(int, QListViewItem *,const QPoint&,int)
75{ 94{
76 m_rightPressed = false; 95 m_rightPressed = false;
77} 96}
78 97
79void AccountView::slotMouseClicked(QListViewItem*item) 98void AccountView::slotMouseClicked(QListViewItem*item)
80{ 99{
81 if (m_rightPressed) return; 100 if (m_rightPressed) return;
82 if (!item || m_currentItem == item) return; 101 if (!item || m_currentItem == item) return;
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index ae24dce..5c4b559 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -1,15 +1,16 @@
1#ifndef ACCOUNTVIEW_H 1#ifndef ACCOUNTVIEW_H
2#define ACCOUNTVIEW_H 2#define ACCOUNTVIEW_H
3 3
4#include <libmailwrapper/mailtypes.h>
5#include <opie2/osmartpointer.h>
4#include <qlistview.h> 6#include <qlistview.h>
5#include <qlist.h> 7#include <qlist.h>
6#include <opie2/osmartpointer.h> 8#include <qmap.h>
7#include <libmailwrapper/mailtypes.h>
8 9
9class Selectstore; 10class Selectstore;
10class Folder; 11class Folder;
11class AbstractMail; 12class AbstractMail;
12class Account; 13class Account;
13class IMAPviewItem; 14class IMAPviewItem;
14class MHviewItem; 15class MHviewItem;
15 16
@@ -19,28 +20,31 @@ class AccountView : public QListView
19 20
20public: 21public:
21 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 22 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
22 virtual ~AccountView(); 23 virtual ~AccountView();
23 virtual void populate( QList<Account> list ); 24 virtual void populate( QList<Account> list );
24 virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); 25 virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail);
25 virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); 26 virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
26 virtual bool currentisDraft(); 27 virtual bool currentisDraft();
28 QMap<int,QString> currentServerMenu()const;
29 QMap<int,QString> currentFolderMenu()const;
27 30
28public slots: 31public slots:
29 virtual void refreshAll(); 32 virtual void refreshAll();
30 virtual void refresh(QListViewItem *item); 33 virtual void refresh(QListViewItem *item);
31 virtual void refreshCurrent(); 34 virtual void refreshCurrent();
32 virtual void slotContextMenu(int id); 35 virtual void slotContextMenu(int id);
33 36
34 void setupFolderselect(Selectstore*sels); 37 void setupFolderselect(Selectstore*sels);
35 38
36signals: 39signals:
37 void refreshMailview(const QValueList<RecMailP>& ); 40 void refreshMailview(const QValueList<RecMailP>& );
38 void serverSelected(int); 41 void serverSelected(int);
42 void refreshMenues(int);
39 43
40protected: 44protected:
41 QListViewItem* m_currentItem; 45 QListViewItem* m_currentItem;
42 QValueList<IMAPviewItem*> imapAccounts; 46 QValueList<IMAPviewItem*> imapAccounts;
43 QValueList<MHviewItem*> mhAccounts; 47 QValueList<MHviewItem*> mhAccounts;
44 bool m_rightPressed:1; 48 bool m_rightPressed:1;
45 49
46protected slots: 50protected slots:
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 81c8fee..3689352 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -16,43 +16,48 @@ 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
25 menuBar = new QMenuBar( toolBar ); 24 menuBar = new QMenuBar( toolBar );
26 25
27 mailMenu = new QPopupMenu( menuBar ); 26 mailMenu = new QPopupMenu( menuBar );
28 menuBar->insertItem( tr( "Mail" ), mailMenu ); 27 menuBar->insertItem( tr( "Mail" ), mailMenu );
29 28
30 settingsMenu = new QPopupMenu( menuBar ); 29 settingsMenu = new QPopupMenu( menuBar );
31 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 30 menuBar->insertItem( tr( "Settings" ), settingsMenu );
32 31
33 serverMenu = new QPopupMenu( menuBar ); 32 if (QApplication::desktop()->width()<330) {
34 m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu ); 33 serverMenu = new QPopupMenu( mailMenu );
34 folderMenu = new QPopupMenu( mailMenu );
35 m_ServerMenuId = mailMenu->insertItem( tr( "Server" ), serverMenu );
36 m_FolderMenuId = mailMenu->insertItem( tr( "Folder" ), folderMenu );
37 } else {
38 serverMenu = new QPopupMenu( menuBar );
39 folderMenu = new QPopupMenu( menuBar );
40 m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu );
41 m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu );
42 }
35 serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT); 43 serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT);
36 serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE); 44 serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE);
37 serverMenu->insertSeparator(); 45 serverMenu->insertSeparator();
38 serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER); 46 serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER);
39 serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER); 47 serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER);
40 serverMenu->insertSeparator(); 48 serverMenu->insertSeparator();
41 serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE); 49 serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE);
42 50
43 folderMenu = new QPopupMenu( menuBar );
44 m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu );
45 folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER); 51 folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER);
46 folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS); 52 folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS);
47 folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER); 53 folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER);
48 folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER); 54 folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER);
49 folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS); 55 folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS);
50
51 menuBar->setItemEnabled(m_ServerMenuId,false); 56 menuBar->setItemEnabled(m_ServerMenuId,false);
52 menuBar->setItemEnabled(m_FolderMenuId,false); 57 menuBar->setItemEnabled(m_FolderMenuId,false);
53 58
54 addToolBar( toolBar ); 59 addToolBar( toolBar );
55 toolBar->setHorizontalStretchable( true ); 60 toolBar->setHorizontalStretchable( true );
56 61
57 QLabel *spacer = new QLabel( toolBar ); 62 QLabel *spacer = new QLabel( toolBar );
58 spacer->setBackgroundMode( QWidget::PaletteButton ); 63 spacer->setBackgroundMode( QWidget::PaletteButton );
@@ -168,21 +173,19 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
168 173
169 QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) ); 174 QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) );
170} 175}
171 176
172MainWindow::~MainWindow() 177MainWindow::~MainWindow()
173{ 178{
174} 179}
175 180
176void MainWindow::serverSelected(int m_isFolder) 181void MainWindow::serverSelected(int)
177{ 182{
178 mailView->clear(); 183 odebug << "slotShowFolders not reached" << oendl;
179 menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1);
180 menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2);
181} 184}
182 185
183void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) 186void MainWindow::systemMessage( const QCString& msg, const QByteArray& data )
184{ 187{
185 int _newrotation; 188 int _newrotation;
186 QDataStream stream( data, IO_ReadOnly ); 189 QDataStream stream( data, IO_ReadOnly );
187 if ( msg == "setCurrentRotation(int)" ) 190 if ( msg == "setCurrentRotation(int)" )
188 { 191 {
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index 409f160..b781d62 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -1,22 +1,22 @@
1#ifndef MAINWINDOW_H 1#ifndef MAINWINDOW_H
2#define MAINWINDOW_H 2#define MAINWINDOW_H
3 3
4#include "accountview.h"
5#include <libmailwrapper/mailtypes.h>
6
7#include <opie2/osmartpointer.h>
8
4#include <qmainwindow.h> 9#include <qmainwindow.h>
5#include <qlistview.h> 10#include <qlistview.h>
6#include <qaction.h> 11#include <qaction.h>
7
8#include <qtoolbar.h> 12#include <qtoolbar.h>
9#include <qmenubar.h> 13#include <qmenubar.h>
10 14#include <qmap.h>
11#include "accountview.h"
12
13#include <libmailwrapper/mailtypes.h>
14#include <opie2/osmartpointer.h>
15 15
16class RecMail; 16class RecMail;
17class QCopChannel; 17class QCopChannel;
18 18
19class MainWindow : public QMainWindow 19class MainWindow : public QMainWindow
20{ 20{
21 Q_OBJECT 21 Q_OBJECT
22 22
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 7c6d314..1bc81e4 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -103,16 +103,17 @@ void ValueExplode::splitit()
103} 103}
104 104
105OpieMail::OpieMail( QWidget *parent, const char *name, WFlags ) 105OpieMail::OpieMail( QWidget *parent, const char *name, WFlags )
106 : MainWindow( parent, name, WStyle_ContextHelp ) 106 : MainWindow( parent, name, WStyle_ContextHelp )
107{ 107{
108 setup_signalblocking(); 108 setup_signalblocking();
109 settings = new Settings(); 109 settings = new Settings();
110 folderView->populate( settings->getAccounts() ); 110 folderView->populate( settings->getAccounts() );
111 connect(folderView,SIGNAL(refreshMenues(int)),this,SLOT(refreshMenu(int)));
111} 112}
112 113
113OpieMail::~OpieMail() 114OpieMail::~OpieMail()
114{ 115{
115 if (settings) delete settings; 116 if (settings) delete settings;
116} 117}
117 118
118void OpieMail::setup_signalblocking() 119void OpieMail::setup_signalblocking()
@@ -381,8 +382,48 @@ void OpieMail::reEditMail()
381{ 382{
382 if (!mailView->currentItem()) return; 383 if (!mailView->currentItem()) return;
383 384
384 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 385 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
385 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 386 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
386 compose.slotAdjustColumns(); 387 compose.slotAdjustColumns();
387 QPEApplication::execDialog( &compose ); 388 QPEApplication::execDialog( &compose );
388} 389}
390
391void OpieMail::refreshMenu(int m_isFolder)
392{
393 if (QApplication::desktop()->width()<330) {
394 mailMenu->setItemEnabled(m_ServerMenuId,m_isFolder&1);
395 mailMenu->setItemEnabled(m_FolderMenuId,m_isFolder&2);
396 } else {
397 menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1);
398 menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2);
399 }
400
401 QMap<int,QString>::ConstIterator it;
402 QMap<int,QString> server_entries=folderView->currentServerMenu();
403 QMap<int,QString> folder_entries=folderView->currentFolderMenu();
404
405 int id;
406 unsigned int i;
407 for (i=0; i<folderMenu->count();++i) {
408 id = folderMenu->idAt(i);
409 folderMenu->setItemEnabled(id,false);
410 }
411 for (it=folder_entries.begin();it!=folder_entries.end();++it) {
412 folderMenu->changeItem(it.key(),it.data());
413 folderMenu->setItemEnabled(it.key(),true);
414 }
415 for (i=0; i<serverMenu->count();++i) {
416 id = serverMenu->idAt(i);
417 serverMenu->setItemEnabled(id,false);
418 }
419 for (it=server_entries.begin();it!=server_entries.end();++it) {
420 serverMenu->changeItem(it.key(),it.data());
421 serverMenu->setItemEnabled(it.key(),true);
422 }
423}
424
425void OpieMail::serverSelected(int m_isFolder)
426{
427 mailView->clear();
428 refreshMenu(m_isFolder);
429}
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h
index c9d758d..75a0b2d 100644
--- a/noncore/net/mail/opiemail.h
+++ b/noncore/net/mail/opiemail.h
@@ -1,45 +1,49 @@
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#include <libmailwrapper/mailtypes.h>
6 7
7#include <opie2/osmartpointer.h> 8#include <opie2/osmartpointer.h>
8#include <libmailwrapper/mailtypes.h> 9
10#include <qmap.h>
9 11
10class OpieMail : public MainWindow 12class OpieMail : public MainWindow
11{ 13{
12 Q_OBJECT 14 Q_OBJECT
13 15
14public: 16public:
15 OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 17 OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
16 virtual ~OpieMail(); 18 virtual ~OpieMail();
17 static QString appName() { return QString::fromLatin1("opiemail"); } 19 static QString appName() { return QString::fromLatin1("opiemail"); }
18 20
19public slots: 21public slots:
20 virtual void slotwriteMail(const QString&name,const QString&email); 22 virtual void slotwriteMail(const QString&name,const QString&email);
21 virtual void slotComposeMail(); 23 virtual void slotComposeMail();
22 virtual void appMessage(const QCString &msg, const QByteArray &data); 24 virtual void appMessage(const QCString &msg, const QByteArray &data);
23 void setDocument(const QString&); 25 void setDocument(const QString&);
24 26
25protected slots: 27protected slots:
26 virtual void slotSendQueued(); 28 virtual void slotSendQueued();
27 virtual void slotSearchMails(); 29 virtual void slotSearchMails();
28 virtual void slotEditSettings(); 30 virtual void slotEditSettings();
29 virtual void slotEditAccounts(); 31 virtual void slotEditAccounts();
30 virtual void displayMail(); 32 virtual void displayMail();
31 virtual void slotDeleteMail(); 33 virtual void slotDeleteMail();
32 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 34 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
33 virtual void slotShowFolders( bool show ); 35 virtual void slotShowFolders( bool show );
34 virtual void refreshMailView(const QValueList<RecMailP>&); 36 virtual void refreshMailView(const QValueList<RecMailP>&);
35 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); 37 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
36 virtual void slotMoveCopyMail(); 38 virtual void slotMoveCopyMail();
37 virtual void reEditMail(); 39 virtual void reEditMail();
40 virtual void serverSelected(int);
41 virtual void refreshMenu(int);
38 42
39protected: 43protected:
40 void setup_signalblocking(); 44 void setup_signalblocking();
41 45
42private: 46private:
43 Settings *settings; 47 Settings *settings;
44 48
45}; 49};