author | ulf69 <ulf69> | 2004-08-13 16:52:31 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-13 16:52:31 (UTC) |
commit | 0e46d151bca931ff5c69a637d91cfcc381094e0b (patch) (unidiff) | |
tree | 8a821a892aaa3035a17b843ab5dbead0353398e5 /libkdepim | |
parent | 2de1d7732f0f44895b353bb61520f725ede484ea (diff) | |
download | kdepimpi-0e46d151bca931ff5c69a637d91cfcc381094e0b.zip kdepimpi-0e46d151bca931ff5c69a637d91cfcc381094e0b.tar.gz kdepimpi-0e46d151bca931ff5c69a637d91cfcc381094e0b.tar.bz2 |
fixed a bug. I passed the QString parameters as latin1 representation, which was not correct.
-rw-r--r-- | libkdepim/externalapphandler.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 1093abf..35638b1 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -272,122 +272,122 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS | |||
272 | 272 | ||
273 | #ifndef DESKTOP_VERSION | 273 | #ifndef DESKTOP_VERSION |
274 | QString channel; | 274 | QString channel; |
275 | QString message2; | 275 | QString message2; |
276 | QString parameters2; | 276 | QString parameters2; |
277 | 277 | ||
278 | 278 | ||
279 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 279 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
280 | if (client == KPimGlobalPrefs::OTHER_EMC) | 280 | if (client == KPimGlobalPrefs::OTHER_EMC) |
281 | { | 281 | { |
282 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 282 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
283 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 283 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
284 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 284 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
285 | } | 285 | } |
286 | else | 286 | else |
287 | { | 287 | { |
288 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); | 288 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); |
289 | if (!dai) | 289 | if (!dai) |
290 | { | 290 | { |
291 | qDebug("could not find configured email application."); | 291 | qDebug("could not find configured email application."); |
292 | return false; | 292 | return false; |
293 | } | 293 | } |
294 | channel = dai->_channel; | 294 | channel = dai->_channel; |
295 | message2 = dai->_message2; | 295 | message2 = dai->_message2; |
296 | parameters2 = dai->_parameters2; | 296 | parameters2 = dai->_parameters2; |
297 | } | 297 | } |
298 | 298 | ||
299 | //first check if one of the mailers need the emails right in the message. | 299 | //first check if one of the mailers need the emails right in the message. |
300 | message2 = translateMessage(message2, emails, urls); | 300 | message2 = translateMessage(message2, emails, urls); |
301 | 301 | ||
302 | 302 | ||
303 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 303 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
304 | qDebug("passing emailadresses:(%s), attachmenturls:(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , 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()); |
305 | 305 | ||
306 | 306 | ||
307 | QCopEnvelope e(channel.latin1(), message2.latin1()); | 307 | QCopEnvelope e(channel.latin1(), message2.latin1()); |
308 | //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 |
309 | 309 | ||
310 | passParameters(&e, parameters2, emails, urls); | 310 | passParameters(&e, parameters2, emails, urls); |
311 | 311 | ||
312 | 312 | ||
313 | 313 | ||
314 | #else | 314 | #else |
315 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 315 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
316 | #endif | 316 | #endif |
317 | 317 | ||
318 | return true; | 318 | return true; |
319 | } | 319 | } |
320 | 320 | ||
321 | /************************************************************************** | 321 | /************************************************************************** |
322 | * | 322 | * |
323 | **************************************************************************/ | 323 | **************************************************************************/ |
324 | 324 | ||
325 | 325 | ||
326 | //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 |
327 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) | 327 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) |
328 | { | 328 | { |
329 | #ifndef DESKTOP_VERSION | 329 | #ifndef DESKTOP_VERSION |
330 | QString channel; | 330 | QString channel; |
331 | QString message; | 331 | QString message; |
332 | QString parameters; | 332 | QString parameters; |
333 | 333 | ||
334 | 334 | ||
335 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 335 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
336 | if (client == KPimGlobalPrefs::OTHER_EMC) | 336 | if (client == KPimGlobalPrefs::OTHER_EMC) |
337 | { | 337 | { |
338 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 338 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
339 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 339 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
340 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 340 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
341 | } | 341 | } |
342 | else | 342 | else |
343 | { | 343 | { |
344 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); | 344 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); |
345 | if (!dai) | 345 | if (!dai) |
346 | { | 346 | { |
347 | qDebug("could not find configured email application."); | 347 | qDebug("could not find configured email application."); |
348 | return false; | 348 | return false; |
349 | } | 349 | } |
350 | channel = dai->_channel; | 350 | channel = dai->_channel; |
351 | message = dai->_message; | 351 | message = dai->_message; |
352 | parameters = dai->_parameters; | 352 | parameters = dai->_parameters; |
353 | } | 353 | } |
354 | 354 | ||
355 | 355 | ||
356 | //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. |
357 | message = translateMessage(message, name, emailadress); | 357 | message = translateMessage(message, name, emailadress); |
358 | 358 | ||
359 | 359 | ||
360 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 360 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
361 | qDebug("passing name:(%s), emailadresses:(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); | 361 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); |
362 | 362 | ||
363 | QCopEnvelope e(channel.latin1(), message.latin1()); | 363 | QCopEnvelope e(channel.latin1(), message.latin1()); |
364 | //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 |
365 | 365 | ||
366 | passParameters(&e, parameters, name, emailadress); | 366 | passParameters(&e, parameters, name, emailadress); |
367 | 367 | ||
368 | 368 | ||
369 | #else | 369 | #else |
370 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 370 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
371 | #endif | 371 | #endif |
372 | 372 | ||
373 | 373 | ||
374 | return true; | 374 | return true; |
375 | } | 375 | } |
376 | 376 | ||
377 | /************************************************************************** | 377 | /************************************************************************** |
378 | * | 378 | * |
379 | **************************************************************************/ | 379 | **************************************************************************/ |
380 | 380 | ||
381 | //calls the emailapplication and creates a mail with parameter as recipients | 381 | //calls the emailapplication and creates a mail with parameter as recipients |
382 | // parameters format is | 382 | // parameters format is |
383 | // NAME <EMAIL>:SUBJECT | 383 | // NAME <EMAIL>:SUBJECT |
384 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) | 384 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) |
385 | { | 385 | { |
386 | QString line = adressline; | 386 | QString line = adressline; |
387 | 387 | ||
388 | int first = line.find( "<"); | 388 | int first = line.find( "<"); |
389 | int last = line.find( ">"); | 389 | int last = line.find( ">"); |
390 | QString name = line.left(first); | 390 | QString name = line.left(first); |
391 | QString emailadress = line.mid(first+1, last-first-1); | 391 | QString emailadress = line.mid(first+1, last-first-1); |
392 | 392 | ||
393 | //Subject can not be handled right now. | 393 | //Subject can not be handled right now. |
@@ -405,230 +405,230 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | |||
405 | #ifndef DESKTOP_VERSION | 405 | #ifndef DESKTOP_VERSION |
406 | QString channel; | 406 | QString channel; |
407 | QString message; | 407 | QString message; |
408 | QString parameters; | 408 | QString parameters; |
409 | 409 | ||
410 | 410 | ||
411 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 411 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
412 | if (client == KPimGlobalPrefs::OTHER_PHC) | 412 | if (client == KPimGlobalPrefs::OTHER_PHC) |
413 | { | 413 | { |
414 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; | 414 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; |
415 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; | 415 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; |
416 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; | 416 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; |
417 | } | 417 | } |
418 | else | 418 | else |
419 | { | 419 | { |
420 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); | 420 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); |
421 | if (!dai) | 421 | if (!dai) |
422 | { | 422 | { |
423 | qDebug("could not find configured phone application."); | 423 | qDebug("could not find configured phone application."); |
424 | return false; | 424 | return false; |
425 | } | 425 | } |
426 | channel = dai->_channel; | 426 | channel = dai->_channel; |
427 | message = dai->_message; | 427 | message = dai->_message; |
428 | parameters = dai->_parameters; | 428 | parameters = dai->_parameters; |
429 | } | 429 | } |
430 | 430 | ||
431 | 431 | ||
432 | //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. |
433 | message = translateMessage(message, phonenumber, ""); | 433 | message = translateMessage(message, phonenumber, ""); |
434 | 434 | ||
435 | 435 | ||
436 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 436 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
437 | qDebug("passing phonenumber:(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 437 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
438 | 438 | ||
439 | QCopEnvelope e(channel.latin1(), message.latin1()); | 439 | QCopEnvelope e(channel.latin1(), message.latin1()); |
440 | //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 |
441 | 441 | ||
442 | passParameters(&e, parameters, phonenumber, ""); | 442 | passParameters(&e, parameters, phonenumber, ""); |
443 | 443 | ||
444 | 444 | ||
445 | #else | 445 | #else |
446 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); | 446 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); |
447 | #endif | 447 | #endif |
448 | 448 | ||
449 | 449 | ||
450 | return true; | 450 | return true; |
451 | } | 451 | } |
452 | 452 | ||
453 | /************************************************************************** | 453 | /************************************************************************** |
454 | * | 454 | * |
455 | **************************************************************************/ | 455 | **************************************************************************/ |
456 | 456 | ||
457 | //calls the smsapplication with the number | 457 | //calls the smsapplication with the number |
458 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | 458 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) |
459 | { | 459 | { |
460 | #ifndef DESKTOP_VERSION | 460 | #ifndef DESKTOP_VERSION |
461 | QString channel; | 461 | QString channel; |
462 | QString message; | 462 | QString message; |
463 | QString parameters; | 463 | QString parameters; |
464 | 464 | ||
465 | 465 | ||
466 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 466 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
467 | if (client == KPimGlobalPrefs::OTHER_SMC) | 467 | if (client == KPimGlobalPrefs::OTHER_SMC) |
468 | { | 468 | { |
469 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; | 469 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; |
470 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; | 470 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; |
471 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; | 471 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; |
472 | } | 472 | } |
473 | else | 473 | else |
474 | { | 474 | { |
475 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); | 475 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); |
476 | if (!dai) | 476 | if (!dai) |
477 | { | 477 | { |
478 | qDebug("could not find configured sms application."); | 478 | qDebug("could not find configured sms application."); |
479 | return false; | 479 | return false; |
480 | } | 480 | } |
481 | channel = dai->_channel; | 481 | channel = dai->_channel; |
482 | message = dai->_message; | 482 | message = dai->_message; |
483 | parameters = dai->_parameters; | 483 | parameters = dai->_parameters; |
484 | } | 484 | } |
485 | 485 | ||
486 | 486 | ||
487 | //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. |
488 | message = translateMessage(message, phonenumber, ""); | 488 | message = translateMessage(message, phonenumber, ""); |
489 | 489 | ||
490 | 490 | ||
491 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 491 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
492 | qDebug("passing phonenumber:(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 492 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
493 | 493 | ||
494 | QCopEnvelope e(channel.latin1(), message.latin1()); | 494 | QCopEnvelope e(channel.latin1(), message.latin1()); |
495 | //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 |
496 | 496 | ||
497 | passParameters(&e, parameters, phonenumber, ""); | 497 | passParameters(&e, parameters, phonenumber, ""); |
498 | 498 | ||
499 | 499 | ||
500 | #else | 500 | #else |
501 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); | 501 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); |
502 | #endif | 502 | #endif |
503 | 503 | ||
504 | 504 | ||
505 | return true; | 505 | return true; |
506 | } | 506 | } |
507 | 507 | ||
508 | /************************************************************************** | 508 | /************************************************************************** |
509 | * | 509 | * |
510 | **************************************************************************/ | 510 | **************************************************************************/ |
511 | 511 | ||
512 | //calls the pagerapplication with the number | 512 | //calls the pagerapplication with the number |
513 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) | 513 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) |
514 | { | 514 | { |
515 | #ifndef DESKTOP_VERSION | 515 | #ifndef DESKTOP_VERSION |
516 | QString channel; | 516 | QString channel; |
517 | QString message; | 517 | QString message; |
518 | QString parameters; | 518 | QString parameters; |
519 | 519 | ||
520 | 520 | ||
521 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 521 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
522 | if (client == KPimGlobalPrefs::OTHER_PAC) | 522 | if (client == KPimGlobalPrefs::OTHER_PAC) |
523 | { | 523 | { |
524 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; | 524 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; |
525 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; | 525 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; |
526 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; | 526 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; |
527 | } | 527 | } |
528 | else | 528 | else |
529 | { | 529 | { |
530 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); | 530 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); |
531 | if (!dai) | 531 | if (!dai) |
532 | { | 532 | { |
533 | qDebug("could not find configured pager application."); | 533 | qDebug("could not find configured pager application."); |
534 | return false; | 534 | return false; |
535 | } | 535 | } |
536 | channel = dai->_channel; | 536 | channel = dai->_channel; |
537 | message = dai->_message; | 537 | message = dai->_message; |
538 | parameters = dai->_parameters; | 538 | parameters = dai->_parameters; |
539 | } | 539 | } |
540 | 540 | ||
541 | 541 | ||
542 | //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. |
543 | message = translateMessage(message, pagernumber, ""); | 543 | message = translateMessage(message, pagernumber, ""); |
544 | 544 | ||
545 | 545 | ||
546 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 546 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
547 | qDebug("passing pagernumber:(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); | 547 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); |
548 | 548 | ||
549 | QCopEnvelope e(channel.latin1(), message.latin1()); | 549 | QCopEnvelope e(channel.latin1(), message.latin1()); |
550 | //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 |
551 | 551 | ||
552 | passParameters(&e, parameters, pagernumber, ""); | 552 | passParameters(&e, parameters, pagernumber, ""); |
553 | 553 | ||
554 | 554 | ||
555 | #else | 555 | #else |
556 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); | 556 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); |
557 | #endif | 557 | #endif |
558 | 558 | ||
559 | 559 | ||
560 | return true; | 560 | return true; |
561 | } | 561 | } |
562 | 562 | ||
563 | /************************************************************************** | 563 | /************************************************************************** |
564 | * | 564 | * |
565 | **************************************************************************/ | 565 | **************************************************************************/ |
566 | 566 | ||
567 | //calls the faxapplication with the number | 567 | //calls the faxapplication with the number |
568 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) | 568 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) |
569 | { | 569 | { |
570 | #ifndef DESKTOP_VERSION | 570 | #ifndef DESKTOP_VERSION |
571 | QString channel; | 571 | QString channel; |
572 | QString message; | 572 | QString message; |
573 | QString parameters; | 573 | QString parameters; |
574 | 574 | ||
575 | 575 | ||
576 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 576 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
577 | if (client == KPimGlobalPrefs::OTHER_FAC) | 577 | if (client == KPimGlobalPrefs::OTHER_FAC) |
578 | { | 578 | { |
579 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; | 579 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; |
580 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; | 580 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; |
581 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; | 581 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; |
582 | } | 582 | } |
583 | else | 583 | else |
584 | { | 584 | { |
585 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); | 585 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); |
586 | if (!dai) | 586 | if (!dai) |
587 | { | 587 | { |
588 | qDebug("could not find configured fax application."); | 588 | qDebug("could not find configured fax application."); |
589 | return false; | 589 | return false; |
590 | } | 590 | } |
591 | channel = dai->_channel; | 591 | channel = dai->_channel; |
592 | message = dai->_message; | 592 | message = dai->_message; |
593 | parameters = dai->_parameters; | 593 | parameters = dai->_parameters; |
594 | } | 594 | } |
595 | 595 | ||
596 | 596 | ||
597 | //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. |
598 | message = translateMessage(message, faxnumber, ""); | 598 | message = translateMessage(message, faxnumber, ""); |
599 | 599 | ||
600 | 600 | ||
601 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 601 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
602 | qDebug("passing faxnumber:(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); | 602 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); |
603 | 603 | ||
604 | QCopEnvelope e(channel.latin1(), message.latin1()); | 604 | QCopEnvelope e(channel.latin1(), message.latin1()); |
605 | //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 |
606 | 606 | ||
607 | passParameters(&e, parameters, faxnumber, ""); | 607 | passParameters(&e, parameters, faxnumber, ""); |
608 | 608 | ||
609 | 609 | ||
610 | #else | 610 | #else |
611 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); | 611 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); |
612 | #endif | 612 | #endif |
613 | 613 | ||
614 | 614 | ||
615 | return true; | 615 | return true; |
616 | } | 616 | } |
617 | 617 | ||
618 | /************************************************************************** | 618 | /************************************************************************** |
619 | * | 619 | * |
620 | **************************************************************************/ | 620 | **************************************************************************/ |
621 | 621 | ||
622 | 622 | ||
623 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const | 623 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const |
624 | { | 624 | { |
625 | message = message.replace( QRegExp("%1"), param1 ); | 625 | message = message.replace( QRegExp("%1"), param1 ); |
626 | return message.replace( QRegExp("%2"), param2 ); | 626 | return message.replace( QRegExp("%2"), param2 ); |
627 | } | 627 | } |
628 | 628 | ||
629 | /************************************************************************** | 629 | /************************************************************************** |
630 | * | 630 | * |
631 | **************************************************************************/ | 631 | **************************************************************************/ |
632 | 632 | ||
633 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const | 633 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const |
634 | { | 634 | { |
@@ -636,45 +636,46 @@ void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& paramete | |||
636 | QMap<QString, QString> valmap; | 636 | QMap<QString, QString> valmap; |
637 | bool useValMap = false; | 637 | bool useValMap = false; |
638 | 638 | ||
639 | // first extract all parts of the parameters. | 639 | // first extract all parts of the parameters. |
640 | QStringList paramlist = QStringList::split(";", parameters); | 640 | QStringList paramlist = QStringList::split(";", parameters); |
641 | 641 | ||
642 | //Now check how many parts we have. | 642 | //Now check how many parts we have. |
643 | //=0 :no params to pass | 643 | //=0 :no params to pass |
644 | //>0 :parameters to pass | 644 | //>0 :parameters to pass |
645 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) | 645 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) |
646 | { | 646 | { |
647 | QString param = (*it); | 647 | QString param = (*it); |
648 | QStringList keyvallist = QStringList::split("=", param); | 648 | QStringList keyvallist = QStringList::split("=", param); |
649 | 649 | ||
650 | //if we have keyvalue pairs, we assume that we pass a map to the envelope | 650 | //if we have keyvalue pairs, we assume that we pass a map to the envelope |
651 | QStringList::Iterator it2 = keyvallist.begin(); | 651 | QStringList::Iterator it2 = keyvallist.begin(); |
652 | QString key = (*it2); | 652 | QString key = (*it2); |
653 | key = key.replace( QRegExp("%1"), param1 ); | 653 | key = key.replace( QRegExp("%1"), param1 ); |
654 | key = key.replace( QRegExp("%2"), param2 ); | 654 | key = key.replace( QRegExp("%2"), param2 ); |
655 | ++it2; | 655 | ++it2; |
656 | 656 | ||
657 | if(it2 != keyvallist.end()) | 657 | if(it2 != keyvallist.end()) |
658 | { | 658 | { |
659 | QString value = (*it2); | 659 | QString value = (*it2); |
660 | value = value.replace( QRegExp("%1"), param1 ); | 660 | value = value.replace( QRegExp("%1"), param1 ); |
661 | value = value.replace( QRegExp("%2"), param2 ); | 661 | value = value.replace( QRegExp("%2"), param2 ); |
662 | 662 | ||
663 | valmap.insert(key, value); | 663 | valmap.insert(key, value); |
664 | useValMap = true; | 664 | useValMap = true; |
665 | } | 665 | } |
666 | else | 666 | else |
667 | { | 667 | { |
668 | (*e) << key.latin1(); | 668 | // qDebug("pass parameter << %s", key.latin1()); |
669 | (*e) << key; | ||
669 | } | 670 | } |
670 | } | 671 | } |
671 | 672 | ||
672 | if (useValMap == true) | 673 | if (useValMap == true) |
673 | (*e) << valmap; | 674 | (*e) << valmap; |
674 | 675 | ||
675 | #endif | 676 | #endif |
676 | 677 | ||
677 | } | 678 | } |
678 | 679 | ||
679 | 680 | ||
680 | 681 | ||