-rw-r--r-- | kmicromail/accountitem.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 12d047a..7795055 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -79,40 +79,40 @@ void POP3viewItem::refresh() | |||
79 | delete folders; | 79 | delete folders; |
80 | } | 80 | } |
81 | 81 | ||
82 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 82 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
83 | { | 83 | { |
84 | 84 | ||
85 | return wrapper->fetchBody( mail ); | 85 | return wrapper->fetchBody( mail ); |
86 | } | 86 | } |
87 | 87 | ||
88 | QPopupMenu * POP3viewItem::getContextMenu() | 88 | QPopupMenu * POP3viewItem::getContextMenu() |
89 | { | 89 | { |
90 | QPopupMenu *m = new QPopupMenu(0); | 90 | QPopupMenu *m = new QPopupMenu(0); |
91 | if (m) | 91 | if (m) |
92 | { | 92 | { |
93 | if (!account->getOffline()) | 93 | if (!account->getOffline()) |
94 | { | 94 | { |
95 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
95 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 96 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
96 | m->insertItem(QObject::tr("Set offline",contextName),1); | 97 | m->insertItem(QObject::tr("Set offline",contextName),1); |
97 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | m->insertItem(QObject::tr("Set online",contextName),1); | ||
102 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 101 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
102 | m->insertItem(QObject::tr("Set online",contextName),1); | ||
103 | } | 103 | } |
104 | } | 104 | } |
105 | return m; | 105 | return m; |
106 | } | 106 | } |
107 | 107 | ||
108 | void POP3viewItem::disconnect() | 108 | void POP3viewItem::disconnect() |
109 | { | 109 | { |
110 | QListViewItem *child = firstChild(); | 110 | QListViewItem *child = firstChild(); |
111 | while ( child ) | 111 | while ( child ) |
112 | { | 112 | { |
113 | QListViewItem *tmp = child; | 113 | QListViewItem *tmp = child; |
114 | child = child->nextSibling(); | 114 | child = child->nextSibling(); |
115 | delete tmp; | 115 | delete tmp; |
116 | } | 116 | } |
117 | wrapper->logout(); | 117 | wrapper->logout(); |
118 | } | 118 | } |
@@ -174,62 +174,66 @@ POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , | |||
174 | void POP3folderItem::refresh(QValueList<RecMailP>&target) | 174 | void POP3folderItem::refresh(QValueList<RecMailP>&target) |
175 | { | 175 | { |
176 | if (folder->may_select()) | 176 | if (folder->may_select()) |
177 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 177 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
178 | } | 178 | } |
179 | 179 | ||
180 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) | 180 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) |
181 | { | 181 | { |
182 | return pop3->getWrapper()->fetchBody(aMail); | 182 | return pop3->getWrapper()->fetchBody(aMail); |
183 | } | 183 | } |
184 | 184 | ||
185 | QPopupMenu * POP3folderItem::getContextMenu() | 185 | QPopupMenu * POP3folderItem::getContextMenu() |
186 | { | 186 | { |
187 | QPopupMenu *m = new QPopupMenu(0); | 187 | QPopupMenu *m = new QPopupMenu(0); |
188 | if (m) | 188 | if (m) |
189 | { | 189 | { |
190 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
190 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 191 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
191 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 192 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
192 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 193 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
193 | } | 194 | } |
194 | return m; | 195 | return m; |
195 | } | 196 | } |
196 | 197 | ||
197 | void POP3folderItem::downloadMails() | 198 | void POP3folderItem::downloadMails() |
198 | { | 199 | { |
199 | AccountView*bl = pop3->accountView(); | 200 | AccountView*bl = pop3->accountView(); |
200 | if (!bl) return; | 201 | if (!bl) return; |
201 | bl->downloadMails(folder,pop3->getWrapper()); | 202 | bl->downloadMails(folder,pop3->getWrapper()); |
202 | } | 203 | } |
203 | 204 | ||
204 | void POP3folderItem::contextMenuSelected(int which) | 205 | void POP3folderItem::contextMenuSelected(int which) |
205 | { | 206 | { |
206 | AccountView * view = (AccountView*)listView(); | 207 | AccountView * view = (AccountView*)listView(); |
207 | switch (which) | 208 | switch (which) |
208 | { | 209 | { |
209 | case 0: | 210 | case 0: |
210 | /* must be 'cause pop3 lists are cached */ | 211 | /* must be 'cause pop3 lists are cached */ |
211 | pop3->getWrapper()->logout(); | 212 | pop3->getWrapper()->logout(); |
212 | view->refreshCurrent(); | 213 | view->refreshCurrent(); |
213 | break; | 214 | break; |
214 | case 1: | 215 | case 1: |
215 | deleteAllMail(pop3->getWrapper(),folder); | 216 | deleteAllMail(pop3->getWrapper(),folder); |
216 | break; | 217 | break; |
217 | case 2: | 218 | case 2: |
218 | downloadMails(); | 219 | downloadMails(); |
219 | break; | 220 | break; |
221 | case GET_NEW_MAILS: // daunlood | ||
222 | view->downloadMailsInbox(getFolder() ,pop3->getWrapper()); | ||
223 | break; | ||
220 | default: | 224 | default: |
221 | break; | 225 | break; |
222 | } | 226 | } |
223 | } | 227 | } |
224 | 228 | ||
225 | /** | 229 | /** |
226 | * NNTP Account stuff | 230 | * NNTP Account stuff |
227 | */ | 231 | */ |
228 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | 232 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) |
229 | : AccountViewItem( parent ) | 233 | : AccountViewItem( parent ) |
230 | { | 234 | { |
231 | account = a; | 235 | account = a; |
232 | wrapper = AbstractMail::getWrapper( account ); | 236 | wrapper = AbstractMail::getWrapper( account ); |
233 | //FIXME | 237 | //FIXME |
234 | SETPIX(PIXMAP_POP3FOLDER); | 238 | SETPIX(PIXMAP_POP3FOLDER); |
235 | #if 0 | 239 | #if 0 |
@@ -500,45 +504,44 @@ void IMAPviewItem::refreshFolders(bool force) | |||
500 | } | 504 | } |
501 | else | 505 | else |
502 | { | 506 | { |
503 | item = new IMAPfolderItem( (*it), this , item ); | 507 | item = new IMAPfolderItem( (*it), this , item ); |
504 | } | 508 | } |
505 | } | 509 | } |
506 | delete folders; | 510 | delete folders; |
507 | } | 511 | } |
508 | 512 | ||
509 | QPopupMenu * IMAPviewItem::getContextMenu() | 513 | QPopupMenu * IMAPviewItem::getContextMenu() |
510 | { | 514 | { |
511 | QPopupMenu *m = new QPopupMenu(0); | 515 | QPopupMenu *m = new QPopupMenu(0); |
512 | if (m) | 516 | if (m) |
513 | { | 517 | { |
514 | if (!account->getOffline()) | 518 | if (!account->getOffline()) |
515 | { | 519 | { |
520 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
516 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 521 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
517 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 522 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
518 | m->insertSeparator(); | 523 | m->insertSeparator(); |
519 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 524 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
520 | m->insertItem(QObject::tr("Set offline",contextName),3); | 525 | m->insertItem(QObject::tr("Set offline",contextName),3); |
521 | m->insertSeparator(); | 526 | m->insertSeparator(); |
522 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
523 | } | 527 | } |
524 | else | 528 | else |
525 | { | 529 | { |
526 | m->insertItem(QObject::tr("Set online",contextName),3); | ||
527 | m->insertSeparator(); | ||
528 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 530 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
531 | m->insertItem(QObject::tr("Set online",contextName),3); | ||
529 | } | 532 | } |
530 | } | 533 | } |
531 | return m; | 534 | return m; |
532 | } | 535 | } |
533 | 536 | ||
534 | void IMAPviewItem::createNewFolder() | 537 | void IMAPviewItem::createNewFolder() |
535 | { | 538 | { |
536 | Newmdirdlg ndirdlg; | 539 | Newmdirdlg ndirdlg; |
537 | 540 | ||
538 | ndirdlg.showMaximized(); | 541 | ndirdlg.showMaximized(); |
539 | if ( ndirdlg.exec() ) | 542 | if ( ndirdlg.exec() ) |
540 | { | 543 | { |
541 | QString ndir = ndirdlg.Newdir(); | 544 | QString ndir = ndirdlg.Newdir(); |
542 | bool makesubs = ndirdlg.subpossible(); | 545 | bool makesubs = ndirdlg.subpossible(); |
543 | QString delemiter = "/"; | 546 | QString delemiter = "/"; |
544 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 547 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
@@ -656,32 +659,33 @@ void IMAPfolderItem::refresh(QValueList<RecMailP>&target) | |||
656 | target.clear(); | 659 | target.clear(); |
657 | } | 660 | } |
658 | } | 661 | } |
659 | 662 | ||
660 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) | 663 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) |
661 | { | 664 | { |
662 | return imap->getWrapper()->fetchBody(aMail); | 665 | return imap->getWrapper()->fetchBody(aMail); |
663 | } | 666 | } |
664 | 667 | ||
665 | QPopupMenu * IMAPfolderItem::getContextMenu() | 668 | QPopupMenu * IMAPfolderItem::getContextMenu() |
666 | { | 669 | { |
667 | QPopupMenu *m = new QPopupMenu(0); | 670 | QPopupMenu *m = new QPopupMenu(0); |
668 | if (m) | 671 | if (m) |
669 | { | 672 | { |
670 | if (folder->may_select()) | 673 | if (folder->may_select()) |
671 | { | 674 | { |
675 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
672 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 676 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
673 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | 677 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); |
674 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 678 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
675 | } | 679 | } |
676 | if (folder->no_inferior()==false) | 680 | if (folder->no_inferior()==false) |
677 | { | 681 | { |
678 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 682 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
679 | } | 683 | } |
680 | if (folder->getDisplayName().lower()!="inbox") | 684 | if (folder->getDisplayName().lower()!="inbox") |
681 | { | 685 | { |
682 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 686 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
683 | } | 687 | } |
684 | } | 688 | } |
685 | return m; | 689 | return m; |
686 | } | 690 | } |
687 | 691 | ||
@@ -740,32 +744,39 @@ void IMAPfolderItem::contextMenuSelected(int id) | |||
740 | { | 744 | { |
741 | case 0: | 745 | case 0: |
742 | view->refreshCurrent(); | 746 | view->refreshCurrent(); |
743 | break; | 747 | break; |
744 | case 1: | 748 | case 1: |
745 | deleteAllMail(imap->getWrapper(),folder); | 749 | deleteAllMail(imap->getWrapper(),folder); |
746 | break; | 750 | break; |
747 | case 2: | 751 | case 2: |
748 | createNewFolder(); | 752 | createNewFolder(); |
749 | break; | 753 | break; |
750 | case 3: | 754 | case 3: |
751 | deleteFolder(); | 755 | deleteFolder(); |
752 | break; | 756 | break; |
753 | case 4: | 757 | case 4: |
754 | downloadMails(); | 758 | downloadMails(); |
755 | break; | 759 | break; |
760 | case GET_NEW_MAILS: // daunlood | ||
761 | { | ||
762 | AccountView*bl = accountView(); | ||
763 | if (!bl) return; | ||
764 | bl->downloadMailsInbox(getFolder(),imap->getWrapper()); | ||
765 | } | ||
766 | break; | ||
756 | default: | 767 | default: |
757 | break; | 768 | break; |
758 | } | 769 | } |
759 | } | 770 | } |
760 | 771 | ||
761 | /** | 772 | /** |
762 | * MH Account stuff | 773 | * MH Account stuff |
763 | */ | 774 | */ |
764 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 775 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
765 | POP3 and MBOX */ | 776 | POP3 and MBOX */ |
766 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 777 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
767 | : AccountViewItem( parent ) | 778 | : AccountViewItem( parent ) |
768 | { | 779 | { |
769 | m_Path = aPath; | 780 | m_Path = aPath; |
770 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 781 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
771 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 782 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); |