Diffstat (limited to 'kaddressbook/xxportselectdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/xxportselectdialog.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp index 41c999b..be254c0 100644 --- a/kaddressbook/xxportselectdialog.cpp +++ b/kaddressbook/xxportselectdialog.cpp @@ -54,96 +54,105 @@ $Id$ XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent, const char* name ) : KDialogBase( Plain, i18n( "Choose which contacts to export" ), Help | Ok | Cancel, Ok, parent, name, true, true ), mCore( core ), mUseSorting( sort ) { initGUI(); connect( mFiltersCombo, SIGNAL( activated( int ) ), SLOT( filterChanged( int ) ) ); connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), SLOT( categoryClicked( QListViewItem* ) ) ); // setup filters #ifndef KAB_EMBEDDED mFilters = Filter::restore( kapp->config(), "Filter" ); Filter::List::iterator filterIt; #else //KAB_EMBEDDED mFilters = Filter::restore( KGlobal::config(), "Filter" ); Filter::List::Iterator filterIt; #endif //KAB_EMBEDDED QStringList filters; for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) filters.append( (*filterIt).name() ); mFiltersCombo->insertStringList( filters ); mUseFilters->setEnabled( filters.count() > 0 ); // setup categories QStringList categories = KABPrefs::instance()->mCustomCategories; QStringList::Iterator it; for ( it = categories.begin(); it != categories.end(); ++it ) new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); mUseCategories->setEnabled( categories.count() > 0 ); int count = mCore->selectedUIDs().count(); mUseSelection->setEnabled( count != 0 ); mUseSelection->setChecked( count > 1 ); mSortTypeCombo->insertItem( i18n( "Ascending" ) ); 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 ) { KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); if ( !addr.isEmpty() ) list.append( addr ); } } else if ( mUseFilters->isChecked() ) { // find contacts that can pass selected filter Filter::List::Iterator filterIt; for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) if ( (*filterIt).name() == mFiltersCombo->currentText() ) break; KABC::AddressBook::Iterator it; for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { if ( (*filterIt).filterAddressee( *it ) ) list.append( *it ); } } else if ( mUseCategories->isChecked() ) { QStringList categorieList = categories(); KABC::AddressBook::Iterator it; for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { QStringList tmp( (*it).categories() ); QStringList::Iterator tmpIt; for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) if ( categorieList.contains( *tmpIt ) ) { list.append( *it ); break; } } } else { // create a string list of all entries: KABC::AddressBook::Iterator it; for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) list.append( *it ); } if ( mUseSorting ) { list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); uint pos = mFieldCombo->currentItem(); if ( pos < mFields.count() ) list.sortByField( mFields[ pos ] ); |