summaryrefslogtreecommitdiff
path: root/noncore/net/mail/accountitem.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/accountitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp309
1 files changed, 197 insertions, 112 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index 2d3cd4b..c8f6ec4 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -1,7 +1,9 @@
+
#include "accountitem.h"
#include "accountview.h"
-#include <qpopupmenu.h>
-#include <qmessagebox.h>
#include "selectstore.h"
#include "newmaildir.h"
+#include "defines.h"
+
+/* OPIE */
#include <libmailwrapper/mailtypes.h>
@@ -9,3 +11,7 @@
#include <libmailwrapper/mailwrapper.h>
-#include "defines.h"
+#include <qpe/qpeapplication.h>
+
+/* QT */
+#include <qpopupmenu.h>
+#include <qmessagebox.h>
@@ -16,3 +22,3 @@
POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
- : AccountViewItem( parent )
+ : AccountViewItem( parent )
{
@@ -22,5 +28,8 @@ POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
#if 0
- if (!account->getOffline()) {
+ if (!account->getOffline())
+ {
setPixmap( 0, );
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_OFFLINE );
@@ -52,3 +61,4 @@ void POP3viewItem::refresh()
QListViewItem *child = firstChild();
- while ( child ) {
+ while ( child )
+ {
QListViewItem *tmp = child;
@@ -59,3 +69,4 @@ void POP3viewItem::refresh()
QListViewItem*item = 0;
- for ( it = folders->first(); it; it = folders->next() ) {
+ for ( it = folders->first(); it; it = folders->next() )
+ {
item = new POP3folderItem( it, this , item );
@@ -77,7 +88,11 @@ QPopupMenu * POP3viewItem::getContextMenu()
QPopupMenu *m = new QPopupMenu(0);
- if (m) {
- if (!account->getOffline()) {
+ if (m)
+ {
+ if (!account->getOffline())
+ {
m->insertItem(QObject::tr("Disconnect",contextName),0);
m->insertItem(QObject::tr("Set offline",contextName),1);
- } else {
+ }
+ else
+ {
m->insertItem(QObject::tr("Set online",contextName),1);
@@ -91,3 +106,4 @@ void POP3viewItem::disconnect()
QListViewItem *child = firstChild();
- while ( child ) {
+ while ( child )
+ {
QListViewItem *tmp = child;
@@ -101,3 +117,4 @@ void POP3viewItem::setOnOffline()
{
- if (!account->getOffline()) {
+ if (!account->getOffline())
+ {
disconnect();
@@ -112,3 +129,4 @@ void POP3viewItem::contextMenuSelected(int which)
{
- switch (which) {
+ switch (which)
+ {
case 0:
@@ -123,7 +141,6 @@ void POP3viewItem::contextMenuSelected(int which)
POP3folderItem::~POP3folderItem()
-{
-}
+{}
POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after )
- : AccountViewItem( parent,after )
+ : AccountViewItem( parent,after )
{
@@ -131,5 +148,8 @@ POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QList
pop3 = parent;
- if (folder->getDisplayName().lower()!="inbox") {
+ if (folder->getDisplayName().lower()!="inbox")
+ {
setPixmap( 0, PIXMAP_POP3FOLDER );
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_INBOXFOLDER);
@@ -153,3 +173,4 @@ QPopupMenu * POP3folderItem::getContextMenu()
QPopupMenu *m = new QPopupMenu(0);
- if (m) {
+ if (m)
+ {
m->insertItem(QObject::tr("Refresh header list",contextName),0);
@@ -171,3 +192,4 @@ void POP3folderItem::contextMenuSelected(int which)
AccountView * view = (AccountView*)listView();
- switch (which) {
+ switch (which)
+ {
case 0:
@@ -192,3 +214,3 @@ void POP3folderItem::contextMenuSelected(int which)
IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
- : AccountViewItem( parent )
+ : AccountViewItem( parent )
{
@@ -224,3 +246,3 @@ void IMAPviewItem::refreshFolders(bool force)
if (childCount()>0 && force==false) return;
- if (account->getOffline()) return;
+ if (account->getOffline()) return;
@@ -238,4 +260,6 @@ void IMAPviewItem::refreshFolders(bool force)
- for ( it = folders->first(); it; it = folders->next() ) {
- if (it->getDisplayName().lower()=="inbox") {
+ for ( it = folders->first(); it; it = folders->next() )
+ {
+ if (it->getDisplayName().lower()=="inbox")
+ {
item = new IMAPfolderItem( it, this , item );
@@ -246,3 +270,4 @@ void IMAPviewItem::refreshFolders(bool force)
}
- for ( it = folders->first(); it; it = folders->next() ) {
+ for ( it = folders->first(); it; it = folders->next() )
+ {
fname = it->getDisplayName();
@@ -250,3 +275,4 @@ void IMAPviewItem::refreshFolders(bool force)
pos = fname.findRev(it->Separator());
- if (pos != -1) {
+ if (pos != -1)
+ {
fname = fname.left(pos);
@@ -254,3 +280,4 @@ void IMAPviewItem::refreshFolders(bool force)
IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname);
- if (pitem) {
+ if (pitem)
+ {
titem = item;
@@ -260,3 +287,5 @@ void IMAPviewItem::refreshFolders(bool force)
item = titem;
- } else {
+ }
+ else
+ {
item = new IMAPfolderItem( it, this , item );
@@ -270,4 +299,6 @@ QPopupMenu * IMAPviewItem::getContextMenu()
QPopupMenu *m = new QPopupMenu(0);
- if (m) {
- if (!account->getOffline()) {
+ if (m)
+ {
+ if (!account->getOffline())
+ {
m->insertItem(QObject::tr("Refresh folder list",contextName),0);
@@ -277,3 +308,5 @@ QPopupMenu * IMAPviewItem::getContextMenu()
m->insertItem(QObject::tr("Set offline",contextName),3);
- } else {
+ }
+ else
+ {
m->insertItem(QObject::tr("Set online",contextName),3);
@@ -287,4 +320,4 @@ void IMAPviewItem::createNewFolder()
Newmdirdlg ndirdlg;
- ndirdlg.showMaximized();
- if (ndirdlg.exec()) {
+ if ( QPEApplication::execDialog( &ndirdlg ))
+ {
QString ndir = ndirdlg.Newdir();
@@ -293,6 +326,8 @@ void IMAPviewItem::createNewFolder()
IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
- if (item) {
+ if (item)
+ {
delemiter = item->Delemiter();
}
- if (wrapper->createMbox(ndir,0,delemiter,makesubs)) {
+ if (wrapper->createMbox(ndir,0,delemiter,makesubs))
+ {
refreshFolders(true);
@@ -305,3 +340,4 @@ void IMAPviewItem::contextMenuSelected(int id)
qDebug("Id selected: %i",id);
- switch (id) {
+ switch (id)
+ {
case 0:
@@ -317,3 +353,4 @@ void IMAPviewItem::contextMenuSelected(int id)
case 3:
- if (account->getOffline()==false) {
+ if (account->getOffline()==false)
+ {
removeChilds();
@@ -325,3 +362,3 @@ void IMAPviewItem::contextMenuSelected(int id)
refreshFolders(false);
- break;
+ break;
default:
@@ -342,3 +379,3 @@ bool IMAPviewItem::offline()
IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after )
- : AccountViewItem( parent , after )
+ : AccountViewItem( parent , after )
{
@@ -346,5 +383,8 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QList
imap = parent;
- if (folder->getDisplayName().lower()!="inbox") {
+ if (folder->getDisplayName().lower()!="inbox")
+ {
setPixmap( 0, PIXMAP_IMAPFOLDER );
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_INBOXFOLDER);
@@ -355,3 +395,3 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QList
IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master )
- : AccountViewItem( parent,after )
+ : AccountViewItem( parent,after )
{
@@ -359,5 +399,8 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QLi
imap = master;
- if (folder->getDisplayName().lower()!="inbox") {
+ if (folder->getDisplayName().lower()!="inbox")
+ {
setPixmap( 0, PIXMAP_IMAPFOLDER );
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_INBOXFOLDER);
@@ -368,4 +411,3 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QLi
IMAPfolderItem::~IMAPfolderItem()
-{
-}
+{}
@@ -378,5 +420,8 @@ void IMAPfolderItem::refresh(QList<RecMail>&target)
{
- if (folder->may_select()) {
+ if (folder->may_select())
+ {
imap->getWrapper()->listMessages( folder->getName(),target );
- } else {
+ }
+ else
+ {
target.clear();
@@ -393,4 +438,6 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
QPopupMenu *m = new QPopupMenu(0);
- if (m) {
- if (folder->may_select()) {
+ if (m)
+ {
+ if (folder->may_select())
+ {
m->insertItem(QObject::tr("Refresh header list",contextName),0);
@@ -399,6 +446,8 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
}
- if (folder->no_inferior()==false) {
+ if (folder->no_inferior()==false)
+ {
m->insertItem(QObject::tr("Create new subfolder",contextName),2);
}
- if (folder->getDisplayName().lower()!="inbox") {
+ if (folder->getDisplayName().lower()!="inbox")
+ {
m->insertItem(QObject::tr("Delete folder",contextName),3);
@@ -412,4 +461,4 @@ void IMAPfolderItem::createNewFolder()
Newmdirdlg ndirdlg;
- ndirdlg.showMaximized();
- if (ndirdlg.exec()) {
+ if ( QPEApplication::execDialog( &ndirdlg ) )
+ {
QString ndir = ndirdlg.Newdir();
@@ -417,3 +466,4 @@ void IMAPfolderItem::createNewFolder()
QString delemiter = Delemiter();
- if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) {
+ if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
+ {
imap->refreshFolders(true);
@@ -426,8 +476,10 @@ void IMAPfolderItem::deleteFolder()
int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
- QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
- QObject::tr("Yes",contextName),
- QObject::tr("No",contextName),QString::null,1,1);
+ QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
+ QObject::tr("Yes",contextName),
+ QObject::tr("No",contextName),QString::null,1,1);
qDebug("Auswahl: %i",yesno);
- if (yesno == 0) {
- if (imap->getWrapper()->deleteMbox(folder)) {
+ if (yesno == 0)
+ {
+ if (imap->getWrapper()->deleteMbox(folder))
+ {
QListView*v=listView();
@@ -437,3 +489,4 @@ void IMAPfolderItem::deleteFolder()
imap->refreshFolders(true);
- if (v) {
+ if (v)
+ {
v->setSelected(box,true);
@@ -455,3 +508,4 @@ void IMAPfolderItem::contextMenuSelected(int id)
AccountView * view = (AccountView*)listView();
- switch(id) {
+ switch(id)
+ {
case 0:
@@ -482,3 +536,3 @@ void IMAPfolderItem::contextMenuSelected(int id)
MHviewItem::MHviewItem( const QString&aPath, AccountView *parent )
- : AccountViewItem( parent )
+ : AccountViewItem( parent )
{
@@ -520,6 +574,8 @@ void MHviewItem::refresh(bool force)
int pos;
- for ( it = folders->first(); it; it = folders->next() ) {
+ for ( it = folders->first(); it; it = folders->next() )
+ {
fname = it->getDisplayName();
/* this folder itself */
- if (fname=="/") {
+ if (fname=="/")
+ {
currentFolders.append(fname);
@@ -530,11 +586,17 @@ void MHviewItem::refresh(bool force)
pos = fname.findRev("/");
- if (pos > 0) {
+ if (pos > 0)
+ {
fname = fname.left(pos);
pmaster = (MHfolderItem*)findSubItem(fname);
- } else {
+ }
+ else
+ {
pmaster = 0;
}
- if (pmaster) {
+ if (pmaster)
+ {
item = new MHfolderItem( it, pmaster, item, this );
- } else {
+ }
+ else
+ {
item = new MHfolderItem( it, this , item );
@@ -557,3 +619,4 @@ QPopupMenu * MHviewItem::getContextMenu()
QPopupMenu *m = new QPopupMenu(0);
- if (m) {
+ if (m)
+ {
m->insertItem(QObject::tr("Refresh folder list",contextName),0);
@@ -569,6 +632,7 @@ void MHviewItem::createFolder()
Newmdirdlg ndirdlg(0,0,true);
- ndirdlg.showMaximized();
- if (ndirdlg.exec()) {
+ if ( QPEApplication::execDialog( &ndirdlg ) )
+ {
QString ndir = ndirdlg.Newdir();
- if (wrapper->createMbox(ndir)) {
+ if (wrapper->createMbox(ndir))
+ {
refresh(true);
@@ -592,3 +656,4 @@ void MHviewItem::contextMenuSelected(int which)
{
- switch (which) {
+ switch (which)
+ {
case 0:
@@ -611,7 +676,6 @@ void MHviewItem::contextMenuSelected(int which)
MHfolderItem::~MHfolderItem()
-{
-}
+{}
MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after )
- : AccountViewItem( parent,after )
+ : AccountViewItem( parent,after )
{
@@ -623,3 +687,3 @@ MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewIt
MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master)
- : AccountViewItem( parent,after )
+ : AccountViewItem( parent,after )
{
@@ -633,3 +697,4 @@ void MHfolderItem::initName()
QString bName = folder->getDisplayName();
- if (bName.startsWith("/")&&bName.length()>1) {
+ if (bName.startsWith("/")&&bName.length()>1)
+ {
bName.replace(0,1,"");
@@ -637,12 +702,18 @@ void MHfolderItem::initName()
int pos = bName.findRev("/");
- if (pos > 0) {
+ if (pos > 0)
+ {
bName.replace(0,pos+1,"");
}
- if (bName.lower() == "outgoing") {
+ if (bName.lower() == "outgoing")
+ {
setPixmap( 0, PIXMAP_OUTBOXFOLDER );
- } else if (bName.lower() == "inbox") {
+ }
+ else if (bName.lower() == "inbox")
+ {
setPixmap( 0, PIXMAP_INBOXFOLDER);
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_MBOXFOLDER );
- }
+ }
setText( 0, bName );
@@ -669,8 +740,10 @@ void MHfolderItem::deleteFolder()
int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
- QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
- QObject::tr("Yes",contextName),
- QObject::tr("No",contextName),QString::null,1,1);
+ QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
+ QObject::tr("Yes",contextName),
+ QObject::tr("No",contextName),QString::null,1,1);
qDebug("Auswahl: %i",yesno);
- if (yesno == 0) {
- if (mbox->getWrapper()->deleteMbox(folder)) {
+ if (yesno == 0)
+ {
+ if (mbox->getWrapper()->deleteMbox(folder))
+ {
QListView*v=listView();
@@ -680,3 +753,4 @@ void MHfolderItem::deleteFolder()
mbox->refresh(true);
- if (v) {
+ if (v)
+ {
v->setSelected(box,true);
@@ -690,3 +764,4 @@ QPopupMenu * MHfolderItem::getContextMenu()
QPopupMenu *m = new QPopupMenu(0);
- if (m) {
+ if (m)
+ {
m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
@@ -709,6 +784,7 @@ void MHfolderItem::createFolder()
Newmdirdlg ndirdlg(0,0,true);
- ndirdlg.showMaximized();
- if (ndirdlg.exec()) {
+ if ( QPEApplication::execDialog( &ndirdlg ) )
+ {
QString ndir = ndirdlg.Newdir();
- if (mbox->getWrapper()->createMbox(ndir,folder)) {
+ if (mbox->getWrapper()->createMbox(ndir,folder))
+ {
QListView*v=listView();
@@ -718,3 +794,4 @@ void MHfolderItem::createFolder()
mbox->refresh(true);
- if (v) {
+ if (v)
+ {
v->setSelected(box,true);
@@ -727,3 +804,4 @@ void MHfolderItem::contextMenuSelected(int which)
{
- switch(which) {
+ switch(which)
+ {
case 0:
@@ -751,4 +829,4 @@ const QString AccountViewItem::contextName="AccountViewItem";
-AccountViewItem::AccountViewItem( AccountView *parent )
- : QListViewItem( parent )
+AccountViewItem::AccountViewItem( AccountView *parent )
+ : QListViewItem( parent )
{
@@ -759,3 +837,3 @@ AccountViewItem::AccountViewItem( AccountView *parent )
AccountViewItem::AccountViewItem( QListViewItem *parent)
- : QListViewItem( parent)
+ : QListViewItem( parent)
{
@@ -765,3 +843,3 @@ AccountViewItem::AccountViewItem( QListViewItem *parent)
AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
- :QListViewItem( parent,after )
+ :QListViewItem( parent,after )
{
@@ -792,9 +870,11 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder)
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);
+ 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);
qDebug("Auswahl: %i",yesno);
- if (yesno == 0) {
- if (wrapper->deleteAllMail(folder)) {
+ if (yesno == 0)
+ {
+ if (wrapper->deleteAllMail(folder))
+ {
AccountView * view = (AccountView*)listView();
@@ -808,3 +888,4 @@ void AccountViewItem::removeChilds()
QListViewItem *child = firstChild();
- while ( child ) {
+ while ( child )
+ {
QListViewItem *tmp = child;
@@ -827,9 +908,13 @@ AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*
else pitem = (AccountViewItem*)start->firstChild();
- while (pitem) {
- if (pitem->matchName(path)) {
+ while (pitem)
+ {
+ if (pitem->matchName(path))
+ {
break;
}
- if (pitem->childCount()>0) {
+ if (pitem->childCount()>0)
+ {
sitem = findSubItem(path,pitem);
- if (sitem) {
+ if (sitem)
+ {
pitem = sitem;