-rw-r--r-- | kmicromail/accountitem.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 7795055..49d86fc 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -257,97 +257,97 @@ NNTPviewItem::~NNTPviewItem() | |||
257 | 257 | ||
258 | AbstractMail *NNTPviewItem::getWrapper() | 258 | AbstractMail *NNTPviewItem::getWrapper() |
259 | { | 259 | { |
260 | return wrapper; | 260 | return wrapper; |
261 | } | 261 | } |
262 | 262 | ||
263 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) | 263 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) |
264 | { | 264 | { |
265 | refresh(); | 265 | refresh(); |
266 | } | 266 | } |
267 | 267 | ||
268 | void NNTPviewItem::refresh() | 268 | void NNTPviewItem::refresh() |
269 | { | 269 | { |
270 | if (account->getOffline()) return; | 270 | if (account->getOffline()) return; |
271 | QValueList<FolderP> *folders = wrapper->listFolders(); | 271 | QValueList<FolderP> *folders = wrapper->listFolders(); |
272 | 272 | ||
273 | QListViewItem *child = firstChild(); | 273 | QListViewItem *child = firstChild(); |
274 | while ( child ) | 274 | while ( child ) |
275 | { | 275 | { |
276 | QListViewItem *tmp = child; | 276 | QListViewItem *tmp = child; |
277 | child = child->nextSibling(); | 277 | child = child->nextSibling(); |
278 | delete tmp; | 278 | delete tmp; |
279 | } | 279 | } |
280 | QValueList<FolderP>::ConstIterator it; | 280 | QValueList<FolderP>::ConstIterator it; |
281 | QListViewItem*item = 0; | 281 | QListViewItem*item = 0; |
282 | for ( it = folders->begin(); it!=folders->end(); ++it) | 282 | for ( it = folders->begin(); it!=folders->end(); ++it) |
283 | { | 283 | { |
284 | item = new NNTPfolderItem( (*it), this , item ); | 284 | item = new NNTPfolderItem( (*it), this , item ); |
285 | item->setSelectable( (*it)->may_select()); | 285 | item->setSelectable( (*it)->may_select()); |
286 | } | 286 | } |
287 | delete folders; | 287 | delete folders; |
288 | } | 288 | } |
289 | 289 | ||
290 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 290 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
291 | { | 291 | { |
292 | 292 | ||
293 | return wrapper->fetchBody( mail ); | 293 | return wrapper->fetchBody( mail ); |
294 | } | 294 | } |
295 | 295 | ||
296 | QPopupMenu * NNTPviewItem::getContextMenu() | 296 | QPopupMenu * NNTPviewItem::getContextMenu() |
297 | { | 297 | { |
298 | QPopupMenu *m = new QPopupMenu(0); | 298 | QPopupMenu *m = new QPopupMenu(0); |
299 | if (m) | 299 | if (m) |
300 | { | 300 | { |
301 | if (!account->getOffline()) | 301 | if (!account->getOffline()) |
302 | { | 302 | { |
303 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 303 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
304 | m->insertItem(QObject::tr("Set offline",contextName),1); | 304 | m->insertItem(QObject::tr("Set offline",contextName),1); |
305 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); | 305 | //m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); |
306 | } | 306 | } |
307 | else | 307 | else |
308 | { | 308 | { |
309 | m->insertItem(QObject::tr("Set online",contextName),1); | 309 | m->insertItem(QObject::tr("Set online",contextName),1); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | return m; | 312 | return m; |
313 | } | 313 | } |
314 | 314 | ||
315 | void NNTPviewItem::subscribeGroups() | 315 | void NNTPviewItem::subscribeGroups() |
316 | { | 316 | { |
317 | NNTPGroupsDlg dlg(account); | 317 | NNTPGroupsDlg dlg(account); |
318 | dlg.showMaximized(); | 318 | dlg.showMaximized(); |
319 | if ( dlg.exec()== QDialog::Accepted ){ | 319 | if ( dlg.exec()== QDialog::Accepted ){ |
320 | refresh(); | 320 | refresh(); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | void NNTPviewItem::disconnect() | 324 | void NNTPviewItem::disconnect() |
325 | { | 325 | { |
326 | QListViewItem *child = firstChild(); | 326 | QListViewItem *child = firstChild(); |
327 | while ( child ) | 327 | while ( child ) |
328 | { | 328 | { |
329 | QListViewItem *tmp = child; | 329 | QListViewItem *tmp = child; |
330 | child = child->nextSibling(); | 330 | child = child->nextSibling(); |
331 | delete tmp; | 331 | delete tmp; |
332 | } | 332 | } |
333 | wrapper->logout(); | 333 | wrapper->logout(); |
334 | } | 334 | } |
335 | 335 | ||
336 | void NNTPviewItem::setOnOffline() | 336 | void NNTPviewItem::setOnOffline() |
337 | { | 337 | { |
338 | if (!account->getOffline()) | 338 | if (!account->getOffline()) |
339 | { | 339 | { |
340 | disconnect(); | 340 | disconnect(); |
341 | } | 341 | } |
342 | account->setOffline(!account->getOffline()); | 342 | account->setOffline(!account->getOffline()); |
343 | account->save(); | 343 | account->save(); |
344 | //FIXME | 344 | //FIXME |
345 | SETPIX(PIXMAP_POP3FOLDER); | 345 | SETPIX(PIXMAP_POP3FOLDER); |
346 | refresh(); | 346 | refresh(); |
347 | } | 347 | } |
348 | 348 | ||
349 | void NNTPviewItem::contextMenuSelected(int which) | 349 | void NNTPviewItem::contextMenuSelected(int which) |
350 | { | 350 | { |
351 | switch (which) | 351 | switch (which) |
352 | { | 352 | { |
353 | case 0: | 353 | case 0: |
@@ -714,99 +714,98 @@ void IMAPfolderItem::deleteFolder() | |||
714 | 714 | ||
715 | if (yesno == 0) | 715 | if (yesno == 0) |
716 | { | 716 | { |
717 | if (imap->getWrapper()->deleteMbox(folder)) | 717 | if (imap->getWrapper()->deleteMbox(folder)) |
718 | { | 718 | { |
719 | QListView*v=listView(); | 719 | QListView*v=listView(); |
720 | IMAPviewItem * box = imap; | 720 | IMAPviewItem * box = imap; |
721 | /* be carefull - after that this object is destroyd so don't use | 721 | /* be carefull - after that this object is destroyd so don't use |
722 | * any member of it after that call!!*/ | 722 | * any member of it after that call!!*/ |
723 | imap->refreshFolders(true); | 723 | imap->refreshFolders(true); |
724 | if (v) | 724 | if (v) |
725 | { | 725 | { |
726 | v->setSelected(box,true); | 726 | v->setSelected(box,true); |
727 | } | 727 | } |
728 | } | 728 | } |
729 | } | 729 | } |
730 | } | 730 | } |
731 | 731 | ||
732 | void IMAPfolderItem::downloadMails() | 732 | void IMAPfolderItem::downloadMails() |
733 | { | 733 | { |
734 | AccountView*bl = imap->accountView(); | 734 | AccountView*bl = imap->accountView(); |
735 | if (!bl) return; | 735 | if (!bl) return; |
736 | bl->downloadMails(folder,imap->getWrapper()); | 736 | bl->downloadMails(folder,imap->getWrapper()); |
737 | } | 737 | } |
738 | 738 | ||
739 | void IMAPfolderItem::contextMenuSelected(int id) | 739 | void IMAPfolderItem::contextMenuSelected(int id) |
740 | { | 740 | { |
741 | 741 | ||
742 | AccountView * view = (AccountView*)listView(); | 742 | AccountView * view = (AccountView*)listView(); |
743 | switch(id) | 743 | switch(id) |
744 | { | 744 | { |
745 | case 0: | 745 | case 0: |
746 | view->refreshCurrent(); | 746 | view->refreshCurrent(); |
747 | break; | 747 | break; |
748 | case 1: | 748 | case 1: |
749 | deleteAllMail(imap->getWrapper(),folder); | 749 | deleteAllMail(imap->getWrapper(),folder); |
750 | break; | 750 | break; |
751 | case 2: | 751 | case 2: |
752 | createNewFolder(); | 752 | createNewFolder(); |
753 | break; | 753 | break; |
754 | case 3: | 754 | case 3: |
755 | deleteFolder(); | 755 | deleteFolder(); |
756 | break; | 756 | break; |
757 | case 4: | 757 | case 4: |
758 | downloadMails(); | 758 | downloadMails(); |
759 | break; | 759 | break; |
760 | case GET_NEW_MAILS: // daunlood | 760 | case GET_NEW_MAILS: // daunlood |
761 | { | 761 | { |
762 | AccountView*bl = accountView(); | 762 | if (!view) return; |
763 | if (!bl) return; | 763 | view->downloadMailsInbox(getFolder(),imap->getWrapper()); |
764 | bl->downloadMailsInbox(getFolder(),imap->getWrapper()); | ||
765 | } | 764 | } |
766 | break; | 765 | break; |
767 | default: | 766 | default: |
768 | break; | 767 | break; |
769 | } | 768 | } |
770 | } | 769 | } |
771 | 770 | ||
772 | /** | 771 | /** |
773 | * MH Account stuff | 772 | * MH Account stuff |
774 | */ | 773 | */ |
775 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 774 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
776 | POP3 and MBOX */ | 775 | POP3 and MBOX */ |
777 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 776 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
778 | : AccountViewItem( parent ) | 777 | : AccountViewItem( parent ) |
779 | { | 778 | { |
780 | m_Path = aPath; | 779 | m_Path = aPath; |
781 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 780 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
782 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 781 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); |
783 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 782 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
784 | setText( 0, " Local Folders" ); | 783 | setText( 0, " Local Folders" ); |
785 | setOpen( true ); | 784 | setOpen( true ); |
786 | folder = 0; | 785 | folder = 0; |
787 | } | 786 | } |
788 | 787 | ||
789 | MHviewItem::~MHviewItem() | 788 | MHviewItem::~MHviewItem() |
790 | { | 789 | { |
791 | delete wrapper; | 790 | delete wrapper; |
792 | } | 791 | } |
793 | 792 | ||
794 | AbstractMail *MHviewItem::getWrapper() | 793 | AbstractMail *MHviewItem::getWrapper() |
795 | { | 794 | { |
796 | return wrapper; | 795 | return wrapper; |
797 | } | 796 | } |
798 | 797 | ||
799 | void MHviewItem::refresh( QValueList<RecMailP> & target) | 798 | void MHviewItem::refresh( QValueList<RecMailP> & target) |
800 | { | 799 | { |
801 | refresh(false); | 800 | refresh(false); |
802 | getWrapper()->listMessages( "",target ); | 801 | getWrapper()->listMessages( "",target ); |
803 | } | 802 | } |
804 | 803 | ||
805 | void MHviewItem::refresh(bool force) | 804 | void MHviewItem::refresh(bool force) |
806 | { | 805 | { |
807 | if (childCount()>0 && force==false) return; | 806 | if (childCount()>0 && force==false) return; |
808 | removeChilds(); | 807 | removeChilds(); |
809 | currentFolders.clear(); | 808 | currentFolders.clear(); |
810 | QValueList<FolderP> *folders = wrapper->listFolders(); | 809 | QValueList<FolderP> *folders = wrapper->listFolders(); |
811 | QValueList<FolderP>::ConstIterator it; | 810 | QValueList<FolderP>::ConstIterator it; |
812 | MHfolderItem*item = 0; | 811 | MHfolderItem*item = 0; |