summaryrefslogtreecommitdiff
path: root/noncore/net
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
parent76b70b355d2c1c32c0f74e844e0654e39db2a175 (diff)
downloadopie-460258f203be746ff79e14f32a823f381b8ea513.zip
opie-460258f203be746ff79e14f32a823f381b8ea513.tar.gz
opie-460258f203be746ff79e14f32a823f381b8ea513.tar.bz2
improve support for BigScreen
Diffstat (limited to 'noncore/net') (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
-rw-r--r--noncore/net/opieirc/ircservereditor.cpp10
-rw-r--r--noncore/net/opieirc/ircserverlist.cpp72
-rw-r--r--noncore/net/opieirc/ircsettings.cpp22
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.cc39
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp201
-rw-r--r--noncore/net/opietooth/manager/obexpopup.cpp22
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp41
-rw-r--r--noncore/net/opietooth/manager/rfcpopup.cpp35
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp5
15 files changed, 791 insertions, 414 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,13 +1,19 @@
+
#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 );}
/**
@@ -20,9 +26,12 @@ POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
wrapper = AbstractMail::getWrapper( account );
SETPIX(PIXMAP_POP3FOLDER);
#if 0
- if (!account->getOffline()) {
+ if (!account->getOffline())
+ {
setPixmap( 0, );
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_OFFLINE );
}
#endif
@@ -50,14 +59,16 @@ void POP3viewItem::refresh()
if (account->getOffline()) return;
QList<Folder> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
- while ( child ) {
+ while ( child )
+ {
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
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());
}
@@ -75,11 +86,15 @@ RecBody POP3viewItem::fetchBody( const RecMail &mail )
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);
}
}
@@ -89,7 +104,8 @@ QPopupMenu * POP3viewItem::getContextMenu()
void POP3viewItem::disconnect()
{
QListViewItem *child = firstChild();
- while ( child ) {
+ while ( child )
+ {
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
@@ -99,7 +115,8 @@ void POP3viewItem::disconnect()
void POP3viewItem::setOnOffline()
{
- if (!account->getOffline()) {
+ if (!account->getOffline())
+ {
disconnect();
}
account->setOffline(!account->getOffline());
@@ -110,7 +127,8 @@ void POP3viewItem::setOnOffline()
void POP3viewItem::contextMenuSelected(int which)
{
- switch (which) {
+ switch (which)
+ {
case 0:
disconnect();
break;
@@ -121,17 +139,19 @@ void POP3viewItem::contextMenuSelected(int which)
}
POP3folderItem::~POP3folderItem()
-{
-}
+{}
POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after )
: AccountViewItem( parent,after )
{
folder = folderInit;
pop3 = parent;
- if (folder->getDisplayName().lower()!="inbox") {
+ if (folder->getDisplayName().lower()!="inbox")
+ {
setPixmap( 0, PIXMAP_POP3FOLDER );
- } else {
+ }
+ else
+ {
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
@@ -151,7 +171,8 @@ RecBody POP3folderItem::fetchBody(const RecMail&aMail)
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);
m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
@@ -169,7 +190,8 @@ void POP3folderItem::downloadMails()
void POP3folderItem::contextMenuSelected(int which)
{
AccountView * view = (AccountView*)listView();
- switch (which) {
+ switch (which)
+ {
case 0:
/* must be 'cause pop3 lists are cached */
pop3->getWrapper()->logout();
@@ -236,29 +258,36 @@ 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);
qDebug("inbox found");
break;
}
}
- 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);
/* setup the short name */
item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1));
item = titem;
- } else {
+ }
+ else
+ {
item = new IMAPfolderItem( it, this , item );
}
}
@@ -268,14 +297,18 @@ void IMAPviewItem::refreshFolders(bool force)
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);
m->insertSeparator();
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);
}
}
@@ -285,16 +318,18 @@ QPopupMenu * IMAPviewItem::getContextMenu()
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);
}
}
@@ -303,7 +338,8 @@ void IMAPviewItem::createNewFolder()
void IMAPviewItem::contextMenuSelected(int id)
{
qDebug("Id selected: %i",id);
- switch (id) {
+ switch (id)
+ {
case 0:
refreshFolders(true);
break;
@@ -315,7 +351,8 @@ void IMAPviewItem::contextMenuSelected(int id)
wrapper->logout();
break;
case 3:
- if (account->getOffline()==false) {
+ if (account->getOffline()==false)
+ {
removeChilds();
wrapper->logout();
}
@@ -344,9 +381,12 @@ 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);
}
setText( 0, folder->getDisplayName() );
@@ -357,17 +397,19 @@ 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);
}
setText( 0, folder->getDisplayName() );
}
IMAPfolderItem::~IMAPfolderItem()
-{
-}
+{}
const QString& IMAPfolderItem::Delemiter()const
{
@@ -376,9 +418,12 @@ 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();
}
}
@@ -391,16 +436,20 @@ RecBody IMAPfolderItem::fetchBody(const RecMail&aMail)
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);
}
}
@@ -410,12 +459,13 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
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);
}
}
@@ -428,14 +478,17 @@ void IMAPfolderItem::deleteFolder()
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();
IMAPviewItem * box = imap;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
imap->refreshFolders(true);
- if (v) {
+ if (v)
+ {
v->setSelected(box,true);
}
}
@@ -453,7 +506,8 @@ void IMAPfolderItem::contextMenuSelected(int id)
{
qDebug("Selected id: %i",id);
AccountView * view = (AccountView*)listView();
- switch(id) {
+ switch(id)
+ {
case 0:
view->refreshCurrent();
break;
@@ -518,25 +572,33 @@ void MHviewItem::refresh(bool force)
MHfolderItem*pmaster = 0;
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;
continue;
}
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 );
}
item->setSelectable(it->may_select());
@@ -555,7 +617,8 @@ RecBody MHviewItem::fetchBody( const RecMail &mail )
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);
m->insertItem(QObject::tr("Delete all mails",contextName),2);
@@ -567,10 +630,11 @@ QPopupMenu * MHviewItem::getContextMenu()
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);
}
}
@@ -590,7 +654,8 @@ QStringList MHviewItem::subFolders()
void MHviewItem::contextMenuSelected(int which)
{
- switch (which) {
+ switch (which)
+ {
case 0:
refresh(true);
break;
@@ -609,8 +674,7 @@ void MHviewItem::contextMenuSelected(int which)
}
MHfolderItem::~MHfolderItem()
-{
-}
+{}
MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after )
: AccountViewItem( parent,after )
@@ -631,18 +695,25 @@ MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewI
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 );
}
setText( 0, bName );
@@ -671,14 +742,17 @@ void MHfolderItem::deleteFolder()
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();
MHviewItem * box = mbox;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
mbox->refresh(true);
- if (v) {
+ if (v)
+ {
v->setSelected(box,true);
}
}
@@ -688,7 +762,8 @@ void MHfolderItem::deleteFolder()
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);
m->insertItem(QObject::tr("Create new subfolder",contextName),3);
@@ -707,16 +782,18 @@ void MHfolderItem::downloadMails()
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;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
mbox->refresh(true);
- if (v) {
+ if (v)
+ {
v->setSelected(box,true);
}
}
@@ -725,7 +802,8 @@ void MHfolderItem::createFolder()
void MHfolderItem::contextMenuSelected(int which)
{
- switch(which) {
+ switch(which)
+ {
case 0:
deleteAllMail(mbox->getWrapper(),folder);
break;
@@ -795,8 +873,10 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder)
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();
if (view) view->refreshCurrent();
}
@@ -806,7 +886,8 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder)
void AccountViewItem::removeChilds()
{
QListViewItem *child = firstChild();
- while ( child ) {
+ while ( child )
+ {
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
@@ -825,13 +906,17 @@ AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*
AccountViewItem*pitem,*sitem;
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,13 +1,18 @@
+
#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 )
: QListView( parent, name, flags )
@@ -55,12 +60,16 @@ void AccountView::populate( QList<Account> list )
mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
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() );
/* must not be hold 'cause it isn't required */
@@ -69,10 +78,12 @@ 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;
headerlist.setAutoDelete(true);
@@ -95,7 +106,6 @@ void AccountView::refreshCurrent()
void AccountView::refreshAll()
{
-
}
RecBody AccountView::fetchBody(const RecMail&aMail)
@@ -108,15 +118,17 @@ 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;
imapAccounts[i]->refreshFolders(false);
@@ -134,10 +146,12 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper)
targetMail = sels.currentMail();
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>"));
return;
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,18 +1,22 @@
+
+#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>
#include <qtextstream.h>
#include <qlistbox.h>
#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 )
{
@@ -30,24 +34,31 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl
QStringList mails;
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);
}
}
}
- if ( addressList->count() <= 0 ) {
+ if ( addressList->count() <= 0 )
+ {
#if 0
// makes this realy sense??
addressList->insertItem(
@@ -55,7 +66,9 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl
#endif
addressList->setEnabled( false );
okButton->setEnabled( false );
- } else {
+ }
+ else
+ {
// addressList->sort();
}
}
@@ -65,14 +78,16 @@ void AddressPicker::accept()
QListBoxItem *item = addressList->firstItem();
QString names;
- while ( item ) {
+ while ( item )
+ {
if ( item->selected() )
names += item->text() + ", ";
item = item->next();
}
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"));
return;
@@ -87,11 +102,10 @@ QString AddressPicker::getNames()
QString names = 0;
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,8 +1,13 @@
-#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 )
{
@@ -39,10 +44,14 @@ 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 );
}
}
@@ -54,60 +63,76 @@ void EditAccounts::slotNewMail()
QString *selection = new QString();
SelectMailType selType( selection, this, 0, true );
selType.show();
- if ( QDialog::Accepted == selType.exec() ) {
+ if ( QDialog::Accepted == selType.exec() )
+ {
slotNewAccount( *selection );
}
}
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();
}
}
@@ -115,32 +140,39 @@ 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();
}
}
@@ -150,7 +182,8 @@ 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();
}
@@ -159,7 +192,8 @@ void EditAccounts::slotDeleteAccount( Account *account )
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>" ),
tr( "Ok" ) );
@@ -172,7 +206,8 @@ void EditAccounts::slotEditMail()
void EditAccounts::slotDeleteMail()
{
- if ( !mailList->currentItem() ) {
+ if ( !mailList->currentItem() )
+ {
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
tr( "Ok" ) );
@@ -192,7 +227,8 @@ void EditAccounts::slotNewNews()
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>" ),
tr( "Ok" ) );
@@ -206,7 +242,8 @@ void EditAccounts::slotEditNews()
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>" ),
tr( "Ok" ) );
@@ -277,12 +314,17 @@ 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 );
}
}
@@ -333,12 +375,17 @@ POP3config::POP3config( POP3account *account, QWidget *parent, const char *name,
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 );
}
}
@@ -391,12 +438,17 @@ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name,
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 );
}
}
@@ -444,9 +496,12 @@ 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,19 +1,25 @@
-#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 )
: MainWindow( parent, name, WStyle_ContextHelp )
@@ -31,13 +37,16 @@ OpieMail::~OpieMail()
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;
stream >> name >> email;
// removing the whitespaces at beginning and end is needed!
slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
- } else if (msg == "newMail()") {
+ }
+ else if (msg == "newMail()")
+ {
slotComposeMail();
}
}
@@ -45,16 +54,19 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
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 );
}
void OpieMail::slotComposeMail()
@@ -72,30 +84,38 @@ void OpieMail::slotSendQueued()
QList<SMTPaccount> smtpList;
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"));
}
delete wrap;
@@ -110,17 +130,15 @@ void OpieMail::slotSearchMails()
void OpieMail::slotEditSettings()
{
SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
- settingsDialog.showMaximized();
- settingsDialog.exec();
+ QPEApplication::execDialog( &settingsDialog );
}
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();
@@ -139,9 +157,12 @@ void OpieMail::displayMail()
readMail.showMaximized();
readMail.exec();
- if ( readMail.deleted ) {
+ if ( readMail.deleted )
+ {
folderView->refreshCurrent();
- } else {
+ }
+ else
+ {
( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) );
}
}
@@ -150,7 +171,8 @@ 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();
}
@@ -163,7 +185,8 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
qDebug("Event right/hold");
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()));
m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail()));
@@ -176,10 +199,13 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
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();
}
@@ -189,7 +215,8 @@ 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)));
item->showEntry();
@@ -216,10 +243,12 @@ void OpieMail::slotMoveCopyMail()
targetMail = sels.currentMail();
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>"));
return;
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,3 +1,17 @@
+#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>
#include <qtextstream.h>
@@ -7,17 +21,6 @@
#include <qapplication.h>
#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)
: QListViewItem(parent,after),_partNum(num)
@@ -46,7 +49,8 @@ bool AttachItem::isParentof(const QValueList<int>&path)
if (path.count()==0||_path.count()==0) return false;
/* 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;
}
return true;
@@ -55,7 +59,8 @@ bool AttachItem::isParentof(const QValueList<int>&path)
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;
}
@@ -68,19 +73,22 @@ AttachItem* ViewMail::lastChild(AttachItem*parent)
AttachItem* item = (AttachItem*)parent->firstChild();
if (!item) return item;
AttachItem*temp=0;
- while( (temp=(AttachItem*)item->nextSibling())) {
+ while( (temp=(AttachItem*)item->nextSibling()))
+ {
item = temp;
}
return item;
}
-void ViewMail::setBody( RecBody body ) {
+void ViewMail::setBody( RecBody body )
+{
m_body = body;
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;
}
AttachItem * curItem=0;
@@ -91,14 +99,16 @@ double s = body.Description().Size();
int w;
w=0;
-while (s>1024) {
+ while (s>1024)
+ {
s/=1024;
++w;
if (w>=2) break;
}
QString q="";
-switch(w) {
+ switch(w)
+ {
case 1:
q="k";
break;
@@ -124,23 +134,28 @@ default:
curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body.Description().Positionlist());
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();
}
}
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";
break;
@@ -157,36 +172,43 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
o << s << " " << q << "Byte";
desc = body.Parts()[i].Description();
parentItem = searchParent(body.Parts()[i].Positionlist());
- if (parentItem) {
+ if (parentItem)
+ {
AttachItem*temp = lastChild(parentItem);
if (temp) curItem = temp;
curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist());
attachments->setRootIsDecorated(true);
curItem = parentItem;
- } else {
+ }
+ else
+ {
curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist());
}
}
}
-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;
}
QPopupMenu *menu = new QPopupMenu();
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 );
}
menu->insertItem( tr( "Save Attachment" ), 0 );
@@ -194,16 +216,20 @@ 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);
output.writeBlock(content->Content(),content->Length());
@@ -215,10 +241,14 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
break ;
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() ] ) );
}
}
@@ -228,7 +258,8 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
}
-void ViewMail::setMail( RecMail mail ) {
+void ViewMail::setMail( RecMail mail )
+{
m_recMail = mail;
@@ -264,7 +295,8 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
attachments->setSorting(-1);
}
-void ViewMail::readConfig() {
+void ViewMail::readConfig()
+{
Config cfg( "mail" );
cfg.setGroup( "Settings" );
m_showHtml = cfg.readBoolEntry( "showHtml", false );
@@ -278,13 +310,16 @@ void ViewMail::setText()
QString ccString;
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);
}
@@ -300,9 +335,12 @@ void ViewMail::setText()
"<b>" + tr( "Date" ) + ": </b> " + m_mail[3] +
"</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>" );
}
// remove later in favor of a real handling
@@ -320,7 +358,8 @@ void ViewMail::hide()
{
QWidget::hide();
- if (_inLoop) {
+ if (_inLoop)
+ {
_inLoop = false;
qApp->exit_loop();
@@ -332,7 +371,8 @@ void ViewMail::exec()
{
show();
- if (!_inLoop) {
+ if (!_inLoop)
+ {
_inLoop = true;
qApp->enter_loop();
}
@@ -351,7 +391,8 @@ 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;
}
@@ -364,7 +405,8 @@ void ViewMail::slotReply()
QString text = m_mail[2];
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";
}
rtext += "\n";
@@ -378,15 +420,16 @@ void ViewMail::slotReply()
composer.setTo( m_mail[0] );
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);
}
}
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;
}
@@ -413,15 +456,15 @@ void ViewMail::slotForward()
ComposeMail composer( settings ,this, 0, true);
composer.setSubject( "Fwd: " + m_mail[1] );
composer.setMessage( ftext );
- composer.showMaximized();
- if ( QDialog::Accepted==composer.exec()) {
-
+ if ( QDialog::Accepted == QPEApplication::execDialog( &composer ))
+ {
}
}
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();
deleted = true;
diff --git a/noncore/net/opieirc/ircservereditor.cpp b/noncore/net/opieirc/ircservereditor.cpp
index 60274d1..2d11bf0 100644
--- a/noncore/net/opieirc/ircservereditor.cpp
+++ b/noncore/net/opieirc/ircservereditor.cpp
@@ -1,8 +1,13 @@
+#include "ircservereditor.h"
+
+/* OPIE */
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qmessagebox.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qwhatsthis.h>
-#include "ircservereditor.h"
IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) {
QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 5);
@@ -43,7 +48,8 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char*
layout->addWidget(label, 6, 0);
layout->addWidget(m_channels, 6, 1);
setCaption(tr("Edit server information"));
- showMaximized();
+
+ QPEApplication::showDialog( this );
}
diff --git a/noncore/net/opieirc/ircserverlist.cpp b/noncore/net/opieirc/ircserverlist.cpp
index 595ae3e..62bfc17 100644
--- a/noncore/net/opieirc/ircserverlist.cpp
+++ b/noncore/net/opieirc/ircserverlist.cpp
@@ -1,22 +1,32 @@
+
+#include "ircserverlist.h"
+#include "ircservereditor.h"
+
+/* OPIE */
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qlayout.h>
#include <qlabel.h>
#include <qhbox.h>
#include <qpushbutton.h>
#include <qwhatsthis.h>
-#include "ircserverlist.h"
-#include "ircservereditor.h"
-class IRCListBoxServer : public QListBoxText {
+class IRCListBoxServer : public QListBoxText
+{
public:
- IRCListBoxServer(IRCServer server) : QListBoxText(server.name()) {
+ IRCListBoxServer(IRCServer server) : QListBoxText(server.name())
+ {
m_server = server;
}
- IRCServer server() {
+ IRCServer server()
+ {
return m_server;
}
- void setServer(IRCServer server) {
+ void setServer(IRCServer server)
+ {
m_server = server;
setText(m_server.name());
}
@@ -24,7 +34,8 @@ protected:
IRCServer m_server;
};
-IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) {
+IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp)
+{
QVBoxLayout *layout = new QVBoxLayout(this, 5, 5);
setCaption(tr("Serverlist Browser"));
QLabel *label = new QLabel(tr("Please choose a server profile"), this);
@@ -48,11 +59,14 @@ IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFla
m_config = new Config("OpieIRC");
m_config->setGroup("OpieIRC");
int count = m_config->readNumEntry("ServerCount", 0);
- if (count) {
- for (int i=0; i<count; i++) {
+ if (count)
+ {
+ for (int i=0; i<count; i++)
+ {
m_config->setGroup("OpieIRC");
QString name = m_config->readEntry("Server"+QString::number(i));
- if (name.length() > 0) {
+ if (name.length() > 0)
+ {
IRCServer server;
m_config->setGroup(name);
server.setName(name);
@@ -68,45 +82,54 @@ IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFla
}
}
- showMaximized();
+ QPEApplication::showDialog( this );
}
-void IRCServerList::addServer() {
+void IRCServerList::addServer()
+{
IRCServer server;
IRCServerEditor editor(server, this, "ServerEditor", TRUE);
- if (editor.exec() == QDialog::Accepted) {
+ if (editor.exec() == QDialog::Accepted)
+ {
server = editor.getServer();
/* Gets deleted by QListBox, so this is ok */
m_list->insertItem(new IRCListBoxServer(server));
}
}
-void IRCServerList::delServer() {
+void IRCServerList::delServer()
+{
int index = m_list->currentItem();
- if (index != -1) {
+ if (index != -1)
+ {
m_list->removeItem(index);
}
}
-void IRCServerList::editServer() {
+void IRCServerList::editServer()
+{
int index = m_list->currentItem();
- if (index != -1) {
+ if (index != -1)
+ {
IRCListBoxServer *item = (IRCListBoxServer *)m_list->item(index);
IRCServer server = item->server();
IRCServerEditor editor(server, this, "ServerEditor", TRUE);
- if (editor.exec() == QDialog::Accepted) {
+ if (editor.exec() == QDialog::Accepted)
+ {
server = editor.getServer();
item->setServer(server);
}
}
}
-int IRCServerList::exec() {
+int IRCServerList::exec()
+{
int returncode = QDialog::exec();
/* Now save the changes */
m_config->setGroup("OpieIRC");
m_config->writeEntry("ServerCount", QString::number(m_list->count()));
- for (unsigned int i=0; i<m_list->count(); i++) {
+ for (unsigned int i=0; i<m_list->count(); i++)
+ {
IRCServer server = ((IRCListBoxServer *)m_list->item(i))->server();
m_config->setGroup("OpieIRC");
m_config->writeEntry("Server"+QString::number(i), server.name());
@@ -122,14 +145,17 @@ int IRCServerList::exec() {
return returncode;
}
-bool IRCServerList::hasServer() {
+bool IRCServerList::hasServer()
+{
return (m_list->currentItem() != -1);
}
-IRCServer IRCServerList::server() {
+IRCServer IRCServerList::server()
+{
return ((IRCListBoxServer *)m_list->item(m_list->currentItem()))->server();
}
-IRCServerList::~IRCServerList() {
+IRCServerList::~IRCServerList()
+{
delete m_config;
}
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp
index 2862296..f69d2c4 100644
--- a/noncore/net/opieirc/ircsettings.cpp
+++ b/noncore/net/opieirc/ircsettings.cpp
@@ -1,11 +1,18 @@
+
+#include "ircsettings.h"
+#include "irctab.h"
+
+/* OPIE */
#include <opie/ocolorbutton.h>
#include <opie/otabwidget.h>
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qvalidator.h>
#include <qwhatsthis.h>
-#include "ircsettings.h"
-#include "irctab.h"
-IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) {
+IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp)
+{
setCaption(tr("Settings") );
m_config = new Config("OpieIRC");
m_config->setGroup("OpieIRC");
@@ -70,10 +77,12 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags)
layout->addWidget(m_notification, 6, 1);
tw->addTab(view, "opieirc/colors", tr("Colors"));
tw->setCurrentTab( genwidget );
- showMaximized();
+
+ QPEApplication::showDialog( this );
}
-void IRCSettings::accept() {
+void IRCSettings::accept()
+{
IRCTab::m_backgroundColor = m_background->color().name();
IRCTab::m_textColor = m_text->color().name();
IRCTab::m_errorColor = m_error->color().name();
@@ -93,6 +102,7 @@ void IRCSettings::accept() {
QDialog::accept();
}
-IRCSettings::~IRCSettings() {
+IRCSettings::~IRCSettings()
+{
delete m_config;
}
diff --git a/noncore/net/opietooth/blue-pin/pindlg.cc b/noncore/net/opietooth/blue-pin/pindlg.cc
index 7d60d6c..9418a20 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.cc
+++ b/noncore/net/opietooth/blue-pin/pindlg.cc
@@ -1,14 +1,18 @@
-#include <stdio.h>
+#include "pindlg.h"
+
+/* OPIE */
+#include <qpe/config.h>
+#include <qpe/qpeapplication.h>
+/* QT */
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qtimer.h>
-#include <qpe/config.h>
-
-#include "pindlg.h"
+/* STD */
+#include <stdio.h>
using namespace OpieTooth;
@@ -20,32 +24,39 @@ PinDlg::PinDlg( const QString& status,
m_mac = mac;
test( mac );
txtStatus->setText(status);
- showMaximized();
+ QPEApplication::showDialog( this );
}
-PinDlg::~PinDlg() {
-}
-void PinDlg::setMac( const QString& mac ) {
+PinDlg::~PinDlg()
+{}
+void PinDlg::setMac( const QString& mac )
+{
txtStatus->setText( mac );
}
-QString PinDlg::pin() const{
+QString PinDlg::pin() const
+{
return lnePin->text();
}
-void PinDlg::test( const QString& mac ) {
- if (!mac.isEmpty() ) {
+void PinDlg::test( const QString& mac )
+{
+ if (!mac.isEmpty() )
+ {
Config cfg("bluepin");
cfg.setGroup(mac);
lnePin->setText(cfg.readEntryCrypt("pin", QString::null ) );
- if ( !lnePin->text().isEmpty() ) {
+ if ( !lnePin->text().isEmpty() )
+ {
//QTimer::singleShot(100, this, SLOT(accept() ) );
}
}
}
-void PinDlg::accept() {
- if ( ckbPin->isChecked() ) {
+void PinDlg::accept()
+{
+ if ( ckbPin->isChecked() )
+ {
Config cfg("bluepin");
cfg.setGroup(m_mac );
cfg.writeEntryCrypt("pin", lnePin->text() );
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 2e68984..0ea45d2 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -22,11 +22,12 @@
#include "btconnectionitem.h"
#include "rfcommassigndialogimpl.h"
-#include <remotedevice.h>
-#include <services.h>
-
-#include <stdlib.h>
+/* OPIE */
+#include <qpe/qpeapplication.h>
+#include <qpe/resource.h>
+#include <qpe/config.h>
+/* QT */
#include <qframe.h>
#include <qlabel.h>
#include <qpushbutton.h>
@@ -46,15 +47,16 @@
#include <qtimer.h>
#include <qlist.h>
-#include <qpe/qpeapplication.h>
-#include <qpe/resource.h>
-#include <qpe/config.h>
-
+/* STD */
+#include <remotedevice.h>
+#include <services.h>
+#include <stdlib.h>
using namespace OpieTooth;
BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
- : BluetoothBase( parent, name, fl ) {
+ : BluetoothBase( parent, name, fl )
+{
m_localDevice = new Manager( "hci0" );
@@ -115,7 +117,8 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
/**
* Reads all options from the config file
*/
-void BlueBase::readConfig() {
+void BlueBase::readConfig()
+{
Config cfg( "bluetoothmanager" );
cfg.setGroup( "bluezsettings" );
@@ -131,7 +134,8 @@ void BlueBase::readConfig() {
/**
* Writes all options to the config file
*/
-void BlueBase::writeConfig() {
+void BlueBase::writeConfig()
+{
Config cfg( "bluetoothmanager" );
cfg.setGroup( "bluezsettings" );
@@ -149,7 +153,8 @@ void BlueBase::writeConfig() {
/**
* Modify the hcid.conf file to our needs
*/
-void BlueBase::writeToHciConfig() {
+void BlueBase::writeToHciConfig()
+{
qWarning("writeToHciConfig");
HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
hciconf.load();
@@ -166,7 +171,8 @@ void BlueBase::writeToHciConfig() {
/**
* Read the list of allready known devices
*/
-void BlueBase::readSavedDevices() {
+void BlueBase::readSavedDevices()
+{
QValueList<RemoteDevice> loadedDevices;
DeviceHandler handler;
@@ -179,12 +185,14 @@ void BlueBase::readSavedDevices() {
/**
* Write the list of allready known devices
*/
-void BlueBase::writeSavedDevices() {
+void BlueBase::writeSavedDevices()
+{
QListViewItemIterator it( ListView2 );
BTListItem* item;
BTDeviceItem* device;
RemoteDevice::ValueList list;
- for ( ; it.current(); ++it ) {
+ for ( ; it.current(); ++it )
+ {
item = (BTListItem*)it.current();
if(item->typeId() != BTListItem::Device )
continue;
@@ -205,7 +213,8 @@ void BlueBase::writeSavedDevices() {
/**
* Set up the gui
*/
-void BlueBase::initGui() {
+void BlueBase::initGui()
+{
StatusLabel->setText( status() ); // maybe move it to getStatus()
cryptCheckBox->setChecked( m_useEncryption );
authCheckBox->setChecked( m_enableAuthentification );
@@ -222,7 +231,8 @@ void BlueBase::initGui() {
* Get the status informations and returns it
* @return QString the status informations gathered
*/
-QString BlueBase::status()const{
+QString BlueBase::status()const
+{
QString infoString = tr( "<b>Device name : </b> Ipaq" );
infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
@@ -234,7 +244,8 @@ QString BlueBase::status()const{
/**
* Read the current values from the gui and invoke writeConfig()
*/
-void BlueBase::applyConfigChanges() {
+void BlueBase::applyConfigChanges()
+{
m_deviceName = deviceNameLine->text();
m_defaultPasskey = passkeyLine->text();
m_useEncryption = cryptCheckBox->isChecked();
@@ -251,12 +262,12 @@ void BlueBase::applyConfigChanges() {
* Launch Rfcomm Bind dialog
*
*/
-void BlueBase::rfcommDialog() {
+void BlueBase::rfcommDialog()
+{
RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
- rfcommAssign.showMaximized();
-
- if ( rfcommAssign.exec() == QDialog::Accepted ) {
+ if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted )
+ {
rfcommAssign.saveConfig();
}
}
@@ -265,11 +276,13 @@ void BlueBase::rfcommDialog() {
* Add fresh found devices from scan dialog to the listing
*
*/
-void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) {
+void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices )
+{
BTDeviceItem * deviceItem;
QValueList<RemoteDevice>::ConstIterator it;
- for( it = newDevices.begin(); it != newDevices.end() ; ++it ) {
+ for( it = newDevices.begin(); it != newDevices.end() ; ++it )
+ {
if (find( (*it) )) // is already inserted
continue;
@@ -290,21 +303,23 @@ void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices )
/**
* Action that is toggled on entrys on click
*/
-void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) {
-}
+void BlueBase::startServiceActionClicked( QListViewItem */*item*/ )
+{}
/**
* Action that are toggled on hold (mostly QPopups i guess)
*/
-void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) {
+void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ )
+{
if (!item )
return;
QPopupMenu *menu = new QPopupMenu();
int ret=0;
- if ( ((BTListItem*)item)->type() == "device") {
+ if ( ((BTListItem*)item)->type() == "device")
+ {
QPopupMenu *groups = new QPopupMenu();
@@ -316,7 +331,8 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
ret = menu->exec( point , 0);
- switch(ret) {
+ switch(ret)
+ {
case -1:
break;
case 2:
@@ -343,21 +359,26 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
* the PopupMenu to delete itself
*
*/
- else if ( ((BTListItem*)item)->type() == "service") {
+ else if ( ((BTListItem*)item)->type() == "service")
+ {
BTServiceItem* service = (BTServiceItem*)item;
QMap<int, QString> list = service->services().classIdList();
QMap<int, QString>::Iterator it = list.begin();
QPopupMenu *popup =0l;
- if ( it != list.end() ) {
+ if ( it != list.end() )
+ {
qWarning("Searching id %d %s", it.key(), it.data().latin1() );
popup = m_popHelper.find( it.key(),
service->services(),
(BTDeviceItem*)service->parent() );
- }else {
+ }
+ else
+ {
qWarning("Empty");
}
- if ( popup == 0l ) {
+ if ( popup == 0l )
+ {
qWarning("factory returned 0l");
popup = new QPopupMenu();
}
@@ -365,9 +386,12 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
ret = popup->exec( point );
qWarning("returned from exec() ");
- if ( ret == -1 ) {
+ if ( ret == -1 )
+ {
;
- } else if ( ret == test1 ) {
+ }
+ else if ( ret == test1 )
+ {
;
}
delete popup;
@@ -380,7 +404,8 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
* Search and display avail. services for a device (on expand from device listing)
* @param item the service item returned
*/
-void BlueBase::addServicesToDevice( BTDeviceItem * item ) {
+void BlueBase::addServicesToDevice( BTDeviceItem * item )
+{
qDebug("addServicesToDevice");
// row of mac adress text(3)
RemoteDevice device = item->remoteDevice();
@@ -396,7 +421,8 @@ void BlueBase::addServicesToDevice( BTDeviceItem * item ) {
* @param device the mac address of the remote device
* @param servicesList the list with the service the device has.
*/
-void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
+void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList )
+{
qDebug("fill services list");
QMap<QString,BTDeviceItem*>::Iterator it;
@@ -412,7 +438,8 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s
QList<QListViewItem> tempList;
tempList.setAutoDelete( true );
QListViewItem * child = deviceItem->firstChild();
- while( child ) {
+ while( child )
+ {
tempList.append( child );
child = child->nextSibling();
}
@@ -422,22 +449,27 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s
BTServiceItem* serviceItem;
- if (!servicesList.isEmpty() ) {
+ if (!servicesList.isEmpty() )
+ {
// add services
QMap<int, QString> list;
QMap<int, QString>::Iterator classIt;
- for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
+ for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 )
+ {
serviceItem = new BTServiceItem( deviceItem, (*it2) );
list = (*it2).classIdList();
classIt = list.begin();
int classId=0;
- if ( classIt != list.end() ) {
+ if ( classIt != list.end() )
+ {
classId = classIt.key();
}
serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
}
- } else {
+ }
+ else
+ {
Services s1;
s1.setServiceName( tr("no services found") );
serviceItem = new BTServiceItem( deviceItem, s1 );
@@ -450,21 +482,26 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s
-void BlueBase::addSignalStrength() {
+void BlueBase::addSignalStrength()
+{
QListViewItemIterator it( ListView4 );
- for ( ; it.current(); ++it ) {
+ for ( ; it.current(); ++it )
+ {
m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() );
}
QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) );
}
-void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) {
+void BlueBase::addSignalStrength( const QString& mac, const QString& strength )
+{
QListViewItemIterator it( ListView4 );
- for ( ; it.current(); ++it ) {
- if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) {
+ for ( ; it.current(); ++it )
+ {
+ if( ((BTConnectionItem*)it.current())->connection().mac() == mac )
+ {
((BTConnectionItem*)it.current() )->setSignalStrength( strength );
}
}
@@ -474,7 +511,8 @@ void BlueBase::addSignalStrength( const QString& mac, const QString& strength )
* Add the existing connections (pairs) to the connections tab.
* This one triggers the search
*/
-void BlueBase::addConnectedDevices() {
+void BlueBase::addConnectedDevices()
+{
m_localDevice->searchConnections();
}
@@ -482,27 +520,34 @@ void BlueBase::addConnectedDevices() {
* This adds the found connections to the connection tab.
* @param connectionList the ValueList with all current connections
*/
-void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) {
+void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
+{
QValueList<OpieTooth::ConnectionState>::Iterator it;
BTConnectionItem * connectionItem;
- if ( !connectionList.isEmpty() ) {
+ if ( !connectionList.isEmpty() )
+ {
- for (it = connectionList.begin(); it != connectionList.end(); ++it) {
+ for (it = connectionList.begin(); it != connectionList.end(); ++it)
+ {
QListViewItemIterator it2( ListView4 );
bool found = false;
- for ( ; it2.current(); ++it2 ) {
- if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) {
+ for ( ; it2.current(); ++it2 )
+ {
+ if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() )
+ {
found = true;
}
}
- if ( found == false ) {
+ if ( found == false )
+ {
connectionItem = new BTConnectionItem( ListView4, (*it) );
- if( m_deviceList.find((*it).mac()).data() ) {
+ if( m_deviceList.find((*it).mac()).data() )
+ {
connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() );
}
}
@@ -510,22 +555,28 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
}
QListViewItemIterator it2( ListView4 );
- for ( ; it2.current(); ++it2 ) {
+ for ( ; it2.current(); ++it2 )
+ {
bool found = false;
- for (it = connectionList.begin(); it != connectionList.end(); ++it) {
- if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) {
+ for (it = connectionList.begin(); it != connectionList.end(); ++it)
+ {
+ if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() )
+ {
found = true;
}
}
- if ( !found ) {
+ if ( !found )
+ {
delete it2.current();
}
}
- } else {
+ }
+ else
+ {
ListView4->clear();
ConnectionState con;
con.setMac( tr("No connections found") );
@@ -541,7 +592,8 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
* Find out if a device can currently be reached
* @param device
*/
-void BlueBase::deviceActive( const RemoteDevice &device ) {
+void BlueBase::deviceActive( const RemoteDevice &device )
+{
// search by mac, async, gets a signal back
// We should have a BTDeviceItem there or where does it get added to the map -zecke
m_localDevice->isAvailable( device.mac() );
@@ -553,7 +605,8 @@ void BlueBase::deviceActive( const RemoteDevice &device ) {
* @param device - the mac address
* @param connected - if it is avail. or not
*/
-void BlueBase::deviceActive( const QString& device, bool connected ) {
+void BlueBase::deviceActive( const QString& device, bool connected )
+{
qDebug("deviceActive slot");
QMap<QString,BTDeviceItem*>::Iterator it;
@@ -565,9 +618,12 @@ void BlueBase::deviceActive( const QString& device, bool connected ) {
BTDeviceItem* deviceItem = it.data();
- if ( connected ) {
+ if ( connected )
+ {
deviceItem->setPixmap( 1, m_onPix );
- } else {
+ }
+ else
+ {
deviceItem->setPixmap( 1, m_offPix );
}
m_deviceList.remove( it );
@@ -577,20 +633,22 @@ void BlueBase::deviceActive( const QString& device, bool connected ) {
/**
* Open the "scan for devices" dialog
*/
-void BlueBase::startScan() {
+void BlueBase::startScan()
+{
ScanDialog *scan = new ScanDialog( this, "ScanDialog",
true, WDestructiveClose );
QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ),
this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) );
- scan->showMaximized();
+ QPEApplication::showDialog( scan );
}
/**
* Set the informations about the local device in information Tab
*/
-void BlueBase::setInfo() {
+void BlueBase::setInfo()
+{
StatusLabel->setText( status() );
}
@@ -598,7 +656,8 @@ void BlueBase::setInfo() {
/**
* Decontructor
*/
-BlueBase::~BlueBase() {
+BlueBase::~BlueBase()
+{
writeSavedDevices();
delete m_iconLoader;
}
@@ -610,11 +669,13 @@ BlueBase::~BlueBase() {
* @param dev RemoteDevice to find
* @return returns true if found
*/
-bool BlueBase::find( const RemoteDevice& rem ) {
+bool BlueBase::find( const RemoteDevice& rem )
+{
QListViewItemIterator it( ListView2 );
BTListItem* item;
BTDeviceItem* device;
- for (; it.current(); ++it ) {
+ for (; it.current(); ++it )
+ {
item = (BTListItem*) it.current();
if ( item->typeId() != BTListItem::Device )
continue;
diff --git a/noncore/net/opietooth/manager/obexpopup.cpp b/noncore/net/opietooth/manager/obexpopup.cpp
index a550648..d147d52 100644
--- a/noncore/net/opietooth/manager/obexpopup.cpp
+++ b/noncore/net/opietooth/manager/obexpopup.cpp
@@ -1,16 +1,21 @@
-#include <qtimer.h>
-
#include "obexdialog.h"
#include "obexpopup.h"
+/* OPIE */
+#include <qpe/qpeapplication.h>
+
+/* QT */
+#include <qtimer.h>
+
using namespace OpieTooth;
/*
* c'tor init the QAction
*/
ObexPopup::ObexPopup()
- : QPopupMenu() {
+ : QPopupMenu()
+{
qWarning("RfcCommPopup c'tor");
QAction* a;
@@ -24,18 +29,17 @@ ObexPopup::ObexPopup()
};
-ObexPopup::~ObexPopup() {
-}
+ObexPopup::~ObexPopup()
+{}
-void ObexPopup::slotPush() {
+void ObexPopup::slotPush()
+{
qWarning("push something");
-
ObexDialog obexDialog;
- obexDialog.showMaximized();
- obexDialog.exec();
+ QPEApplication::execDialog( &obexDialog );
}
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
index b5cc074..fc76301 100644
--- a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
+++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
@@ -3,8 +3,11 @@
#include "rfcommassigndialogitem.h"
#include "rfcommconfhandler.h"
+/* OPIE */
#include <qpe/config.h>
+#include <qpe/qpeapplication.h>
+/* QT */
#include <qlayout.h>
using namespace OpieTooth;
@@ -15,7 +18,8 @@ using namespace OpieTooth;
RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
- : RfcommAssignDialogBase( parent, name, modal, fl ) {
+ : RfcommAssignDialogBase( parent, name, modal, fl )
+{
m_range = 5;
@@ -33,28 +37,34 @@ RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool
loadConfig();
}
-RfcommAssignDialog::~RfcommAssignDialog() {
- if ( confHandler ) {
+RfcommAssignDialog::~RfcommAssignDialog()
+{
+ if ( confHandler )
+ {
delete confHandler;
}
}
-void RfcommAssignDialog::newDevice( const QString & mac ) {
+void RfcommAssignDialog::newDevice( const QString & mac )
+{
- for ( int i = 0 ; i < m_range; i++ ) {
+ for ( int i = 0 ; i < m_range; i++ )
+ {
QMap<QString, RfCommConfObject*>::Iterator it;
it = confHandler->foundEntries().find( QString("%1").arg( i ) );
// make sure that rfcommX is not assigned yet
- if ( it == confHandler->foundEntries().end() ) {
+ if ( it == confHandler->foundEntries().end() )
+ {
QDialog dialog( this, "newdevice", true, WStyle_ContextHelp );
- dialog.showMaximized();
+
RfcommDialogItem *newDev = new RfcommDialogItem( &dialog );
newDev->setIdent( i );
newDev->setMac( mac );
- if ( dialog.exec() == QDialog::Accepted ) {
+ if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted )
+ {
RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
m_itemList.insert( i , rfcomm );
rfcomm->setIdent( i );
@@ -67,18 +77,21 @@ void RfcommAssignDialog::newDevice( const QString & mac ) {
}
}
-void RfcommAssignDialog::loadConfig() {
+void RfcommAssignDialog::loadConfig()
+{
//Config cfg( "bluetoothmanager-rfcommbind" );
- for ( int i = 0 ; i < m_range; i++ ) {
+ for ( int i = 0 ; i < m_range; i++ )
+ {
// cfg.setGroup( QString("%1").arg( i ) );
RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
m_itemList.insert( i , rfcomm );
rfcomm->setIdent( i );
QMap<QString, RfCommConfObject*>::Iterator it;
it = confHandler->foundEntries().find( QString("%1").arg( i ) );
- if ( it != confHandler->foundEntries().end() ) {
+ if ( it != confHandler->foundEntries().end() )
+ {
qDebug( "Found key in foundEntries() " );
rfcomm->setMac( it.data()->mac() );
rfcomm->setChannel( it.data()->channel() );
@@ -93,7 +106,8 @@ void RfcommAssignDialog::loadConfig() {
}
-void RfcommAssignDialog::saveConfig() {
+void RfcommAssignDialog::saveConfig()
+{
//Config cfg( "bluetoothmanager-rfcommbind" );
@@ -101,7 +115,8 @@ void RfcommAssignDialog::saveConfig() {
QMap< QString, RfCommConfObject*> outMap;
- for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) {
+ for( it = m_itemList.begin(); it != m_itemList.end(); ++it )
+ {
//cfg.setGroup( QString("%1").arg( it.key() ) );
RfcommDialogItem *rfcomm = it.data();
diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp
index d95f14b..04bfe48 100644
--- a/noncore/net/opietooth/manager/rfcpopup.cpp
+++ b/noncore/net/opietooth/manager/rfcpopup.cpp
@@ -1,17 +1,22 @@
-#include <qtimer.h>
-
#include "pppdialog.h"
#include "rfcpopup.h"
#include "rfcommassigndialogimpl.h"
+/* OPIE */
+#include <qpe/qpeapplication.h>
+
+/* QT */
+#include <qtimer.h>
+
using namespace OpieTooth;
/*
* c'tor init the QAction
*/
RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
- : QPopupMenu() {
+ : QPopupMenu()
+{
qWarning("RfcCommPopup c'tor");
QAction* a;
@@ -53,7 +58,8 @@ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
};
-RfcCommPopup::~RfcCommPopup() {
+RfcCommPopup::~RfcCommPopup()
+{
/* delete m_con;
delete m_dis;
delete m_foo;
@@ -61,36 +67,37 @@ RfcCommPopup::~RfcCommPopup() {
}
-void RfcCommPopup::slotConnect() {
+void RfcCommPopup::slotConnect()
+{
qWarning("connect");
-
-
PPPDialog pppDialog;
- pppDialog.showMaximized();
- pppDialog.exec();
+ QPEApplication::execDialog( &pppDialog );
}
-void RfcCommPopup::slotDisconnect() {
+void RfcCommPopup::slotDisconnect()
+{
qWarning("slot disconnected");
}
-void RfcCommPopup::slotBind() {
+void RfcCommPopup::slotBind()
+{
RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
- rfcommAssign.showMaximized();
rfcommAssign.newDevice( m_item->mac() );
- if ( rfcommAssign.exec() == QDialog::Accepted ) {
+ if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted )
+ {
rfcommAssign.saveConfig();
}
}
-void RfcCommPopup::slotBar() {
+void RfcCommPopup::slotBar()
+{
qWarning("slotBar");
};
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index 3729ed0..95a8294 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -177,10 +177,7 @@ void WellenreiterMainWindow::showConfigure()
{
qDebug( "show configure..." );
cw->setCaption( tr( "Configure" ) );
- #ifdef QWS
- cw->showMaximized();
- #endif
- int result = cw->exec();
+ int result = QPEApplication::execDialog( cw );
if ( result ) updateToolButtonState();
}