Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/externalapphandler.cpp | 128 |
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 | |||
@@ -63,27 +63,33 @@ ExternalAppHandler::ExternalAppHandler() | |||
63 | ExternalAppHandler::~ExternalAppHandler() | 63 | ExternalAppHandler::~ExternalAppHandler() |
64 | { | 64 | { |
65 | } | 65 | } |
66 | 66 | ||
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 | ||
73 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | 79 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); |
74 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | 80 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); |
75 | 81 | ||
76 | if (opiepath.isEmpty()) | 82 | if (opiepath.isEmpty()) |
77 | opiepath = qtopiapath; | 83 | opiepath = qtopiapath; |
78 | 84 | ||
79 | //mailclients | 85 | //mailclients |
80 | QString mailmsg1 = "writeMail(QString,QString)"; | 86 | QString mailmsg1 = "writeMail(QString,QString)"; |
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); |
86 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); | 92 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); |
87 | 93 | ||
88 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || | 94 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || |
89 | ( QFile::exists( opiepath + "/bin/ompi" ))) | 95 | ( QFile::exists( opiepath + "/bin/ompi" ))) |
@@ -162,12 +168,105 @@ DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) | |||
162 | return dai; | 168 | return dai; |
163 | } | 169 | } |
164 | 170 | ||
165 | return 0; | 171 | return 0; |
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 | ||
170 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) | 269 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) |
171 | bool ExternalAppHandler::mailAttachments( const QString& urls ) | 270 | bool ExternalAppHandler::mailAttachments( const QString& urls ) |
172 | { | 271 | { |
173 | 272 | ||
@@ -213,12 +312,15 @@ bool ExternalAppHandler::mailAttachments( const QString& urls ) | |||
213 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 312 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
214 | #endif | 313 | #endif |
215 | 314 | ||
216 | return true; | 315 | return true; |
217 | } | 316 | } |
218 | 317 | ||
318 | /************************************************************************** | ||
319 | * | ||
320 | **************************************************************************/ | ||
219 | 321 | ||
220 | 322 | ||
221 | //calls the emailapplication and creates a mail with parameter emails as recipients | 323 | //calls the emailapplication and creates a mail with parameter emails as recipients |
222 | bool ExternalAppHandler::mailToContacts( const QString& emails ) | 324 | bool ExternalAppHandler::mailToContacts( const QString& emails ) |
223 | { | 325 | { |
224 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
@@ -266,12 +368,15 @@ bool ExternalAppHandler::mailToContacts( const QString& emails ) | |||
266 | #endif | 368 | #endif |
267 | 369 | ||
268 | 370 | ||
269 | return true; | 371 | return true; |
270 | } | 372 | } |
271 | 373 | ||
374 | /************************************************************************** | ||
375 | * | ||
376 | **************************************************************************/ | ||
272 | 377 | ||
273 | //calls the phoneapplication with the number | 378 | //calls the phoneapplication with the number |
274 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | 379 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) |
275 | { | 380 | { |
276 | #ifndef DESKTOP_VERSION | 381 | #ifndef DESKTOP_VERSION |
277 | QString channel; | 382 | QString channel; |
@@ -318,12 +423,16 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | |||
318 | #endif | 423 | #endif |
319 | 424 | ||
320 | 425 | ||
321 | return true; | 426 | return true; |
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 ) |
326 | { | 435 | { |
327 | #ifndef DESKTOP_VERSION | 436 | #ifndef DESKTOP_VERSION |
328 | QString channel; | 437 | QString channel; |
329 | QString message; | 438 | QString message; |
@@ -369,12 +478,16 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | |||
369 | #endif | 478 | #endif |
370 | 479 | ||
371 | 480 | ||
372 | return true; | 481 | return true; |
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 ) |
377 | { | 490 | { |
378 | #ifndef DESKTOP_VERSION | 491 | #ifndef DESKTOP_VERSION |
379 | QString channel; | 492 | QString channel; |
380 | QString message; | 493 | QString message; |
@@ -420,12 +533,16 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber ) | |||
420 | #endif | 533 | #endif |
421 | 534 | ||
422 | 535 | ||
423 | return true; | 536 | return true; |
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 ) |
428 | { | 545 | { |
429 | #ifndef DESKTOP_VERSION | 546 | #ifndef DESKTOP_VERSION |
430 | QString channel; | 547 | QString channel; |
431 | QString message; | 548 | QString message; |
@@ -471,22 +588,27 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) | |||
471 | #endif | 588 | #endif |
472 | 589 | ||
473 | 590 | ||
474 | return true; | 591 | return true; |
475 | } | 592 | } |
476 | 593 | ||
477 | 594 | /************************************************************************** | |
478 | 595 | * | |
596 | **************************************************************************/ | ||
479 | 597 | ||
480 | 598 | ||
481 | 599 | ||
482 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1) const | 600 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1) const |
483 | { | 601 | { |
484 | return message.replace( QRegExp("%1"), param1 ); | 602 | return message.replace( QRegExp("%1"), param1 ); |
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 | { |
489 | #ifndef DESKTOP_VERSION | 611 | #ifndef DESKTOP_VERSION |
490 | QMap<QString, QString> valmap; | 612 | QMap<QString, QString> valmap; |
491 | bool useValMap = false; | 613 | bool useValMap = false; |
492 | 614 | ||