summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-11-08 21:29:18 (UTC)
committer zautrix <zautrix>2004-11-08 21:29:18 (UTC)
commit7b899c8a9c38cf96fca6c46b20ae406a716dd213 (patch) (unidiff)
tree8c1df14a990de3a630d54a3edf8a6838a7697438
parent4481ce9842b3820087b24a8bfce2c194974aae73 (diff)
downloadkdepimpi-7b899c8a9c38cf96fca6c46b20ae406a716dd213.zip
kdepimpi-7b899c8a9c38cf96fca6c46b20ae406a716dd213.tar.gz
kdepimpi-7b899c8a9c38cf96fca6c46b20ae406a716dd213.tar.bz2
Better phone export contact selection
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp19
-rw-r--r--kaddressbook/xxportselectdialog.cpp9
-rw-r--r--kaddressbook/xxportselectdialog.h1
-rw-r--r--version2
4 files changed, 23 insertions, 8 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index c339244..755da11 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -110,16 +110,17 @@ $Id$
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
@@ -673,17 +674,16 @@ void KABCore::setContactSelected( const QString &uid )
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
686void KABCore::sendMail() 686void KABCore::sendMail()
687{ 687{
688 sendMail( mViewManager->selectedEmails().join( ", " ) ); 688 sendMail( mViewManager->selectedEmails().join( ", " ) );
689} 689}
@@ -775,17 +775,26 @@ void KABCore::beamMySelf()
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
781void KABCore::export2phone() 781void 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 }
@@ -793,20 +802,16 @@ void KABCore::export2phone()
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}
@@ -1794,17 +1799,17 @@ void KABCore::initActions()
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() ) {
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp
index 41c999b..be254c0 100644
--- a/kaddressbook/xxportselectdialog.cpp
+++ b/kaddressbook/xxportselectdialog.cpp
@@ -94,16 +94,25 @@ XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort,
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
102QStringList 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}
102KABC::AddresseeList XXPortSelectDialog::contacts() 111KABC::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 ) {
diff --git a/kaddressbook/xxportselectdialog.h b/kaddressbook/xxportselectdialog.h
index 8d56f66..3bb696f 100644
--- a/kaddressbook/xxportselectdialog.h
+++ b/kaddressbook/xxportselectdialog.h
@@ -43,16 +43,17 @@ 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
diff --git a/version b/version
index 4368d49..c4fe6e2 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "1.9.12"; version = "1.9.13";