summaryrefslogtreecommitdiffabout
path: root/libkdepim/externalapphandler.cpp
authorulf69 <ulf69>2004-08-10 19:37:46 (UTC)
committer ulf69 <ulf69>2004-08-10 19:37:46 (UTC)
commit2666ac52add8d79e34a04a64e4d5f092dd3d3d7e (patch) (side-by-side diff)
tree268ecd1ce5d898f7bd6ce82f5d023b161dc38892 /libkdepim/externalapphandler.cpp
parent9f73ddc03d2b02934906193cf8db5ff0813fce0b (diff)
downloadkdepimpi-2666ac52add8d79e34a04a64e4d5f092dd3d3d7e.zip
kdepimpi-2666ac52add8d79e34a04a64e4d5f092dd3d3d7e.tar.gz
kdepimpi-2666ac52add8d79e34a04a64e4d5f092dd3d3d7e.tar.bz2
added methods to check if a certain application is available
Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp128
1 files changed, 125 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
@@ -61,31 +61,37 @@ ExternalAppHandler::ExternalAppHandler()
}
ExternalAppHandler::~ExternalAppHandler()
{
}
void ExternalAppHandler::loadConfig()
{
+
mDefaultItems.clear();
+ mEmailAppAvailable = UNDEFINED;
+ mPhoneAppAvailable = UNDEFINED;
+ mFaxAppAvailable = UNDEFINED;
+ mSMSAppAvailable = UNDEFINED;
+ mPagerAppAvailable = UNDEFINED;
QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
if (opiepath.isEmpty())
opiepath = qtopiapath;
//mailclients
QString mailmsg1 = "writeMail(QString,QString)";
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);
addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined);
if (( QFile::exists( qtopiapath + "/bin/ompi" )) ||
( QFile::exists( opiepath + "/bin/ompi" )))
addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", "newMail(QString)", "%1", mailmsg2, "ATTACHMENT=%1");
@@ -160,16 +166,109 @@ DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid)
{
if (dai->_type == type && dai->_id == clientid)
return dai;
}
return 0;
}
+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
+}
+
+/**************************************************************************
+ *
+ **************************************************************************/
//calls the emailapplication with a number of attachments that need to be send (Seperated by Comma)
bool ExternalAppHandler::mailAttachments( const QString& urls )
{
#ifndef DESKTOP_VERSION
QString channel;
@@ -211,16 +310,19 @@ bool ExternalAppHandler::mailAttachments( const QString& urls )
#else
KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
#endif
return true;
}
+/**************************************************************************
+ *
+ **************************************************************************/
//calls the emailapplication and creates a mail with parameter emails as recipients
bool ExternalAppHandler::mailToContacts( const QString& emails )
{
#ifndef DESKTOP_VERSION
QString channel;
QString message;
@@ -264,16 +366,19 @@ bool ExternalAppHandler::mailToContacts( const QString& emails )
#else
KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
#endif
return true;
}
+/**************************************************************************
+ *
+ **************************************************************************/
//calls the phoneapplication with the number
bool ExternalAppHandler::callByPhone( const QString& phonenumber )
{
#ifndef DESKTOP_VERSION
QString channel;
QString message;
QString parameters;
@@ -316,16 +421,20 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber )
#else
KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) );
#endif
return true;
}
+/**************************************************************************
+ *
+ **************************************************************************/
+
//calls the smsapplication with the number
bool ExternalAppHandler::callBySMS( const QString& phonenumber )
{
#ifndef DESKTOP_VERSION
QString channel;
QString message;
QString parameters;
@@ -367,16 +476,20 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber )
#else
KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) );
#endif
return true;
}
+/**************************************************************************
+ *
+ **************************************************************************/
+
//calls the pagerapplication with the number
bool ExternalAppHandler::callByPager( const QString& pagernumber )
{
#ifndef DESKTOP_VERSION
QString channel;
QString message;
QString parameters;
@@ -418,16 +531,20 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber )
#else
KMessageBox::sorry( 0, i18n( "This version does not support paging." ) );
#endif
return true;
}
+/**************************************************************************
+ *
+ **************************************************************************/
+
//calls the faxapplication with the number
bool ExternalAppHandler::callByFax( const QString& faxnumber )
{
#ifndef DESKTOP_VERSION
QString channel;
QString message;
QString parameters;
@@ -469,26 +586,31 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber )
#else
KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) );
#endif
return true;
}
-
-
+/**************************************************************************
+ *
+ **************************************************************************/
QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1) const
{
return message.replace( QRegExp("%1"), param1 );
}
+/**************************************************************************
+ *
+ **************************************************************************/
+
void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameters, const QString& param1) const
{
#ifndef DESKTOP_VERSION
QMap<QString, QString> valmap;
bool useValMap = false;
// first extract all parts of the parameters.
QStringList paramlist = QStringList::split(";", parameters);