Diffstat (limited to 'kaddressbook/xxportselectdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kaddressbook/xxportselectdialog.cpp | 48 |
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 | |||
@@ -55,5 +55,5 @@ $Id$ | |||
55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, | 55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, |
56 | QWidget* parent, const char* name ) | 56 | QWidget* parent, const char* name ) |
57 | : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel, | 57 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, |
58 | Ok, parent, name, true, true ), mCore( core ), | 58 | Ok, parent, name, true, true ), mCore( core ), |
59 | mUseSorting( sort ) | 59 | mUseSorting( sort ) |
@@ -110,11 +110,51 @@ QStringList XXPortSelectDialog::uids() | |||
110 | return uidlist; | 110 | return uidlist; |
111 | } | 111 | } |
112 | KABC::AddresseeList XXPortSelectDialog::contacts() | 112 | void XXPortSelectDialog::tagSelected() |
113 | { | 113 | { |
114 | if ( mUseSelection->isChecked() ) { | ||
115 | |||
114 | QStringList selection = mCore->selectedUIDs(); | 116 | QStringList selection = mCore->selectedUIDs(); |
117 | KABC::AddressBook::Iterator it; | ||
118 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | ||
119 | if ( selection.findIndex((*it).uid()) >= 0 ) | ||
120 | (*it).setTagged( true ); | ||
121 | } | ||
122 | } else if ( mUseFilters->isChecked() ) { | ||
123 | // find contacts that can pass selected filter | ||
124 | Filter::List::Iterator filterIt; | ||
125 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | ||
126 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) | ||
127 | break; | ||
128 | KABC::AddressBook::Iterator it; | ||
129 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | ||
130 | if ( (*filterIt).filterAddressee( *it ) ) | ||
131 | (*it).setTagged( true ); | ||
132 | } | ||
133 | } else if ( mUseCategories->isChecked() ) { | ||
134 | QStringList categorieList = categories(); | ||
135 | KABC::AddressBook::Iterator it; | ||
136 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | ||
137 | QStringList tmp( (*it).categories() ); | ||
138 | QStringList::Iterator tmpIt; | ||
139 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) | ||
140 | if ( categorieList.contains( *tmpIt ) ) { | ||
141 | (*it).setTagged( true ); | ||
142 | break; | ||
143 | } | ||
144 | } | ||
145 | } else { | ||
146 | // create a string list of all entries: | ||
147 | KABC::AddressBook::Iterator it; | ||
148 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) | ||
149 | (*it).setTagged( true ); | ||
150 | } | ||
151 | } | ||
152 | KABC::AddresseeList XXPortSelectDialog::contacts() | ||
153 | { | ||
115 | 154 | ||
116 | KABC::AddresseeList list; | 155 | KABC::AddresseeList list; |
117 | if ( mUseSelection->isChecked() ) { | 156 | if ( mUseSelection->isChecked() ) { |
118 | QStringList::Iterator it; | 157 | QStringList::Iterator it; |
158 | QStringList selection = mCore->selectedUIDs(); | ||
119 | for ( it = selection.begin(); it != selection.end(); ++it ) { | 159 | for ( it = selection.begin(); it != selection.end(); ++it ) { |
120 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); | 160 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); |
@@ -247,6 +287,6 @@ void XXPortSelectDialog::initGUI() | |||
247 | groupLayout->addWidget( mCategoriesView, 3, 1 ); | 287 | groupLayout->addWidget( mCategoriesView, 3, 1 ); |
248 | 288 | ||
249 | // if (QApplication::desktop()->height() == 480 ) | 289 | if (QApplication::desktop()->height() == 480 ) |
250 | // mCategoriesView->setMaximumHeight( 240 ); | 290 | mCategoriesView->setMaximumHeight( 240 ); |
251 | topLayout->addWidget( mButtonGroup ); | 291 | topLayout->addWidget( mButtonGroup ); |
252 | 292 | ||