author | ulf69 <ulf69> | 2004-08-10 22:40:58 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-10 22:40:58 (UTC) |
commit | c1ef5e08dbc5d0b891de75ef8e90e73cc4f3d26f (patch) (unidiff) | |
tree | d225831e4aa2af66480dbb7df3a9e56590c8ddbb /libkdepim | |
parent | 29abd716e5187a4717a5459b9c25c6c299df8d56 (diff) | |
download | kdepimpi-c1ef5e08dbc5d0b891de75ef8e90e73cc4f3d26f.zip kdepimpi-c1ef5e08dbc5d0b891de75ef8e90e73cc4f3d26f.tar.gz kdepimpi-c1ef5e08dbc5d0b891de75ef8e90e73cc4f3d26f.tar.bz2 |
changes on how we call external email application
-rw-r--r-- | libkdepim/externalapphandler.cpp | 70 |
1 files changed, 48 insertions, 22 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 5a56d68..1093abf 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -94,11 +94,11 @@ void ExternalAppHandler::loadConfig() | |||
94 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || | 94 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || |
95 | ( QFile::exists( opiepath + "/bin/ompi" ))) | 95 | ( QFile::exists( opiepath + "/bin/ompi" ))) |
96 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", "newMail(QString)", "%1", mailmsg2, "ATTACHMENT=%1"); | 96 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
97 | 97 | ||
98 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) | 98 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) |
99 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, ";%1", mailmsg2, "ATTACHMENT=%1"); | 99 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
100 | 100 | ||
101 | if ( QFile::exists( opiepath + "/bin/opiemail" )) | 101 | if ( QFile::exists( opiepath + "/bin/opiemail" )) |
102 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, ";%1", mailmsg2, "ATTACHMENT=%1"); | 102 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
103 | 103 | ||
104 | 104 | ||
@@ -268,5 +268,5 @@ bool ExternalAppHandler::isPagerAppAvailable() | |||
268 | 268 | ||
269 | //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) |
270 | bool ExternalAppHandler::mailAttachments( const QString& urls ) | 270 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) |
271 | { | 271 | { |
272 | 272 | ||
@@ -297,7 +297,10 @@ bool ExternalAppHandler::mailAttachments( const QString& urls ) | |||
297 | } | 297 | } |
298 | 298 | ||
299 | //first check if one of the mailers need the emails right in the message. | ||
300 | message2 = translateMessage(message2, emails, urls); | ||
301 | |||
299 | 302 | ||
300 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 303 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
301 | qDebug("passing attachmenturls:(%s) as parameter in the form %s to QCopEnvelope", urls.latin1(), parameters2.latin1()); | 304 | qDebug("passing emailadresses:(%s), attachmenturls:(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); |
302 | 305 | ||
303 | 306 | ||
@@ -305,5 +308,5 @@ bool ExternalAppHandler::mailAttachments( const QString& urls ) | |||
305 | //US we need no names in the To field. The emailadresses are enough | 308 | //US we need no names in the To field. The emailadresses are enough |
306 | 309 | ||
307 | passParameter(&e, parameters2, urls); | 310 | passParameters(&e, parameters2, emails, urls); |
308 | 311 | ||
309 | 312 | ||
@@ -322,5 +325,5 @@ bool ExternalAppHandler::mailAttachments( const QString& urls ) | |||
322 | 325 | ||
323 | //calls the emailapplication and creates a mail with parameter emails as recipients | 326 | //calls the emailapplication and creates a mail with parameter emails as recipients |
324 | bool ExternalAppHandler::mailToContacts( const QString& emails ) | 327 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) |
325 | { | 328 | { |
326 | #ifndef DESKTOP_VERSION | 329 | #ifndef DESKTOP_VERSION |
@@ -352,14 +355,14 @@ bool ExternalAppHandler::mailToContacts( const QString& emails ) | |||
352 | 355 | ||
353 | //first check if one of the mailers need the emails right in the message. | 356 | //first check if one of the mailers need the emails right in the message. |
354 | message = translateMessage(message, emails); | 357 | message = translateMessage(message, name, emailadress); |
355 | 358 | ||
356 | 359 | ||
357 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 360 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
358 | qDebug("passing emailadresses:(%s) as parameter in the form %s to QCopEnvelope", emails.latin1(), parameters.latin1()); | 361 | qDebug("passing name:(%s), emailadresses:(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); |
359 | 362 | ||
360 | QCopEnvelope e(channel.latin1(), message.latin1()); | 363 | QCopEnvelope e(channel.latin1(), message.latin1()); |
361 | //US we need no names in the To field. The emailadresses are enough | 364 | //US we need no names in the To field. The emailadresses are enough |
362 | 365 | ||
363 | passParameter(&e, parameters, emails); | 366 | passParameters(&e, parameters, name, emailadress); |
364 | 367 | ||
365 | 368 | ||
@@ -376,4 +379,25 @@ bool ExternalAppHandler::mailToContacts( const QString& emails ) | |||
376 | **************************************************************************/ | 379 | **************************************************************************/ |
377 | 380 | ||
381 | //calls the emailapplication and creates a mail with parameter as recipients | ||
382 | // parameters format is | ||
383 | // NAME <EMAIL>:SUBJECT | ||
384 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) | ||
385 | { | ||
386 | QString line = adressline; | ||
387 | |||
388 | int first = line.find( "<"); | ||
389 | int last = line.find( ">"); | ||
390 | QString name = line.left(first); | ||
391 | QString emailadress = line.mid(first+1, last-first-1); | ||
392 | |||
393 | //Subject can not be handled right now. | ||
394 | mailToOneContact( name, emailadress ); | ||
395 | } | ||
396 | |||
397 | |||
398 | /************************************************************************** | ||
399 | * | ||
400 | **************************************************************************/ | ||
401 | |||
378 | //calls the phoneapplication with the number | 402 | //calls the phoneapplication with the number |
379 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | 403 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) |
@@ -407,5 +431,5 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | |||
407 | 431 | ||
408 | //first check if one of the mailers need the emails right in the message. | 432 | //first check if one of the mailers need the emails right in the message. |
409 | message = translateMessage(message, phonenumber); | 433 | message = translateMessage(message, phonenumber, ""); |
410 | 434 | ||
411 | 435 | ||
@@ -416,5 +440,5 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | |||
416 | //US we need no names in the To field. The emailadresses are enough | 440 | //US we need no names in the To field. The emailadresses are enough |
417 | 441 | ||
418 | passParameter(&e, parameters, phonenumber); | 442 | passParameters(&e, parameters, phonenumber, ""); |
419 | 443 | ||
420 | 444 | ||
@@ -462,5 +486,5 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | |||
462 | 486 | ||
463 | //first check if one of the mailers need the emails right in the message. | 487 | //first check if one of the mailers need the emails right in the message. |
464 | message = translateMessage(message, phonenumber); | 488 | message = translateMessage(message, phonenumber, ""); |
465 | 489 | ||
466 | 490 | ||
@@ -471,5 +495,5 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | |||
471 | //US we need no names in the To field. The emailadresses are enough | 495 | //US we need no names in the To field. The emailadresses are enough |
472 | 496 | ||
473 | passParameter(&e, parameters, phonenumber); | 497 | passParameters(&e, parameters, phonenumber, ""); |
474 | 498 | ||
475 | 499 | ||
@@ -517,5 +541,5 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber ) | |||
517 | 541 | ||
518 | //first check if one of the mailers need the emails right in the message. | 542 | //first check if one of the mailers need the emails right in the message. |
519 | message = translateMessage(message, pagernumber); | 543 | message = translateMessage(message, pagernumber, ""); |
520 | 544 | ||
521 | 545 | ||
@@ -526,5 +550,5 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber ) | |||
526 | //US we need no names in the To field. The emailadresses are enough | 550 | //US we need no names in the To field. The emailadresses are enough |
527 | 551 | ||
528 | passParameter(&e, parameters, pagernumber); | 552 | passParameters(&e, parameters, pagernumber, ""); |
529 | 553 | ||
530 | 554 | ||
@@ -572,5 +596,5 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) | |||
572 | 596 | ||
573 | //first check if one of the mailers need the emails right in the message. | 597 | //first check if one of the mailers need the emails right in the message. |
574 | message = translateMessage(message, faxnumber); | 598 | message = translateMessage(message, faxnumber, ""); |
575 | 599 | ||
576 | 600 | ||
@@ -581,5 +605,5 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) | |||
581 | //US we need no names in the To field. The emailadresses are enough | 605 | //US we need no names in the To field. The emailadresses are enough |
582 | 606 | ||
583 | passParameter(&e, parameters, faxnumber); | 607 | passParameters(&e, parameters, faxnumber, ""); |
584 | 608 | ||
585 | 609 | ||
@@ -597,8 +621,8 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) | |||
597 | 621 | ||
598 | 622 | ||
599 | 623 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const | |
600 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1) const | ||
601 | { | 624 | { |
602 | return message.replace( QRegExp("%1"), param1 ); | 625 | message = message.replace( QRegExp("%1"), param1 ); |
626 | return message.replace( QRegExp("%2"), param2 ); | ||
603 | } | 627 | } |
604 | 628 | ||
@@ -607,5 +631,5 @@ QString& ExternalAppHandler::translateMessage(QString& message, const QString& p | |||
607 | **************************************************************************/ | 631 | **************************************************************************/ |
608 | 632 | ||
609 | void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameters, const QString& param1) const | 633 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const |
610 | { | 634 | { |
611 | #ifndef DESKTOP_VERSION | 635 | #ifndef DESKTOP_VERSION |
@@ -628,4 +652,5 @@ void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameter | |||
628 | QString key = (*it2); | 652 | QString key = (*it2); |
629 | key = key.replace( QRegExp("%1"), param1 ); | 653 | key = key.replace( QRegExp("%1"), param1 ); |
654 | key = key.replace( QRegExp("%2"), param2 ); | ||
630 | ++it2; | 655 | ++it2; |
631 | 656 | ||
@@ -634,4 +659,5 @@ void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameter | |||
634 | QString value = (*it2); | 659 | QString value = (*it2); |
635 | value = value.replace( QRegExp("%1"), param1 ); | 660 | value = value.replace( QRegExp("%1"), param1 ); |
661 | value = value.replace( QRegExp("%2"), param2 ); | ||
636 | 662 | ||
637 | valmap.insert(key, value); | 663 | valmap.insert(key, value); |