summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp128
-rw-r--r--libkdepim/externalapphandler.h19
2 files changed, 144 insertions, 3 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 0128cf7..5a56d68 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -67,6 +67,12 @@ ExternalAppHandler::~ExternalAppHandler()
void ExternalAppHandler::loadConfig()
{
+
mDefaultItems.clear();
+ mEmailAppAvailable = UNDEFINED;
+ mPhoneAppAvailable = UNDEFINED;
+ mFaxAppAvailable = UNDEFINED;
+ mSMSAppAvailable = UNDEFINED;
+ mPagerAppAvailable = UNDEFINED;
@@ -81,5 +87,5 @@ void ExternalAppHandler::loadConfig()
QString mailmsg2 = "writeMail(QMap(QString,QString))";
- QString undefined = "undefined";
+ QString undefined = "";
addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined);
@@ -166,4 +172,97 @@ DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid)
}
+bool ExternalAppHandler::isEmailAppAvailable()
+{
+#ifndef DESKTOP_VERSION
+ if (mEmailAppAvailable == UNDEFINED)
+ {
+ int client = KPimGlobalPrefs::instance()->mEmailClient;
+ if (client == KPimGlobalPrefs::NONE_EMC)
+ mEmailAppAvailable = UNAVAILABLE;
+ else
+ mEmailAppAvailable = AVAILABLE;
+ }
+ return (mEmailAppAvailable == AVAILABLE);
+
+#else //DESKTOP_VERSION
+ return false;
+#endif //DESKTOP_VERSION
+}
+
+bool ExternalAppHandler::isSMSAppAvailable()
+{
+#ifndef DESKTOP_VERSION
+ if (mSMSAppAvailable == UNDEFINED)
+ {
+ int client = KPimGlobalPrefs::instance()->mSMSClient;
+ if (client == KPimGlobalPrefs::NONE_SMC)
+ mSMSAppAvailable = UNAVAILABLE;
+ else
+ mSMSAppAvailable = AVAILABLE;
+ }
+
+ return (mSMSAppAvailable == AVAILABLE);
+#else //DESKTOP_VERSION
+ return false;
+#endif //DESKTOP_VERSION
+}
+
+bool ExternalAppHandler::isPhoneAppAvailable()
+{
+#ifndef DESKTOP_VERSION
+ if (mPhoneAppAvailable == UNDEFINED)
+ {
+ int client = KPimGlobalPrefs::instance()->mPhoneClient;
+ if (client == KPimGlobalPrefs::NONE_PHC)
+ mPhoneAppAvailable = UNAVAILABLE;
+ else
+ mPhoneAppAvailable = AVAILABLE;
+ }
+
+ return (mPhoneAppAvailable == AVAILABLE);
+#else //DESKTOP_VERSION
+ return false;
+#endif //DESKTOP_VERSION
+}
+
+bool ExternalAppHandler::isFaxAppAvailable()
+{
+#ifndef DESKTOP_VERSION
+ if (mFaxAppAvailable == UNDEFINED)
+ {
+ int client = KPimGlobalPrefs::instance()->mFaxClient;
+ if (client == KPimGlobalPrefs::NONE_FAC)
+ mFaxAppAvailable = UNAVAILABLE;
+ else
+ mFaxAppAvailable = AVAILABLE;
+ }
+
+ return (mFaxAppAvailable == AVAILABLE);
+#else //DESKTOP_VERSION
+ return false;
+#endif //DESKTOP_VERSION
+}
+
+bool ExternalAppHandler::isPagerAppAvailable()
+{
+#ifndef DESKTOP_VERSION
+ if (mPagerAppAvailable == UNDEFINED)
+ {
+ int client = KPimGlobalPrefs::instance()->mPagerClient;
+ if (client == KPimGlobalPrefs::NONE_PAC)
+ mPagerAppAvailable = UNAVAILABLE;
+ else
+ mPagerAppAvailable = AVAILABLE;
+ }
+
+ return (mPagerAppAvailable == AVAILABLE);
+#else //DESKTOP_VERSION
+ return false;
+#endif //DESKTOP_VERSION
+}
+
+/**************************************************************************
+ *
+ **************************************************************************/
@@ -217,4 +316,7 @@ bool ExternalAppHandler::mailAttachments( const QString& urls )
}
+/**************************************************************************
+ *
+ **************************************************************************/
@@ -270,4 +372,7 @@ bool ExternalAppHandler::mailToContacts( const QString& emails )
}
+/**************************************************************************
+ *
+ **************************************************************************/
//calls the phoneapplication with the number
@@ -322,4 +427,8 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber )
}
+/**************************************************************************
+ *
+ **************************************************************************/
+
//calls the smsapplication with the number
bool ExternalAppHandler::callBySMS( const QString& phonenumber )
@@ -373,4 +482,8 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber )
}
+/**************************************************************************
+ *
+ **************************************************************************/
+
//calls the pagerapplication with the number
bool ExternalAppHandler::callByPager( const QString& pagernumber )
@@ -424,4 +537,8 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber )
}
+/**************************************************************************
+ *
+ **************************************************************************/
+
//calls the faxapplication with the number
bool ExternalAppHandler::callByFax( const QString& faxnumber )
@@ -475,6 +592,7 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber )
}
-
-
+/**************************************************************************
+ *
+ **************************************************************************/
@@ -485,4 +603,8 @@ QString& ExternalAppHandler::translateMessage(QString& message, const QString& p
}
+/**************************************************************************
+ *
+ **************************************************************************/
+
void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameters, const QString& param1) const
{
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index 3ecf1b1..efcdd89 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -76,4 +76,10 @@ class ExternalAppHandler
};
+ enum Availability {
+ UNDEFINED = -1,
+ UNAVAILABLE = 0,
+ AVAILABLE = 1
+ };
+
//calls the emailapplication with a number of attachments that need to be send
bool mailAttachments( const QString& urls );
@@ -94,4 +100,11 @@ class ExternalAppHandler
bool callByFax( const QString& faxnumber );
+ bool isEmailAppAvailable();
+ bool isSMSAppAvailable();
+ bool isPhoneAppAvailable();
+ bool isFaxAppAvailable();
+ bool isPagerAppAvailable();
+
+
//loadConfig clears the cache and checks again if the applications are available or not
@@ -106,4 +119,10 @@ class ExternalAppHandler
QList<DefaultAppItem> mDefaultItems;
+ Availability mEmailAppAvailable;
+ Availability mPhoneAppAvailable;
+ Availability mFaxAppAvailable;
+ Availability mSMSAppAvailable;
+ Availability mPagerAppAvailable;
+
void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2);