summaryrefslogtreecommitdiff
path: root/noncore/net/mail
authorar <ar>2004-02-21 15:27:41 (UTC)
committer ar <ar>2004-02-21 15:27:41 (UTC)
commit460258f203be746ff79e14f32a823f381b8ea513 (patch) (side-by-side diff)
tree87dddbacda3050027d343730cf021b53045e80cb /noncore/net/mail
parent76b70b355d2c1c32c0f74e844e0654e39db2a175 (diff)
downloadopie-460258f203be746ff79e14f32a823f381b8ea513.zip
opie-460258f203be746ff79e14f32a823f381b8ea513.tar.gz
opie-460258f203be746ff79e14f32a823f381b8ea513.tar.bz2
improve support for BigScreen
Diffstat (limited to 'noncore/net/mail') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp259
-rw-r--r--noncore/net/mail/accountview.cpp40
-rw-r--r--noncore/net/mail/addresspicker.cpp54
-rw-r--r--noncore/net/mail/editaccounts.cpp153
-rw-r--r--noncore/net/mail/opiemail.cpp101
-rw-r--r--noncore/net/mail/viewmail.cpp151
6 files changed, 499 insertions, 259 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,12 +1,18 @@
+
#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>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailwrapper.h>
-#include "defines.h"
+#include <qpe/qpeapplication.h>
+
+/* QT */
+#include <qpopupmenu.h>
+#include <qmessagebox.h>
#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
@@ -21,7 +27,10 @@ POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
SETPIX(PIXMAP_POP3FOLDER);
#if 0
- if (!account->getOffline()) {
+ if (!account->getOffline())
+ {
setPixmap( 0, );
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_OFFLINE );
}
@@ -51,5 +60,6 @@ void POP3viewItem::refresh()
QList<Folder> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
- while ( child ) {
+ while ( child )
+ {
QListViewItem *tmp = child;
child = child->nextSibling();
@@ -58,5 +68,6 @@ void POP3viewItem::refresh()
Folder *it;
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 );
item->setSelectable(it->may_select());
@@ -76,9 +87,13 @@ 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);
}
@@ -90,5 +105,6 @@ void POP3viewItem::disconnect()
{
QListViewItem *child = firstChild();
- while ( child ) {
+ while ( child )
+ {
QListViewItem *tmp = child;
child = child->nextSibling();
@@ -100,5 +116,6 @@ void POP3viewItem::disconnect()
void POP3viewItem::setOnOffline()
{
- if (!account->getOffline()) {
+ if (!account->getOffline())
+ {
disconnect();
}
@@ -111,5 +128,6 @@ void POP3viewItem::setOnOffline()
void POP3viewItem::contextMenuSelected(int which)
{
- switch (which) {
+ switch (which)
+ {
case 0:
disconnect();
@@ -122,6 +140,5 @@ void POP3viewItem::contextMenuSelected(int which)
POP3folderItem::~POP3folderItem()
-{
-}
+{}
POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after )
@@ -130,7 +147,10 @@ POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QList
folder = folderInit;
pop3 = parent;
- if (folder->getDisplayName().lower()!="inbox") {
+ if (folder->getDisplayName().lower()!="inbox")
+ {
setPixmap( 0, PIXMAP_POP3FOLDER );
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
@@ -152,5 +172,6 @@ QPopupMenu * POP3folderItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
- if (m) {
+ if (m)
+ {
m->insertItem(QObject::tr("Refresh header list",contextName),0);
m->insertItem(QObject::tr("Delete all mails",contextName),1);
@@ -170,5 +191,6 @@ void POP3folderItem::contextMenuSelected(int which)
{
AccountView * view = (AccountView*)listView();
- switch (which) {
+ switch (which)
+ {
case 0:
/* must be 'cause pop3 lists are cached */
@@ -237,6 +259,8 @@ void IMAPviewItem::refreshFolders(bool force)
folders->setAutoDelete(false);
- 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 );
folders->remove(it);
@@ -245,13 +269,16 @@ void IMAPviewItem::refreshFolders(bool force)
}
}
- for ( it = folders->first(); it; it = folders->next() ) {
+ for ( it = folders->first(); it; it = folders->next() )
+ {
fname = it->getDisplayName();
currentFolders.append(it->getName());
pos = fname.findRev(it->Separator());
- if (pos != -1) {
+ if (pos != -1)
+ {
fname = fname.left(pos);
}
IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname);
- if (pitem) {
+ if (pitem)
+ {
titem = item;
item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this);
@@ -259,5 +286,7 @@ void IMAPviewItem::refreshFolders(bool force)
item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1));
item = titem;
- } else {
+ }
+ else
+ {
item = new IMAPfolderItem( it, this , item );
}
@@ -269,6 +298,8 @@ 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);
m->insertItem(QObject::tr("Create new folder",contextName),1);
@@ -276,5 +307,7 @@ QPopupMenu * IMAPviewItem::getContextMenu()
m->insertItem(QObject::tr("Disconnect",contextName),2);
m->insertItem(QObject::tr("Set offline",contextName),3);
- } else {
+ }
+ else
+ {
m->insertItem(QObject::tr("Set online",contextName),3);
}
@@ -286,14 +319,16 @@ void IMAPviewItem::createNewFolder()
{
Newmdirdlg ndirdlg;
- ndirdlg.showMaximized();
- if (ndirdlg.exec()) {
+ if ( QPEApplication::execDialog( &ndirdlg ))
+ {
QString ndir = ndirdlg.Newdir();
bool makesubs = ndirdlg.subpossible();
QString delemiter = "/";
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);
}
@@ -304,5 +339,6 @@ void IMAPviewItem::contextMenuSelected(int id)
{
qDebug("Id selected: %i",id);
- switch (id) {
+ switch (id)
+ {
case 0:
refreshFolders(true);
@@ -316,5 +352,6 @@ void IMAPviewItem::contextMenuSelected(int id)
break;
case 3:
- if (account->getOffline()==false) {
+ if (account->getOffline()==false)
+ {
removeChilds();
wrapper->logout();
@@ -345,7 +382,10 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QList
folder = folderInit;
imap = parent;
- if (folder->getDisplayName().lower()!="inbox") {
+ if (folder->getDisplayName().lower()!="inbox")
+ {
setPixmap( 0, PIXMAP_IMAPFOLDER );
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
@@ -358,7 +398,10 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QLi
folder = folderInit;
imap = master;
- if (folder->getDisplayName().lower()!="inbox") {
+ if (folder->getDisplayName().lower()!="inbox")
+ {
setPixmap( 0, PIXMAP_IMAPFOLDER );
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
@@ -367,6 +410,5 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QLi
IMAPfolderItem::~IMAPfolderItem()
-{
-}
+{}
const QString& IMAPfolderItem::Delemiter()const
@@ -377,7 +419,10 @@ const QString& IMAPfolderItem::Delemiter()const
void IMAPfolderItem::refresh(QList<RecMail>&target)
{
- if (folder->may_select()) {
+ if (folder->may_select())
+ {
imap->getWrapper()->listMessages( folder->getName(),target );
- } else {
+ }
+ else
+ {
target.clear();
}
@@ -392,14 +437,18 @@ 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);
m->insertItem(QObject::tr("Move/Copie all mails",contextName),4);
m->insertItem(QObject::tr("Delete all mails",contextName),1);
}
- 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);
}
@@ -411,10 +460,11 @@ void IMAPfolderItem::createNewFolder()
{
Newmdirdlg ndirdlg;
- ndirdlg.showMaximized();
- if (ndirdlg.exec()) {
+ if ( QPEApplication::execDialog( &ndirdlg ) )
+ {
QString ndir = ndirdlg.Newdir();
bool makesubs = ndirdlg.subpossible();
QString delemiter = Delemiter();
- if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) {
+ if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
+ {
imap->refreshFolders(true);
}
@@ -429,6 +479,8 @@ void IMAPfolderItem::deleteFolder()
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();
IMAPviewItem * box = imap;
@@ -436,5 +488,6 @@ void IMAPfolderItem::deleteFolder()
* any member of it after that call!!*/
imap->refreshFolders(true);
- if (v) {
+ if (v)
+ {
v->setSelected(box,true);
}
@@ -454,5 +507,6 @@ void IMAPfolderItem::contextMenuSelected(int id)
qDebug("Selected id: %i",id);
AccountView * view = (AccountView*)listView();
- switch(id) {
+ switch(id)
+ {
case 0:
view->refreshCurrent();
@@ -519,8 +573,10 @@ void MHviewItem::refresh(bool force)
QString fname = "";
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);
folder = it;
@@ -529,13 +585,19 @@ void MHviewItem::refresh(bool force)
currentFolders.append(fname);
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 );
}
@@ -556,5 +618,6 @@ QPopupMenu * MHviewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
- if (m) {
+ if (m)
+ {
m->insertItem(QObject::tr("Refresh folder list",contextName),0);
m->insertItem(QObject::tr("Create new folder",contextName),1);
@@ -568,8 +631,9 @@ 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);
}
@@ -591,5 +655,6 @@ QStringList MHviewItem::subFolders()
void MHviewItem::contextMenuSelected(int which)
{
- switch (which) {
+ switch (which)
+ {
case 0:
refresh(true);
@@ -610,6 +675,5 @@ void MHviewItem::contextMenuSelected(int which)
MHfolderItem::~MHfolderItem()
-{
-}
+{}
MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after )
@@ -632,16 +696,23 @@ void MHfolderItem::initName()
{
QString bName = folder->getDisplayName();
- if (bName.startsWith("/")&&bName.length()>1) {
+ if (bName.startsWith("/")&&bName.length()>1)
+ {
bName.replace(0,1,"");
}
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 );
}
@@ -672,6 +743,8 @@ void MHfolderItem::deleteFolder()
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();
MHviewItem * box = mbox;
@@ -679,5 +752,6 @@ void MHfolderItem::deleteFolder()
* any member of it after that call!!*/
mbox->refresh(true);
- if (v) {
+ if (v)
+ {
v->setSelected(box,true);
}
@@ -689,5 +763,6 @@ QPopupMenu * MHfolderItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
- if (m) {
+ if (m)
+ {
m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
m->insertItem(QObject::tr("Delete all mails",contextName),0);
@@ -708,8 +783,9 @@ 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();
MHviewItem * box = mbox;
@@ -717,5 +793,6 @@ void MHfolderItem::createFolder()
* any member of it after that call!!*/
mbox->refresh(true);
- if (v) {
+ if (v)
+ {
v->setSelected(box,true);
}
@@ -726,5 +803,6 @@ void MHfolderItem::createFolder()
void MHfolderItem::contextMenuSelected(int which)
{
- switch(which) {
+ switch(which)
+ {
case 0:
deleteAllMail(mbox->getWrapper(),folder);
@@ -796,6 +874,8 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder)
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();
if (view) view->refreshCurrent();
@@ -807,5 +887,6 @@ void AccountViewItem::removeChilds()
{
QListViewItem *child = firstChild();
- while ( child ) {
+ while ( child )
+ {
QListViewItem *tmp = child;
child = child->nextSibling();
@@ -826,11 +907,15 @@ AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*
if (!start) pitem = (AccountViewItem*)firstChild();
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;
break;
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index d9792d4..2ddf834 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -1,12 +1,17 @@
+
#include "accountview.h"
#include "accountitem.h"
#include "selectstore.h"
-#include <qmessagebox.h>
-#include <qpopupmenu.h>
+
+/* OPIE */
#include <libmailwrapper/settings.h>
#include <libmailwrapper/mailwrapper.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
+#include <qpe/qpeapplication.h>
+/* QT */
+#include <qmessagebox.h>
+#include <qpopupmenu.h>
AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
@@ -56,10 +61,14 @@ void AccountView::populate( QList<Account> list )
Account *it;
- for ( it = list.first(); it; it = list.next() ) {
- if ( it->getType().compare( "IMAP" ) == 0 ) {
+ for ( it = list.first(); it; it = list.next() )
+ {
+ if ( it->getType().compare( "IMAP" ) == 0 )
+ {
IMAPaccount *imap = static_cast<IMAPaccount *>(it);
qDebug( "added IMAP " + imap->getAccountName() );
imapAccounts.append(new IMAPviewItem( imap, this ));
- } else if ( it->getType().compare( "POP3" ) == 0 ) {
+ }
+ else if ( it->getType().compare( "POP3" ) == 0 )
+ {
POP3account *pop3 = static_cast<POP3account *>(it);
qDebug( "added POP3 " + pop3->getAccountName() );
@@ -70,8 +79,10 @@ void AccountView::populate( QList<Account> list )
}
-void AccountView::refresh(QListViewItem *item) {
+void AccountView::refresh(QListViewItem *item)
+{
qDebug("AccountView refresh...");
- if ( item ) {
+ if ( item )
+ {
m_currentItem = item;
QList<RecMail> headerlist;
@@ -96,5 +107,4 @@ void AccountView::refreshCurrent()
void AccountView::refreshAll()
{
-
}
@@ -109,13 +119,15 @@ RecBody AccountView::fetchBody(const RecMail&aMail)
void AccountView::setupFolderselect(Selectstore*sels)
{
- sels->showMaximized();
+ QPEApplication::showDialog( sels );
QStringList sFolders;
unsigned int i = 0;
- for (i=0; i < mhAccounts.count();++i) {
+ 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) {
+ for (i=0; i < imapAccounts.count();++i)
+ {
if (imapAccounts[i]->offline())
continue;
@@ -135,8 +147,10 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper)
targetFolder = sels.currentFolder();
if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
- targetFolder.isEmpty()) {
+ targetFolder.isEmpty())
+ {
return;
}
- if (sels.newFolder() && !targetMail->createMbox(targetFolder)) {
+ if (sels.newFolder() && !targetMail->createMbox(targetFolder))
+ {
QMessageBox::critical(0,tr("Error creating new Folder"),
tr("<center>Error while creating<br>new folder - breaking.</center>"));
diff --git a/noncore/net/mail/addresspicker.cpp b/noncore/net/mail/addresspicker.cpp
index f4f4cea..8cdabde 100644
--- a/noncore/net/mail/addresspicker.cpp
+++ b/noncore/net/mail/addresspicker.cpp
@@ -1,2 +1,12 @@
+
+#include "composemail.h"
+
+/* OPIE */
+#include <opie2/ocontactaccess.h>
+#include <opie2/ocontact.h>
+#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qpushbutton.h>
#include <qmessagebox.h>
@@ -5,13 +15,7 @@
#include <qfile.h>
-#include <qpe/resource.h>
-#include <opie2/ocontactaccess.h>
-#include <opie2/ocontact.h>
-
-
+/* STD */
#include <stdlib.h>
-#include "composemail.h"
-
AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags )
: AddressPickerUI( parent, name, modal, flags )
@@ -31,16 +35,22 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl
QString pre,suf;
Opie::OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
- for ( it = m_list.begin(); it != m_list.end(); ++it ) {
- if ((*it).defaultEmail().length()!=0) {
+ for ( it = m_list.begin(); it != m_list.end(); ++it )
+ {
+ if ((*it).defaultEmail().length()!=0)
+ {
mails = (*it).emailList();
- if ((*it).fileAs().length()>0) {
+ if ((*it).fileAs().length()>0)
+ {
pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <";
suf = ">";
- } else {
+ }
+ else
+ {
pre = "";
suf = "";
}
QStringList::ConstIterator sit = mails.begin();
- for (;sit!=mails.end();++sit) {
+ for (;sit!=mails.end();++sit)
+ {
contactLine=pre+(*sit)+suf;
addressList->insertItem(contactLine);
@@ -48,5 +58,6 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl
}
}
- if ( addressList->count() <= 0 ) {
+ if ( addressList->count() <= 0 )
+ {
#if 0
// makes this realy sense??
@@ -56,5 +67,7 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl
addressList->setEnabled( false );
okButton->setEnabled( false );
- } else {
+ }
+ else
+ {
// addressList->sort();
}
@@ -66,5 +79,6 @@ void AddressPicker::accept()
QString names;
- while ( item ) {
+ while ( item )
+ {
if ( item->selected() )
names += item->text() + ", ";
@@ -73,5 +87,6 @@ void AddressPicker::accept()
names.replace( names.length() - 2, 2, "" );
- if ( names.isEmpty() ) {
+ if ( names.isEmpty() )
+ {
QMessageBox::information(this, tr("Error"), tr("<p>You have to select"
" at least one address entry.</p>"), tr("Ok"));
@@ -88,9 +103,8 @@ QString AddressPicker::getNames()
AddressPicker picker(0, 0, true);
- picker.showMaximized();
- picker.show();
- int ret = picker.exec();
- if ( QDialog::Accepted == ret ) {
+ int ret = QPEApplication::execDialog( &picker );
+ if ( QDialog::Accepted == ret )
+ {
return picker.selectedNames;
}
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 1cb202e..60bffa5 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -1,7 +1,12 @@
-#include <qt.h>
#include "defines.h"
#include "editaccounts.h"
+/* OPIE */
+#include <qpe/qpeapplication.h>
+
+/* QT */
+#include <qt.h>
+
AccountListItem::AccountListItem( QListView *parent, Account *a)
: QListViewItem( parent )
@@ -40,8 +45,12 @@ void EditAccounts::slotFillLists()
QList<Account> accounts = settings->getAccounts();
Account *it;
- for ( it = accounts.first(); it; it = accounts.next() ) {
- if ( it->getType().compare( "NNTP" ) == 0 ) {
+ for ( it = accounts.first(); it; it = accounts.next() )
+ {
+ if ( it->getType().compare( "NNTP" ) == 0 )
+ {
(void) new AccountListItem( newsList, it );
- } else {
+ }
+ else
+ {
(void) new AccountListItem( mailList, it );
}
@@ -55,5 +64,6 @@ void EditAccounts::slotNewMail()
SelectMailType selType( selection, this, 0, true );
selType.show();
- if ( QDialog::Accepted == selType.exec() ) {
+ if ( QDialog::Accepted == selType.exec() )
+ {
slotNewAccount( *selection );
}
@@ -62,51 +72,66 @@ void EditAccounts::slotNewMail()
void EditAccounts::slotNewAccount( const QString &type )
{
- if ( type.compare( "IMAP" ) == 0 ) {
+ if ( type.compare( "IMAP" ) == 0 )
+ {
qDebug( "-> config IMAP" );
IMAPaccount *account = new IMAPaccount();
IMAPconfig imap( account, this, 0, true );
- imap.showMaximized();
- if ( QDialog::Accepted == imap.exec() ) {
+ if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) )
+ {
settings->addAccount( account );
account->save();
slotFillLists();
- } else {
+ }
+ else
+ {
account->remove();
}
- } else if ( type.compare( "POP3" ) == 0 ) {
+ }
+ else if ( type.compare( "POP3" ) == 0 )
+ {
qDebug( "-> config POP3" );
POP3account *account = new POP3account();
POP3config pop3( account, this, 0, true, WStyle_ContextHelp );
- pop3.showMaximized();
- if ( QDialog::Accepted == pop3.exec() ) {
+ if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) )
+ {
settings->addAccount( account );
account->save();
slotFillLists();
- } else {
+ }
+ else
+ {
account->remove();
}
- } else if ( type.compare( "SMTP" ) == 0 ) {
+ }
+ else if ( type.compare( "SMTP" ) == 0 )
+ {
qDebug( "-> config SMTP" );
SMTPaccount *account = new SMTPaccount();
SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp );
- smtp.showMaximized();
- if ( QDialog::Accepted == smtp.exec() ) {
+ if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) )
+ {
settings->addAccount( account );
account->save();
slotFillLists();
- } else {
+ }
+ else
+ {
account->remove();
}
- } else if ( type.compare( "NNTP" ) == 0 ) {
+ }
+ else if ( type.compare( "NNTP" ) == 0 )
+ {
qDebug( "-> config NNTP" );
NNTPaccount *account = new NNTPaccount();
NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp );
- nntp.showMaximized();
- if ( QDialog::Accepted == nntp.exec() ) {
+ if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) )
+ {
settings->addAccount( account );
account->save();
slotFillLists();
- } else {
+ }
+ else
+ {
account->remove();
}
@@ -116,30 +141,37 @@ void EditAccounts::slotNewAccount( const QString &type )
void EditAccounts::slotEditAccount( Account *account )
{
- if ( account->getType().compare( "IMAP" ) == 0 ) {
+ if ( account->getType().compare( "IMAP" ) == 0 )
+ {
IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp );
- imap.showMaximized();
- if ( QDialog::Accepted == imap.exec() ) {
+ if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) )
+ {
slotFillLists();
}
- } else if ( account->getType().compare( "POP3" ) == 0 ) {
+ }
+ else if ( account->getType().compare( "POP3" ) == 0 )
+ {
POP3account *pop3Acc = static_cast<POP3account *>(account);
POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp );
- pop3.showMaximized();
- if ( QDialog::Accepted == pop3.exec() ) {
+ if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) )
+ {
slotFillLists();
}
- } else if ( account->getType().compare( "SMTP" ) == 0 ) {
+ }
+ else if ( account->getType().compare( "SMTP" ) == 0 )
+ {
SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account);
SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp );
- smtp.showMaximized();
- if ( QDialog::Accepted == smtp.exec() ) {
+ if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) )
+ {
slotFillLists();
}
- } else if ( account->getType().compare( "NNTP" ) == 0 ) {
+ }
+ else if ( account->getType().compare( "NNTP" ) == 0 )
+ {
NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
- nntp.showMaximized();
- if ( QDialog::Accepted == nntp.exec() ) {
+ if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) )
+ {
slotFillLists();
}
@@ -151,5 +183,6 @@ void EditAccounts::slotDeleteAccount( Account *account )
if ( QMessageBox::information( this, tr( "Question" ),
tr( "<p>Do you really want to delete the selected Account?</p>" ),
- tr( "Yes" ), tr( "No" ) ) == 0 ) {
+ tr( "Yes" ), tr( "No" ) ) == 0 )
+ {
settings->delAccount( account );
slotFillLists();
@@ -160,5 +193,6 @@ void EditAccounts::slotEditMail()
{
qDebug( "Edit Mail Account" );
- if ( !mailList->currentItem() ) {
+ if ( !mailList->currentItem() )
+ {
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
@@ -173,5 +207,6 @@ void EditAccounts::slotEditMail()
void EditAccounts::slotDeleteMail()
{
- if ( !mailList->currentItem() ) {
+ if ( !mailList->currentItem() )
+ {
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
@@ -193,5 +228,6 @@ void EditAccounts::slotEditNews()
{
qDebug( "Edit News Account" );
- if ( !newsList->currentItem() ) {
+ if ( !newsList->currentItem() )
+ {
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
@@ -207,5 +243,6 @@ void EditAccounts::slotDeleteNews()
{
qDebug( "Delete News Account" );
- if ( !newsList->currentItem() ) {
+ if ( !newsList->currentItem() )
+ {
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
@@ -278,10 +315,15 @@ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name,
void IMAPconfig::slotConnectionToggle( int index )
{
- if ( index == 2 ) {
+ if ( index == 2 )
+ {
portLine->setText( IMAP_SSL_PORT );
- } else if ( index == 3 ) {
+ }
+ else if ( index == 3 )
+ {
portLine->setText( IMAP_PORT );
CommandEdit->show();
- } else {
+ }
+ else
+ {
portLine->setText( IMAP_PORT );
}
@@ -334,10 +376,15 @@ void POP3config::slotConnectionToggle( int index )
{
// 2 is ssl connection
- if ( index == 2 ) {
+ if ( index == 2 )
+ {
portLine->setText( POP3_SSL_PORT );
- } else if ( index == 3 ) {
+ }
+ else if ( index == 3 )
+ {
portLine->setText( POP3_PORT );
CommandEdit->show();
- } else {
+ }
+ else
+ {
portLine->setText( POP3_PORT );
}
@@ -392,10 +439,15 @@ void SMTPconfig::slotConnectionToggle( int index )
{
// 2 is ssl connection
- if ( index == 2 ) {
+ if ( index == 2 )
+ {
portLine->setText( SMTP_SSL_PORT );
- } else if ( index == 3 ) {
+ }
+ else if ( index == 3 )
+ {
portLine->setText( SMTP_PORT );
CommandEdit->show();
- } else {
+ }
+ else
+ {
portLine->setText( SMTP_PORT );
}
@@ -445,7 +497,10 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name,
void NNTPconfig::slotSSL( bool enabled )
{
- if ( enabled ) {
+ if ( enabled )
+ {
portLine->setText( NNTP_SSL_PORT );
- } else {
+ }
+ else
+ {
portLine->setText( NNTP_PORT );
}
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 0795436..abf93dc 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -1,18 +1,24 @@
-#include <qmessagebox.h>
+
#include "settingsdialog.h"
#include "opiemail.h"
#include "editaccounts.h"
#include "composemail.h"
+#include "mailistviewitem.h"
+#include "viewmail.h"
+#include "selectstore.h"
+#include "selectsmtp.h"
+
+/* OPIE */
#include <libmailwrapper/smtpwrapper.h>
+#include <libmailwrapper/mailtypes.h>
+#include <libmailwrapper/abstractmail.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
+
+/* QT */
+#include <qmessagebox.h>
#include <qaction.h>
#include <qapplication.h>
-#include <libmailwrapper/mailtypes.h>
-#include <libmailwrapper/abstractmail.h>
-#include "mailistviewitem.h"
-#include "viewmail.h"
-#include "selectstore.h"
-#include "selectsmtp.h"
OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
@@ -32,5 +38,6 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
{
// copied from old mail2
- if (msg == "writeMail(QString,QString)") {
+ if (msg == "writeMail(QString,QString)")
+ {
QDataStream stream(data,IO_ReadOnly);
QString name, email;
@@ -38,5 +45,7 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
// removing the whitespaces at beginning and end is needed!
slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
- } else if (msg == "newMail()") {
+ }
+ else if (msg == "newMail()")
+ {
slotComposeMail();
}
@@ -46,14 +55,17 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email)
{
ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
- if (!email.isEmpty()) {
- if (!name.isEmpty()) {
+ if (!email.isEmpty())
+ {
+ if (!name.isEmpty())
+ {
compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
- } else {
+ }
+ else
+ {
compose.setTo(email);
}
}
- compose.showMaximized();
compose.slotAdjustColumns();
- compose.exec();
+ QPEApplication::execDialog( &compose );
}
@@ -73,28 +85,36 @@ void OpieMail::slotSendQueued()
smtpList.setAutoDelete(false);
Account *it;
- for ( it = list.first(); it; it = list.next() ) {
- if ( it->getType().compare( "SMTP" ) == 0 ) {
+ for ( it = list.first(); it; it = list.next() )
+ {
+ if ( it->getType().compare( "SMTP" ) == 0 )
+ {
smtp = static_cast<SMTPaccount *>(it);
smtpList.append(smtp);
}
}
- if (smtpList.count()==0) {
+ if (smtpList.count()==0)
+ {
QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
return;
}
- if (smtpList.count()==1) {
+ if (smtpList.count()==1)
+ {
smtp = smtpList.at(0);
- } else {
+ }
+ else
+ {
smtp = 0;
selectsmtp selsmtp;
selsmtp.setSelectionlist(&smtpList);
- selsmtp.showMaximized();
- if (selsmtp.exec()==QDialog::Accepted) {
+ if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted )
+ {
smtp = selsmtp.selected_smtp();
}
}
- if (smtp) {
+ if (smtp)
+ {
SMTPwrapper * wrap = new SMTPwrapper(smtp);
- if ( wrap->flushOutbox() ) {
+ if ( wrap->flushOutbox() )
+ {
QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
}
@@ -111,6 +131,5 @@ void OpieMail::slotEditSettings()
{
SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
- settingsDialog.showMaximized();
- settingsDialog.exec();
+ QPEApplication::execDialog( &settingsDialog );
}
@@ -119,7 +138,6 @@ void OpieMail::slotEditAccounts()
qDebug( "Edit Accounts" );
EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
- eaDialog.showMaximized();
eaDialog.slotAdjustColumns();
- eaDialog.exec();
+ QPEApplication::execDialog( &eaDialog );
if ( settings ) delete settings;
settings = new Settings();
@@ -140,7 +158,10 @@ void OpieMail::displayMail()
readMail.exec();
- if ( readMail.deleted ) {
+ if ( readMail.deleted )
+ {
folderView->refreshCurrent();
- } else {
+ }
+ else
+ {
( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) );
}
@@ -151,5 +172,6 @@ void OpieMail::slotDeleteMail()
if (!mailView->currentItem()) return;
RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
- if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
+ if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
+ {
mail.Wrapper()->deleteMail( mail );
folderView->refreshCurrent();
@@ -164,5 +186,6 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
if (!item) return;
QPopupMenu *m = new QPopupMenu(0);
- if (m) {
+ if (m)
+ {
m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
@@ -177,8 +200,11 @@ void OpieMail::slotShowFolders( bool show )
{
qDebug( "Show Folders" );
- if ( show && folderView->isHidden() ) {
+ if ( show && folderView->isHidden() )
+ {
qDebug( "-> showing" );
folderView->show();
- } else if ( !show && !folderView->isHidden() ) {
+ }
+ else if ( !show && !folderView->isHidden() )
+ {
qDebug( "-> hiding" );
folderView->hide();
@@ -190,5 +216,6 @@ void OpieMail::refreshMailView(QList<RecMail>*list)
MailListViewItem*item = 0;
mailView->clear();
- for (unsigned int i = 0; i < list->count();++i) {
+ for (unsigned int i = 0; i < list->count();++i)
+ {
item = new MailListViewItem(mailView,item);
item->storeData(*(list->at(i)));
@@ -217,8 +244,10 @@ void OpieMail::slotMoveCopyMail()
targetFolder = sels.currentFolder();
if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) ||
- targetFolder.isEmpty()) {
+ targetFolder.isEmpty())
+ {
return;
}
- if (sels.newFolder() && !targetMail->createMbox(targetFolder)) {
+ if (sels.newFolder() && !targetMail->createMbox(targetFolder))
+ {
QMessageBox::critical(0,tr("Error creating new Folder"),
tr("<center>Error while creating<br>new folder - breaking.</center>"));
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 99965d4..f015228 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -1,2 +1,16 @@
+#include "composemail.h"
+#include "viewmail.h"
+#include "accountview.h"
+
+/* OPIE */
+#include <libmailwrapper/settings.h>
+#include <libmailwrapper/abstractmail.h>
+#include <libmailwrapper/mailtypes.h>
+
+#include <opie2/ofiledialog.h>
+#include <qpe/config.h>
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qtextbrowser.h>
#include <qmessagebox.h>
@@ -8,15 +22,4 @@
#include <qvaluelist.h>
-#include <qpe/config.h>
-
-#include <opie2/ofiledialog.h>
-
-#include <libmailwrapper/settings.h>
-#include "composemail.h"
-#include "viewmail.h"
-#include <libmailwrapper/abstractmail.h>
-#include "accountview.h"
-#include <libmailwrapper/mailtypes.h>
-
AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path)
@@ -47,5 +50,6 @@ bool AttachItem::isParentof(const QValueList<int>&path)
/* the parent must have one digit less then a child */
if (path.count()!=_path.count()+1) return false;
- for (unsigned int i=0; i < _path.count();++i) {
+ for (unsigned int i=0; i < _path.count();++i)
+ {
if (_path[i]!=path[i]) return false;
}
@@ -56,5 +60,6 @@ AttachItem* ViewMail::searchParent(const QValueList<int>&path)
{
QListViewItemIterator it( attachments );
- for ( ; it.current(); ++it ) {
+ for ( ; it.current(); ++it )
+ {
AttachItem*ati = (AttachItem*)it.current();
if (ati->isParentof(path)) return ati;
@@ -69,5 +74,6 @@ AttachItem* ViewMail::lastChild(AttachItem*parent)
if (!item) return item;
AttachItem*temp=0;
- while( (temp=(AttachItem*)item->nextSibling())) {
+ while( (temp=(AttachItem*)item->nextSibling()))
+ {
item = temp;
}
@@ -75,5 +81,6 @@ AttachItem* ViewMail::lastChild(AttachItem*parent)
}
-void ViewMail::setBody( RecBody body ) {
+void ViewMail::setBody( RecBody body )
+{
m_body = body;
@@ -81,5 +88,6 @@ m_mail[2] = body.Bodytext();
attachbutton->setEnabled(body.Parts().count()>0);
attachments->setEnabled(body.Parts().count()>0);
-if (body.Parts().count()==0) {
+ if (body.Parts().count()==0)
+ {
return;
}
@@ -92,5 +100,6 @@ int w;
w=0;
-while (s>1024) {
+ while (s>1024)
+ {
s/=1024;
++w;
@@ -99,5 +108,6 @@ while (s>1024) {
QString q="";
-switch(w) {
+ switch(w)
+ {
case 1:
q="k";
@@ -125,10 +135,13 @@ curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body.Desc
QString filename = "";
-for (unsigned int i = 0; i < body.Parts().count();++i) {
+ for (unsigned int i = 0; i < body.Parts().count();++i)
+ {
type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype();
part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin();
- for (;it!=body.Parts()[i].Parameters().end();++it) {
+ for (;it!=body.Parts()[i].Parameters().end();++it)
+ {
qDebug(it.key());
- if (it.key().lower()=="name") {
+ if (it.key().lower()=="name")
+ {
filename=it.data();
}
@@ -136,10 +149,12 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
s = body.Parts()[i].Size();
w = 0;
- while (s>1024) {
+ while (s>1024)
+ {
s/=1024;
++w;
if (w>=2) break;
}
- switch(w) {
+ switch(w)
+ {
case 1:
q="k";
@@ -158,5 +173,6 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
desc = body.Parts()[i].Description();
parentItem = searchParent(body.Parts()[i].Positionlist());
- if (parentItem) {
+ if (parentItem)
+ {
AttachItem*temp = lastChild(parentItem);
if (temp) curItem = temp;
@@ -164,5 +180,7 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
attachments->setRootIsDecorated(true);
curItem = parentItem;
- } else {
+ }
+ else
+ {
curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist());
}
@@ -171,14 +189,17 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
-void ViewMail::slotShowHtml( bool state ) {
+void ViewMail::slotShowHtml( bool state )
+{
m_showHtml = state;
setText();
}
-void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) {
+void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
+{
if (!item )
return;
- if ( ( ( AttachItem* )item )->Partnumber() == -1 ) {
+ if ( ( ( AttachItem* )item )->Partnumber() == -1 )
+ {
setText();
return;
@@ -187,5 +208,6 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
int ret=0;
- if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) {
+ if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
+ {
menu->insertItem( tr( "Show Text" ), 1 );
}
@@ -195,14 +217,18 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
ret = menu->exec( point, 0 );
- switch(ret) {
+ switch(ret)
+ {
case 0:
- { MimeTypes types;
+ {
+ MimeTypes types;
types.insert( "all", "*" );
QString str = Opie::OFileDialog::getSaveFileName( 1,
"/", item->text( 2 ) , types, 0 );
- if( !str.isEmpty() ) {
+ if( !str.isEmpty() )
+ {
encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
- if (content) {
+ if (content)
+ {
QFile output(str);
output.open(IO_WriteOnly);
@@ -216,8 +242,12 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
case 1:
- if ( ( ( AttachItem* )item )->Partnumber() == -1 ) {
+ if ( ( ( AttachItem* )item )->Partnumber() == -1 )
+ {
setText();
- } else {
- if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions
+ }
+ else
+ {
+ if ( m_recMail.Wrapper() != 0l )
+ { // make sure that there is a wrapper , even after delete or simular actions
browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
}
@@ -229,5 +259,6 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
-void ViewMail::setMail( RecMail mail ) {
+void ViewMail::setMail( RecMail mail )
+{
m_recMail = mail;
@@ -265,5 +296,6 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
}
-void ViewMail::readConfig() {
+void ViewMail::readConfig()
+{
Config cfg( "mail" );
cfg.setGroup( "Settings" );
@@ -279,11 +311,14 @@ void ViewMail::setText()
QString bccString;
- for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) {
+ for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
+ {
toString += (*it);
}
- for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) {
+ for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it )
+ {
ccString += (*it);
}
- for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) {
+ for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it )
+ {
bccString += (*it);
}
@@ -301,7 +336,10 @@ void ViewMail::setText()
"</td></tr></table><font face=fixed>";
- if ( !m_showHtml ) {
+ if ( !m_showHtml )
+ {
browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
- } else {
+ }
+ else
+ {
browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
}
@@ -321,5 +359,6 @@ void ViewMail::hide()
QWidget::hide();
- if (_inLoop) {
+ if (_inLoop)
+ {
_inLoop = false;
qApp->exit_loop();
@@ -333,5 +372,6 @@ void ViewMail::exec()
show();
- if (!_inLoop) {
+ if (!_inLoop)
+ {
_inLoop = true;
qApp->enter_loop();
@@ -352,5 +392,6 @@ QString ViewMail::deHtml(const QString &string)
void ViewMail::slotReply()
{
- if (!m_gotBody) {
+ if (!m_gotBody)
+ {
QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok"));
return;
@@ -365,5 +406,6 @@ void ViewMail::slotReply()
QStringList lines = QStringList::split(QRegExp("\\n"), text);
QStringList::Iterator it;
- for (it = lines.begin(); it != lines.end(); it++) {
+ for (it = lines.begin(); it != lines.end(); it++)
+ {
rtext += "> " + *it + "\n";
}
@@ -379,6 +421,6 @@ void ViewMail::slotReply()
composer.setSubject( "Re: " + m_mail[1] );
composer.setMessage( rtext );
- composer.showMaximized();
- if ( QDialog::Accepted==composer.exec()) {
+ if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) )
+ {
m_recMail.Wrapper()->answeredMail(m_recMail);
}
@@ -387,5 +429,6 @@ void ViewMail::slotReply()
void ViewMail::slotForward()
{
- if (!m_gotBody) {
+ if (!m_gotBody)
+ {
QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok"));
return;
@@ -414,7 +457,6 @@ void ViewMail::slotForward()
composer.setSubject( "Fwd: " + m_mail[1] );
composer.setMessage( ftext );
- composer.showMaximized();
- if ( QDialog::Accepted==composer.exec()) {
-
+ if ( QDialog::Accepted == QPEApplication::execDialog( &composer ))
+ {
}
}
@@ -422,5 +464,6 @@ void ViewMail::slotForward()
void ViewMail::slotDeleteMail( )
{
- if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
+ if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
+ {
m_recMail.Wrapper()->deleteMail( m_recMail );
hide();