-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 975911e..25c6f3a 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -645,128 +645,129 @@ static void parseName( const QString& name, QString *first, QString *middle, | |||
645 | } else { | 645 | } else { |
646 | *first = rest.left( space ); | 646 | *first = rest.left( space ); |
647 | *middle = rest.mid( space+1 ); | 647 | *middle = rest.mid( space+1 ); |
648 | } | 648 | } |
649 | 649 | ||
650 | } | 650 | } |
651 | 651 | ||
652 | 652 | ||
653 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 653 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
654 | { | 654 | { |
655 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); | 655 | qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); |
656 | 656 | ||
657 | if (msg == "editPersonal()") { | 657 | if (msg == "editPersonal()") { |
658 | editPersonal(); | 658 | editPersonal(); |
659 | } else if (msg == "editPersonalAndClose()") { | 659 | } else if (msg == "editPersonalAndClose()") { |
660 | editPersonal(); | 660 | editPersonal(); |
661 | close(); | 661 | close(); |
662 | } else if ( msg == "addContact(QString,QString)" ) { | 662 | } else if ( msg == "addContact(QString,QString)" ) { |
663 | QDataStream stream(data,IO_ReadOnly); | 663 | QDataStream stream(data,IO_ReadOnly); |
664 | QString name, email; | 664 | QString name, email; |
665 | stream >> name >> email; | 665 | stream >> name >> email; |
666 | 666 | ||
667 | OContact cnt; | 667 | OContact cnt; |
668 | QString fn, mn, ln; | 668 | QString fn, mn, ln; |
669 | parseName( name, &fn, &mn, &ln ); | 669 | parseName( name, &fn, &mn, &ln ); |
670 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 670 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
671 | cnt.setFirstName( fn ); | 671 | cnt.setFirstName( fn ); |
672 | cnt.setMiddleName( mn ); | 672 | cnt.setMiddleName( mn ); |
673 | cnt.setLastName( ln ); | 673 | cnt.setLastName( ln ); |
674 | cnt.insertEmails( email ); | 674 | cnt.insertEmails( email ); |
675 | cnt.setDefaultEmail( email ); | 675 | cnt.setDefaultEmail( email ); |
676 | cnt.setFileAs(); | 676 | cnt.setFileAs(); |
677 | 677 | ||
678 | m_abView -> addEntry( cnt ); | 678 | m_abView -> addEntry( cnt ); |
679 | 679 | ||
680 | // :SXm_abView()->init( cnt ); | 680 | // :SXm_abView()->init( cnt ); |
681 | editEntry( EditEntry ); | 681 | editEntry( EditEntry ); |
682 | } else if ( msg == "beamBusinessCard()" ) { | 682 | } else if ( msg == "beamBusinessCard()" ) { |
683 | QString beamFilename = addressbookPersonalVCardName(); | 683 | QString beamFilename = addressbookPersonalVCardName(); |
684 | if ( !QFile::exists( beamFilename ) ) | 684 | if ( !QFile::exists( beamFilename ) ) |
685 | return; // can't beam a non-existent file | 685 | return; // can't beam a non-existent file |
686 | 686 | ||
687 | Ir *ir = new Ir( this ); | 687 | Ir *ir = new Ir( this ); |
688 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 688 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
689 | QString description = "mycard.vcf"; | 689 | QString description = "mycard.vcf"; |
690 | ir->send( beamFilename, description, "text/x-vCard" ); | 690 | ir->send( beamFilename, description, "text/x-vCard" ); |
691 | } else if ( msg == "show(int)" ) { | 691 | } else if ( msg == "show(int)" ) { |
692 | QDataStream stream(data,IO_ReadOnly); | 692 | QDataStream stream(data,IO_ReadOnly); |
693 | int uid; | 693 | int uid; |
694 | stream >> uid; | 694 | stream >> uid; |
695 | 695 | ||
696 | qWarning( "Showing uid: %d" , uid ); | 696 | qWarning( "Showing uid: %d" , uid ); |
697 | 697 | ||
698 | // Deactivate Personal View.. | 698 | // Deactivate Personal View.. |
699 | if ( actionPersonal->isOn() ){ | 699 | if ( actionPersonal->isOn() ){ |
700 | actionPersonal->setOn( false ); | 700 | actionPersonal->setOn( false ); |
701 | slotPersonalView(); | 701 | slotPersonalView(); |
702 | } | 702 | } |
703 | 703 | ||
704 | // Reset category and show as card.. | 704 | // Reset category and show as card.. |
705 | m_abView -> setShowByCategory( QString::null ); | 705 | m_abView -> setShowByCategory( QString::null ); |
706 | m_abView -> setCurrentUid( uid ); | 706 | m_abView -> setCurrentUid( uid ); |
707 | slotViewSwitched ( AbView::CardView ); | 707 | slotViewSwitched ( AbView::CardView ); |
708 | 708 | ||
709 | showMaximized(); | ||
709 | qApp->exec(); | 710 | qApp->exec(); |
710 | 711 | ||
711 | } else if ( msg == "edit(int)" ) { | 712 | } else if ( msg == "edit(int)" ) { |
712 | QDataStream stream(data,IO_ReadOnly); | 713 | QDataStream stream(data,IO_ReadOnly); |
713 | int uid; | 714 | int uid; |
714 | stream >> uid; | 715 | stream >> uid; |
715 | 716 | ||
716 | // Deactivate Personal View.. | 717 | // Deactivate Personal View.. |
717 | if ( actionPersonal->isOn() ){ | 718 | if ( actionPersonal->isOn() ){ |
718 | actionPersonal->setOn( false ); | 719 | actionPersonal->setOn( false ); |
719 | slotPersonalView(); | 720 | slotPersonalView(); |
720 | } | 721 | } |
721 | 722 | ||
722 | // Reset category and edit.. | 723 | // Reset category and edit.. |
723 | m_abView -> setShowByCategory( QString::null ); | 724 | m_abView -> setShowByCategory( QString::null ); |
724 | m_abView -> setCurrentUid( uid ); | 725 | m_abView -> setCurrentUid( uid ); |
725 | slotViewEdit(); | 726 | slotViewEdit(); |
726 | } | 727 | } |
727 | 728 | ||
728 | } | 729 | } |
729 | 730 | ||
730 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 731 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
731 | { | 732 | { |
732 | OContact entry; | 733 | OContact entry; |
733 | if ( !abEditor ) { | 734 | if ( !abEditor ) { |
734 | abEditor = new ContactEditor( entry, this, "editor" ); | 735 | abEditor = new ContactEditor( entry, this, "editor" ); |
735 | } | 736 | } |
736 | if ( entryMode == EditEntry ) | 737 | if ( entryMode == EditEntry ) |
737 | abEditor->setEntry( m_abView -> currentEntry() ); | 738 | abEditor->setEntry( m_abView -> currentEntry() ); |
738 | else if ( entryMode == NewEntry ) | 739 | else if ( entryMode == NewEntry ) |
739 | abEditor->setEntry( entry ); | 740 | abEditor->setEntry( entry ); |
740 | // other things may change the caption. | 741 | // other things may change the caption. |
741 | abEditor->setCaption( tr("Edit Address") ); | 742 | abEditor->setCaption( tr("Edit Address") ); |
742 | 743 | ||
743 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 744 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
744 | abEditor->showMaximized(); | 745 | abEditor->showMaximized(); |
745 | #endif | 746 | #endif |
746 | // fix the foxus... | 747 | // fix the foxus... |
747 | abEditor->setNameFocus(); | 748 | abEditor->setNameFocus(); |
748 | if ( abEditor->exec() ) { | 749 | if ( abEditor->exec() ) { |
749 | setFocus(); | 750 | setFocus(); |
750 | if ( entryMode == NewEntry ) { | 751 | if ( entryMode == NewEntry ) { |
751 | OContact insertEntry = abEditor->entry(); | 752 | OContact insertEntry = abEditor->entry(); |
752 | insertEntry.assignUid(); | 753 | insertEntry.assignUid(); |
753 | m_abView -> addEntry( insertEntry ); | 754 | m_abView -> addEntry( insertEntry ); |
754 | } else { | 755 | } else { |
755 | OContact replEntry = abEditor->entry(); | 756 | OContact replEntry = abEditor->entry(); |
756 | 757 | ||
757 | if ( !replEntry.isValidUid() ) | 758 | if ( !replEntry.isValidUid() ) |
758 | replEntry.assignUid(); | 759 | replEntry.assignUid(); |
759 | 760 | ||
760 | m_abView -> replaceEntry( replEntry ); | 761 | m_abView -> replaceEntry( replEntry ); |
761 | } | 762 | } |
762 | } | 763 | } |
763 | // populateCategories(); | 764 | // populateCategories(); |
764 | 765 | ||
765 | } | 766 | } |
766 | 767 | ||
767 | void AddressbookWindow::editPersonal() | 768 | void AddressbookWindow::editPersonal() |
768 | { | 769 | { |
769 | OContact entry; | 770 | OContact entry; |
770 | 771 | ||
771 | // Switch to personal view if not selected | 772 | // Switch to personal view if not selected |
772 | // but take care of the menu, too | 773 | // but take care of the menu, too |