author | zautrix <zautrix> | 2004-11-08 21:29:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-11-08 21:29:18 (UTC) |
commit | 7b899c8a9c38cf96fca6c46b20ae406a716dd213 (patch) (side-by-side diff) | |
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 @@ -110,16 +110,17 @@ $Id$ #include <qmenubar.h> #endif #endif // KAB_EMBEDDED #include "kcmconfigs/kcmkabconfig.h" #include "kcmconfigs/kcmkdepimconfig.h" #include "kpimglobalprefs.h" #include "externalapphandler.h" +#include "xxportselectdialog.h" #include <kresources/selectdialog.h> #include <kmessagebox.h> #include <picture.h> #include <resource.h> @@ -673,17 +674,16 @@ void KABCore::setContactSelected( const QString &uid ) mActionMail->setEnabled( selected ); mActionMailVCard->setEnabled( selected ); //if (mActionBeam) //mActionBeam->setEnabled( selected ); if (mActionBeamVCard) mActionBeamVCard->setEnabled( selected ); - mActionExport2phone->setEnabled( selected ); mActionWhoAmI->setEnabled( selected ); mActionCategories->setEnabled( selected ); } void KABCore::sendMail() { sendMail( mViewManager->selectedEmails().join( ", " ) ); } @@ -775,17 +775,26 @@ void KABCore::beamMySelf() KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); } } void KABCore::export2phone() { - + QStringList uids; + XXPortSelectDialog dlg( this, false, this ); + if ( dlg.exec() ) + uids = dlg.uids(); + else + return; + if ( uids.isEmpty() ) + return; + // qDebug("count %d ", uids.count()); + KAex2phonePrefs ex2phone; ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); if ( !ex2phone.exec() ) { return; } @@ -793,20 +802,16 @@ void KABCore::export2phone() KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, KPimGlobalPrefs::instance()->mEx2PhoneConnection, KPimGlobalPrefs::instance()->mEx2PhoneModel ); - QStringList uids = mViewManager->selectedUids(); - if ( uids.isEmpty() ) - return; - QString fileName = getPhoneFile(); if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) return; message(i18n("Exporting to phone...")); QTimer::singleShot( 1, this , SLOT ( writeToPhone())); } @@ -1794,17 +1799,17 @@ void KABCore::initActions() mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, SLOT( newContact() ), actionCollection(), "file_new_contact" ); mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, this, SLOT( mailVCard() ), actionCollection(), "file_mail_vcard"); - mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, + mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, SLOT( export2phone() ), actionCollection(), "kaddressbook_ex2phone" ); mActionBeamVCard = 0; mActionBeam = 0; #ifndef DESKTOP_VERSION 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, mSortTypeCombo->insertItem( i18n( "Descending" ) ); mFields = mCore->addressBook()->fields( KABC::Field::All ); KABC::Field::List::Iterator fieldIt; for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) mFieldCombo->insertItem( (*fieldIt)->label() ); } +QStringList XXPortSelectDialog::uids() +{ + QStringList uidlist; + KABC::AddresseeList list = contacts(); + KABC::Addressee::List::Iterator it; + for ( it = list.begin(); it != list.end(); ++it ) + uidlist.append((*it).uid()); + return uidlist; +} KABC::AddresseeList XXPortSelectDialog::contacts() { QStringList selection = mCore->selectedUIDs(); KABC::AddresseeList list; if ( mUseSelection->isChecked() ) { QStringList::Iterator it; 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 { Q_OBJECT public: XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent, const char* name = 0 ); KABC::AddresseeList contacts(); + QStringList uids(); private slots: void filterChanged( int ); void categoryClicked( QListViewItem * i ); protected slots: void slotHelp(); |