hasEmailSupport patch
Tick Chen
tick at openmoko.com
Tue Jul 15 10:02:25 CEST 2008
Hi Holger,
I created a patch to solve unusable Email button on overview dialog.
The VCard view is not done yet, for that will need something more to
deal with.
Cheers,
Tick
-------------- next part --------------
diff --git a/src/applications/addressbook/contactoverview.cpp b/src/applications/addressbook/contactoverview.cpp
index 078ddb7..850d5fc 100644
--- a/src/applications/addressbook/contactoverview.cpp
+++ b/src/applications/addressbook/contactoverview.cpp
@@ -36,6 +36,7 @@
#include <QResizeEvent>
#include <QtopiaService>
+#include <qemailsupport.h>
// -------------------------------------------------------------
// ContactOverview
@@ -92,7 +93,7 @@ void ContactOverview::updateCommands()
#endif
mCall->setVisible( bDialer && numbers.count() > 0 );
- mEmail->setVisible(bEmail && !ent.defaultEmail().isEmpty() );
+ mEmail->setVisible(bEmail && !ent.defaultEmail().isEmpty() && QEmailSupport::hasEmailSupport());
mText->setVisible( bSMS && numbers.count() > 0 );
if (numbers.count() > 1) {
diff --git a/src/libraries/qtopiamail/qemailsupport.cpp b/src/libraries/qtopiamail/qemailsupport.cpp
new file mode 100644
index 0000000..c32b70f
--- /dev/null
+++ b/src/libraries/qtopiamail/qemailsupport.cpp
@@ -0,0 +1,45 @@
+/***************************************************************************
+**
+** Copyright (C) 2008 Openmoko Inc.
+**
+** This software is licensed under the terms of the GNU General Public
+** License (GPL) version 2 or at your option any later version.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+***************************************************************************/
+
+#include <qsettings.h>
+#include <qdebug.h>
+#include "qemailsupport.h"
+
+
+namespace QEmailSupport {
+
+bool _getEmailConf(QSettings *conf, int count)
+{
+ int i;
+ for (i=0;i< count;i++) {
+ conf->beginGroup( "account_" + QString::number(i) );
+ if (!conf->value("smtpserver").toString().isEmpty()) {
+ return true;
+ }
+ conf->endGroup();
+ }
+ return false;
+}
+
+bool hasEmailSupport()
+{
+ int count;
+ QSettings accountconf("Trolltech","qtmail_account");
+ accountconf.beginGroup( "accountglobal" );
+ count = accountconf.value("accounts", 0).toInt();
+ accountconf.endGroup();
+ if(count==0)
+ return false;
+ return _getEmailConf(&accountconf, count);
+}
+
+}
diff --git a/src/libraries/qtopiamail/qemailsupport.h b/src/libraries/qtopiamail/qemailsupport.h
new file mode 100644
index 0000000..eb5e81a
--- /dev/null
+++ b/src/libraries/qtopiamail/qemailsupport.h
@@ -0,0 +1,21 @@
+/***************************************************************************
+**
+** Copyright (C) 2008 Openmoko Inc.
+**
+** This software is licensed under the terms of the GNU General Public
+** License (GPL) version 2 or at your option any later version.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+***************************************************************************/
+
+
+#ifndef _QEMAILSUPPORT_H_
+#define _QEMAILSUPPORT_H_
+
+namespace QEmailSupport {
+ bool hasEmailSupport();
+};
+
+#endif
diff --git a/src/libraries/qtopiamail/qtopiamail.pro b/src/libraries/qtopiamail/qtopiamail.pro
index 144b6e0..822c72e 100644
--- a/src/libraries/qtopiamail/qtopiamail.pro
+++ b/src/libraries/qtopiamail/qtopiamail.pro
@@ -33,7 +33,8 @@ HEADERS+=\
qmailid.h\
mailbodystore_p.h\
qprivateimplementation_p.h\
- qprivateimplementationdef_p.h
+ qprivateimplementationdef_p.h\
+ qemailsupport.h
SOURCES+=\
qmailaddress.cpp\
@@ -55,7 +56,8 @@ SOURCES+=\
qmailviewerplugin.cpp\
qmailid.cpp\
mailbodystore.cpp\
- qprivateimplementation.cpp
+ qprivateimplementation.cpp\
+ qemailsupport.cpp
depends(libraries/qtopiapim)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.openmoko.org/pipermail/devel/attachments/20080715/b1b3c4cc/attachment.pgp
More information about the devel
mailing list