From 32479683283fc9f20d369ac9671ba0f8a33d3381 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 17 Jan 2005 18:22:47 +0000 Subject: fast set formatted name --- (limited to 'kaddressbook/xxportselectdialog.cpp') diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp index 6282453..e7bc8c0 100644 --- a/kaddressbook/xxportselectdialog.cpp +++ b/kaddressbook/xxportselectdialog.cpp @@ -54,7 +54,7 @@ $Id$ XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent, const char* name ) - : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel, + : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, Ok, parent, name, true, true ), mCore( core ), mUseSorting( sort ) { @@ -109,13 +109,53 @@ QStringList XXPortSelectDialog::uids() uidlist.append((*it).uid()); return uidlist; } +void XXPortSelectDialog::tagSelected() +{ + if ( mUseSelection->isChecked() ) { + + QStringList selection = mCore->selectedUIDs(); + KABC::AddressBook::Iterator it; + for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { + if ( selection.findIndex((*it).uid()) >= 0 ) + (*it).setTagged( true ); + } + } 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 ) ) + (*it).setTagged( true ); + } + } 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 ) ) { + (*it).setTagged( true ); + break; + } + } + } else { + // create a string list of all entries: + KABC::AddressBook::Iterator it; + for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) + (*it).setTagged( true ); + } +} KABC::AddresseeList XXPortSelectDialog::contacts() { - QStringList selection = mCore->selectedUIDs(); KABC::AddresseeList list; if ( mUseSelection->isChecked() ) { QStringList::Iterator it; + QStringList selection = mCore->selectedUIDs(); for ( it = selection.begin(); it != selection.end(); ++it ) { KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); if ( !addr.isEmpty() ) @@ -246,8 +286,8 @@ void XXPortSelectDialog::initGUI() QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); groupLayout->addWidget( mCategoriesView, 3, 1 ); - // if (QApplication::desktop()->height() == 480 ) - // mCategoriesView->setMaximumHeight( 240 ); + if (QApplication::desktop()->height() == 480 ) + mCategoriesView->setMaximumHeight( 240 ); topLayout->addWidget( mButtonGroup ); QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); -- cgit v0.9.0.2