author | alwin <alwin> | 2003-12-25 02:21:47 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-25 02:21:47 (UTC) |
commit | e0b1bc403c2792dff3aa04a00eaf58b9defc6dac (patch) (unidiff) | |
tree | bb76837783433a91f49c555b80e1d87e3dee720a | |
parent | dd78bcd2bf8dd6432b54af61e17a75dcc05c2406 (diff) | |
download | opie-e0b1bc403c2792dff3aa04a00eaf58b9defc6dac.zip opie-e0b1bc403c2792dff3aa04a00eaf58b9defc6dac.tar.gz opie-e0b1bc403c2792dff3aa04a00eaf58b9defc6dac.tar.bz2 |
called binary when sending email to a contact is "opiemail" instead
of "mail" when using opiemal as standard mailer.
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 9f668f4..00cd2a6 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -376,388 +376,388 @@ void AddressbookWindow::setDocument( const QString &filename ) | |||
376 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), | 376 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), |
377 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), | 377 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), |
378 | tr( "&Yes" ), tr( "&No" ), QString::null, | 378 | tr( "&Yes" ), tr( "&No" ), QString::null, |
379 | 0, // Enter == button 0 | 379 | 0, // Enter == button 0 |
380 | 2 ) ) { // Escape == button 2 | 380 | 2 ) ) { // Escape == button 2 |
381 | case 0: | 381 | case 0: |
382 | qWarning("YES clicked"); | 382 | qWarning("YES clicked"); |
383 | break; | 383 | break; |
384 | case 1: | 384 | case 1: |
385 | qWarning("NO clicked"); | 385 | qWarning("NO clicked"); |
386 | return; | 386 | return; |
387 | break; | 387 | break; |
388 | } | 388 | } |
389 | } | 389 | } |
390 | 390 | ||
391 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 391 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
392 | filename ); | 392 | filename ); |
393 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 393 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
394 | OContactAccess::List allList = access->allRecords(); | 394 | OContactAccess::List allList = access->allRecords(); |
395 | qWarning( "Found number of contacts in File: %d", allList.count() ); | 395 | qWarning( "Found number of contacts in File: %d", allList.count() ); |
396 | 396 | ||
397 | if ( !allList.count() ) { | 397 | if ( !allList.count() ) { |
398 | QMessageBox::information( this, "Import VCard", | 398 | QMessageBox::information( this, "Import VCard", |
399 | "It was impossible to import\nthe VCard.\n" | 399 | "It was impossible to import\nthe VCard.\n" |
400 | "The VCard may be corrupted!" ); | 400 | "The VCard may be corrupted!" ); |
401 | } | 401 | } |
402 | 402 | ||
403 | bool doAsk = true; | 403 | bool doAsk = true; |
404 | OContactAccess::List::Iterator it; | 404 | OContactAccess::List::Iterator it; |
405 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 405 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
406 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); | 406 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); |
407 | if ( doAsk ){ | 407 | if ( doAsk ){ |
408 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), | 408 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), |
409 | tr( "Do you really want add contact for \n%1?" ) | 409 | tr( "Do you really want add contact for \n%1?" ) |
410 | .arg( (*it).fullName().latin1() ), | 410 | .arg( (*it).fullName().latin1() ), |
411 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), | 411 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), |
412 | 0, // Enter == button 0 | 412 | 0, // Enter == button 0 |
413 | 2 ) ) { // Escape == button 2 | 413 | 2 ) ) { // Escape == button 2 |
414 | case 0: | 414 | case 0: |
415 | qWarning("YES clicked"); | 415 | qWarning("YES clicked"); |
416 | m_abView->addEntry( *it ); | 416 | m_abView->addEntry( *it ); |
417 | break; | 417 | break; |
418 | case 1: | 418 | case 1: |
419 | qWarning("NO clicked"); | 419 | qWarning("NO clicked"); |
420 | break; | 420 | break; |
421 | case 2: | 421 | case 2: |
422 | qWarning("YesAll clicked"); | 422 | qWarning("YesAll clicked"); |
423 | doAsk = false; | 423 | doAsk = false; |
424 | break; | 424 | break; |
425 | } | 425 | } |
426 | }else | 426 | }else |
427 | m_abView->addEntry( *it ); | 427 | m_abView->addEntry( *it ); |
428 | 428 | ||
429 | } | 429 | } |
430 | 430 | ||
431 | delete access; | 431 | delete access; |
432 | } | 432 | } |
433 | 433 | ||
434 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 434 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
435 | { | 435 | { |
436 | QMainWindow::resizeEvent( e ); | 436 | QMainWindow::resizeEvent( e ); |
437 | 437 | ||
438 | 438 | ||
439 | } | 439 | } |
440 | 440 | ||
441 | AddressbookWindow::~AddressbookWindow() | 441 | AddressbookWindow::~AddressbookWindow() |
442 | { | 442 | { |
443 | ToolBarDock dock; | 443 | ToolBarDock dock; |
444 | int dummy; | 444 | int dummy; |
445 | bool bDummy; | 445 | bool bDummy; |
446 | getLocation ( listTools, dock, dummy, bDummy, dummy ); | 446 | getLocation ( listTools, dock, dummy, bDummy, dummy ); |
447 | m_config.setToolBarDock( dock ); | 447 | m_config.setToolBarDock( dock ); |
448 | m_config.save(); | 448 | m_config.save(); |
449 | } | 449 | } |
450 | 450 | ||
451 | void AddressbookWindow::slotUpdateToolbar() | 451 | void AddressbookWindow::slotUpdateToolbar() |
452 | { | 452 | { |
453 | OContact ce = m_abView->currentEntry(); | 453 | OContact ce = m_abView->currentEntry(); |
454 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 454 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
455 | } | 455 | } |
456 | 456 | ||
457 | void AddressbookWindow::slotListNew() | 457 | void AddressbookWindow::slotListNew() |
458 | { | 458 | { |
459 | OContact cnt; | 459 | OContact cnt; |
460 | if( !syncing ) { | 460 | if( !syncing ) { |
461 | editEntry( NewEntry ); | 461 | editEntry( NewEntry ); |
462 | } else { | 462 | } else { |
463 | QMessageBox::warning(this, tr("Contacts"), | 463 | QMessageBox::warning(this, tr("Contacts"), |
464 | tr("Can not edit data, currently syncing")); | 464 | tr("Can not edit data, currently syncing")); |
465 | } | 465 | } |
466 | } | 466 | } |
467 | 467 | ||
468 | // void AddressbookWindow::slotListView() | 468 | // void AddressbookWindow::slotListView() |
469 | // { | 469 | // { |
470 | // m_abView -> init( abList->currentEntry() ); | 470 | // m_abView -> init( abList->currentEntry() ); |
471 | // // :SX mView->sync(); | 471 | // // :SX mView->sync(); |
472 | // //:SXshowView(); | 472 | // //:SXshowView(); |
473 | // } | 473 | // } |
474 | 474 | ||
475 | void AddressbookWindow::slotListDelete() | 475 | void AddressbookWindow::slotListDelete() |
476 | { | 476 | { |
477 | if(!syncing) { | 477 | if(!syncing) { |
478 | OContact tmpEntry = m_abView ->currentEntry(); | 478 | OContact tmpEntry = m_abView ->currentEntry(); |
479 | 479 | ||
480 | // get a name, do the best we can... | 480 | // get a name, do the best we can... |
481 | QString strName = tmpEntry.fullName(); | 481 | QString strName = tmpEntry.fullName(); |
482 | if ( strName.isEmpty() ) { | 482 | if ( strName.isEmpty() ) { |
483 | strName = tmpEntry.company(); | 483 | strName = tmpEntry.company(); |
484 | if ( strName.isEmpty() ) | 484 | if ( strName.isEmpty() ) |
485 | strName = "No Name"; | 485 | strName = "No Name"; |
486 | } | 486 | } |
487 | 487 | ||
488 | 488 | ||
489 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 489 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
490 | strName ) ) { | 490 | strName ) ) { |
491 | m_abView->removeEntry( tmpEntry.uid() ); | 491 | m_abView->removeEntry( tmpEntry.uid() ); |
492 | } | 492 | } |
493 | } else { | 493 | } else { |
494 | QMessageBox::warning( this, tr("Contacts"), | 494 | QMessageBox::warning( this, tr("Contacts"), |
495 | tr("Can not edit data, currently syncing") ); | 495 | tr("Can not edit data, currently syncing") ); |
496 | } | 496 | } |
497 | } | 497 | } |
498 | 498 | ||
499 | void AddressbookWindow::slotFindOpen() | 499 | void AddressbookWindow::slotFindOpen() |
500 | { | 500 | { |
501 | searchBar->show(); | 501 | searchBar->show(); |
502 | m_abView -> inSearch(); | 502 | m_abView -> inSearch(); |
503 | searchEdit->setFocus(); | 503 | searchEdit->setFocus(); |
504 | } | 504 | } |
505 | void AddressbookWindow::slotFindClose() | 505 | void AddressbookWindow::slotFindClose() |
506 | { | 506 | { |
507 | searchBar->hide(); | 507 | searchBar->hide(); |
508 | m_abView -> offSearch(); | 508 | m_abView -> offSearch(); |
509 | // m_abView->setFocus(); | 509 | // m_abView->setFocus(); |
510 | } | 510 | } |
511 | 511 | ||
512 | 512 | ||
513 | void AddressbookWindow::slotFind() | 513 | void AddressbookWindow::slotFind() |
514 | { | 514 | { |
515 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); | 515 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); |
516 | 516 | ||
517 | searchEdit->clearFocus(); | 517 | searchEdit->clearFocus(); |
518 | // m_abView->setFocus(); | 518 | // m_abView->setFocus(); |
519 | 519 | ||
520 | } | 520 | } |
521 | 521 | ||
522 | void AddressbookWindow::slotViewBack() | 522 | void AddressbookWindow::slotViewBack() |
523 | { | 523 | { |
524 | // :SX showList(); | 524 | // :SX showList(); |
525 | } | 525 | } |
526 | 526 | ||
527 | void AddressbookWindow::slotViewEdit() | 527 | void AddressbookWindow::slotViewEdit() |
528 | { | 528 | { |
529 | if(!syncing) { | 529 | if(!syncing) { |
530 | if (actionPersonal->isOn()) { | 530 | if (actionPersonal->isOn()) { |
531 | editPersonal(); | 531 | editPersonal(); |
532 | } else { | 532 | } else { |
533 | editEntry( EditEntry ); | 533 | editEntry( EditEntry ); |
534 | } | 534 | } |
535 | } else { | 535 | } else { |
536 | QMessageBox::warning( this, tr("Contacts"), | 536 | QMessageBox::warning( this, tr("Contacts"), |
537 | tr("Can not edit data, currently syncing") ); | 537 | tr("Can not edit data, currently syncing") ); |
538 | } | 538 | } |
539 | } | 539 | } |
540 | 540 | ||
541 | 541 | ||
542 | 542 | ||
543 | void AddressbookWindow::writeMail() | 543 | void AddressbookWindow::writeMail() |
544 | { | 544 | { |
545 | OContact c = m_abView -> currentEntry(); | 545 | OContact c = m_abView -> currentEntry(); |
546 | QString name = c.fileAs(); | 546 | QString name = c.fileAs(); |
547 | QString email = c.defaultEmail(); | 547 | QString email = c.defaultEmail(); |
548 | 548 | ||
549 | // I prefer the OPIE-Environment variable before the | 549 | // I prefer the OPIE-Environment variable before the |
550 | // QPE-one.. | 550 | // QPE-one.. |
551 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 551 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
552 | if ( basepath.isEmpty() ) | 552 | if ( basepath.isEmpty() ) |
553 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 553 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
554 | 554 | ||
555 | // Try to access the preferred. If not possible, try to | 555 | // Try to access the preferred. If not possible, try to |
556 | // switch to the other one.. | 556 | // switch to the other one.. |
557 | if ( m_config.useQtMail() ){ | 557 | if ( m_config.useQtMail() ){ |
558 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); | 558 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); |
559 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 559 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
560 | qWarning ("QCop"); | 560 | qWarning ("QCop"); |
561 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 561 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
562 | e << name << email; | 562 | e << name << email; |
563 | return; | 563 | return; |
564 | } else | 564 | } else |
565 | m_config.setUseOpieMail( true ); | 565 | m_config.setUseOpieMail( true ); |
566 | } | 566 | } |
567 | if ( m_config.useOpieMail() ){ | 567 | if ( m_config.useOpieMail() ){ |
568 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); | 568 | qWarning ("Accessing: %s", (basepath + "/bin/opiemail").latin1()); |
569 | if ( QFile::exists( basepath + "/bin/mail" ) ){ | 569 | if ( QFile::exists( basepath + "/bin/opiemail" ) ){ |
570 | qWarning ("QCop"); | 570 | qWarning ("QCop"); |
571 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); | 571 | QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); |
572 | e << name << email; | 572 | e << name << email; |
573 | return; | 573 | return; |
574 | } else | 574 | } else |
575 | m_config.setUseQtMail( true ); | 575 | m_config.setUseQtMail( true ); |
576 | } | 576 | } |
577 | 577 | ||
578 | } | 578 | } |
579 | 579 | ||
580 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 580 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
581 | 581 | ||
582 | void AddressbookWindow::slotBeam() | 582 | void AddressbookWindow::slotBeam() |
583 | { | 583 | { |
584 | QString beamFilename; | 584 | QString beamFilename; |
585 | OContact c; | 585 | OContact c; |
586 | if ( actionPersonal->isOn() ) { | 586 | if ( actionPersonal->isOn() ) { |
587 | beamFilename = addressbookPersonalVCardName(); | 587 | beamFilename = addressbookPersonalVCardName(); |
588 | if ( !QFile::exists( beamFilename ) ) | 588 | if ( !QFile::exists( beamFilename ) ) |
589 | return; // can't beam a non-existent file | 589 | return; // can't beam a non-existent file |
590 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 590 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
591 | beamFilename ); | 591 | beamFilename ); |
592 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 592 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
593 | OContactAccess::List allList = access->allRecords(); | 593 | OContactAccess::List allList = access->allRecords(); |
594 | OContactAccess::List::Iterator it = allList.begin(); // Just take first | 594 | OContactAccess::List::Iterator it = allList.begin(); // Just take first |
595 | c = *it; | 595 | c = *it; |
596 | 596 | ||
597 | delete access; | 597 | delete access; |
598 | } else { | 598 | } else { |
599 | unlink( beamfile ); // delete if exists | 599 | unlink( beamfile ); // delete if exists |
600 | mkdir("/tmp/obex/", 0755); | 600 | mkdir("/tmp/obex/", 0755); |
601 | c = m_abView -> currentEntry(); | 601 | c = m_abView -> currentEntry(); |
602 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 602 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
603 | beamfile ); | 603 | beamfile ); |
604 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 604 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
605 | access->add( c ); | 605 | access->add( c ); |
606 | access->save(); | 606 | access->save(); |
607 | delete access; | 607 | delete access; |
608 | 608 | ||
609 | beamFilename = beamfile; | 609 | beamFilename = beamfile; |
610 | } | 610 | } |
611 | 611 | ||
612 | qWarning("Beaming: %s", beamFilename.latin1() ); | 612 | qWarning("Beaming: %s", beamFilename.latin1() ); |
613 | 613 | ||
614 | Ir *ir = new Ir( this ); | 614 | Ir *ir = new Ir( this ); |
615 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 615 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
616 | QString description = c.fullName(); | 616 | QString description = c.fullName(); |
617 | ir->send( beamFilename, description, "text/x-vCard" ); | 617 | ir->send( beamFilename, description, "text/x-vCard" ); |
618 | } | 618 | } |
619 | 619 | ||
620 | void AddressbookWindow::beamDone( Ir *ir ) | 620 | void AddressbookWindow::beamDone( Ir *ir ) |
621 | { | 621 | { |
622 | 622 | ||
623 | delete ir; | 623 | delete ir; |
624 | unlink( beamfile ); | 624 | unlink( beamfile ); |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | static void parseName( const QString& name, QString *first, QString *middle, | 628 | static void parseName( const QString& name, QString *first, QString *middle, |
629 | QString * last ) | 629 | QString * last ) |
630 | { | 630 | { |
631 | 631 | ||
632 | int comma = name.find ( "," ); | 632 | int comma = name.find ( "," ); |
633 | QString rest; | 633 | QString rest; |
634 | if ( comma > 0 ) { | 634 | if ( comma > 0 ) { |
635 | *last = name.left( comma ); | 635 | *last = name.left( comma ); |
636 | comma++; | 636 | comma++; |
637 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 637 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
638 | comma++; | 638 | comma++; |
639 | rest = name.mid( comma ); | 639 | rest = name.mid( comma ); |
640 | } else { | 640 | } else { |
641 | int space = name.findRev( ' ' ); | 641 | int space = name.findRev( ' ' ); |
642 | *last = name.mid( space+1 ); | 642 | *last = name.mid( space+1 ); |
643 | rest = name.left( space ); | 643 | rest = name.left( space ); |
644 | } | 644 | } |
645 | int space = rest.find( ' ' ); | 645 | int space = rest.find( ' ' ); |
646 | if ( space <= 0 ) { | 646 | if ( space <= 0 ) { |
647 | *first = rest; | 647 | *first = rest; |
648 | } else { | 648 | } else { |
649 | *first = rest.left( space ); | 649 | *first = rest.left( space ); |
650 | *middle = rest.mid( space+1 ); | 650 | *middle = rest.mid( space+1 ); |
651 | } | 651 | } |
652 | 652 | ||
653 | } | 653 | } |
654 | 654 | ||
655 | 655 | ||
656 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 656 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
657 | { | 657 | { |
658 | bool needShow = FALSE; | 658 | bool needShow = FALSE; |
659 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); | 659 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); |
660 | 660 | ||
661 | 661 | ||
662 | if (msg == "editPersonal()") { | 662 | if (msg == "editPersonal()") { |
663 | editPersonal(); | 663 | editPersonal(); |
664 | } else if (msg == "editPersonalAndClose()") { | 664 | } else if (msg == "editPersonalAndClose()") { |
665 | editPersonal(); | 665 | editPersonal(); |
666 | close(); | 666 | close(); |
667 | } else if ( msg == "addContact(QString,QString)" ) { | 667 | } else if ( msg == "addContact(QString,QString)" ) { |
668 | QDataStream stream(data,IO_ReadOnly); | 668 | QDataStream stream(data,IO_ReadOnly); |
669 | QString name, email; | 669 | QString name, email; |
670 | stream >> name >> email; | 670 | stream >> name >> email; |
671 | 671 | ||
672 | OContact cnt; | 672 | OContact cnt; |
673 | QString fn, mn, ln; | 673 | QString fn, mn, ln; |
674 | parseName( name, &fn, &mn, &ln ); | 674 | parseName( name, &fn, &mn, &ln ); |
675 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 675 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
676 | cnt.setFirstName( fn ); | 676 | cnt.setFirstName( fn ); |
677 | cnt.setMiddleName( mn ); | 677 | cnt.setMiddleName( mn ); |
678 | cnt.setLastName( ln ); | 678 | cnt.setLastName( ln ); |
679 | cnt.insertEmails( email ); | 679 | cnt.insertEmails( email ); |
680 | cnt.setDefaultEmail( email ); | 680 | cnt.setDefaultEmail( email ); |
681 | cnt.setFileAs(); | 681 | cnt.setFileAs(); |
682 | 682 | ||
683 | m_abView -> addEntry( cnt ); | 683 | m_abView -> addEntry( cnt ); |
684 | 684 | ||
685 | // :SXm_abView()->init( cnt ); | 685 | // :SXm_abView()->init( cnt ); |
686 | editEntry( EditEntry ); | 686 | editEntry( EditEntry ); |
687 | } else if ( msg == "beamBusinessCard()" ) { | 687 | } else if ( msg == "beamBusinessCard()" ) { |
688 | QString beamFilename = addressbookPersonalVCardName(); | 688 | QString beamFilename = addressbookPersonalVCardName(); |
689 | if ( !QFile::exists( beamFilename ) ) | 689 | if ( !QFile::exists( beamFilename ) ) |
690 | return; // can't beam a non-existent file | 690 | return; // can't beam a non-existent file |
691 | 691 | ||
692 | Ir *ir = new Ir( this ); | 692 | Ir *ir = new Ir( this ); |
693 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 693 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
694 | QString description = "mycard.vcf"; | 694 | QString description = "mycard.vcf"; |
695 | ir->send( beamFilename, description, "text/x-vCard" ); | 695 | ir->send( beamFilename, description, "text/x-vCard" ); |
696 | } else if ( msg == "show(int)" ) { | 696 | } else if ( msg == "show(int)" ) { |
697 | raise(); | 697 | raise(); |
698 | QDataStream stream(data,IO_ReadOnly); | 698 | QDataStream stream(data,IO_ReadOnly); |
699 | int uid; | 699 | int uid; |
700 | stream >> uid; | 700 | stream >> uid; |
701 | 701 | ||
702 | qWarning( "Showing uid: %d" , uid ); | 702 | qWarning( "Showing uid: %d" , uid ); |
703 | 703 | ||
704 | // Deactivate Personal View.. | 704 | // Deactivate Personal View.. |
705 | if ( actionPersonal->isOn() ){ | 705 | if ( actionPersonal->isOn() ){ |
706 | actionPersonal->setOn( false ); | 706 | actionPersonal->setOn( false ); |
707 | slotPersonalView(); | 707 | slotPersonalView(); |
708 | } | 708 | } |
709 | 709 | ||
710 | // Reset category and show as card.. | 710 | // Reset category and show as card.. |
711 | m_abView -> setShowByCategory( QString::null ); | 711 | m_abView -> setShowByCategory( QString::null ); |
712 | m_abView -> setCurrentUid( uid ); | 712 | m_abView -> setCurrentUid( uid ); |
713 | slotViewSwitched ( AbView::CardView ); | 713 | slotViewSwitched ( AbView::CardView ); |
714 | 714 | ||
715 | needShow = true; | 715 | needShow = true; |
716 | 716 | ||
717 | 717 | ||
718 | } else if ( msg == "edit(int)" ) { | 718 | } else if ( msg == "edit(int)" ) { |
719 | QDataStream stream(data,IO_ReadOnly); | 719 | QDataStream stream(data,IO_ReadOnly); |
720 | int uid; | 720 | int uid; |
721 | stream >> uid; | 721 | stream >> uid; |
722 | 722 | ||
723 | // Deactivate Personal View.. | 723 | // Deactivate Personal View.. |
724 | if ( actionPersonal->isOn() ){ | 724 | if ( actionPersonal->isOn() ){ |
725 | actionPersonal->setOn( false ); | 725 | actionPersonal->setOn( false ); |
726 | slotPersonalView(); | 726 | slotPersonalView(); |
727 | } | 727 | } |
728 | 728 | ||
729 | // Reset category and edit.. | 729 | // Reset category and edit.. |
730 | m_abView -> setShowByCategory( QString::null ); | 730 | m_abView -> setShowByCategory( QString::null ); |
731 | m_abView -> setCurrentUid( uid ); | 731 | m_abView -> setCurrentUid( uid ); |
732 | slotViewEdit(); | 732 | slotViewEdit(); |
733 | } | 733 | } |
734 | 734 | ||
735 | if (needShow) | 735 | if (needShow) |
736 | QPEApplication::setKeepRunning(); | 736 | QPEApplication::setKeepRunning(); |
737 | 737 | ||
738 | } | 738 | } |
739 | 739 | ||
740 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 740 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
741 | { | 741 | { |
742 | OContact entry; | 742 | OContact entry; |
743 | if ( !abEditor ) { | 743 | if ( !abEditor ) { |
744 | abEditor = new ContactEditor( entry, this, "editor" ); | 744 | abEditor = new ContactEditor( entry, this, "editor" ); |
745 | } | 745 | } |
746 | if ( entryMode == EditEntry ) | 746 | if ( entryMode == EditEntry ) |
747 | abEditor->setEntry( m_abView -> currentEntry() ); | 747 | abEditor->setEntry( m_abView -> currentEntry() ); |
748 | else if ( entryMode == NewEntry ) | 748 | else if ( entryMode == NewEntry ) |
749 | abEditor->setEntry( entry ); | 749 | abEditor->setEntry( entry ); |
750 | // other things may change the caption. | 750 | // other things may change the caption. |
751 | abEditor->setCaption( tr("Edit Address") ); | 751 | abEditor->setCaption( tr("Edit Address") ); |
752 | 752 | ||
753 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 753 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
754 | abEditor->showMaximized(); | 754 | abEditor->showMaximized(); |
755 | #endif | 755 | #endif |
756 | // fix the foxus... | 756 | // fix the foxus... |
757 | abEditor->setNameFocus(); | 757 | abEditor->setNameFocus(); |
758 | if ( abEditor->exec() ) { | 758 | if ( abEditor->exec() ) { |
759 | setFocus(); | 759 | setFocus(); |
760 | if ( entryMode == NewEntry ) { | 760 | if ( entryMode == NewEntry ) { |
761 | OContact insertEntry = abEditor->entry(); | 761 | OContact insertEntry = abEditor->entry(); |
762 | insertEntry.assignUid(); | 762 | insertEntry.assignUid(); |
763 | m_abView -> addEntry( insertEntry ); | 763 | m_abView -> addEntry( insertEntry ); |