summaryrefslogtreecommitdiffabout
path: root/kmicromail/accountitem.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/accountitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index 7b9b881..59c8abb 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -1,42 +1,44 @@
#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>
+#define GET_NEW_MAILS 101
+
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 );
}
@@ -71,94 +73,94 @@ void POP3viewItem::refresh()
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 new INBOX messages",contextName),2);
+ m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
}
else
{
m->insertItem(QObject::tr("Set online",contextName),1);
- m->insertItem(QObject::tr("Download new INBOX messages",contextName),2);
+ m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
}
}
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
+ case GET_NEW_MAILS: // daunlood
if (account->getOffline())
setOnOffline();
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 );
}
@@ -496,55 +498,55 @@ void IMAPviewItem::refreshFolders(bool force)
item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1));
item = titem;
}
else
{
item = new IMAPfolderItem( (*it), this , item );
}
}
delete folders;
}
QPopupMenu * IMAPviewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
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);
m->insertSeparator();
- m->insertItem(QObject::tr("Download new INBOX messages",contextName),4);
+ m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
}
else
{
m->insertItem(QObject::tr("Set online",contextName),3);
m->insertSeparator();
- m->insertItem(QObject::tr("Download new INBOX messages",contextName),4);
+ m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
}
}
return m;
}
void IMAPviewItem::createNewFolder()
{
Newmdirdlg ndirdlg;
ndirdlg.showMaximized();
if ( ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
bool makesubs = ndirdlg.subpossible();
QString delemiter = "/";
IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
if (item)
{
delemiter = item->Delemiter();
}
if (wrapper->createMbox(ndir,0,delemiter,makesubs))
{
refreshFolders(true);
}
@@ -556,49 +558,49 @@ void IMAPviewItem::contextMenuSelected(int id)
switch (id)
{
case 0:
refreshFolders(true);
break;
case 1:
createNewFolder();
break;
case 2:
removeChilds();
wrapper->logout();
break;
case 3:
if (account->getOffline()==false)
{
removeChilds();
wrapper->logout();
}
account->setOffline(!account->getOffline());
account->save();
SETPIX(PIXMAP_IMAPFOLDER);
refreshFolders(false);
break;
- case 4: // daunlood
+ case GET_NEW_MAILS: // daunlood
{
if (account->getOffline()) {
contextMenuSelected( 3 );
}
AccountView*bl = accountView();
if (!bl) return;
AccountViewItem* in = findSubItem( "inbox" , 0);
if ( ! in )
return;
bl->downloadMailsInbox(in->getFolder(),getWrapper());
}
break;
default:
break;
}
}
RECBODYP IMAPviewItem::fetchBody(const RecMailP&)
{
return new RecBody();
}
bool IMAPviewItem::offline()
{