-rw-r--r-- | noncore/net/mail/accountitem.cpp | 259 | ||||
-rw-r--r-- | noncore/net/mail/accountview.cpp | 40 | ||||
-rw-r--r-- | noncore/net/mail/addresspicker.cpp | 54 | ||||
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 153 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 101 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 151 |
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,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> @@ -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,4 +141,3 @@ void POP3viewItem::contextMenuSelected(int which) POP3folderItem::~POP3folderItem() -{ -} +{} @@ -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: @@ -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(); @@ -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); @@ -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); @@ -430,4 +480,6 @@ void IMAPfolderItem::deleteFolder() 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: @@ -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,4 +676,3 @@ void MHviewItem::contextMenuSelected(int which) MHfolderItem::~MHfolderItem() -{ -} +{} @@ -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,10 +702,16 @@ 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 ); @@ -673,4 +744,6 @@ void MHfolderItem::deleteFolder() 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: @@ -797,4 +875,6 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) 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; 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 +1,2 @@ + #include "accountview.h" @@ -3,4 +4,4 @@ #include "selectstore.h" -#include <qmessagebox.h> -#include <qpopupmenu.h> + +/* OPIE */ #include <libmailwrapper/settings.h> @@ -9,3 +10,7 @@ #include <libmailwrapper/abstractmail.h> +#include <qpe/qpeapplication.h> +/* QT */ +#include <qmessagebox.h> +#include <qpopupmenu.h> @@ -57,4 +62,6 @@ 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); @@ -62,3 +69,5 @@ void AccountView::populate( QList<Account> list ) 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); @@ -71,6 +80,8 @@ 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; @@ -97,3 +108,2 @@ void AccountView::refreshAll() { - } @@ -110,6 +120,7 @@ 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); @@ -118,3 +129,4 @@ void AccountView::setupFolderselect(Selectstore*sels) } - for (i=0; i < imapAccounts.count();++i) { + for (i=0; i < imapAccounts.count();++i) + { if (imapAccounts[i]->offline()) @@ -136,6 +148,8 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) 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"), 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 +1,11 @@ + +#include "composemail.h" + +/* OPIE */ +#include <opie2/ocontactaccess.h> +#include <opie2/ocontact.h> +#include <qpe/resource.h> +#include <qpe/qpeapplication.h> + +/* QT */ #include <qpushbutton.h> @@ -6,11 +16,5 @@ -#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 ) @@ -32,9 +36,14 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl 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 = ""; @@ -43,3 +52,4 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl QStringList::ConstIterator sit = mails.begin(); - for (;sit!=mails.end();++sit) { + for (;sit!=mails.end();++sit) + { contactLine=pre+(*sit)+suf; @@ -49,3 +59,4 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl } - if ( addressList->count() <= 0 ) { + if ( addressList->count() <= 0 ) + { #if 0 @@ -57,3 +68,5 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl okButton->setEnabled( false ); - } else { + } + else + { // addressList->sort(); @@ -67,3 +80,4 @@ void AddressPicker::accept() - while ( item ) { + while ( item ) + { if ( item->selected() ) @@ -74,3 +88,4 @@ void AddressPicker::accept() - if ( names.isEmpty() ) { + if ( names.isEmpty() ) + { QMessageBox::information(this, tr("Error"), tr("<p>You have to select" @@ -89,7 +104,6 @@ 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,2 +1 @@ -#include <qt.h> @@ -5,2 +4,8 @@ +/* OPIE */ +#include <qpe/qpeapplication.h> + +/* QT */ +#include <qt.h> + AccountListItem::AccountListItem( QListView *parent, Account *a) @@ -41,6 +46,10 @@ void EditAccounts::slotFillLists() 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 ); @@ -56,3 +65,4 @@ void EditAccounts::slotNewMail() selType.show(); - if ( QDialog::Accepted == selType.exec() ) { + if ( QDialog::Accepted == selType.exec() ) + { slotNewAccount( *selection ); @@ -63,3 +73,4 @@ void EditAccounts::slotNewAccount( const QString &type ) { - if ( type.compare( "IMAP" ) == 0 ) { + if ( type.compare( "IMAP" ) == 0 ) + { qDebug( "-> config IMAP" ); @@ -67,4 +78,4 @@ void EditAccounts::slotNewAccount( const QString &type ) IMAPconfig imap( account, this, 0, true ); - imap.showMaximized(); - if ( QDialog::Accepted == imap.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) + { settings->addAccount( account ); @@ -72,6 +83,10 @@ void EditAccounts::slotNewAccount( const QString &type ) slotFillLists(); - } else { + } + else + { account->remove(); } - } else if ( type.compare( "POP3" ) == 0 ) { + } + else if ( type.compare( "POP3" ) == 0 ) + { qDebug( "-> config POP3" ); @@ -79,4 +94,4 @@ void EditAccounts::slotNewAccount( const QString &type ) POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); - pop3.showMaximized(); - if ( QDialog::Accepted == pop3.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) + { settings->addAccount( account ); @@ -84,6 +99,10 @@ void EditAccounts::slotNewAccount( const QString &type ) slotFillLists(); - } else { + } + else + { account->remove(); } - } else if ( type.compare( "SMTP" ) == 0 ) { + } + else if ( type.compare( "SMTP" ) == 0 ) + { qDebug( "-> config SMTP" ); @@ -91,4 +110,4 @@ void EditAccounts::slotNewAccount( const QString &type ) SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); - smtp.showMaximized(); - if ( QDialog::Accepted == smtp.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) + { settings->addAccount( account ); @@ -97,6 +116,10 @@ void EditAccounts::slotNewAccount( const QString &type ) - } else { + } + else + { account->remove(); } - } else if ( type.compare( "NNTP" ) == 0 ) { + } + else if ( type.compare( "NNTP" ) == 0 ) + { qDebug( "-> config NNTP" ); @@ -104,4 +127,4 @@ void EditAccounts::slotNewAccount( const QString &type ) NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); - nntp.showMaximized(); - if ( QDialog::Accepted == nntp.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) + { settings->addAccount( account ); @@ -109,3 +132,5 @@ void EditAccounts::slotNewAccount( const QString &type ) slotFillLists(); - } else { + } + else + { account->remove(); @@ -117,28 +142,35 @@ 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(); @@ -152,3 +184,4 @@ void EditAccounts::slotDeleteAccount( Account *account ) 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 ); @@ -161,3 +194,4 @@ void EditAccounts::slotEditMail() qDebug( "Edit Mail Account" ); - if ( !mailList->currentItem() ) { + if ( !mailList->currentItem() ) + { QMessageBox::information( this, tr( "Error" ), @@ -174,3 +208,4 @@ void EditAccounts::slotDeleteMail() { - if ( !mailList->currentItem() ) { + if ( !mailList->currentItem() ) + { QMessageBox::information( this, tr( "Error" ), @@ -194,3 +229,4 @@ void EditAccounts::slotEditNews() qDebug( "Edit News Account" ); - if ( !newsList->currentItem() ) { + if ( !newsList->currentItem() ) + { QMessageBox::information( this, tr( "Error" ), @@ -208,3 +244,4 @@ void EditAccounts::slotDeleteNews() qDebug( "Delete News Account" ); - if ( !newsList->currentItem() ) { + if ( !newsList->currentItem() ) + { QMessageBox::information( this, tr( "Error" ), @@ -279,8 +316,13 @@ 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 ); @@ -335,8 +377,13 @@ 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 ); @@ -393,8 +440,13 @@ 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 ); @@ -446,5 +498,8 @@ 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,2 +1,2 @@ -#include <qmessagebox.h> + #include "settingsdialog.h" @@ -5,13 +5,19 @@ #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" @@ -33,3 +39,4 @@ 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); @@ -39,3 +46,5 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data) slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); - } else if (msg == "newMail()") { + } + else if (msg == "newMail()") + { slotComposeMail(); @@ -47,6 +56,10 @@ 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); @@ -54,5 +67,4 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) } - compose.showMaximized(); compose.slotAdjustColumns(); - compose.exec(); + QPEApplication::execDialog( &compose ); } @@ -74,4 +86,6 @@ void OpieMail::slotSendQueued() 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); @@ -80,3 +94,4 @@ void OpieMail::slotSendQueued() } - if (smtpList.count()==0) { + if (smtpList.count()==0) + { QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); @@ -84,5 +99,8 @@ void OpieMail::slotSendQueued() } - if (smtpList.count()==1) { + if (smtpList.count()==1) + { smtp = smtpList.at(0); - } else { + } + else + { smtp = 0; @@ -90,4 +108,4 @@ void OpieMail::slotSendQueued() selsmtp.setSelectionlist(&smtpList); - selsmtp.showMaximized(); - if (selsmtp.exec()==QDialog::Accepted) { + if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) + { smtp = selsmtp.selected_smtp(); @@ -95,5 +113,7 @@ void OpieMail::slotSendQueued() } - if (smtp) { + if (smtp) + { SMTPwrapper * wrap = new SMTPwrapper(smtp); - if ( wrap->flushOutbox() ) { + if ( wrap->flushOutbox() ) + { QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); @@ -112,4 +132,3 @@ void OpieMail::slotEditSettings() SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); - settingsDialog.showMaximized(); - settingsDialog.exec(); + QPEApplication::execDialog( &settingsDialog ); } @@ -120,5 +139,4 @@ void OpieMail::slotEditAccounts() EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); - eaDialog.showMaximized(); eaDialog.slotAdjustColumns(); - eaDialog.exec(); + QPEApplication::execDialog( &eaDialog ); if ( settings ) delete settings; @@ -141,5 +159,8 @@ void OpieMail::displayMail() - if ( readMail.deleted ) { + if ( readMail.deleted ) + { folderView->refreshCurrent(); - } else { + } + else + { ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); @@ -152,3 +173,4 @@ void OpieMail::slotDeleteMail() 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 ); @@ -165,3 +187,4 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) QPopupMenu *m = new QPopupMenu(0); - if (m) { + if (m) + { m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); @@ -178,6 +201,9 @@ 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" ); @@ -191,3 +217,4 @@ void OpieMail::refreshMailView(QList<RecMail>*list) 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); @@ -218,6 +245,8 @@ void OpieMail::slotMoveCopyMail() 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"), 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 +1,15 @@ +#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> @@ -9,13 +23,2 @@ -#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, @@ -48,3 +51,4 @@ bool AttachItem::isParentof(const QValueList<int>&path) 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; @@ -57,3 +61,4 @@ AttachItem* ViewMail::searchParent(const QValueList<int>&path) QListViewItemIterator it( attachments ); - for ( ; it.current(); ++it ) { + for ( ; it.current(); ++it ) + { AttachItem*ati = (AttachItem*)it.current(); @@ -70,3 +75,4 @@ AttachItem* ViewMail::lastChild(AttachItem*parent) AttachItem*temp=0; - while( (temp=(AttachItem*)item->nextSibling())) { + while( (temp=(AttachItem*)item->nextSibling())) + { item = temp; @@ -76,3 +82,4 @@ AttachItem* ViewMail::lastChild(AttachItem*parent) -void ViewMail::setBody( RecBody body ) { +void ViewMail::setBody( RecBody body ) +{ @@ -82,3 +89,4 @@ attachbutton->setEnabled(body.Parts().count()>0); attachments->setEnabled(body.Parts().count()>0); -if (body.Parts().count()==0) { + if (body.Parts().count()==0) + { return; @@ -93,3 +101,4 @@ w=0; -while (s>1024) { + while (s>1024) + { s/=1024; @@ -100,3 +109,4 @@ while (s>1024) { QString q=""; -switch(w) { + switch(w) + { case 1: @@ -126,8 +136,11 @@ 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(); @@ -137,3 +150,4 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { w = 0; - while (s>1024) { + while (s>1024) + { s/=1024; @@ -142,3 +156,4 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { } - switch(w) { + switch(w) + { case 1: @@ -159,3 +174,4 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { parentItem = searchParent(body.Parts()[i].Positionlist()); - if (parentItem) { + if (parentItem) + { AttachItem*temp = lastChild(parentItem); @@ -165,3 +181,5 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { curItem = parentItem; - } else { + } + else + { curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); @@ -172,3 +190,4 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { -void ViewMail::slotShowHtml( bool state ) { +void ViewMail::slotShowHtml( bool state ) +{ m_showHtml = state; @@ -177,3 +196,4 @@ void ViewMail::slotShowHtml( bool state ) { -void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) { +void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) +{ if (!item ) @@ -181,3 +201,4 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int - if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { + if ( ( ( AttachItem* )item )->Partnumber() == -1 ) + { setText(); @@ -188,3 +209,4 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int - 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 ); @@ -196,5 +218,7 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int - switch(ret) { + switch(ret) + { case 0: - { MimeTypes types; + { + MimeTypes types; types.insert( "all", "*" ); @@ -203,5 +227,7 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int - 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); @@ -217,6 +243,10 @@ 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() ] ) ); @@ -230,3 +260,4 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int -void ViewMail::setMail( RecMail mail ) { +void ViewMail::setMail( RecMail mail ) +{ @@ -266,3 +297,4 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) -void ViewMail::readConfig() { +void ViewMail::readConfig() +{ Config cfg( "mail" ); @@ -280,9 +312,12 @@ void ViewMail::setText() - 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); @@ -302,5 +337,8 @@ void ViewMail::setText() - 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>" ); @@ -322,3 +360,4 @@ void ViewMail::hide() - if (_inLoop) { + if (_inLoop) + { _inLoop = false; @@ -334,3 +373,4 @@ void ViewMail::exec() - if (!_inLoop) { + if (!_inLoop) + { _inLoop = true; @@ -353,3 +393,4 @@ 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")); @@ -366,3 +407,4 @@ void ViewMail::slotReply() QStringList::Iterator it; - for (it = lines.begin(); it != lines.end(); it++) { + for (it = lines.begin(); it != lines.end(); it++) + { rtext += "> " + *it + "\n"; @@ -380,4 +422,4 @@ void ViewMail::slotReply() composer.setMessage( rtext ); - composer.showMaximized(); - if ( QDialog::Accepted==composer.exec()) { + if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) + { m_recMail.Wrapper()->answeredMail(m_recMail); @@ -388,3 +430,4 @@ 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")); @@ -415,5 +458,4 @@ void ViewMail::slotForward() composer.setMessage( ftext ); - composer.showMaximized(); - if ( QDialog::Accepted==composer.exec()) { - + if ( QDialog::Accepted == QPEApplication::execDialog( &composer )) + { } @@ -423,3 +465,4 @@ 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 ); |