summaryrefslogtreecommitdiffabout
path: root/kaddressbook/xxportselectdialog.cpp
Unidiff
Diffstat (limited to 'kaddressbook/xxportselectdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxportselectdialog.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp
index ab95d5f..6282453 100644
--- a/kaddressbook/xxportselectdialog.cpp
+++ b/kaddressbook/xxportselectdialog.cpp
@@ -1,85 +1,86 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> 3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
4 Tobias Koenig <tokoe@kde.org> 4 Tobias Koenig <tokoe@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25/* 25/*
26Enhanced Version of the file for platform independent KDE tools. 26Enhanced Version of the file for platform independent KDE tools.
27Copyright (c) 2004 Ulf Schenk 27Copyright (c) 2004 Ulf Schenk
28 28
29$Id$ 29$Id$
30*/ 30*/
31 31
32#include <kabc/addressbook.h> 32#include <kabc/addressbook.h>
33#include <kapplication.h> 33#include <kapplication.h>
34#include <kcombobox.h> 34#include <kcombobox.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kglobal.h> 36#include <kglobal.h>
37 37
38#include <qapplication.h>
38#include <qbuttongroup.h> 39#include <qbuttongroup.h>
39#include <qcombobox.h> 40#include <qcombobox.h>
40#include <qheader.h> 41#include <qheader.h>
41#include <qlabel.h> 42#include <qlabel.h>
42#include <qlayout.h> 43#include <qlayout.h>
43#include <qlistview.h> 44#include <qlistview.h>
44#include <qpushbutton.h> 45#include <qpushbutton.h>
45#include <qradiobutton.h> 46#include <qradiobutton.h>
46#include <qstringlist.h> 47#include <qstringlist.h>
47#include <qwhatsthis.h> 48#include <qwhatsthis.h>
48 49
49#include "kabcore.h" 50#include "kabcore.h"
50#include "kabprefs.h" 51#include "kabprefs.h"
51 52
52#include "xxportselectdialog.h" 53#include "xxportselectdialog.h"
53 54
54XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, 55XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort,
55 QWidget* parent, const char* name ) 56 QWidget* parent, const char* name )
56 : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel, 57 : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel,
57 Ok, parent, name, true, true ), mCore( core ), 58 Ok, parent, name, true, true ), mCore( core ),
58 mUseSorting( sort ) 59 mUseSorting( sort )
59{ 60{
60 initGUI(); 61 initGUI();
61 62
62 connect( mFiltersCombo, SIGNAL( activated( int ) ), 63 connect( mFiltersCombo, SIGNAL( activated( int ) ),
63 SLOT( filterChanged( int ) ) ); 64 SLOT( filterChanged( int ) ) );
64 connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), 65 connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ),
65 SLOT( categoryClicked( QListViewItem* ) ) ); 66 SLOT( categoryClicked( QListViewItem* ) ) );
66 67
67 // setup filters 68 // setup filters
68#ifndef KAB_EMBEDDED 69#ifndef KAB_EMBEDDED
69 mFilters = Filter::restore( kapp->config(), "Filter" ); 70 mFilters = Filter::restore( kapp->config(), "Filter" );
70 Filter::List::iterator filterIt; 71 Filter::List::iterator filterIt;
71#else //KAB_EMBEDDED 72#else //KAB_EMBEDDED
72 mFilters = Filter::restore( KGlobal::config(), "Filter" ); 73 mFilters = Filter::restore( KGlobal::config(), "Filter" );
73 Filter::List::Iterator filterIt; 74 Filter::List::Iterator filterIt;
74#endif //KAB_EMBEDDED 75#endif //KAB_EMBEDDED
75 QStringList filters; 76 QStringList filters;
76 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) 77 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
77 filters.append( (*filterIt).name() ); 78 filters.append( (*filterIt).name() );
78 79
79 mFiltersCombo->insertStringList( filters ); 80 mFiltersCombo->insertStringList( filters );
80 mUseFilters->setEnabled( filters.count() > 0 ); 81 mUseFilters->setEnabled( filters.count() > 0 );
81 82
82 // setup categories 83 // setup categories
83 QStringList categories = KABPrefs::instance()->mCustomCategories; 84 QStringList categories = KABPrefs::instance()->mCustomCategories;
84 QStringList::Iterator it; 85 QStringList::Iterator it;
85 for ( it = categories.begin(); it != categories.end(); ++it ) 86 for ( it = categories.begin(); it != categories.end(); ++it )
@@ -200,89 +201,94 @@ void XXPortSelectDialog::slotHelp()
200void XXPortSelectDialog::initGUI() 201void XXPortSelectDialog::initGUI()
201{ 202{
202 QFrame *page = plainPage(); 203 QFrame *page = plainPage();
203 204
204 QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(), 205 QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(),
205 KDialog::spacingHint() ); 206 KDialog::spacingHint() );
206 207
207 QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); 208 QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page );
208 topLayout->addWidget( label ); 209 topLayout->addWidget( label );
209 210
210 mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); 211 mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page );
211 mButtonGroup->setColumnLayout( 0, Qt::Vertical ); 212 mButtonGroup->setColumnLayout( 0, Qt::Vertical );
212 mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); 213 mButtonGroup->layout()->setSpacing( KDialog::spacingHint() );
213 mButtonGroup->layout()->setMargin( KDialog::marginHint() ); 214 mButtonGroup->layout()->setMargin( KDialog::marginHint() );
214 215
215 QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); 216 QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() );
216 groupLayout->setAlignment( Qt::AlignTop ); 217 groupLayout->setAlignment( Qt::AlignTop );
217 218
218 mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); 219 mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup );
219 mUseWholeBook->setChecked( true ); 220 mUseWholeBook->setChecked( true );
220 QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); 221 QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) );
221 groupLayout->addWidget( mUseWholeBook, 0, 0 ); 222 groupLayout->addWidget( mUseWholeBook, 0, 0 );
222 223
223 mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); 224 mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup );
224 QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" 225 QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n"
225 "This option is disabled if no contacts are selected." ) ); 226 "This option is disabled if no contacts are selected." ) );
226 groupLayout->addWidget( mUseSelection, 1, 0 ); 227 groupLayout->addWidget( mUseSelection, 1, 0 );
227 228
228 mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); 229 mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup );
229 QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" 230 QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n"
230 "This option is disabled if you haven't defined any filters" ) ); 231 "This option is disabled if you haven't defined any filters" ) );
231 groupLayout->addWidget( mUseFilters, 2, 0 ); 232 groupLayout->addWidget( mUseFilters, 2, 0 );
232 233
233 mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); 234 mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup );
234 QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" 235 QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n"
235 "This option is disabled if you have no categories." ) ); 236 "This option is disabled if you have no categories." ) );
236 groupLayout->addWidget( mUseCategories, 3, 0 ); 237 groupLayout->addWidget( mUseCategories, 3, 0 );
237 238
238 mFiltersCombo = new QComboBox( false, mButtonGroup ); 239 mFiltersCombo = new QComboBox( false, mButtonGroup );
239 QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); 240 QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) );
240 groupLayout->addWidget( mFiltersCombo, 2, 1 ); 241 groupLayout->addWidget( mFiltersCombo, 2, 1 );
241 242
242 mCategoriesView = new QListView( mButtonGroup ); 243 mCategoriesView = new QListView( mButtonGroup );
243 mCategoriesView->addColumn( "" ); 244 mCategoriesView->addColumn( "" );
244 mCategoriesView->header()->hide(); 245 mCategoriesView->header()->hide();
245 QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); 246 QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) );
246 groupLayout->addWidget( mCategoriesView, 3, 1 ); 247 groupLayout->addWidget( mCategoriesView, 3, 1 );
247 248
249 // if (QApplication::desktop()->height() == 480 )
250 // mCategoriesView->setMaximumHeight( 240 );
248 topLayout->addWidget( mButtonGroup ); 251 topLayout->addWidget( mButtonGroup );
249 252
250 QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); 253 QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page );
251 sortingGroup->setColumnLayout( 0, Qt::Vertical ); 254 sortingGroup->setColumnLayout( 0, Qt::Vertical );
252 QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, 255 QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2,
253 KDialog::spacingHint() ); 256 KDialog::spacingHint() );
254 sortLayout->setAlignment( Qt::AlignTop ); 257 sortLayout->setAlignment( Qt::AlignTop );
255 258
256 label = new QLabel( i18n( "Criterion:" ), sortingGroup ); 259 label = new QLabel( i18n( "Criterion:" ), sortingGroup );
257 sortLayout->addWidget( label, 0, 0 ); 260 sortLayout->addWidget( label, 0, 0 );
258 261
259#ifndef KAB_EMBEDDED 262#ifndef KAB_EMBEDDED
260 mFieldCombo = new KComboBox( false, sortingGroup ); 263 mFieldCombo = new KComboBox( false, sortingGroup );
261#else //KAB_EMBEDDED 264#else //KAB_EMBEDDED
262 //US Combobox is not editable anyway 265 //US Combobox is not editable anyway
263 mFieldCombo = new KComboBox( sortingGroup ); 266 mFieldCombo = new KComboBox( sortingGroup );
264#endif //KAB_EMBEDDED 267#endif //KAB_EMBEDDED
265 sortLayout->addWidget( mFieldCombo, 0, 1 ); 268 sortLayout->addWidget( mFieldCombo, 0, 1 );
266 269
267 label = new QLabel( i18n( "Order:" ), sortingGroup ); 270 label = new QLabel( i18n( "Order:" ), sortingGroup );
268 sortLayout->addWidget( label, 1, 0 ); 271 sortLayout->addWidget( label, 1, 0 );
269 272
270#ifndef KAB_EMBEDDED 273#ifndef KAB_EMBEDDED
271 mSortTypeCombo = new KComboBox( false, sortingGroup ); 274 mSortTypeCombo = new KComboBox( false, sortingGroup );
272#else //KAB_EMBEDDED 275#else //KAB_EMBEDDED
273 //US Combobox is not editable anyway 276 //US Combobox is not editable anyway
274 mSortTypeCombo = new KComboBox( sortingGroup ); 277 mSortTypeCombo = new KComboBox( sortingGroup );
275#endif //KAB_EMBEDDED 278#endif //KAB_EMBEDDED
276 sortLayout->addWidget( mSortTypeCombo, 1, 1 ); 279 sortLayout->addWidget( mSortTypeCombo, 1, 1 );
277 280
278 topLayout->addWidget( sortingGroup ); 281 topLayout->addWidget( sortingGroup );
279 282
280 if ( !mUseSorting ) 283 if ( !mUseSorting )
281 sortingGroup->hide(); 284 sortingGroup->hide();
285#ifndef DESKTOP_VERSION
286 hideButtons();
287#endif
282} 288}
283 289
284#ifndef KAB_EMBEDDED 290#ifndef KAB_EMBEDDED
285#include "xxportselectdialog.moc" 291#include "xxportselectdialog.moc"
286#endif //KAB_EMBEDDED 292#endif //KAB_EMBEDDED
287 293
288 294