summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp234
-rw-r--r--noncore/net/mail/accountview.h71
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h4
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.h6
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h1
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp12
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h5
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h4
-rw-r--r--noncore/net/mail/selectstore.cpp53
-rw-r--r--noncore/net/mail/selectstore.h18
-rw-r--r--noncore/net/mail/selectstoreui.ui43
17 files changed, 415 insertions, 78 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index faa6982..eea021f 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -12,3 +12,3 @@
*/
-POP3viewItem::POP3viewItem( POP3account *a, QListView *parent )
+POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
: AccountViewItem( parent )
@@ -34,2 +34,3 @@ void POP3viewItem::refresh( QList<RecMail> & )
{
+ if (account->getOffline()) return;
QList<Folder> *folders = wrapper->listFolders();
@@ -58,2 +59,48 @@ RecBody POP3viewItem::fetchBody( const RecMail &mail )
+QPopupMenu * POP3viewItem::getContextMenu()
+{
+ QPopupMenu *m = new QPopupMenu(0);
+ if (m) {
+ if (!account->getOffline()) {
+ m->insertItem(QObject::tr("Disconnect",contextName),0);
+ m->insertItem(QObject::tr("Set offline",contextName),1);
+ } else {
+ m->insertItem(QObject::tr("Set online",contextName),1);
+ }
+ }
+ return m;
+}
+
+void POP3viewItem::disconnect()
+{
+ QListViewItem *child = firstChild();
+ while ( child ) {
+ QListViewItem *tmp = child;
+ child = child->nextSibling();
+ delete tmp;
+ }
+ wrapper->logout();
+}
+
+void POP3viewItem::setOnOffline()
+{
+ if (!account->getOffline()) {
+ disconnect();
+ }
+ account->setOffline(!account->getOffline());
+ account->save();
+}
+
+void POP3viewItem::contextMenuSelected(int which)
+{
+ switch (which) {
+ case 0:
+ disconnect();
+ break;
+ case 1:
+ setOnOffline();
+ break;
+ }
+}
+
POP3folderItem::~POP3folderItem()
@@ -93,3 +140,3 @@ QPopupMenu * POP3folderItem::getContextMenu()
m->insertItem(QObject::tr("Delete all mails",contextName),1);
- m->insertItem(QObject::tr("Download all mails",contextName),2);
+ m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
}
@@ -100,5 +147,5 @@ void POP3folderItem::downloadMails()
{
- Selectstore sels;
- sels.showMaximized();
- sels.exec();
+ AccountView*bl = pop3->accountView();
+ if (!bl) return;
+ bl->downloadMails(folder,pop3->getWrapper());
}
@@ -128,3 +175,3 @@ void POP3folderItem::contextMenuSelected(int which)
*/
-IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent )
+IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
: AccountViewItem( parent )
@@ -185,2 +232,7 @@ void IMAPviewItem::removeChilds()
+const QStringList&IMAPviewItem::subFolders()
+{
+ return currentFolders;
+}
+
void IMAPviewItem::refreshFolders(bool force)
@@ -188,5 +240,6 @@ void IMAPviewItem::refreshFolders(bool force)
if (childCount()>0 && force==false) return;
-
- removeChilds();
+ if (account->getOffline()) return;
+ removeChilds();
+ currentFolders.clear();
QList<Folder> *folders = wrapper->listFolders();
@@ -211,2 +264,3 @@ void IMAPviewItem::refreshFolders(bool force)
fname = it->getDisplayName();
+ currentFolders.append(it->getName());
pos = fname.findRev(it->Separator());
@@ -233,6 +287,11 @@ QPopupMenu * IMAPviewItem::getContextMenu()
if (m) {
- m->insertItem(QObject::tr("Refresh folder list",contextName),0);
- m->insertItem(QObject::tr("Create new folder",contextName),1);
- m->insertSeparator();
- m->insertItem(QObject::tr("Disconnect",contextName),2);
+ if (!account->getOffline()) {
+ m->insertItem(QObject::tr("Refresh folder list",contextName),0);
+ m->insertItem(QObject::tr("Create new folder",contextName),1);
+ m->insertSeparator();
+ m->insertItem(QObject::tr("Disconnect",contextName),2);
+ m->insertItem(QObject::tr("Set offline",contextName),3);
+ } else {
+ m->insertItem(QObject::tr("Set online",contextName),3);
+ }
}
@@ -273,2 +332,11 @@ void IMAPviewItem::contextMenuSelected(int id)
break;
+ case 3:
+ if (account->getOffline()==false) {
+ removeChilds();
+ wrapper->logout();
+ }
+ account->setOffline(!account->getOffline());
+ account->save();
+ refreshFolders(false);
+ break;
default:
@@ -283,5 +351,5 @@ RecBody IMAPviewItem::fetchBody(const RecMail&)
-IMAPfolderItem::~IMAPfolderItem()
+bool IMAPviewItem::offline()
{
- delete folder;
+ return account->getOffline();
}
@@ -314,2 +382,7 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QLi
+IMAPfolderItem::~IMAPfolderItem()
+{
+ delete folder;
+}
+
const QString& IMAPfolderItem::Delemiter()const
@@ -344,2 +417,3 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
m->insertItem(QObject::tr("Refresh header list",contextName),0);
+ m->insertItem(QObject::tr("Move/Copie all mails",contextName),4);
m->insertItem(QObject::tr("Delete all mails",contextName),1);
@@ -391,2 +465,9 @@ void IMAPfolderItem::deleteFolder()
+void IMAPfolderItem::downloadMails()
+{
+ AccountView*bl = imap->accountView();
+ if (!bl) return;
+ bl->downloadMails(folder,imap->getWrapper());
+}
+
void IMAPfolderItem::contextMenuSelected(int id)
@@ -408,2 +489,5 @@ void IMAPfolderItem::contextMenuSelected(int id)
break;
+ case 4:
+ downloadMails();
+ break;
default:
@@ -419,2 +503,29 @@ const QString AccountViewItem::contextName="AccountViewItem";
+AccountViewItem::AccountViewItem( AccountView *parent )
+ : QListViewItem( parent )
+{
+ m_Backlink = parent;
+}
+
+AccountViewItem::AccountViewItem( QListViewItem *parent)
+ : QListViewItem( parent)
+{
+ m_Backlink = 0;
+}
+
+AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
+ :QListViewItem( parent,after )
+{
+ m_Backlink = 0;
+}
+
+AccountViewItem::~AccountViewItem()
+{
+}
+
+AccountView*AccountViewItem::accountView()
+{
+ return m_Backlink;
+}
+
void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder)
@@ -449,2 +560,8 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
+AccountView::~AccountView()
+{
+ imapAccounts.clear();
+ mboxAccounts.clear();
+}
+
void AccountView::slotContextMenu(int id)
@@ -473,3 +590,6 @@ void AccountView::populate( QList<Account> list )
- (void) new MBOXviewItem(AbstractMail::defaultLocalfolder(),this);
+ imapAccounts.clear();
+ mboxAccounts.clear();
+
+ mboxAccounts.append(new MBOXviewItem(AbstractMail::defaultLocalfolder(),this));
@@ -480,3 +600,3 @@ void AccountView::populate( QList<Account> list )
qDebug( "added IMAP " + imap->getAccountName() );
- (void) new IMAPviewItem( imap, this );
+ imapAccounts.append(new IMAPviewItem( imap, this ));
} else if ( it->getType().compare( "POP3" ) == 0 ) {
@@ -484,2 +604,3 @@ void AccountView::populate( QList<Account> list )
qDebug( "added POP3 " + pop3->getAccountName() );
+ /* must not be hold 'cause it isn't required */
(void) new POP3viewItem( pop3, this );
@@ -505,8 +626,8 @@ void AccountView::refreshCurrent()
m_currentItem = currentItem();
- if ( !m_currentItem ) return;
- QList<RecMail> headerlist;
- headerlist.setAutoDelete(true);
- AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
- view->refresh(headerlist);
- emit refreshMailview(&headerlist);
+ if ( !m_currentItem ) return;
+ QList<RecMail> headerlist;
+ headerlist.setAutoDelete(true);
+ AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
+ view->refresh(headerlist);
+ emit refreshMailview(&headerlist);
}
@@ -526,2 +647,48 @@ RecBody AccountView::fetchBody(const RecMail&aMail)
+void AccountView::setupFolderselect(Selectstore*sels)
+{
+ sels->showMaximized();
+ QStringList sFolders;
+ unsigned int i = 0;
+ for (i=0; i < mboxAccounts.count();++i) {
+ mboxAccounts[i]->refresh(false);
+ sFolders = mboxAccounts[i]->subFolders();
+ sels->addAccounts(mboxAccounts[i]->getWrapper(),sFolders);
+ }
+ for (i=0; i < imapAccounts.count();++i) {
+ if (imapAccounts[i]->offline())
+ continue;
+ imapAccounts[i]->refreshFolders(false);
+ sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders());
+ }
+}
+
+void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper)
+{
+ unsigned int i = 0;
+ AbstractMail*targetMail = 0;
+ QString targetFolder = "";
+ Selectstore sels;
+ setupFolderselect(&sels);
+ if (!sels.exec()) return;
+ targetMail = sels.currentMail();
+ targetFolder = sels.currentFolder();
+ if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
+ targetFolder.isEmpty()) {
+ return;
+ }
+
+ QList<RecMail> t;
+ fromWrapper->listMessages(fromFolder->getName(),t);
+ encodedString*st = 0;
+ for (i = 0; i < t.count();++i) {
+ RecMail*r = t.at(i);
+ st = fromWrapper->fetchRawBody(*r);
+ if (st) {
+ targetMail->storeMessage(st->Content(),st->Length(),targetFolder);
+ delete st;
+ }
+ }
+}
+
/**
@@ -530,3 +697,3 @@ RecBody AccountView::fetchBody(const RecMail&aMail)
-MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent )
+MBOXviewItem::MBOXviewItem( const QString&aPath, AccountView *parent )
: AccountViewItem( parent )
@@ -534,3 +701,4 @@ MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent )
m_Path = aPath;
- wrapper = AbstractMail::getWrapper( m_Path );
+ /* be carefull - the space within settext is wanted - thats why the string twice */
+ wrapper = AbstractMail::getWrapper( m_Path,"Local Folders");
setPixmap( 0, PIXMAP_LOCALFOLDER );
@@ -604,2 +772,15 @@ void MBOXviewItem::createFolder()
+QStringList MBOXviewItem::subFolders()
+{
+ QStringList result;
+ QListViewItem *child = firstChild();
+ while ( child ) {
+ MBOXfolderItem *tmp = (MBOXfolderItem*)child;
+ child = child->nextSibling();
+ result.append(tmp->getFolder()->getName());
+ }
+ qDebug("Size of result: %i",result.count());
+ return result;
+}
+
void MBOXviewItem::contextMenuSelected(int which)
@@ -638,2 +819,7 @@ MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QList
+Folder*MBOXfolderItem::getFolder()
+{
+ return folder;
+}
+
void MBOXfolderItem::refresh(QList<RecMail>&target)
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 7131192..48f52c7 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -14,2 +14,4 @@ class RecBody;
class QPopupMenu;
+class Selectstore;
+class AccountView;
@@ -19,5 +21,6 @@ class AccountViewItem : public QListViewItem
public:
- AccountViewItem( QListView *parent ) : QListViewItem( parent ) {}
- AccountViewItem( QListViewItem *parent) : QListViewItem( parent) {}
- AccountViewItem( QListViewItem *parent , QListViewItem*after ) : QListViewItem( parent,after ) {}
+ AccountViewItem( AccountView *parent );
+ AccountViewItem( QListViewItem *parent);
+ AccountViewItem( QListViewItem *parent , QListViewItem*after );
+ virtual ~AccountViewItem();
virtual void refresh(QList<RecMail>&)=0;
@@ -26,2 +29,3 @@ public:
virtual void contextMenuSelected(int){}
+ virtual AccountView*accountView();
protected:
@@ -29,2 +33,3 @@ protected:
static const QString contextName;
+ AccountView*m_Backlink;
};
@@ -35,4 +40,4 @@ class POP3viewItem : public AccountViewItem
public:
- POP3viewItem( POP3account *a, QListView *parent );
- ~POP3viewItem();
+ POP3viewItem( POP3account *a, AccountView *parent );
+ virtual ~POP3viewItem();
virtual void refresh( QList<RecMail> &target );
@@ -40,6 +45,10 @@ public:
AbstractMail *getWrapper();
-private:
+ virtual QPopupMenu * getContextMenu();
+ virtual void contextMenuSelected(int);
+
+protected:
POP3account *account;
AbstractMail *wrapper;
-
+ void disconnect();
+ void setOnOffline();
};
@@ -51,3 +60,3 @@ public:
POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after );
- ~POP3folderItem();
+ virtual ~POP3folderItem();
virtual void refresh(QList<RecMail>&);
@@ -59,4 +68,2 @@ protected:
void downloadMails();
-
-private:
Folder *folder;
@@ -71,4 +78,4 @@ class IMAPviewItem : public AccountViewItem
public:
- IMAPviewItem( IMAPaccount *a, QListView *parent );
- ~IMAPviewItem();
+ IMAPviewItem( IMAPaccount *a, AccountView *parent );
+ virtual ~IMAPviewItem();
virtual void refresh(QList<RecMail>&);
@@ -78,2 +85,5 @@ public:
virtual void contextMenuSelected(int);
+ const QStringList&subFolders();
+ virtual void refreshFolders(bool force=false);
+ bool offline();
@@ -81,9 +91,7 @@ protected:
IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0);
- virtual void refreshFolders(bool force=false);
virtual void createNewFolder();
virtual void removeChilds();
-
-private:
IMAPaccount *account;
AbstractMail *wrapper;
+ QStringList currentFolders;
};
@@ -96,3 +104,3 @@ public:
IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master );
- ~IMAPfolderItem();
+ virtual ~IMAPfolderItem();
virtual void refresh(QList<RecMail>&);
@@ -106,4 +114,3 @@ protected:
virtual void deleteFolder();
-
-private:
+ virtual void downloadMails();
Folder *folder;
@@ -117,5 +124,4 @@ class MBOXviewItem : public AccountViewItem
public:
-// MBOXviewItem( MBOXaccount *a, QListView *parent );
- MBOXviewItem( const QString&aMboxPath, QListView *parent );
- ~MBOXviewItem();
+ MBOXviewItem( const QString&aMboxPath, AccountView *parent );
+ virtual ~MBOXviewItem();
virtual void refresh( QList<RecMail> &target );
@@ -125,9 +131,7 @@ public:
virtual void contextMenuSelected(int);
+ QStringList subFolders();
+ virtual void refresh(bool force=false);
protected:
- virtual void refresh(bool force=false);
virtual void createFolder();
-
-private:
-// MBOXaccount *account;
QString m_Path;
@@ -142,3 +146,3 @@ public:
MBOXfolderItem( Folder *folder, MBOXviewItem *parent , QListViewItem*after );
- ~MBOXfolderItem();
+ virtual ~MBOXfolderItem();
virtual void refresh(QList<RecMail>&);
@@ -147,2 +151,3 @@ public:
virtual void contextMenuSelected(int);
+ virtual Folder*getFolder();
@@ -150,3 +155,2 @@ protected:
virtual void deleteFolder();
-private:
Folder *folder;
@@ -161,4 +165,6 @@ public:
AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
- void populate( QList<Account> list );
- RecBody fetchBody(const RecMail&aMail);
+ virtual ~AccountView();
+ virtual void populate( QList<Account> list );
+ virtual RecBody fetchBody(const RecMail&aMail);
+ virtual void downloadMails(Folder*fromFolder,AbstractMail*fromWrapper);
@@ -170,2 +176,3 @@ public slots:
virtual void slotContextMenu(int id);
+ void setupFolderselect(Selectstore*sels);
@@ -174,4 +181,6 @@ signals:
-private:
- QListViewItem* m_currentItem;
+protected:
+ QListViewItem* m_currentItem;
+ QValueList<IMAPviewItem*> imapAccounts;
+ QValueList<MBOXviewItem*> mboxAccounts;
};
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 80d0b52..3dd2fce 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -23,5 +23,5 @@ AbstractMail* AbstractMail::getWrapper(POP3account *a)
-AbstractMail* AbstractMail::getWrapper(const QString&a)
+AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
{
- return new MBOXwrapper(a);
+ return new MBOXwrapper(a,name);
}
@@ -101 +101,6 @@ QString AbstractMail::defaultLocalfolder()
}
+
+/* temporary - will be removed when implemented in all classes */
+void AbstractMail::deleteMails(const QString &,QList<RecMail> &)
+{
+}
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index 9770991..15d83cb 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -33,2 +33,3 @@ public:
virtual int deleteAllMail(const Folder*)=0;
+ virtual void deleteMails(const QString & FolderName,QList<RecMail> &target);
virtual int deleteMbox(const Folder*)=0;
@@ -48,3 +49,3 @@ public:
/* mbox only! */
- static AbstractMail* getWrapper(const QString&a);
+ static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders");
@@ -53,2 +54,3 @@ public:
virtual const QString&getType()const=0;
+ virtual const QString&getName()const=0;
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index d252159..bb74de9 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -31,2 +31,3 @@ void IMAPwrapper::login()
+ if (account->getOffline()) return;
/* we are connected this moment */
@@ -1008,2 +1009,7 @@ const QString&IMAPwrapper::getType()const
+const QString&IMAPwrapper::getName()const
+{
+ return account->getAccountName();
+}
+
encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail)
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index b246f58..b2bd7e9 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -47,2 +47,4 @@ public:
virtual const QString&getType()const;
+ virtual const QString&getName()const;
+
protected:
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
index bc496f7..97f301e 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
@@ -10,4 +10,4 @@ const QString MBOXwrapper::wrapperType="MBOX";
-MBOXwrapper::MBOXwrapper(const QString & mbox_dir)
- : Genericwrapper(),MBOXPath(mbox_dir)
+MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name)
+ : Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name)
{
@@ -332 +332,6 @@ const QString&MBOXwrapper::getType()const
}
+
+const QString&MBOXwrapper::getName()const
+{
+ return MBOXName;
+}
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h
index 2794014..194ff86 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h
@@ -15,3 +15,3 @@ class MBOXwrapper : public Genericwrapper
public:
- MBOXwrapper(const QString & dir);
+ MBOXwrapper(const QString & dir,const QString&name);
virtual ~MBOXwrapper();
@@ -34,5 +34,6 @@ public:
virtual encodedString* fetchRawBody(const RecMail&mail);
- virtual void deleteMails(const QString & mailbox,QList<RecMail> &target);
+ virtual void deleteMails(const QString & FolderName,QList<RecMail> &target);
virtual int deleteAllMail(const Folder*);
virtual const QString&getType()const;
+ virtual const QString&getName()const;
@@ -41,2 +42,3 @@ protected:
QString MBOXPath;
+ QString MBOXName;
static const QString wrapperType;
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index cceb22e..67bde38 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -110,2 +110,3 @@ void POP3wrapper::login()
{
+ if (account->getOffline()) return;
/* we'll hold the line */
@@ -251 +252,6 @@ const QString&POP3wrapper::getType()const
}
+
+const QString&POP3wrapper::getName()const
+{
+ return account->getAccountName();
+}
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index f0307b6..d2b708d 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -32,2 +32,3 @@ public:
virtual const QString&getType()const;
+ virtual const QString&getName()const;
static void pop3_progress( size_t current, size_t maximum );
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index c5187f5..02a80a3 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -170,2 +170,4 @@ void IMAPaccount::read()
if (prefix.isNull()) prefix = "";
+ offline = conf->readBoolEntry("Offline",false);
+ delete conf;
}
@@ -186,3 +188,5 @@ void IMAPaccount::save()
conf->writeEntry( "MailPrefix",prefix);
+ conf->writeEntry( "Offline",offline);
conf->write();
+ delete conf;
}
@@ -240,2 +244,4 @@ void POP3account::read()
password = conf->readEntryCrypt( "Password" );
+ offline = conf->readBoolEntry("Offline",false);
+ delete conf;
}
@@ -255,3 +261,5 @@ void POP3account::save()
conf->writeEntryCrypt( "Password", password );
+ conf->writeEntry( "Offline",offline);
conf->write();
+ delete conf;
}
@@ -315,2 +323,3 @@ void SMTPaccount::read()
password = conf->readEntryCrypt( "Password" );
+ delete conf;
}
@@ -332,2 +341,3 @@ void SMTPaccount::save()
conf->write();
+ delete conf;
}
@@ -388,2 +398,3 @@ void NNTPaccount::read()
password = conf->readEntryCrypt( "Password" );
+ delete conf;
}
@@ -405,2 +416,3 @@ void NNTPaccount::save()
conf->write();
+ delete conf;
}
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h
index caa5dfc..2104997 100644
--- a/noncore/net/mail/libmailwrapper/settings.h
+++ b/noncore/net/mail/libmailwrapper/settings.h
@@ -32,2 +32,5 @@ public:
bool getSSL() { return ssl; }
+
+ void setOffline(bool b) {offline = b;}
+ bool getOffline()const{return offline;}
@@ -40,3 +43,3 @@ protected:
bool ssl;
-
+ bool offline;
};
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index 4764b77..281b88e 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -491,3 +491,3 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box)
QString localfolders = AbstractMail::defaultLocalfolder();
- MBOXwrapper*wrap = new MBOXwrapper(localfolders);
+ AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
wrap->storeMessage(mail,length,box);
@@ -518,7 +518,5 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp )
}
- QString tmp = data;
- tmp.replace(QRegExp("\r+",true,false),"");
msg = 0;
if (later) {
- storeMail((char*)tmp.data(),tmp.length(),"Outgoing");
+ storeMail(data,size,"Outgoing");
if (data) free( data );
@@ -638,3 +636,3 @@ void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
-int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
+int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which)
{
@@ -687,3 +685,3 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp)
QString localfolders = AbstractMail::defaultLocalfolder();
- MBOXwrapper*wrap = new MBOXwrapper(localfolders);
+ AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
if (!wrap) {
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index 04fc4b0..7dcdbfd 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -12,3 +12,3 @@
class Mail;
-class MBOXwrapper;
+class AbstractMail;
class RecMail;
@@ -61,3 +61,3 @@ protected:
- int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which);
+ int sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which);
diff --git a/noncore/net/mail/selectstore.cpp b/noncore/net/mail/selectstore.cpp
index 28ab5a8..0a07d51 100644
--- a/noncore/net/mail/selectstore.cpp
+++ b/noncore/net/mail/selectstore.cpp
@@ -1,2 +1,6 @@
#include "selectstore.h"
+#include <qlineedit.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <libmailwrapper/abstractmail.h>
@@ -5,3 +9,5 @@ Selectstore::Selectstore(QWidget* parent, const char* name)
{
-
+ folderMap.clear();
+ mailMap.clear();
+ cMail = 0;
}
@@ -14,2 +20,5 @@ void Selectstore::slotCreateNewFolder()
{
+ bool how = newFoldersel->isChecked();
+ folderSelection->setEnabled(!how);
+ newFolderedit->setEnabled(how);
}
@@ -19 +28,43 @@ void Selectstore::slotMoveMail()
}
+
+void Selectstore::addAccounts(AbstractMail*mail,const QStringList&folders)
+{
+ accountSelection->insertItem(mail->getName());
+ mailMap[accountSelection->count()-1]=mail;
+ folderMap[accountSelection->count()-1]=folders;
+ if (accountSelection->count()==1) {
+ cMail = mail;
+ folderSelection->insertStringList(folders);
+ }
+}
+
+void Selectstore::slotAccountselected(int i)
+{
+ folderSelection->clear();
+ folderSelection->insertStringList(folderMap[i]);
+ cMail = mailMap[i];
+}
+
+QString Selectstore::currentFolder()
+{
+ if (newFoldersel->isChecked()) {
+ return newFolderedit->text();
+ } else {
+ return folderSelection->currentText();
+ }
+}
+
+AbstractMail*Selectstore::currentMail()
+{
+ return cMail;
+}
+
+bool Selectstore::newFolder()
+{
+ return newFoldersel->isChecked();
+}
+
+bool Selectstore::moveMails()
+{
+ return selMove->isChecked();
+}
diff --git a/noncore/net/mail/selectstore.h b/noncore/net/mail/selectstore.h
index 8b8e8ee..447a6ae 100644
--- a/noncore/net/mail/selectstore.h
+++ b/noncore/net/mail/selectstore.h
@@ -4,2 +4,7 @@
#include "selectstoreui.h"
+#include <qvaluelist.h>
+#include <qmap.h>
+#include <qstringlist.h>
+
+class AbstractMail;
@@ -11,8 +16,17 @@ public:
virtual ~Selectstore();
+ virtual void addAccounts(AbstractMail*mail,const QStringList&folders);
+ virtual QString currentFolder();
+ virtual AbstractMail*currentMail();
+ bool newFolder();
+ bool moveMails();
-protected:
+protected slots:
virtual void slotCreateNewFolder();
virtual void slotMoveMail();
-protected slots:
+ virtual void slotAccountselected(int);
+protected:
+ QMap<int,QStringList> folderMap;
+ QMap<int,AbstractMail*> mailMap;
+ AbstractMail*cMail;
};
diff --git a/noncore/net/mail/selectstoreui.ui b/noncore/net/mail/selectstoreui.ui
index 3741b71..5f0e507 100644
--- a/noncore/net/mail/selectstoreui.ui
+++ b/noncore/net/mail/selectstoreui.ui
@@ -13,3 +13,3 @@
<y>0</y>
- <width>190</width>
+ <width>182</width>
<height>273</height>
@@ -30,3 +30,3 @@
<name>margin</name>
- <number>2</number>
+ <number>1</number>
</property>
@@ -34,3 +34,3 @@
<name>spacing</name>
- <number>2</number>
+ <number>1</number>
</property>
@@ -176,2 +176,23 @@
<widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>newFolderLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Prefix will prepend, no need to enter it!</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>WordBreak|AlignCenter</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ <property>
+ <name>wordwrap</name>
+ </property>
+ </widget>
+ <widget>
<class>Line</class>
@@ -233,4 +254,18 @@
</connection>
- <slot access="protected">slotMoveMail()</slot>
+ <connection>
+ <sender>accountSelection</sender>
+ <signal>activated(int)</signal>
+ <receiver>selectstoreui</receiver>
+ <slot>slotAccountselected(int)</slot>
+ </connection>
+ <connection>
+ <sender>folderSelection</sender>
+ <signal>activated(int)</signal>
+ <receiver>selectstoreui</receiver>
+ <slot>slotFolderSelected(int)</slot>
+ </connection>
+ <slot access="protected">slotFolderSelected(int)</slot>
+ <slot access="protected">slotAccountselected(int)</slot>
<slot access="protected">slotCreateNewFolder()</slot>
+ <slot access="protected">slotMoveMail()</slot>
</connections>