author | zautrix <zautrix> | 2004-11-08 21:29:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-11-08 21:29:18 (UTC) |
commit | 7b899c8a9c38cf96fca6c46b20ae406a716dd213 (patch) (unidiff) | |
tree | 8c1df14a990de3a630d54a3edf8a6838a7697438 /kaddressbook | |
parent | 4481ce9842b3820087b24a8bfce2c194974aae73 (diff) | |
download | kdepimpi-7b899c8a9c38cf96fca6c46b20ae406a716dd213.zip kdepimpi-7b899c8a9c38cf96fca6c46b20ae406a716dd213.tar.gz kdepimpi-7b899c8a9c38cf96fca6c46b20ae406a716dd213.tar.bz2 |
Better phone export contact selection
-rw-r--r-- | kaddressbook/kabcore.cpp | 19 | ||||
-rw-r--r-- | kaddressbook/xxportselectdialog.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/xxportselectdialog.h | 1 |
3 files changed, 22 insertions, 7 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index c339244..755da11 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -86,64 +86,65 @@ $Id$ | |||
86 | #include "kactioncollection.h" | 86 | #include "kactioncollection.h" |
87 | #include "addresseedialog.h" | 87 | #include "addresseedialog.h" |
88 | //US | 88 | //US |
89 | #include <addresseeview.h> | 89 | #include <addresseeview.h> |
90 | 90 | ||
91 | #include <qapp.h> | 91 | #include <qapp.h> |
92 | #include <qmenubar.h> | 92 | #include <qmenubar.h> |
93 | //#include <qtoolbar.h> | 93 | //#include <qtoolbar.h> |
94 | #include <qmessagebox.h> | 94 | #include <qmessagebox.h> |
95 | #include <kdebug.h> | 95 | #include <kdebug.h> |
96 | #include <kiconloader.h> // needed for SmallIcon | 96 | #include <kiconloader.h> // needed for SmallIcon |
97 | #include <kresources/kcmkresources.h> | 97 | #include <kresources/kcmkresources.h> |
98 | #include <ktoolbar.h> | 98 | #include <ktoolbar.h> |
99 | 99 | ||
100 | 100 | ||
101 | //#include <qlabel.h> | 101 | //#include <qlabel.h> |
102 | 102 | ||
103 | 103 | ||
104 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
105 | #include <qpe/ir.h> | 105 | #include <qpe/ir.h> |
106 | #include <qpe/qpemenubar.h> | 106 | #include <qpe/qpemenubar.h> |
107 | #include <qtopia/qcopenvelope_qws.h> | 107 | #include <qtopia/qcopenvelope_qws.h> |
108 | #else | 108 | #else |
109 | 109 | ||
110 | #include <qmenubar.h> | 110 | #include <qmenubar.h> |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | #endif // KAB_EMBEDDED | 113 | #endif // KAB_EMBEDDED |
114 | #include "kcmconfigs/kcmkabconfig.h" | 114 | #include "kcmconfigs/kcmkabconfig.h" |
115 | #include "kcmconfigs/kcmkdepimconfig.h" | 115 | #include "kcmconfigs/kcmkdepimconfig.h" |
116 | #include "kpimglobalprefs.h" | 116 | #include "kpimglobalprefs.h" |
117 | #include "externalapphandler.h" | 117 | #include "externalapphandler.h" |
118 | #include "xxportselectdialog.h" | ||
118 | 119 | ||
119 | 120 | ||
120 | #include <kresources/selectdialog.h> | 121 | #include <kresources/selectdialog.h> |
121 | #include <kmessagebox.h> | 122 | #include <kmessagebox.h> |
122 | 123 | ||
123 | #include <picture.h> | 124 | #include <picture.h> |
124 | #include <resource.h> | 125 | #include <resource.h> |
125 | 126 | ||
126 | //US#include <qsplitter.h> | 127 | //US#include <qsplitter.h> |
127 | #include <qmap.h> | 128 | #include <qmap.h> |
128 | #include <qdir.h> | 129 | #include <qdir.h> |
129 | #include <qfile.h> | 130 | #include <qfile.h> |
130 | #include <qvbox.h> | 131 | #include <qvbox.h> |
131 | #include <qlayout.h> | 132 | #include <qlayout.h> |
132 | #include <qclipboard.h> | 133 | #include <qclipboard.h> |
133 | #include <qtextstream.h> | 134 | #include <qtextstream.h> |
134 | #include <qradiobutton.h> | 135 | #include <qradiobutton.h> |
135 | #include <qbuttongroup.h> | 136 | #include <qbuttongroup.h> |
136 | 137 | ||
137 | #include <libkdepim/categoryselectdialog.h> | 138 | #include <libkdepim/categoryselectdialog.h> |
138 | #include <libkdepim/categoryeditdialog.h> | 139 | #include <libkdepim/categoryeditdialog.h> |
139 | #include <kabc/vcardconverter.h> | 140 | #include <kabc/vcardconverter.h> |
140 | 141 | ||
141 | 142 | ||
142 | #include "addresseeutil.h" | 143 | #include "addresseeutil.h" |
143 | #include "undocmds.h" | 144 | #include "undocmds.h" |
144 | #include "addresseeeditordialog.h" | 145 | #include "addresseeeditordialog.h" |
145 | #include "viewmanager.h" | 146 | #include "viewmanager.h" |
146 | #include "details/detailsviewcontainer.h" | 147 | #include "details/detailsviewcontainer.h" |
147 | #include "kabprefs.h" | 148 | #include "kabprefs.h" |
148 | #include "xxportmanager.h" | 149 | #include "xxportmanager.h" |
149 | #include "incsearchwidget.h" | 150 | #include "incsearchwidget.h" |
@@ -649,65 +650,64 @@ void KABCore::setContactSelected( const QString &uid ) | |||
649 | QPixmap px; | 650 | QPixmap px; |
650 | if (pic.data().isNull() != true) | 651 | if (pic.data().isNull() != true) |
651 | { | 652 | { |
652 | px.convertFromImage(pic.data()); | 653 | px.convertFromImage(pic.data()); |
653 | } | 654 | } |
654 | 655 | ||
655 | emit contactSelected( px ); | 656 | emit contactSelected( px ); |
656 | } | 657 | } |
657 | } | 658 | } |
658 | 659 | ||
659 | 660 | ||
660 | mExtensionManager->setSelectionChanged(); | 661 | mExtensionManager->setSelectionChanged(); |
661 | 662 | ||
662 | // update the actions | 663 | // update the actions |
663 | bool selected = !uid.isEmpty(); | 664 | bool selected = !uid.isEmpty(); |
664 | 665 | ||
665 | if ( mReadWrite ) { | 666 | if ( mReadWrite ) { |
666 | mActionCut->setEnabled( selected ); | 667 | mActionCut->setEnabled( selected ); |
667 | mActionPaste->setEnabled( selected ); | 668 | mActionPaste->setEnabled( selected ); |
668 | } | 669 | } |
669 | 670 | ||
670 | mActionCopy->setEnabled( selected ); | 671 | mActionCopy->setEnabled( selected ); |
671 | mActionDelete->setEnabled( selected ); | 672 | mActionDelete->setEnabled( selected ); |
672 | mActionEditAddressee->setEnabled( selected ); | 673 | mActionEditAddressee->setEnabled( selected ); |
673 | mActionMail->setEnabled( selected ); | 674 | mActionMail->setEnabled( selected ); |
674 | mActionMailVCard->setEnabled( selected ); | 675 | mActionMailVCard->setEnabled( selected ); |
675 | //if (mActionBeam) | 676 | //if (mActionBeam) |
676 | //mActionBeam->setEnabled( selected ); | 677 | //mActionBeam->setEnabled( selected ); |
677 | 678 | ||
678 | if (mActionBeamVCard) | 679 | if (mActionBeamVCard) |
679 | mActionBeamVCard->setEnabled( selected ); | 680 | mActionBeamVCard->setEnabled( selected ); |
680 | 681 | ||
681 | mActionExport2phone->setEnabled( selected ); | ||
682 | mActionWhoAmI->setEnabled( selected ); | 682 | mActionWhoAmI->setEnabled( selected ); |
683 | mActionCategories->setEnabled( selected ); | 683 | mActionCategories->setEnabled( selected ); |
684 | } | 684 | } |
685 | 685 | ||
686 | void KABCore::sendMail() | 686 | void KABCore::sendMail() |
687 | { | 687 | { |
688 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 688 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
689 | } | 689 | } |
690 | 690 | ||
691 | void KABCore::sendMail( const QString& emaillist ) | 691 | void KABCore::sendMail( const QString& emaillist ) |
692 | { | 692 | { |
693 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 693 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
694 | if (emaillist.contains(",") > 0) | 694 | if (emaillist.contains(",") > 0) |
695 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 695 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
696 | else | 696 | else |
697 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 697 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
698 | } | 698 | } |
699 | 699 | ||
700 | 700 | ||
701 | 701 | ||
702 | void KABCore::mailVCard() | 702 | void KABCore::mailVCard() |
703 | { | 703 | { |
704 | QStringList uids = mViewManager->selectedUids(); | 704 | QStringList uids = mViewManager->selectedUids(); |
705 | if ( !uids.isEmpty() ) | 705 | if ( !uids.isEmpty() ) |
706 | mailVCard( uids ); | 706 | mailVCard( uids ); |
707 | } | 707 | } |
708 | 708 | ||
709 | void KABCore::mailVCard( const QStringList& uids ) | 709 | void KABCore::mailVCard( const QStringList& uids ) |
710 | { | 710 | { |
711 | QStringList urls; | 711 | QStringList urls; |
712 | 712 | ||
713 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 713 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
@@ -751,86 +751,91 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
751 | 751 | ||
752 | /*US | 752 | /*US |
753 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 753 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
754 | QString::null, // subject | 754 | QString::null, // subject |
755 | QString::null, // body | 755 | QString::null, // body |
756 | QString::null, | 756 | QString::null, |
757 | urls ); // attachments | 757 | urls ); // attachments |
758 | */ | 758 | */ |
759 | 759 | ||
760 | } | 760 | } |
761 | 761 | ||
762 | /** | 762 | /** |
763 | Beams the "WhoAmI contact. | 763 | Beams the "WhoAmI contact. |
764 | */ | 764 | */ |
765 | void KABCore::beamMySelf() | 765 | void KABCore::beamMySelf() |
766 | { | 766 | { |
767 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 767 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
768 | if (!a.isEmpty()) | 768 | if (!a.isEmpty()) |
769 | { | 769 | { |
770 | QStringList uids; | 770 | QStringList uids; |
771 | uids << a.uid(); | 771 | uids << a.uid(); |
772 | 772 | ||
773 | beamVCard(uids); | 773 | beamVCard(uids); |
774 | } else { | 774 | } else { |
775 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 775 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
776 | 776 | ||
777 | 777 | ||
778 | } | 778 | } |
779 | } | 779 | } |
780 | 780 | ||
781 | void KABCore::export2phone() | 781 | void KABCore::export2phone() |
782 | { | 782 | { |
783 | 783 | QStringList uids; | |
784 | XXPortSelectDialog dlg( this, false, this ); | ||
785 | if ( dlg.exec() ) | ||
786 | uids = dlg.uids(); | ||
787 | else | ||
788 | return; | ||
789 | if ( uids.isEmpty() ) | ||
790 | return; | ||
791 | // qDebug("count %d ", uids.count()); | ||
792 | |||
784 | KAex2phonePrefs ex2phone; | 793 | KAex2phonePrefs ex2phone; |
785 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 794 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
786 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 795 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
787 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 796 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
788 | 797 | ||
789 | if ( !ex2phone.exec() ) { | 798 | if ( !ex2phone.exec() ) { |
790 | return; | 799 | return; |
791 | } | 800 | } |
792 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 801 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
793 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 802 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
794 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 803 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
795 | 804 | ||
796 | 805 | ||
797 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 806 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
798 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 807 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
799 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 808 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
800 | 809 | ||
801 | QStringList uids = mViewManager->selectedUids(); | ||
802 | if ( uids.isEmpty() ) | ||
803 | return; | ||
804 | |||
805 | QString fileName = getPhoneFile(); | 810 | QString fileName = getPhoneFile(); |
806 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 811 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
807 | return; | 812 | return; |
808 | 813 | ||
809 | message(i18n("Exporting to phone...")); | 814 | message(i18n("Exporting to phone...")); |
810 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 815 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
811 | 816 | ||
812 | } | 817 | } |
813 | QString KABCore::getPhoneFile() | 818 | QString KABCore::getPhoneFile() |
814 | { | 819 | { |
815 | #ifdef DESKTOP_VERSION | 820 | #ifdef DESKTOP_VERSION |
816 | return locateLocal("tmp", "phonefile.vcf"); | 821 | return locateLocal("tmp", "phonefile.vcf"); |
817 | #else | 822 | #else |
818 | return "/tmp/phonefile.vcf"; | 823 | return "/tmp/phonefile.vcf"; |
819 | #endif | 824 | #endif |
820 | 825 | ||
821 | } | 826 | } |
822 | void KABCore::writeToPhone( ) | 827 | void KABCore::writeToPhone( ) |
823 | { | 828 | { |
824 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 829 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
825 | message(i18n("Export to phone finished!")); | 830 | message(i18n("Export to phone finished!")); |
826 | else | 831 | else |
827 | qDebug(i18n("Error exporting to phone")); | 832 | qDebug(i18n("Error exporting to phone")); |
828 | } | 833 | } |
829 | void KABCore::beamVCard() | 834 | void KABCore::beamVCard() |
830 | { | 835 | { |
831 | QStringList uids = mViewManager->selectedUids(); | 836 | QStringList uids = mViewManager->selectedUids(); |
832 | if ( !uids.isEmpty() ) | 837 | if ( !uids.isEmpty() ) |
833 | beamVCard( uids ); | 838 | beamVCard( uids ); |
834 | } | 839 | } |
835 | 840 | ||
836 | 841 | ||
@@ -1770,65 +1775,65 @@ void KABCore::initActions() | |||
1770 | { | 1775 | { |
1771 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1776 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1772 | 1777 | ||
1773 | #ifndef KAB_EMBEDDED | 1778 | #ifndef KAB_EMBEDDED |
1774 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1779 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1775 | SLOT( clipboardDataChanged() ) ); | 1780 | SLOT( clipboardDataChanged() ) ); |
1776 | #endif //KAB_EMBEDDED | 1781 | #endif //KAB_EMBEDDED |
1777 | 1782 | ||
1778 | // file menu | 1783 | // file menu |
1779 | if ( mIsPart ) { | 1784 | if ( mIsPart ) { |
1780 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1785 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1781 | SLOT( sendMail() ), actionCollection(), | 1786 | SLOT( sendMail() ), actionCollection(), |
1782 | "kaddressbook_mail" ); | 1787 | "kaddressbook_mail" ); |
1783 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1788 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1784 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1789 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1785 | 1790 | ||
1786 | } else { | 1791 | } else { |
1787 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1792 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1788 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1793 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1789 | } | 1794 | } |
1790 | 1795 | ||
1791 | 1796 | ||
1792 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1797 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1793 | SLOT( save() ), actionCollection(), "file_sync" ); | 1798 | SLOT( save() ), actionCollection(), "file_sync" ); |
1794 | 1799 | ||
1795 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1800 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1796 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1801 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1797 | 1802 | ||
1798 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1803 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1799 | this, SLOT( mailVCard() ), | 1804 | this, SLOT( mailVCard() ), |
1800 | actionCollection(), "file_mail_vcard"); | 1805 | actionCollection(), "file_mail_vcard"); |
1801 | 1806 | ||
1802 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, | 1807 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, |
1803 | SLOT( export2phone() ), actionCollection(), | 1808 | SLOT( export2phone() ), actionCollection(), |
1804 | "kaddressbook_ex2phone" ); | 1809 | "kaddressbook_ex2phone" ); |
1805 | 1810 | ||
1806 | mActionBeamVCard = 0; | 1811 | mActionBeamVCard = 0; |
1807 | mActionBeam = 0; | 1812 | mActionBeam = 0; |
1808 | 1813 | ||
1809 | #ifndef DESKTOP_VERSION | 1814 | #ifndef DESKTOP_VERSION |
1810 | if ( Ir::supported() ) { | 1815 | if ( Ir::supported() ) { |
1811 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1816 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1812 | SLOT( beamVCard() ), actionCollection(), | 1817 | SLOT( beamVCard() ), actionCollection(), |
1813 | "kaddressbook_beam_vcard" ); | 1818 | "kaddressbook_beam_vcard" ); |
1814 | 1819 | ||
1815 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1820 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1816 | SLOT( beamMySelf() ), actionCollection(), | 1821 | SLOT( beamMySelf() ), actionCollection(), |
1817 | "kaddressbook_beam_myself" ); | 1822 | "kaddressbook_beam_myself" ); |
1818 | } | 1823 | } |
1819 | #endif | 1824 | #endif |
1820 | 1825 | ||
1821 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1826 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1822 | this, SLOT( editContact2() ), | 1827 | this, SLOT( editContact2() ), |
1823 | actionCollection(), "file_properties" ); | 1828 | actionCollection(), "file_properties" ); |
1824 | 1829 | ||
1825 | #ifdef KAB_EMBEDDED | 1830 | #ifdef KAB_EMBEDDED |
1826 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1831 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1827 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1832 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1828 | mMainWindow, SLOT( exit() ), | 1833 | mMainWindow, SLOT( exit() ), |
1829 | actionCollection(), "quit" ); | 1834 | actionCollection(), "quit" ); |
1830 | #endif //KAB_EMBEDDED | 1835 | #endif //KAB_EMBEDDED |
1831 | 1836 | ||
1832 | // edit menu | 1837 | // edit menu |
1833 | if ( mIsPart ) { | 1838 | if ( mIsPart ) { |
1834 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1839 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp index 41c999b..be254c0 100644 --- a/kaddressbook/xxportselectdialog.cpp +++ b/kaddressbook/xxportselectdialog.cpp | |||
@@ -70,64 +70,73 @@ XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, | |||
70 | Filter::List::iterator filterIt; | 70 | Filter::List::iterator filterIt; |
71 | #else //KAB_EMBEDDED | 71 | #else //KAB_EMBEDDED |
72 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); | 72 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); |
73 | Filter::List::Iterator filterIt; | 73 | Filter::List::Iterator filterIt; |
74 | #endif //KAB_EMBEDDED | 74 | #endif //KAB_EMBEDDED |
75 | QStringList filters; | 75 | QStringList filters; |
76 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 76 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
77 | filters.append( (*filterIt).name() ); | 77 | filters.append( (*filterIt).name() ); |
78 | 78 | ||
79 | mFiltersCombo->insertStringList( filters ); | 79 | mFiltersCombo->insertStringList( filters ); |
80 | mUseFilters->setEnabled( filters.count() > 0 ); | 80 | mUseFilters->setEnabled( filters.count() > 0 ); |
81 | 81 | ||
82 | // setup categories | 82 | // setup categories |
83 | QStringList categories = KABPrefs::instance()->mCustomCategories; | 83 | QStringList categories = KABPrefs::instance()->mCustomCategories; |
84 | QStringList::Iterator it; | 84 | QStringList::Iterator it; |
85 | for ( it = categories.begin(); it != categories.end(); ++it ) | 85 | for ( it = categories.begin(); it != categories.end(); ++it ) |
86 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); | 86 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); |
87 | mUseCategories->setEnabled( categories.count() > 0 ); | 87 | mUseCategories->setEnabled( categories.count() > 0 ); |
88 | 88 | ||
89 | int count = mCore->selectedUIDs().count(); | 89 | int count = mCore->selectedUIDs().count(); |
90 | mUseSelection->setEnabled( count != 0 ); | 90 | mUseSelection->setEnabled( count != 0 ); |
91 | mUseSelection->setChecked( count > 1 ); | 91 | mUseSelection->setChecked( count > 1 ); |
92 | 92 | ||
93 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); | 93 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); |
94 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); | 94 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); |
95 | 95 | ||
96 | mFields = mCore->addressBook()->fields( KABC::Field::All ); | 96 | mFields = mCore->addressBook()->fields( KABC::Field::All ); |
97 | KABC::Field::List::Iterator fieldIt; | 97 | KABC::Field::List::Iterator fieldIt; |
98 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) | 98 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) |
99 | mFieldCombo->insertItem( (*fieldIt)->label() ); | 99 | mFieldCombo->insertItem( (*fieldIt)->label() ); |
100 | } | 100 | } |
101 | 101 | ||
102 | QStringList XXPortSelectDialog::uids() | ||
103 | { | ||
104 | QStringList uidlist; | ||
105 | KABC::AddresseeList list = contacts(); | ||
106 | KABC::Addressee::List::Iterator it; | ||
107 | for ( it = list.begin(); it != list.end(); ++it ) | ||
108 | uidlist.append((*it).uid()); | ||
109 | return uidlist; | ||
110 | } | ||
102 | KABC::AddresseeList XXPortSelectDialog::contacts() | 111 | KABC::AddresseeList XXPortSelectDialog::contacts() |
103 | { | 112 | { |
104 | QStringList selection = mCore->selectedUIDs(); | 113 | QStringList selection = mCore->selectedUIDs(); |
105 | 114 | ||
106 | KABC::AddresseeList list; | 115 | KABC::AddresseeList list; |
107 | if ( mUseSelection->isChecked() ) { | 116 | if ( mUseSelection->isChecked() ) { |
108 | QStringList::Iterator it; | 117 | QStringList::Iterator it; |
109 | for ( it = selection.begin(); it != selection.end(); ++it ) { | 118 | for ( it = selection.begin(); it != selection.end(); ++it ) { |
110 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); | 119 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); |
111 | if ( !addr.isEmpty() ) | 120 | if ( !addr.isEmpty() ) |
112 | list.append( addr ); | 121 | list.append( addr ); |
113 | } | 122 | } |
114 | } else if ( mUseFilters->isChecked() ) { | 123 | } else if ( mUseFilters->isChecked() ) { |
115 | // find contacts that can pass selected filter | 124 | // find contacts that can pass selected filter |
116 | Filter::List::Iterator filterIt; | 125 | Filter::List::Iterator filterIt; |
117 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 126 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
118 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) | 127 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) |
119 | break; | 128 | break; |
120 | 129 | ||
121 | KABC::AddressBook::Iterator it; | 130 | KABC::AddressBook::Iterator it; |
122 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 131 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
123 | if ( (*filterIt).filterAddressee( *it ) ) | 132 | if ( (*filterIt).filterAddressee( *it ) ) |
124 | list.append( *it ); | 133 | list.append( *it ); |
125 | } | 134 | } |
126 | } else if ( mUseCategories->isChecked() ) { | 135 | } else if ( mUseCategories->isChecked() ) { |
127 | QStringList categorieList = categories(); | 136 | QStringList categorieList = categories(); |
128 | KABC::AddressBook::Iterator it; | 137 | KABC::AddressBook::Iterator it; |
129 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 138 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
130 | QStringList tmp( (*it).categories() ); | 139 | QStringList tmp( (*it).categories() ); |
131 | QStringList::Iterator tmpIt; | 140 | QStringList::Iterator tmpIt; |
132 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) | 141 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) |
133 | if ( categorieList.contains( *tmpIt ) ) { | 142 | if ( categorieList.contains( *tmpIt ) ) { |
diff --git a/kaddressbook/xxportselectdialog.h b/kaddressbook/xxportselectdialog.h index 8d56f66..3bb696f 100644 --- a/kaddressbook/xxportselectdialog.h +++ b/kaddressbook/xxportselectdialog.h | |||
@@ -19,63 +19,64 @@ | |||
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef XXPORTSELECTDIALOG_H | 24 | #ifndef XXPORTSELECTDIALOG_H |
25 | #define XXPORTSELECTDIALOG_H | 25 | #define XXPORTSELECTDIALOG_H |
26 | 26 | ||
27 | #include <kabc/addresseelist.h> | 27 | #include <kabc/addresseelist.h> |
28 | #include <kabc/field.h> | 28 | #include <kabc/field.h> |
29 | #include <kdialogbase.h> | 29 | #include <kdialogbase.h> |
30 | 30 | ||
31 | #include "filter.h" | 31 | #include "filter.h" |
32 | 32 | ||
33 | class QButtonGroup; | 33 | class QButtonGroup; |
34 | class QComboBox; | 34 | class QComboBox; |
35 | class QListView; | 35 | class QListView; |
36 | class QListViewItem; | 36 | class QListViewItem; |
37 | class QRadioButton; | 37 | class QRadioButton; |
38 | 38 | ||
39 | class KABCore; | 39 | class KABCore; |
40 | class KComboBox; | 40 | class KComboBox; |
41 | 41 | ||
42 | class XXPortSelectDialog : public KDialogBase | 42 | class XXPortSelectDialog : public KDialogBase |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | 45 | ||
46 | public: | 46 | public: |
47 | XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent, | 47 | XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent, |
48 | const char* name = 0 ); | 48 | const char* name = 0 ); |
49 | 49 | ||
50 | KABC::AddresseeList contacts(); | 50 | KABC::AddresseeList contacts(); |
51 | QStringList uids(); | ||
51 | 52 | ||
52 | private slots: | 53 | private slots: |
53 | void filterChanged( int ); | 54 | void filterChanged( int ); |
54 | void categoryClicked( QListViewItem * i ); | 55 | void categoryClicked( QListViewItem * i ); |
55 | 56 | ||
56 | protected slots: | 57 | protected slots: |
57 | void slotHelp(); | 58 | void slotHelp(); |
58 | 59 | ||
59 | private: | 60 | private: |
60 | void initGUI(); | 61 | void initGUI(); |
61 | QStringList categories() const; | 62 | QStringList categories() const; |
62 | 63 | ||
63 | QButtonGroup* mButtonGroup; | 64 | QButtonGroup* mButtonGroup; |
64 | QRadioButton* mUseCategories; | 65 | QRadioButton* mUseCategories; |
65 | QRadioButton* mUseFilters; | 66 | QRadioButton* mUseFilters; |
66 | QRadioButton* mUseWholeBook; | 67 | QRadioButton* mUseWholeBook; |
67 | QRadioButton* mUseSelection; | 68 | QRadioButton* mUseSelection; |
68 | QComboBox* mFiltersCombo; | 69 | QComboBox* mFiltersCombo; |
69 | QListView* mCategoriesView; | 70 | QListView* mCategoriesView; |
70 | 71 | ||
71 | KComboBox *mFieldCombo; | 72 | KComboBox *mFieldCombo; |
72 | KComboBox *mSortTypeCombo; | 73 | KComboBox *mSortTypeCombo; |
73 | 74 | ||
74 | KABCore *mCore; | 75 | KABCore *mCore; |
75 | KABC::AddresseeList mAddresseeList; | 76 | KABC::AddresseeList mAddresseeList; |
76 | Filter::List mFilters; | 77 | Filter::List mFilters; |
77 | KABC::Field::List mFields; | 78 | KABC::Field::List mFields; |
78 | bool mUseSorting; | 79 | bool mUseSorting; |
79 | }; | 80 | }; |
80 | 81 | ||
81 | #endif | 82 | #endif |