summaryrefslogtreecommitdiffabout
path: root/kaddressbook/xxportselectdialog.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/xxportselectdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxportselectdialog.cpp48
1 files changed, 44 insertions, 4 deletions
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 );