Diffstat (limited to 'kaddressbook/xxportselectdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kaddressbook/xxportselectdialog.cpp | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp index 278cab0..088bffa 100644 --- a/kaddressbook/xxportselectdialog.cpp +++ b/kaddressbook/xxportselectdialog.cpp | |||
@@ -31,44 +31,49 @@ $Id$ | |||
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 <qapplication.h> |
39 | #include <qbuttongroup.h> | 39 | #include <QDesktopWidget> |
40 | #include <q3buttongroup.h> | ||
40 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
41 | #include <qheader.h> | 42 | #include <q3header.h> |
42 | #include <qlabel.h> | 43 | #include <qlabel.h> |
43 | #include <qlayout.h> | 44 | #include <qlayout.h> |
44 | #include <qlistview.h> | 45 | #include <q3listview.h> |
45 | #include <qpushbutton.h> | 46 | #include <qpushbutton.h> |
46 | #include <qradiobutton.h> | 47 | #include <qradiobutton.h> |
47 | #include <qstringlist.h> | 48 | #include <qstringlist.h> |
48 | #include <qwhatsthis.h> | 49 | #include <q3whatsthis.h> |
50 | //Added by qt3to4: | ||
51 | #include <Q3GridLayout> | ||
52 | #include <Q3Frame> | ||
53 | #include <Q3VBoxLayout> | ||
49 | 54 | ||
50 | #include "kabcore.h" | 55 | #include "kabcore.h" |
51 | #include "kabprefs.h" | 56 | #include "kabprefs.h" |
52 | 57 | ||
53 | #include "xxportselectdialog.h" | 58 | #include "xxportselectdialog.h" |
54 | 59 | ||
55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, | 60 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, |
56 | QWidget* parent, const char* name ) | 61 | QWidget* parent, const char* name ) |
57 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, | 62 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, |
58 | Ok, parent, name, true, true ), mCore( core ), | 63 | Ok, parent, name, true, true ), mCore( core ), |
59 | mUseSorting( sort ) | 64 | mUseSorting( sort ) |
60 | { | 65 | { |
61 | initGUI(); | 66 | initGUI(); |
62 | 67 | ||
63 | connect( mFiltersCombo, SIGNAL( activated( int ) ), | 68 | connect( mFiltersCombo, SIGNAL( activated( int ) ), |
64 | SLOT( filterChanged( int ) ) ); | 69 | SLOT( filterChanged( int ) ) ); |
65 | connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), | 70 | connect( mCategoriesView, SIGNAL( clicked( Q3ListViewItem* ) ), |
66 | SLOT( categoryClicked( QListViewItem* ) ) ); | 71 | SLOT( categoryClicked( Q3ListViewItem* ) ) ); |
67 | 72 | ||
68 | // setup filters | 73 | // setup filters |
69 | #ifndef KAB_EMBEDDED | 74 | #ifndef KAB_EMBEDDED |
70 | mFilters = Filter::restore( kapp->config(), "Filter" ); | 75 | mFilters = Filter::restore( kapp->config(), "Filter" ); |
71 | Filter::List::iterator filterIt; | 76 | Filter::List::iterator filterIt; |
72 | #else //KAB_EMBEDDED | 77 | #else //KAB_EMBEDDED |
73 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); | 78 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); |
74 | Filter::List::Iterator filterIt; | 79 | Filter::List::Iterator filterIt; |
@@ -79,17 +84,17 @@ XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, | |||
79 | 84 | ||
80 | mFiltersCombo->insertStringList( filters ); | 85 | mFiltersCombo->insertStringList( filters ); |
81 | mUseFilters->setEnabled( filters.count() > 0 ); | 86 | mUseFilters->setEnabled( filters.count() > 0 ); |
82 | 87 | ||
83 | // setup categories | 88 | // setup categories |
84 | QStringList categories = KABPrefs::instance()->mCustomCategories; | 89 | QStringList categories = KABPrefs::instance()->mCustomCategories; |
85 | QStringList::Iterator it; | 90 | QStringList::Iterator it; |
86 | for ( it = categories.begin(); it != categories.end(); ++it ) | 91 | for ( it = categories.begin(); it != categories.end(); ++it ) |
87 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); | 92 | new Q3CheckListItem( mCategoriesView, *it, Q3CheckListItem::CheckBox ); |
88 | mUseCategories->setEnabled( categories.count() > 0 ); | 93 | mUseCategories->setEnabled( categories.count() > 0 ); |
89 | 94 | ||
90 | int count = mCore->selectedUIDs().count(); | 95 | int count = mCore->selectedUIDs().count(); |
91 | mUseSelection->setEnabled( count != 0 ); | 96 | mUseSelection->setEnabled( count != 0 ); |
92 | mUseSelection->setChecked( count > 1 ); | 97 | mUseSelection->setChecked( count > 1 ); |
93 | 98 | ||
94 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); | 99 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); |
95 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); | 100 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); |
@@ -205,104 +210,104 @@ KABC::AddresseeList XXPortSelectDialog::contacts() | |||
205 | 210 | ||
206 | return list; | 211 | return list; |
207 | } | 212 | } |
208 | 213 | ||
209 | QStringList XXPortSelectDialog::categories() const | 214 | QStringList XXPortSelectDialog::categories() const |
210 | { | 215 | { |
211 | QStringList list; | 216 | QStringList list; |
212 | 217 | ||
213 | QListViewItemIterator it( mCategoriesView ); | 218 | Q3ListViewItemIterator it( mCategoriesView ); |
214 | for ( ; it.current(); ++it ) { | 219 | for ( ; it.current(); ++it ) { |
215 | QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); | 220 | Q3CheckListItem* qcli = static_cast<Q3CheckListItem*>(it.current()); |
216 | if ( qcli->isOn() ) | 221 | if ( qcli->isOn() ) |
217 | list.append( it.current()->text( 0 ) ); | 222 | list.append( it.current()->text( 0 ) ); |
218 | } | 223 | } |
219 | 224 | ||
220 | return list; | 225 | return list; |
221 | } | 226 | } |
222 | 227 | ||
223 | void XXPortSelectDialog::filterChanged( int ) | 228 | void XXPortSelectDialog::filterChanged( int ) |
224 | { | 229 | { |
225 | mUseFilters->setChecked( true ); | 230 | mUseFilters->setChecked( true ); |
226 | } | 231 | } |
227 | 232 | ||
228 | void XXPortSelectDialog::categoryClicked( QListViewItem *i ) | 233 | void XXPortSelectDialog::categoryClicked( Q3ListViewItem *i ) |
229 | { | 234 | { |
230 | QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); | 235 | Q3CheckListItem *qcli = static_cast<Q3CheckListItem*>( i ); |
231 | if ( qcli->isOn() ) | 236 | if ( qcli->isOn() ) |
232 | mUseCategories->setChecked( true ); | 237 | mUseCategories->setChecked( true ); |
233 | } | 238 | } |
234 | 239 | ||
235 | void XXPortSelectDialog::slotHelp() | 240 | void XXPortSelectDialog::slotHelp() |
236 | { | 241 | { |
237 | #ifndef KAB_EMBEDDED | 242 | #ifndef KAB_EMBEDDED |
238 | kapp->invokeHelp( "import-and-export" ); | 243 | kapp->invokeHelp( "import-and-export" ); |
239 | #else //KAB_EMBEDDED | 244 | #else //KAB_EMBEDDED |
240 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); | 245 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); |
241 | #endif //KAB_EMBEDDED | 246 | #endif //KAB_EMBEDDED |
242 | 247 | ||
243 | } | 248 | } |
244 | 249 | ||
245 | void XXPortSelectDialog::initGUI() | 250 | void XXPortSelectDialog::initGUI() |
246 | { | 251 | { |
247 | QFrame *page = plainPage(); | 252 | Q3Frame *page = plainPage(); |
248 | 253 | ||
249 | QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHintSmall(), | 254 | Q3VBoxLayout *topLayout = new Q3VBoxLayout( page, KDialog::marginHintSmall(), |
250 | KDialog::spacingHintSmall() ); | 255 | KDialog::spacingHintSmall() ); |
251 | 256 | ||
252 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); | 257 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); |
253 | topLayout->addWidget( label ); | 258 | topLayout->addWidget( label ); |
254 | 259 | ||
255 | mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); | 260 | mButtonGroup = new Q3ButtonGroup( i18n( "Contact Selection" ), page ); |
256 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); | 261 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); |
257 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); | 262 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); |
258 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); | 263 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); |
259 | 264 | ||
260 | QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); | 265 | Q3GridLayout *groupLayout = new Q3GridLayout( mButtonGroup->layout() ); |
261 | groupLayout->setAlignment( Qt::AlignTop ); | 266 | groupLayout->setAlignment( Qt::AlignTop ); |
262 | 267 | ||
263 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); | 268 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); |
264 | mUseWholeBook->setChecked( true ); | 269 | mUseWholeBook->setChecked( true ); |
265 | QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); | 270 | Q3WhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); |
266 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); | 271 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); |
267 | 272 | ||
268 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); | 273 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); |
269 | QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" | 274 | Q3WhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" |
270 | "This option is disabled if no contacts are selected." ) ); | 275 | "This option is disabled if no contacts are selected." ) ); |
271 | groupLayout->addWidget( mUseSelection, 1, 0 ); | 276 | groupLayout->addWidget( mUseSelection, 1, 0 ); |
272 | 277 | ||
273 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); | 278 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); |
274 | QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" | 279 | Q3WhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" |
275 | "This option is disabled if you haven't defined any filters" ) ); | 280 | "This option is disabled if you haven't defined any filters" ) ); |
276 | groupLayout->addWidget( mUseFilters, 2, 0 ); | 281 | groupLayout->addWidget( mUseFilters, 2, 0 ); |
277 | 282 | ||
278 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); | 283 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); |
279 | QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" | 284 | Q3WhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" |
280 | "This option is disabled if you have no categories." ) ); | 285 | "This option is disabled if you have no categories." ) ); |
281 | groupLayout->addWidget( mUseCategories, 3, 0 ); | 286 | groupLayout->addWidget( mUseCategories, 3, 0 ); |
282 | 287 | ||
283 | mFiltersCombo = new QComboBox( false, mButtonGroup ); | 288 | mFiltersCombo = new QComboBox( false, mButtonGroup ); |
284 | mFiltersCombo->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 289 | mFiltersCombo->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
285 | QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); | 290 | Q3WhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); |
286 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); | 291 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); |
287 | 292 | ||
288 | mCategoriesView = new QListView( mButtonGroup ); | 293 | mCategoriesView = new Q3ListView( mButtonGroup ); |
289 | mCategoriesView->addColumn( "" ); | 294 | mCategoriesView->addColumn( "" ); |
290 | mCategoriesView->header()->hide(); | 295 | mCategoriesView->header()->hide(); |
291 | QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); | 296 | Q3WhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); |
292 | groupLayout->addWidget( mCategoriesView, 3, 1 ); | 297 | groupLayout->addWidget( mCategoriesView, 3, 1 ); |
293 | mCategoriesView->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | 298 | mCategoriesView->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); |
294 | //if (QApplication::desktop()->height() == 480 ) | 299 | //if (QApplication::desktop()->height() == 480 ) |
295 | // mCategoriesView->setMaximumHeight( 240 ); | 300 | // mCategoriesView->setMaximumHeight( 240 ); |
296 | topLayout->addWidget( mButtonGroup ); | 301 | topLayout->addWidget( mButtonGroup ); |
297 | 302 | ||
298 | QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); | 303 | Q3ButtonGroup *sortingGroup = new Q3ButtonGroup( i18n( "Sorting" ), page ); |
299 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); | 304 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); |
300 | QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, | 305 | Q3GridLayout *sortLayout = new Q3GridLayout( sortingGroup->layout(), 2, 2, |
301 | KDialog::spacingHint() ); | 306 | KDialog::spacingHint() ); |
302 | sortLayout->setAlignment( Qt::AlignTop ); | 307 | sortLayout->setAlignment( Qt::AlignTop ); |
303 | 308 | ||
304 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); | 309 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); |
305 | sortLayout->addWidget( label, 0, 0 ); | 310 | sortLayout->addWidget( label, 0, 0 ); |
306 | 311 | ||
307 | #ifndef KAB_EMBEDDED | 312 | #ifndef KAB_EMBEDDED |
308 | mFieldCombo = new KComboBox( false, sortingGroup ); | 313 | mFieldCombo = new KComboBox( false, sortingGroup ); |
@@ -330,13 +335,11 @@ void XXPortSelectDialog::initGUI() | |||
330 | if (QApplication::desktop()->width() <= 640 ) { | 335 | if (QApplication::desktop()->width() <= 640 ) { |
331 | showMaximized(); | 336 | showMaximized(); |
332 | #ifndef DESKTOP_VERSION | 337 | #ifndef DESKTOP_VERSION |
333 | hideButtons(); | 338 | hideButtons(); |
334 | #endif | 339 | #endif |
335 | } | 340 | } |
336 | } | 341 | } |
337 | 342 | ||
338 | #ifndef KAB_EMBEDDED | 343 | #ifndef KAB_EMBEDDED_ |
339 | #include "xxportselectdialog.moc" | 344 | #include "moc_xxportselectdialog.cpp" |
340 | #endif //KAB_EMBEDDED | 345 | #endif //KAB_EMBEDDED |
341 | |||
342 | |||