summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp12
-rw-r--r--kmicromail/accountitem.h1
-rw-r--r--kmicromail/accountview.cpp27
-rw-r--r--kmicromail/accountview.h1
-rw-r--r--kmicromail/imapconfigui.ui506
-rw-r--r--kmicromail/libmailwrapper/settings.cpp14
-rw-r--r--kmicromail/libmailwrapper/settings.h4
-rw-r--r--kmicromail/pop3configui.ui19
8 files changed, 434 insertions, 150 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index d0321ef..1698b40 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -1,265 +1,275 @@
#include "accountitem.h"
#include "accountview.h"
#include "newmaildir.h"
#include "nntpgroupsdlg.h"
#include "defines.h"
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailwrapper.h>
/* OPIE */
//#include <qpe/qpeapplication.h>
/* QT */
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include <kiconloader.h>
using namespace Opie::Core;
#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
/**
* POP3 Account stuff
*/
POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
SETPIX(PIXMAP_POP3FOLDER);
#if 0
if (!account->getOffline())
{
setPixmap( 0, );
}
else
{
setPixmap( 0, PIXMAP_OFFLINE );
}
#endif
setText( 0, account->getAccountName() );
setOpen( true );
}
POP3viewItem::~POP3viewItem()
{
delete wrapper;
}
AbstractMail *POP3viewItem::getWrapper()
{
return wrapper;
}
void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & )
{
refresh();
}
void POP3viewItem::refresh()
{
if (account->getOffline()) return;
QValueList<FolderP> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
QValueList<FolderP>::ConstIterator it;
QListViewItem*item = 0;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
item = new POP3folderItem( (*it), this , item );
item->setSelectable( (*it)->may_select());
}
delete folders;
}
RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
{
return wrapper->fetchBody( 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);
+ m->insertItem(QObject::tr("Download messages",contextName),2);
}
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();
SETPIX(PIXMAP_POP3FOLDER);
refresh();
}
void POP3viewItem::contextMenuSelected(int which)
{
switch (which)
{
case 0:
disconnect();
break;
case 1:
setOnOffline();
break;
+ case 2: // daunlood
+ AccountView*bl = accountView();
+ if (!bl) return;
+ AccountViewItem* in = findSubItem( "inbox" , 0);
+ if ( ! in )
+ return;
+ bl->downloadMailsInbox(in->getFolder() ,getWrapper());
+ setOnOffline();
+ break;
}
}
POP3folderItem::~POP3folderItem()
{}
POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after )
: AccountViewItem(folderInit,parent,after )
{
pop3 = parent;
if (folder->getDisplayName().lower()!="inbox")
{
setPixmap( 0, PIXMAP_POP3FOLDER );
}
else
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
}
void POP3folderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
pop3->getWrapper()->listMessages( folder->getName(),target );
}
RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail)
{
return pop3->getWrapper()->fetchBody(aMail);
}
QPopupMenu * POP3folderItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
m->insertItem(QObject::tr("Refresh header list",contextName),0);
m->insertItem(QObject::tr("Delete all mails",contextName),1);
m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
}
return m;
}
void POP3folderItem::downloadMails()
{
AccountView*bl = pop3->accountView();
if (!bl) return;
bl->downloadMails(folder,pop3->getWrapper());
}
void POP3folderItem::contextMenuSelected(int which)
{
AccountView * view = (AccountView*)listView();
switch (which)
{
case 0:
/* must be 'cause pop3 lists are cached */
pop3->getWrapper()->logout();
view->refreshCurrent();
break;
case 1:
deleteAllMail(pop3->getWrapper(),folder);
break;
case 2:
downloadMails();
break;
default:
break;
}
}
/**
* NNTP Account stuff
*/
NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
//FIXME
SETPIX(PIXMAP_POP3FOLDER);
#if 0
if (!account->getOffline())
{
setPixmap( 0, );
}
else
{
setPixmap( 0, PIXMAP_OFFLINE );
}
#endif
setText( 0, account->getAccountName() );
setOpen( true );
}
NNTPviewItem::~NNTPviewItem()
{
delete wrapper;
}
AbstractMail *NNTPviewItem::getWrapper()
{
return wrapper;
}
void NNTPviewItem::refresh( QValueList<RecMailP> & )
{
refresh();
}
void NNTPviewItem::refresh()
{
if (account->getOffline()) return;
QValueList<FolderP> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
QValueList<FolderP>::ConstIterator it;
QListViewItem*item = 0;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
item = new NNTPfolderItem( (*it), this , item );
@@ -980,161 +990,161 @@ void MHfolderItem::createFolder()
Newmdirdlg ndirdlg(0,0,true);
ndirdlg.showMaximized();
if (ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
if (mbox->getWrapper()->createMbox(ndir,folder))
{
QListView*v=listView();
MHviewItem * box = mbox;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
mbox->refresh(true);
if (v)
{
v->setSelected(box,true);
}
}
}
}
void MHfolderItem::contextMenuSelected(int which)
{
switch(which)
{
case 0:
deleteAllMail(mbox->getWrapper(),folder);
break;
case 1:
deleteFolder();
break;
case 2:
downloadMails();
break;
case 3:
createFolder();
break;
default:
break;
}
}
bool MHfolderItem::isDraftfolder()
{
if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true;
return false;
}
/**
* Generic stuff
*/
const QString AccountViewItem::contextName="AccountViewItem";
AccountViewItem::AccountViewItem( AccountView *parent )
: QListViewItem( parent )
{
init();
m_Backlink = parent;
}
AccountViewItem::AccountViewItem( QListViewItem *parent)
: QListViewItem( parent),folder(0)
{
init();
}
AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
:QListViewItem( parent,after ),folder(0)
{
init();
}
AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after )
:QListViewItem( parent,after ),folder(folderInit)
{
init();
}
void AccountViewItem::init()
{
m_Backlink = 0;
}
AccountViewItem::~AccountViewItem()
{
folder = 0;
}
AccountView*AccountViewItem::accountView()
{
return m_Backlink;
}
void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
{
if (!wrapper) return;
QString fname="";
if (folder) fname = folder->getDisplayName();
int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).
arg(fname),
QObject::tr("Yes",contextName),
QObject::tr("No",contextName),QString::null,1,1);
if (yesno == 0)
{
if (wrapper->deleteAllMail(folder))
{
AccountView * view = (AccountView*)listView();
if (view) view->refreshCurrent();
}
}
}
void AccountViewItem::removeChilds()
{
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
}
bool AccountViewItem::matchName(const QString&name)const
{
if (!folder) return false;
- return folder->getDisplayName()==name;
+ return folder->getDisplayName().lower()==name.lower();
}
AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start)
{
AccountViewItem*pitem,*sitem;
if (!start) pitem = (AccountViewItem*)firstChild();
else pitem = (AccountViewItem*)start->firstChild();
while (pitem)
{
if (pitem->matchName(path))
{
break;
}
if (pitem->childCount()>0)
{
sitem = findSubItem(path,pitem);
if (sitem)
{
pitem = sitem;
break;
}
}
pitem=(AccountViewItem*)pitem->nextSibling();
}
return pitem;
}
bool AccountViewItem::isDraftfolder()
{
return false;
}
diff --git a/kmicromail/accountitem.h b/kmicromail/accountitem.h
index f125eeb..faf919d 100644
--- a/kmicromail/accountitem.h
+++ b/kmicromail/accountitem.h
@@ -1,166 +1,167 @@
#ifndef __ACCOUNT_ITEM
#define __ACCOUNT_ITEM
#include <qlistview.h>
#include <qlist.h>
#include <opie2/osmartpointer.h>
class POP3wrapper;
class RecMail;
class RecBody;
class QPopupMenu;
class Selectstore;
class AccountView;
class POP3account;
class NNTPaccount;
class IMAPaccount;
class AbstractMail;
class Folder;
#define RECBODYP Opie::Core::OSmartPointer<RecBody>
class AccountViewItem : public QListViewItem
{
public:
AccountViewItem( AccountView *parent );
AccountViewItem( QListViewItem *parent);
AccountViewItem( QListViewItem *parent , QListViewItem*after );
AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after );
virtual ~AccountViewItem();
virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0;
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0;
virtual QPopupMenu * getContextMenu(){return 0;};
virtual void contextMenuSelected(int){}
virtual AccountView*accountView();
virtual bool matchName(const QString&name)const;
virtual bool isDraftfolder();
+ Opie::Core::OSmartPointer<Folder> getFolder() { return folder; };
protected:
AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0);
virtual void init();
virtual void removeChilds();
virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f);
static const QString contextName;
AccountView*m_Backlink;
Opie::Core::OSmartPointer<Folder> folder;
};
class POP3viewItem : public AccountViewItem
{
public:
POP3viewItem( POP3account *a, AccountView *parent );
virtual ~POP3viewItem();
virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
AbstractMail *getWrapper();
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
protected:
POP3account *account;
virtual void refresh();
AbstractMail *wrapper;
void disconnect();
void setOnOffline();
};
class POP3folderItem : public AccountViewItem
{
public:
POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after );
virtual ~POP3folderItem();
virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
protected:
void downloadMails();
POP3viewItem *pop3;
};
class NNTPviewItem : public AccountViewItem
{
public:
NNTPviewItem( NNTPaccount *a, AccountView *parent );
virtual ~NNTPviewItem();
virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
AbstractMail *getWrapper();
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
protected:
NNTPaccount *account;
virtual void refresh();
AbstractMail *wrapper;
void disconnect();
void setOnOffline();
void subscribeGroups();
};
class NNTPfolderItem : public AccountViewItem
{
public:
NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after );
virtual ~NNTPfolderItem();
virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
protected:
void downloadMails();
NNTPviewItem *nntp;
};
class IMAPviewItem : public AccountViewItem
{
friend class IMAPfolderItem;
public:
IMAPviewItem( IMAPaccount *a, AccountView *parent );
virtual ~IMAPviewItem();
virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
AbstractMail *getWrapper();
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
const QStringList&subFolders();
virtual void refreshFolders(bool force=false);
bool offline();
protected:
virtual void createNewFolder();
IMAPaccount *account;
AbstractMail *wrapper;
QStringList currentFolders;
};
class IMAPfolderItem : public AccountViewItem
{
public:
IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after );
IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master );
virtual ~IMAPfolderItem();
virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
virtual const QString& Delemiter()const;
protected:
virtual void createNewFolder();
virtual void deleteFolder();
virtual void downloadMails();
IMAPviewItem *imap;
};
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp
index 4ead545..85523b1 100644
--- a/kmicromail/accountview.cpp
+++ b/kmicromail/accountview.cpp
@@ -14,163 +14,190 @@
/* QT */
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qcheckbox.h>
#include <qspinbox.h>
using namespace Opie::Core;
AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
: QListView( parent, name, flags )
{
connect( this, SIGNAL( selectionChanged(QListViewItem*) ),
SLOT( refresh(QListViewItem*) ) );
connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) );
setSorting(0);
}
AccountView::~AccountView()
{
imapAccounts.clear();
mhAccounts.clear();
}
void AccountView::slotContextMenu(int id)
{
AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
if (!view) return;
view->contextMenuSelected(id);
}
void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
{
if (button==1) {return;}
if (!item) return;
AccountViewItem *view = static_cast<AccountViewItem *>(item);
QPopupMenu*m = view->getContextMenu();
if (!m) return;
connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
void AccountView::populate( QList<Account> list )
{
clear();
imapAccounts.clear();
mhAccounts.clear();
mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
Account *it;
for ( it = list.first(); it; it = list.next() )
{
if ( it->getType() == MAILLIB::A_IMAP )
{
IMAPaccount *imap = static_cast<IMAPaccount *>(it);
imapAccounts.append(new IMAPviewItem( imap, this ));
}
else if ( it->getType() == MAILLIB::A_POP3 )
{
POP3account *pop3 = static_cast<POP3account *>(it);
/* must not be hold 'cause it isn't required */
(void) new POP3viewItem( pop3, this );
}
else if ( it->getType() == MAILLIB::A_NNTP )
{
NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
/* must not be hold 'cause it isn't required */
(void) new NNTPviewItem( nntp, this );
}
}
}
void AccountView::refresh(QListViewItem *item)
{
if ( item )
{
m_currentItem = item;
QValueList<RecMailP> headerlist;
AccountViewItem *view = static_cast<AccountViewItem *>(item);
view->refresh(headerlist);
emit refreshMailview(headerlist);
}
}
void AccountView::refreshCurrent()
{
m_currentItem = currentItem();
if ( !m_currentItem ) return;
QValueList<RecMailP> headerlist;
AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
view->refresh(headerlist);
emit refreshMailview(headerlist);
}
void AccountView::refreshAll()
{
}
RecBodyP AccountView::fetchBody(const RecMailP&aMail)
{
QListViewItem*item = selectedItem ();
if (!item) return new RecBody();
AccountViewItem *view = static_cast<AccountViewItem *>(item);
return view->fetchBody(aMail);
}
void AccountView::setupFolderselect(Selectstore*sels)
{
sels->showMaximized();
QStringList sFolders;
unsigned int i = 0;
for (i=0; i < mhAccounts.count();++i)
{
mhAccounts[i]->refresh(false);
sFolders = mhAccounts[i]->subFolders();
sels->addAccounts(mhAccounts[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::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper)
+{
+ 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;
+ }
+ if (sels.newFolder() && !targetMail->createMbox(targetFolder))
+ {
+ QMessageBox::critical(0,tr("Error creating new Folder"),
+ tr("<center>Error while creating<br>new folder - breaking.</center>"));
+ return;
+ }
+ int maxsize = 0;
+ if ( sels.useSize->isChecked())
+ maxsize = sels.sizeSpinBox->value();
+
+ fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize);
+ refreshCurrent();
+}
void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper)
{
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;
}
if (sels.newFolder() && !targetMail->createMbox(targetFolder))
{
QMessageBox::critical(0,tr("Error creating new Folder"),
tr("<center>Error while creating<br>new folder - breaking.</center>"));
return;
}
int maxsize = 0;
if ( sels.useSize->isChecked())
maxsize = sels.sizeSpinBox->value();
fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize);
refreshCurrent();
}
bool AccountView::currentisDraft()
{
AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
if (!view) return false;
return view->isDraftfolder();
}
diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h
index 787b0b0..fcf33d1 100644
--- a/kmicromail/accountview.h
+++ b/kmicromail/accountview.h
@@ -1,45 +1,46 @@
#ifndef ACCOUNTVIEW_H
#define ACCOUNTVIEW_H
#include <qlistview.h>
#include <qlist.h>
#include <opie2/osmartpointer.h>
#include <libmailwrapper/mailtypes.h>
class Selectstore;
class Folder;
class AbstractMail;
class Account;
class IMAPviewItem;
class MHviewItem;
class AccountView : public QListView
{
Q_OBJECT
public:
AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
virtual ~AccountView();
virtual void populate( QList<Account> list );
virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail);
virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
+ virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
virtual bool currentisDraft();
public slots:
virtual void refreshAll();
virtual void refresh(QListViewItem *item);
virtual void refreshCurrent();
virtual void slotHold(int, QListViewItem *,const QPoint&,int);
virtual void slotContextMenu(int id);
void setupFolderselect(Selectstore*sels);
signals:
void refreshMailview(const QValueList<RecMailP>& );
protected:
QListViewItem* m_currentItem;
QValueList<IMAPviewItem*> imapAccounts;
QValueList<MHviewItem*> mhAccounts;
};
#endif
diff --git a/kmicromail/imapconfigui.ui b/kmicromail/imapconfigui.ui
index a96c1a2..2e4c9ca 100644
--- a/kmicromail/imapconfigui.ui
+++ b/kmicromail/imapconfigui.ui
@@ -1,259 +1,475 @@
<!DOCTYPE UI><UI>
<class>IMAPconfigUI</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>IMAPconfigUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>425</width>
- <height>428</height>
+ <width>306</width>
+ <height>396</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Configure IMAP</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
- <grid>
+ <vbox>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>3</number>
+ <number>1</number>
</property>
- <widget row="2" column="1" >
- <class>QLineEdit</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>serverLine</cstring>
- </property>
- </widget>
- <widget row="3" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>portLabel</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Port</string>
- </property>
+ <cstring>Layout22</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>accountLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Account</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>accountLine</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Name of the Account</string>
+ </property>
+ </widget>
+ </hbox>
</widget>
- <widget row="2" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>serverLabel</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Server</string>
- </property>
- </widget>
- <widget row="3" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>portLine</cstring>
- </property>
- </widget>
- <widget row="0" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>accountLine</cstring>
- </property>
- <property>
- <name>toolTip</name>
- <string>Name of the Account</string>
- </property>
- </widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>accountLabel</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Account</string>
- </property>
- </widget>
- <widget row="1" column="0" rowspan="1" colspan="2" >
+ <widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>line1</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
- <spacer row="12" column="1" >
- <property>
- <name>name</name>
- <cstring>spacer</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Vertical</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget row="8" column="1" >
- <class>QLineEdit</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>userLine</cstring>
- </property>
- </widget>
- <widget row="9" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>passLine</cstring>
- </property>
- <property stdset="1">
- <name>echoMode</name>
- <enum>Password</enum>
- </property>
- </widget>
- <widget row="11" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>prefixLabel</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Prefix</string>
- </property>
+ <cstring>Layout23</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>serverLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Server</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>serverLine</cstring>
+ </property>
+ </widget>
+ </hbox>
</widget>
- <widget row="11" column="1" >
- <class>QLineEdit</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>prefixLine</cstring>
- </property>
+ <cstring>Layout24</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>portLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Port</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>portLine</cstring>
+ </property>
+ </widget>
+ </hbox>
</widget>
- <widget row="8" column="0" >
- <class>QLabel</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>userLabel</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>User</string>
- </property>
+ <cstring>Layout16</cstring>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Use secure sockets:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QComboBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ComboBox1</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>CommandEdit</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>ssh $SERVER exec</string>
+ </property>
+ </widget>
+ </vbox>
</widget>
- <widget row="7" column="0" rowspan="1" colspan="2" >
+ <widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>line2</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>caption</name>
<string></string>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
</widget>
- <widget row="10" column="0" rowspan="1" colspan="2" >
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout25</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>userLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>User</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>userLine</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout26</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>passLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Password</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>passLine</cstring>
+ </property>
+ <property stdset="1">
+ <name>echoMode</name>
+ <enum>Password</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>Line3</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
- <widget row="9" column="0" >
- <class>QLabel</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>passLabel</cstring>
- </property>
+ <cstring>Layout27</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>prefixLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Prefix</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>prefixLine</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
- <name>text</name>
- <string>Password</string>
- </property>
+ <name>name</name>
+ <cstring>Layout11</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Local storage folder:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>localFolder</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout12</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>CheckBoxDown</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Download only messages smaller</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>SpinBoxDown</cstring>
+ </property>
+ <property stdset="1">
+ <name>suffix</name>
+ <string>kB</string>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>99999</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ </widget>
+ </hbox>
</widget>
- <widget row="6" column="0" rowspan="1" colspan="2" >
- <class>QLineEdit</class>
+ <widget>
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>CommandEdit</cstring>
+ <cstring>CheckBoxLeaveOn</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>ssh $SERVER exec</string>
+ <string>Leave Messages on Server</string>
</property>
</widget>
- <widget row="5" column="0" rowspan="1" colspan="2" >
- <class>QComboBox</class>
- <property stdset="1">
+ <spacer>
+ <property>
<name>name</name>
- <cstring>ComboBox1</cstring>
+ <cstring>spacer</cstring>
</property>
- </widget>
- <widget row="4" column="0" rowspan="1" colspan="2" >
- <class>QLabel</class>
<property stdset="1">
- <name>name</name>
- <cstring>TextLabel1</cstring>
+ <name>orientation</name>
+ <enum>Vertical</enum>
</property>
<property stdset="1">
- <name>text</name>
- <string>Use secure sockets:</string>
+ <name>sizeType</name>
+ <enum>Expanding</enum>
</property>
- </widget>
- </grid>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
</widget>
<tabstops>
<tabstop>accountLine</tabstop>
<tabstop>serverLine</tabstop>
<tabstop>portLine</tabstop>
<tabstop>userLine</tabstop>
<tabstop>passLine</tabstop>
</tabstops>
</UI>
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 90e32fa..f996d9c 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -52,361 +52,375 @@ void Settings::delAccount( Account *account )
accounts.remove( account );
account->remove();
}
void Settings::updateAccounts()
{
accounts.clear();
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList::Iterator it;
QStringList imap = dir.entryList( "imap-*" );
for ( it = imap.begin(); it != imap.end(); it++ ) {
IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList pop3 = dir.entryList( "pop3-*" );
for ( it = pop3.begin(); it != pop3.end(); it++ ) {
POP3account *account = new POP3account( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList smtp = dir.entryList( "smtp-*" );
for ( it = smtp.begin(); it != smtp.end(); it++ ) {
SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList nntp = dir.entryList( "nntp-*" );
for ( it = nntp.begin(); it != nntp.end(); it++ ) {
NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
readAccounts();
}
void Settings::saveAccounts()
{
checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->save();
}
}
void Settings::readAccounts()
{
checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->read();
}
}
Account::Account()
{
accountName = "changeMe";
type = MAILLIB::A_UNDEFINED;
ssl = false;
connectionType = 1;
offline = false;
}
void Account::remove()
{
QFile file( getFileName() );
file.remove();
}
IMAPaccount::IMAPaccount()
: Account()
{
file = IMAPaccount::getUniqueFileName();
accountName = "New IMAP Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_IMAP;
port = IMAP_PORT;
}
IMAPaccount::IMAPaccount( QString filename )
: Account()
{
file = filename;
accountName = "New IMAP Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_IMAP;
port = IMAP_PORT;
}
QString IMAPaccount::getUniqueFileName()
{
int num = 0;
QString unique;
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList imap = dir.entryList( "imap-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "imap-" + unique ) > 0 );
return unique;
}
void IMAPaccount::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "IMAP Account" );
accountName = conf->readEntry( "Account","" );
if (accountName.isNull()) accountName = "";
server = conf->readEntry( "Server","" );
if (server.isNull()) server="";
port = conf->readEntry( "Port","" );
if (port.isNull()) port="143";
connectionType = conf->readNumEntry( "ConnectionType" );
ssl = conf->readBoolEntry( "SSL",false );
user = conf->readEntry( "User","" );
if (user.isNull()) user = "";
password = conf->readEntryCrypt( "Password","" );
if (password.isNull()) password = "";
prefix = conf->readEntry("MailPrefix","");
if (prefix.isNull()) prefix = "";
offline = conf->readBoolEntry("Offline",false);
+ localFolder = conf->readEntry( "LocalFolder" );
+ maxMailSize = conf->readNumEntry( "MaxSize",0 );
+ int lf = conf->readNumEntry( "LastFetch",0 );
+ QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
+ leaveOnServer = conf->readBoolEntry("LeaveOnServer",false);
+ lastFetch = dt.addSecs( lf );
delete conf;
}
void IMAPaccount::save()
{
qDebug("saving %s ",getFileName().latin1() );
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "IMAP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "MailPrefix",prefix);
conf->writeEntry( "Offline",offline);
+ conf->writeEntry( "LocalFolder", localFolder );
+ conf->writeEntry( "MaxSize", maxMailSize );
+ QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
+ int lf = dt.secsTo ( lastFetch );
+ conf->writeEntry( "LastFetch", lf );
+ conf->writeEntry( "LeaveOnServer", leaveOnServer);
conf->write();
delete conf;
}
QString IMAPaccount::getFileName()
{
return locateLocal("data", "kopiemail" ) +"/imap-" + file;
}
POP3account::POP3account()
: Account()
{
file = POP3account::getUniqueFileName();
accountName = "New POP3 Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_POP3;
port = POP3_PORT;
}
POP3account::POP3account( QString filename )
: Account()
{
file = filename;
accountName = "New POP3 Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_POP3;
port = POP3_PORT;
}
QString POP3account::getUniqueFileName()
{
int num = 0;
QString unique;
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList imap = dir.entryList( "pop3-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "pop3-" + unique ) > 0 );
return unique;
}
void POP3account::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "POP3 Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
connectionType = conf->readNumEntry( "ConnectionType" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
offline = conf->readBoolEntry("Offline",false);
localFolder = conf->readEntry( "LocalFolder" );
maxMailSize = conf->readNumEntry( "MaxSize",0 );
int lf = conf->readNumEntry( "LastFetch",0 );
QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
+ leaveOnServer = conf->readBoolEntry("LeaveOnServer",false);
lastFetch = dt.addSecs( lf );
delete conf;
}
void POP3account::save()
{
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "POP3 Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "Offline",offline);
conf->writeEntry( "LocalFolder", localFolder );
conf->writeEntry( "MaxSize", maxMailSize );
QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
int lf = dt.secsTo ( lastFetch );
conf->writeEntry( "LastFetch", lf );
+ conf->writeEntry( "LeaveOnServer", leaveOnServer);
conf->write();
delete conf;
}
QString POP3account::getFileName()
{
return locateLocal("data", "kopiemail" ) +"/pop3-" + file;
}
SMTPaccount::SMTPaccount()
: Account()
{
file = SMTPaccount::getUniqueFileName();
accountName = "New SMTP Account";
ssl = false;
connectionType = 1;
login = false;
useCC = false;
useBCC = false;
useReply = false;
type = MAILLIB::A_SMTP;
port = SMTP_PORT;
}
SMTPaccount::SMTPaccount( QString filename )
: Account()
{
file = filename;
accountName = "New SMTP Account";
ssl = false;
connectionType = 1;
login = false;
type = MAILLIB::A_SMTP;
port = SMTP_PORT;
}
QString SMTPaccount::getUniqueFileName()
{
int num = 0;
QString unique;
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList imap = dir.entryList( "smtp-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "smtp-" + unique ) > 0 );
return unique;
}
void SMTPaccount::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "SMTP Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
connectionType = conf->readNumEntry( "ConnectionType" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
delete conf;
}
void SMTPaccount::save()
{
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "SMTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->write();
delete conf;
}
QString SMTPaccount::getFileName()
{
return locateLocal("data", "kopiemail" ) +"/smtp-" + file;
}
NNTPaccount::NNTPaccount()
: Account()
{
file = NNTPaccount::getUniqueFileName();
accountName = "New NNTP Account";
ssl = false;
login = false;
type = MAILLIB::A_NNTP;
port = NNTP_PORT;
}
NNTPaccount::NNTPaccount( QString filename )
: Account()
{
file = filename;
accountName = "New NNTP Account";
ssl = false;
login = false;
type = MAILLIB::A_NNTP;
port = NNTP_PORT;
}
QString NNTPaccount::getUniqueFileName()
{
int num = 0;
QString unique;
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList imap = dir.entryList( "nntp-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "nntp-" + unique ) > 0 );
return unique;
}
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h
index c33c403..85b817c 100644
--- a/kmicromail/libmailwrapper/settings.h
+++ b/kmicromail/libmailwrapper/settings.h
@@ -1,173 +1,177 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include "maildefines.h"
/* OPIE */
/* QT */
#include <qobject.h>
#include <qlist.h>
#include <qdatetime.h>
class Account
{
public:
Account();
virtual ~Account() {}
void remove();
void setAccountName( QString name ) { accountName = name; }
const QString&getAccountName()const{ return accountName; }
MAILLIB::ATYPE getType()const{ return type; }
void setServer(const QString&str){ server = str; }
const QString&getServer()const{ return server; }
void setLocalFolder( QString name ) { localFolder = name; }
const QString& getLocalFolder()const{ return localFolder; }
void setPort(const QString&str) { port = str; }
const QString&getPort()const{ return port; }
void setUser(const QString&str){ user = str; }
const QString&getUser()const{ return user; }
void setPassword(const QString&str) { password = str; }
const QString&getPassword()const { return password; }
void setSSL( bool b ) { ssl = b; }
bool getSSL() { return ssl; }
void setConnectionType( int x ) { connectionType = x; }
int ConnectionType() { return connectionType; }
void setMaxMailSize( int x ) { maxMailSize = x; }
int getMaxMailSize() { return maxMailSize; }
void setOffline(bool b) {offline = b;}
bool getOffline()const{return offline;}
+ bool getLeaveOnServer(){ return leaveOnServer;}
+ void setLeaveOnServer(bool b){ leaveOnServer = b;}
+
virtual QString getFileName() { return accountName; }
virtual void read() { ; }
virtual void save() { ; }
protected:
QString accountName, server, port, user, password;
bool ssl;
int connectionType;
bool offline;
MAILLIB::ATYPE type;
QString localFolder;
int maxMailSize;
QDateTime lastFetch;
+ bool leaveOnServer;
};
class IMAPaccount : public Account
{
public:
IMAPaccount();
IMAPaccount( QString filename );
static QString getUniqueFileName();
virtual void read();
virtual void save();
virtual QString getFileName();
void setPrefix(const QString&str) {prefix=str;}
const QString&getPrefix()const{return prefix;}
private:
QString file,prefix;
};
class POP3account : public Account
{
public:
POP3account();
POP3account( QString filename );
static QString getUniqueFileName();
virtual void read();
virtual void save();
virtual QString getFileName();
private:
QString file;
};
class SMTPaccount : public Account
{
public:
SMTPaccount();
SMTPaccount( QString filename );
static QString getUniqueFileName();
virtual void read();
virtual void save();
virtual QString getFileName();
void setLogin( bool b ) { login = b; }
bool getLogin() { return login; }
private:
QString file, name, mail, org, cc, bcc, reply, signature;
bool useCC, useBCC, useReply, login;
};
class NNTPaccount : public Account
{
public:
NNTPaccount();
NNTPaccount( QString filename );
static QString getUniqueFileName();
virtual void read();
virtual void save();
virtual QString getFileName();
void setLogin( bool b ) { login = b; }
bool getLogin() { return login; }
void setGroups( QStringList list ) { subscribedGroups = list; }
QStringList getGroups() { return subscribedGroups; }
private:
QString file;
bool login;
QStringList subscribedGroups;
};
class Settings : public QObject
{
Q_OBJECT
public:
Settings();
QList<Account> getAccounts();
void addAccount(Account *account);
void delAccount(Account *account);
void saveAccounts();
void readAccounts();
static void checkDirectory();
private:
void updateAccounts();
QList<Account> accounts;
};
#endif
diff --git a/kmicromail/pop3configui.ui b/kmicromail/pop3configui.ui
index a2d43bd..6acd394 100644
--- a/kmicromail/pop3configui.ui
+++ b/kmicromail/pop3configui.ui
@@ -1,163 +1,163 @@
<!DOCTYPE UI><UI>
<class>POP3configUI</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>POP3configUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>322</width>
- <height>404</height>
+ <width>306</width>
+ <height>371</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Configure POP3</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>11</number>
+ <number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>1</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout12</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>accountLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Account</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>accountLine</cstring>
</property>
<property>
<name>toolTip</name>
<string>Name of the Account</string>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>line1</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout11</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout9</cstring>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>serverLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Server</string>
</property>
</widget>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>portLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Port</string>
</property>
</widget>
</vbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout10</cstring>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>serverLine</cstring>
</property>
</widget>
<widget>
@@ -280,159 +280,170 @@
<string>Password</string>
</property>
</widget>
</vbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout5</cstring>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>userLine</cstring>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>passLine</cstring>
</property>
<property stdset="1">
<name>echoMode</name>
<enum>Password</enum>
</property>
</widget>
</vbox>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout9</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Local storage folder:</string>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>localFolder</cstring>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout10</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBoxDown</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Download only messages smaller</string>
</property>
</widget>
<widget>
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>SpinBoxDown</cstring>
</property>
<property stdset="1">
<name>suffix</name>
<string>kB</string>
</property>
<property stdset="1">
<name>maxValue</name>
<number>99999</number>
</property>
<property stdset="1">
<name>minValue</name>
<number>1</number>
</property>
</widget>
</hbox>
</widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>CheckBoxLeaveOn</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Leave Messages on Server</string>
+ </property>
+ </widget>
<spacer>
<property>
<name>name</name>
<cstring>spacer</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<tabstops>
<tabstop>accountLine</tabstop>
<tabstop>serverLine</tabstop>
<tabstop>portLine</tabstop>
<tabstop>userLine</tabstop>
<tabstop>passLine</tabstop>
</tabstops>
</UI>