author | ulf69 <ulf69> | 2004-08-10 19:37:46 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-10 19:37:46 (UTC) |
commit | 2666ac52add8d79e34a04a64e4d5f092dd3d3d7e (patch) (unidiff) | |
tree | 268ecd1ce5d898f7bd6ce82f5d023b161dc38892 | |
parent | 9f73ddc03d2b02934906193cf8db5ff0813fce0b (diff) | |
download | kdepimpi-2666ac52add8d79e34a04a64e4d5f092dd3d3d7e.zip kdepimpi-2666ac52add8d79e34a04a64e4d5f092dd3d3d7e.tar.gz kdepimpi-2666ac52add8d79e34a04a64e4d5f092dd3d3d7e.tar.bz2 |
added methods to check if a certain application is available
-rw-r--r-- | libkdepim/externalapphandler.cpp | 128 | ||||
-rw-r--r-- | libkdepim/externalapphandler.h | 19 |
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() | |||
67 | void ExternalAppHandler::loadConfig() | 67 | void ExternalAppHandler::loadConfig() |
68 | { | 68 | { |
69 | |||
69 | mDefaultItems.clear(); | 70 | mDefaultItems.clear(); |
70 | 71 | ||
72 | mEmailAppAvailable = UNDEFINED; | ||
73 | mPhoneAppAvailable = UNDEFINED; | ||
74 | mFaxAppAvailable = UNDEFINED; | ||
75 | mSMSAppAvailable = UNDEFINED; | ||
76 | mPagerAppAvailable = UNDEFINED; | ||
71 | 77 | ||
72 | 78 | ||
@@ -81,5 +87,5 @@ void ExternalAppHandler::loadConfig() | |||
81 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; | 87 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; |
82 | 88 | ||
83 | QString undefined = "undefined"; | 89 | QString undefined = ""; |
84 | 90 | ||
85 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); | 91 | 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) | |||
166 | } | 172 | } |
167 | 173 | ||
174 | bool ExternalAppHandler::isEmailAppAvailable() | ||
175 | { | ||
176 | #ifndef DESKTOP_VERSION | ||
177 | if (mEmailAppAvailable == UNDEFINED) | ||
178 | { | ||
179 | int client = KPimGlobalPrefs::instance()->mEmailClient; | ||
180 | if (client == KPimGlobalPrefs::NONE_EMC) | ||
181 | mEmailAppAvailable = UNAVAILABLE; | ||
182 | else | ||
183 | mEmailAppAvailable = AVAILABLE; | ||
184 | } | ||
185 | return (mEmailAppAvailable == AVAILABLE); | ||
186 | |||
187 | #else //DESKTOP_VERSION | ||
188 | return false; | ||
189 | #endif //DESKTOP_VERSION | ||
190 | } | ||
191 | |||
192 | bool ExternalAppHandler::isSMSAppAvailable() | ||
193 | { | ||
194 | #ifndef DESKTOP_VERSION | ||
195 | if (mSMSAppAvailable == UNDEFINED) | ||
196 | { | ||
197 | int client = KPimGlobalPrefs::instance()->mSMSClient; | ||
198 | if (client == KPimGlobalPrefs::NONE_SMC) | ||
199 | mSMSAppAvailable = UNAVAILABLE; | ||
200 | else | ||
201 | mSMSAppAvailable = AVAILABLE; | ||
202 | } | ||
203 | |||
204 | return (mSMSAppAvailable == AVAILABLE); | ||
205 | #else //DESKTOP_VERSION | ||
206 | return false; | ||
207 | #endif //DESKTOP_VERSION | ||
208 | } | ||
209 | |||
210 | bool ExternalAppHandler::isPhoneAppAvailable() | ||
211 | { | ||
212 | #ifndef DESKTOP_VERSION | ||
213 | if (mPhoneAppAvailable == UNDEFINED) | ||
214 | { | ||
215 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | ||
216 | if (client == KPimGlobalPrefs::NONE_PHC) | ||
217 | mPhoneAppAvailable = UNAVAILABLE; | ||
218 | else | ||
219 | mPhoneAppAvailable = AVAILABLE; | ||
220 | } | ||
221 | |||
222 | return (mPhoneAppAvailable == AVAILABLE); | ||
223 | #else //DESKTOP_VERSION | ||
224 | return false; | ||
225 | #endif //DESKTOP_VERSION | ||
226 | } | ||
227 | |||
228 | bool ExternalAppHandler::isFaxAppAvailable() | ||
229 | { | ||
230 | #ifndef DESKTOP_VERSION | ||
231 | if (mFaxAppAvailable == UNDEFINED) | ||
232 | { | ||
233 | int client = KPimGlobalPrefs::instance()->mFaxClient; | ||
234 | if (client == KPimGlobalPrefs::NONE_FAC) | ||
235 | mFaxAppAvailable = UNAVAILABLE; | ||
236 | else | ||
237 | mFaxAppAvailable = AVAILABLE; | ||
238 | } | ||
239 | |||
240 | return (mFaxAppAvailable == AVAILABLE); | ||
241 | #else //DESKTOP_VERSION | ||
242 | return false; | ||
243 | #endif //DESKTOP_VERSION | ||
244 | } | ||
245 | |||
246 | bool ExternalAppHandler::isPagerAppAvailable() | ||
247 | { | ||
248 | #ifndef DESKTOP_VERSION | ||
249 | if (mPagerAppAvailable == UNDEFINED) | ||
250 | { | ||
251 | int client = KPimGlobalPrefs::instance()->mPagerClient; | ||
252 | if (client == KPimGlobalPrefs::NONE_PAC) | ||
253 | mPagerAppAvailable = UNAVAILABLE; | ||
254 | else | ||
255 | mPagerAppAvailable = AVAILABLE; | ||
256 | } | ||
257 | |||
258 | return (mPagerAppAvailable == AVAILABLE); | ||
259 | #else //DESKTOP_VERSION | ||
260 | return false; | ||
261 | #endif //DESKTOP_VERSION | ||
262 | } | ||
263 | |||
264 | /************************************************************************** | ||
265 | * | ||
266 | **************************************************************************/ | ||
168 | 267 | ||
169 | 268 | ||
@@ -217,4 +316,7 @@ bool ExternalAppHandler::mailAttachments( const QString& urls ) | |||
217 | } | 316 | } |
218 | 317 | ||
318 | /************************************************************************** | ||
319 | * | ||
320 | **************************************************************************/ | ||
219 | 321 | ||
220 | 322 | ||
@@ -270,4 +372,7 @@ bool ExternalAppHandler::mailToContacts( const QString& emails ) | |||
270 | } | 372 | } |
271 | 373 | ||
374 | /************************************************************************** | ||
375 | * | ||
376 | **************************************************************************/ | ||
272 | 377 | ||
273 | //calls the phoneapplication with the number | 378 | //calls the phoneapplication with the number |
@@ -322,4 +427,8 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | |||
322 | } | 427 | } |
323 | 428 | ||
429 | /************************************************************************** | ||
430 | * | ||
431 | **************************************************************************/ | ||
432 | |||
324 | //calls the smsapplication with the number | 433 | //calls the smsapplication with the number |
325 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | 434 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) |
@@ -373,4 +482,8 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | |||
373 | } | 482 | } |
374 | 483 | ||
484 | /************************************************************************** | ||
485 | * | ||
486 | **************************************************************************/ | ||
487 | |||
375 | //calls the pagerapplication with the number | 488 | //calls the pagerapplication with the number |
376 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) | 489 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) |
@@ -424,4 +537,8 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber ) | |||
424 | } | 537 | } |
425 | 538 | ||
539 | /************************************************************************** | ||
540 | * | ||
541 | **************************************************************************/ | ||
542 | |||
426 | //calls the faxapplication with the number | 543 | //calls the faxapplication with the number |
427 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) | 544 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) |
@@ -475,6 +592,7 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) | |||
475 | } | 592 | } |
476 | 593 | ||
477 | 594 | /************************************************************************** | |
478 | 595 | * | |
596 | **************************************************************************/ | ||
479 | 597 | ||
480 | 598 | ||
@@ -485,4 +603,8 @@ QString& ExternalAppHandler::translateMessage(QString& message, const QString& p | |||
485 | } | 603 | } |
486 | 604 | ||
605 | /************************************************************************** | ||
606 | * | ||
607 | **************************************************************************/ | ||
608 | |||
487 | void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameters, const QString& param1) const | 609 | void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameters, const QString& param1) const |
488 | { | 610 | { |
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 | |||
76 | }; | 76 | }; |
77 | 77 | ||
78 | enum Availability { | ||
79 | UNDEFINED = -1, | ||
80 | UNAVAILABLE = 0, | ||
81 | AVAILABLE = 1 | ||
82 | }; | ||
83 | |||
78 | //calls the emailapplication with a number of attachments that need to be send | 84 | //calls the emailapplication with a number of attachments that need to be send |
79 | bool mailAttachments( const QString& urls ); | 85 | bool mailAttachments( const QString& urls ); |
@@ -94,4 +100,11 @@ class ExternalAppHandler | |||
94 | bool callByFax( const QString& faxnumber ); | 100 | bool callByFax( const QString& faxnumber ); |
95 | 101 | ||
102 | bool isEmailAppAvailable(); | ||
103 | bool isSMSAppAvailable(); | ||
104 | bool isPhoneAppAvailable(); | ||
105 | bool isFaxAppAvailable(); | ||
106 | bool isPagerAppAvailable(); | ||
107 | |||
108 | |||
96 | 109 | ||
97 | //loadConfig clears the cache and checks again if the applications are available or not | 110 | //loadConfig clears the cache and checks again if the applications are available or not |
@@ -106,4 +119,10 @@ class ExternalAppHandler | |||
106 | QList<DefaultAppItem> mDefaultItems; | 119 | QList<DefaultAppItem> mDefaultItems; |
107 | 120 | ||
121 | Availability mEmailAppAvailable; | ||
122 | Availability mPhoneAppAvailable; | ||
123 | Availability mFaxAppAvailable; | ||
124 | Availability mSMSAppAvailable; | ||
125 | Availability mPagerAppAvailable; | ||
126 | |||
108 | 127 | ||
109 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); | 128 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); |