summaryrefslogtreecommitdiff
path: root/noncore/net/mail/accountview.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index d9792d4..2ddf834 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -1,13 +1,18 @@
1
1#include "accountview.h" 2#include "accountview.h"
2#include "accountitem.h" 3#include "accountitem.h"
3#include "selectstore.h" 4#include "selectstore.h"
4#include <qmessagebox.h> 5
5#include <qpopupmenu.h> 6/* OPIE */
6#include <libmailwrapper/settings.h> 7#include <libmailwrapper/settings.h>
7#include <libmailwrapper/mailwrapper.h> 8#include <libmailwrapper/mailwrapper.h>
8#include <libmailwrapper/mailtypes.h> 9#include <libmailwrapper/mailtypes.h>
9#include <libmailwrapper/abstractmail.h> 10#include <libmailwrapper/abstractmail.h>
11#include <qpe/qpeapplication.h>
10 12
13/* QT */
14#include <qmessagebox.h>
15#include <qpopupmenu.h>
11 16
12AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) 17AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
13 : QListView( parent, name, flags ) 18 : QListView( parent, name, flags )
@@ -55,12 +60,16 @@ void AccountView::populate( QList<Account> list )
55 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); 60 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
56 61
57 Account *it; 62 Account *it;
58 for ( it = list.first(); it; it = list.next() ) { 63 for ( it = list.first(); it; it = list.next() )
59 if ( it->getType().compare( "IMAP" ) == 0 ) { 64 {
65 if ( it->getType().compare( "IMAP" ) == 0 )
66 {
60 IMAPaccount *imap = static_cast<IMAPaccount *>(it); 67 IMAPaccount *imap = static_cast<IMAPaccount *>(it);
61 qDebug( "added IMAP " + imap->getAccountName() ); 68 qDebug( "added IMAP " + imap->getAccountName() );
62 imapAccounts.append(new IMAPviewItem( imap, this )); 69 imapAccounts.append(new IMAPviewItem( imap, this ));
63 } else if ( it->getType().compare( "POP3" ) == 0 ) { 70 }
71 else if ( it->getType().compare( "POP3" ) == 0 )
72 {
64 POP3account *pop3 = static_cast<POP3account *>(it); 73 POP3account *pop3 = static_cast<POP3account *>(it);
65 qDebug( "added POP3 " + pop3->getAccountName() ); 74 qDebug( "added POP3 " + pop3->getAccountName() );
66 /* must not be hold 'cause it isn't required */ 75 /* must not be hold 'cause it isn't required */
@@ -69,10 +78,12 @@ void AccountView::populate( QList<Account> list )
69 } 78 }
70} 79}
71 80
72void AccountView::refresh(QListViewItem *item) { 81void AccountView::refresh(QListViewItem *item)
82{
73 83
74 qDebug("AccountView refresh..."); 84 qDebug("AccountView refresh...");
75 if ( item ) { 85 if ( item )
86 {
76 m_currentItem = item; 87 m_currentItem = item;
77 QList<RecMail> headerlist; 88 QList<RecMail> headerlist;
78 headerlist.setAutoDelete(true); 89 headerlist.setAutoDelete(true);
@@ -95,7 +106,6 @@ void AccountView::refreshCurrent()
95 106
96void AccountView::refreshAll() 107void AccountView::refreshAll()
97{ 108{
98
99} 109}
100 110
101RecBody AccountView::fetchBody(const RecMail&aMail) 111RecBody AccountView::fetchBody(const RecMail&aMail)
@@ -108,15 +118,17 @@ RecBody AccountView::fetchBody(const RecMail&aMail)
108 118
109void AccountView::setupFolderselect(Selectstore*sels) 119void AccountView::setupFolderselect(Selectstore*sels)
110{ 120{
111 sels->showMaximized(); 121 QPEApplication::showDialog( sels );
112 QStringList sFolders; 122 QStringList sFolders;
113 unsigned int i = 0; 123 unsigned int i = 0;
114 for (i=0; i < mhAccounts.count();++i) { 124 for (i=0; i < mhAccounts.count();++i)
125 {
115 mhAccounts[i]->refresh(false); 126 mhAccounts[i]->refresh(false);
116 sFolders = mhAccounts[i]->subFolders(); 127 sFolders = mhAccounts[i]->subFolders();
117 sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); 128 sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders);
118 } 129 }
119 for (i=0; i < imapAccounts.count();++i) { 130 for (i=0; i < imapAccounts.count();++i)
131 {
120 if (imapAccounts[i]->offline()) 132 if (imapAccounts[i]->offline())
121 continue; 133 continue;
122 imapAccounts[i]->refreshFolders(false); 134 imapAccounts[i]->refreshFolders(false);
@@ -134,10 +146,12 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper)
134 targetMail = sels.currentMail(); 146 targetMail = sels.currentMail();
135 targetFolder = sels.currentFolder(); 147 targetFolder = sels.currentFolder();
136 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || 148 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
137 targetFolder.isEmpty()) { 149 targetFolder.isEmpty())
150 {
138 return; 151 return;
139 } 152 }
140 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { 153 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
154 {
141 QMessageBox::critical(0,tr("Error creating new Folder"), 155 QMessageBox::critical(0,tr("Error creating new Folder"),
142 tr("<center>Error while creating<br>new folder - breaking.</center>")); 156 tr("<center>Error while creating<br>new folder - breaking.</center>"));
143 return; 157 return;