author | tille <tille> | 2002-12-14 23:41:39 (UTC) |
---|---|---|
committer | tille <tille> | 2002-12-14 23:41:39 (UTC) |
commit | 3fb7da21aa421afdbdbfd6e02a457d7d55236ef7 (patch) (unidiff) | |
tree | e48be6be2cab6f1f1607dad30aea8b52c7a89500 | |
parent | 11638099db6dd30ff5542f636f5291e2af20c3e1 (diff) | |
download | opie-3fb7da21aa421afdbdbfd6e02a457d7d55236ef7.zip opie-3fb7da21aa421afdbdbfd6e02a457d7d55236ef7.tar.gz opie-3fb7da21aa421afdbdbfd6e02a457d7d55236ef7.tar.bz2 |
fixes bug #548
-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 30fa85b..c2cce92 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -624,192 +624,193 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | |||
624 | 624 | ||
625 | OContact cnt; | 625 | OContact cnt; |
626 | QString fn, mn, ln; | 626 | QString fn, mn, ln; |
627 | parseName( name, &fn, &mn, &ln ); | 627 | parseName( name, &fn, &mn, &ln ); |
628 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 628 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
629 | cnt.setFirstName( fn ); | 629 | cnt.setFirstName( fn ); |
630 | cnt.setMiddleName( mn ); | 630 | cnt.setMiddleName( mn ); |
631 | cnt.setLastName( ln ); | 631 | cnt.setLastName( ln ); |
632 | cnt.insertEmails( email ); | 632 | cnt.insertEmails( email ); |
633 | cnt.setDefaultEmail( email ); | 633 | cnt.setDefaultEmail( email ); |
634 | cnt.setFileAs(); | 634 | cnt.setFileAs(); |
635 | 635 | ||
636 | m_abView -> addEntry( cnt ); | 636 | m_abView -> addEntry( cnt ); |
637 | 637 | ||
638 | // :SXm_abView()->init( cnt ); | 638 | // :SXm_abView()->init( cnt ); |
639 | editEntry( EditEntry ); | 639 | editEntry( EditEntry ); |
640 | 640 | ||
641 | 641 | ||
642 | 642 | ||
643 | } | 643 | } |
644 | #if 0 | 644 | #if 0 |
645 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { | 645 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { |
646 | QDataStream stream(data,IO_ReadOnly); | 646 | QDataStream stream(data,IO_ReadOnly); |
647 | QCString ch,m; | 647 | QCString ch,m; |
648 | QStringList types; | 648 | QStringList types; |
649 | stream >> ch >> m >> types; | 649 | stream >> ch >> m >> types; |
650 | AddressPicker picker(abList,this,0,TRUE); | 650 | AddressPicker picker(abList,this,0,TRUE); |
651 | picker.showMaximized(); | 651 | picker.showMaximized(); |
652 | picker.setChoiceNames(types); | 652 | picker.setChoiceNames(types); |
653 | int i=0; | 653 | int i=0; |
654 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 654 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
655 | QStringList sel; | 655 | QStringList sel; |
656 | stream >> sel; | 656 | stream >> sel; |
657 | picker.setSelection(i++,sel); | 657 | picker.setSelection(i++,sel); |
658 | } | 658 | } |
659 | picker.showMaximized(); | 659 | picker.showMaximized(); |
660 | picker.exec(); | 660 | picker.exec(); |
661 | 661 | ||
662 | // ###### note: contacts may have been added - save here! | 662 | // ###### note: contacts may have been added - save here! |
663 | 663 | ||
664 | setCentralWidget(abList); | 664 | setCentralWidget(abList); |
665 | QCopEnvelope e(ch,m); | 665 | QCopEnvelope e(ch,m); |
666 | i=0; | 666 | i=0; |
667 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 667 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
668 | QStringList sel = picker.selection(i++); | 668 | QStringList sel = picker.selection(i++); |
669 | e << sel; | 669 | e << sel; |
670 | } | 670 | } |
671 | } | 671 | } |
672 | #endif | 672 | #endif |
673 | 673 | ||
674 | } | 674 | } |
675 | 675 | ||
676 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 676 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
677 | { | 677 | { |
678 | OContact entry; | 678 | OContact entry; |
679 | if ( !abEditor ) { | 679 | if ( !abEditor ) { |
680 | abEditor = new ContactEditor( entry, this, "editor" ); | 680 | abEditor = new ContactEditor( entry, this, "editor" ); |
681 | } | 681 | } |
682 | if ( entryMode == EditEntry ) | 682 | if ( entryMode == EditEntry ) |
683 | abEditor->setEntry( m_abView -> currentEntry() ); | 683 | abEditor->setEntry( m_abView -> currentEntry() ); |
684 | else if ( entryMode == NewEntry ) | 684 | else if ( entryMode == NewEntry ) |
685 | abEditor->setEntry( entry ); | 685 | abEditor->setEntry( entry ); |
686 | // other things may change the caption. | 686 | // other things may change the caption. |
687 | abEditor->setCaption( tr("Edit Address") ); | 687 | abEditor->setCaption( tr("Edit Address") ); |
688 | 688 | ||
689 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 689 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
690 | abEditor->showMaximized(); | 690 | abEditor->showMaximized(); |
691 | #endif | 691 | #endif |
692 | // fix the foxus... | 692 | // fix the foxus... |
693 | abEditor->setNameFocus(); | 693 | abEditor->setNameFocus(); |
694 | if ( abEditor->exec() ) { | 694 | if ( abEditor->exec() ) { |
695 | setFocus(); | 695 | setFocus(); |
696 | if ( entryMode == NewEntry ) { | 696 | if ( entryMode == NewEntry ) { |
697 | OContact insertEntry = abEditor->entry(); | 697 | OContact insertEntry = abEditor->entry(); |
698 | insertEntry.assignUid(); | 698 | insertEntry.assignUid(); |
699 | m_abView -> addEntry( insertEntry ); | 699 | m_abView -> addEntry( insertEntry ); |
700 | } else { | 700 | } else { |
701 | OContact replEntry = abEditor->entry(); | 701 | OContact replEntry = abEditor->entry(); |
702 | 702 | ||
703 | if ( !replEntry.isValidUid() ) | 703 | if ( !replEntry.isValidUid() ) |
704 | replEntry.assignUid(); | 704 | replEntry.assignUid(); |
705 | 705 | ||
706 | m_abView -> replaceEntry( replEntry ); | 706 | m_abView -> replaceEntry( replEntry ); |
707 | } | 707 | } |
708 | } | 708 | } |
709 | // populateCategories(); | 709 | // populateCategories(); |
710 | 710 | ||
711 | } | 711 | } |
712 | 712 | ||
713 | void AddressbookWindow::editPersonal() | 713 | void AddressbookWindow::editPersonal() |
714 | { | 714 | { |
715 | OContact entry; | 715 | OContact entry; |
716 | if ( !abEditor ) { | 716 | if ( !abEditor ) { |
717 | abEditor = new ContactEditor( entry, this, "editor" ); | 717 | abEditor = new ContactEditor( entry, this, "editor" ); |
718 | } | 718 | } |
719 | 719 | ||
720 | m_abView->showPersonal( true ); | ||
720 | abEditor->setCaption(tr("Edit My Personal Details")); | 721 | abEditor->setCaption(tr("Edit My Personal Details")); |
721 | abEditor->setPersonalView( true ); | 722 | abEditor->setPersonalView( true ); |
722 | editEntry( EditEntry ); | 723 | editEntry( EditEntry ); |
723 | abEditor->setPersonalView( false ); | 724 | abEditor->setPersonalView( false ); |
724 | 725 | ||
725 | } | 726 | } |
726 | 727 | ||
727 | 728 | ||
728 | void AddressbookWindow::slotPersonalView() | 729 | void AddressbookWindow::slotPersonalView() |
729 | { | 730 | { |
730 | if (!actionPersonal->isOn()) { | 731 | if (!actionPersonal->isOn()) { |
731 | // we just turned it off | 732 | // we just turned it off |
732 | setCaption( tr("Contacts") ); | 733 | setCaption( tr("Contacts") ); |
733 | actionNew->setEnabled(TRUE); | 734 | actionNew->setEnabled(TRUE); |
734 | actionTrash->setEnabled(TRUE); | 735 | actionTrash->setEnabled(TRUE); |
735 | actionFind->setEnabled(TRUE); | 736 | actionFind->setEnabled(TRUE); |
736 | actionMail->setEnabled(TRUE); | 737 | actionMail->setEnabled(TRUE); |
737 | // slotUpdateToolbar(); | 738 | // slotUpdateToolbar(); |
738 | 739 | ||
739 | m_abView->showPersonal( false ); | 740 | m_abView->showPersonal( false ); |
740 | 741 | ||
741 | return; | 742 | return; |
742 | } | 743 | } |
743 | 744 | ||
744 | // XXX need to disable some QActions. | 745 | // XXX need to disable some QActions. |
745 | actionNew->setEnabled(FALSE); | 746 | actionNew->setEnabled(FALSE); |
746 | actionTrash->setEnabled(FALSE); | 747 | actionTrash->setEnabled(FALSE); |
747 | actionFind->setEnabled(FALSE); | 748 | actionFind->setEnabled(FALSE); |
748 | actionMail->setEnabled(FALSE); | 749 | actionMail->setEnabled(FALSE); |
749 | 750 | ||
750 | setCaption( tr("Contacts - My Personal Details") ); | 751 | setCaption( tr("Contacts - My Personal Details") ); |
751 | 752 | ||
752 | m_abView->showPersonal( true ); | 753 | m_abView->showPersonal( true ); |
753 | 754 | ||
754 | } | 755 | } |
755 | 756 | ||
756 | 757 | ||
757 | void AddressbookWindow::listIsEmpty( bool empty ) | 758 | void AddressbookWindow::listIsEmpty( bool empty ) |
758 | { | 759 | { |
759 | if ( !empty ) { | 760 | if ( !empty ) { |
760 | deleteButton->setEnabled( TRUE ); | 761 | deleteButton->setEnabled( TRUE ); |
761 | } | 762 | } |
762 | } | 763 | } |
763 | 764 | ||
764 | void AddressbookWindow::reload() | 765 | void AddressbookWindow::reload() |
765 | { | 766 | { |
766 | syncing = FALSE; | 767 | syncing = FALSE; |
767 | m_abView->clear(); | 768 | m_abView->clear(); |
768 | m_abView->reload(); | 769 | m_abView->reload(); |
769 | } | 770 | } |
770 | 771 | ||
771 | void AddressbookWindow::flush() | 772 | void AddressbookWindow::flush() |
772 | { | 773 | { |
773 | syncing = TRUE; | 774 | syncing = TRUE; |
774 | m_abView->save(); | 775 | m_abView->save(); |
775 | } | 776 | } |
776 | 777 | ||
777 | 778 | ||
778 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 779 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
779 | { | 780 | { |
780 | if(active_view == AbView::CardView){ | 781 | if(active_view == AbView::CardView){ |
781 | slotViewSwitched( AbView::TableView ); | 782 | slotViewSwitched( AbView::TableView ); |
782 | e->ignore(); | 783 | e->ignore(); |
783 | return; | 784 | return; |
784 | } | 785 | } |
785 | if(syncing) { | 786 | if(syncing) { |
786 | /* shouldn't we save, I hear you say? well its already been set | 787 | /* shouldn't we save, I hear you say? well its already been set |
787 | so that an edit can not occur during a sync, and we flushed | 788 | so that an edit can not occur during a sync, and we flushed |
788 | at the start of the sync, so there is no need to save | 789 | at the start of the sync, so there is no need to save |
789 | Saving however itself would cause problems. */ | 790 | Saving however itself would cause problems. */ |
790 | e->accept(); | 791 | e->accept(); |
791 | return; | 792 | return; |
792 | } | 793 | } |
793 | //################## shouldn't always save | 794 | //################## shouldn't always save |
794 | // True, but the database handles this automatically ! (se) | 795 | // True, but the database handles this automatically ! (se) |
795 | if ( save() ) | 796 | if ( save() ) |
796 | e->accept(); | 797 | e->accept(); |
797 | else | 798 | else |
798 | e->ignore(); | 799 | e->ignore(); |
799 | } | 800 | } |
800 | 801 | ||
801 | /* | 802 | /* |
802 | Returns TRUE if it is OK to exit | 803 | Returns TRUE if it is OK to exit |
803 | */ | 804 | */ |
804 | 805 | ||
805 | bool AddressbookWindow::save() | 806 | bool AddressbookWindow::save() |
806 | { | 807 | { |
807 | if ( !m_abView->save() ) { | 808 | if ( !m_abView->save() ) { |
808 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 809 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
809 | tr("Unable to save information.\n" | 810 | tr("Unable to save information.\n" |
810 | "Free up some space\n" | 811 | "Free up some space\n" |
811 | "and try again.\n" | 812 | "and try again.\n" |
812 | "\nQuit anyway?"), | 813 | "\nQuit anyway?"), |
813 | QMessageBox::Yes|QMessageBox::Escape, | 814 | QMessageBox::Yes|QMessageBox::Escape, |
814 | QMessageBox::No|QMessageBox::Default ) | 815 | QMessageBox::No|QMessageBox::Default ) |
815 | != QMessageBox::No ) | 816 | != QMessageBox::No ) |