Diffstat (limited to 'kaddressbook/kcmconfigs/kabconfigwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 9e4db74..d2b7ef1 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -19,22 +19,26 @@ | |||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qframe.h> | 25 | #include <q3frame.h> |
26 | #include <qgroupbox.h> | 26 | #include <q3groupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qvbox.h> | 34 | #include <q3vbox.h> |
35 | //Added by qt3to4: | ||
36 | #include <Q3HBoxLayout> | ||
37 | #include <Q3PtrList> | ||
38 | #include <Q3VBoxLayout> | ||
35 | 39 | ||
36 | #include <kconfig.h> | 40 | #include <kconfig.h> |
37 | #include <kdebug.h> | 41 | #include <kdebug.h> |
38 | #include <kdialog.h> | 42 | #include <kdialog.h> |
39 | #include <klistview.h> | 43 | #include <klistview.h> |
40 | #include <klocale.h> | 44 | #include <klocale.h> |
@@ -54,21 +58,21 @@ | |||
54 | #include "extensionwidget.h" | 58 | #include "extensionwidget.h" |
55 | #include "kabprefs.h" | 59 | #include "kabprefs.h" |
56 | 60 | ||
57 | #include "kabconfigwidget.h" | 61 | #include "kabconfigwidget.h" |
58 | #include <kglobalsettings.h> | 62 | #include <kglobalsettings.h> |
59 | 63 | ||
60 | class ExtensionItem : public QCheckListItem | 64 | class ExtensionItem : public Q3CheckListItem |
61 | { | 65 | { |
62 | public: | 66 | public: |
63 | 67 | ||
64 | #ifndef KAB_EMBEDDED | 68 | #ifndef KAB_EMBEDDED |
65 | ExtensionItem( QListView *parent, const QString &text ); | 69 | ExtensionItem( Q3ListView *parent, const QString &text ); |
66 | void setService( const KService::Ptr &ptr ); | 70 | void setService( const KService::Ptr &ptr ); |
67 | #else //KAB_EMBEDDED | 71 | #else //KAB_EMBEDDED |
68 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); | 72 | ExtensionItem( Q3ListView *parent, const QString &text, const QString &name, const QString &comment ); |
69 | void setFactory( ExtensionFactory* fac ); | 73 | void setFactory( ExtensionFactory* fac ); |
70 | #endif //KAB_EMBEDDED | 74 | #endif //KAB_EMBEDDED |
71 | 75 | ||
72 | bool configWidgetAvailable() const; | 76 | bool configWidgetAvailable() const; |
73 | ExtensionFactory *factory() const; | 77 | ExtensionFactory *factory() const; |
74 | 78 | ||
@@ -87,26 +91,26 @@ class ExtensionItem : public QCheckListItem | |||
87 | }; | 91 | }; |
88 | 92 | ||
89 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) | 93 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) |
90 | : KPrefsWidget( prefs, parent, name ) | 94 | : KPrefsWidget( prefs, parent, name ) |
91 | { | 95 | { |
92 | 96 | ||
93 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 97 | Q3VBoxLayout *topLayout = new Q3VBoxLayout( this, 0, |
94 | KDialog::spacingHintSmall() ); | 98 | KDialog::spacingHintSmall() ); |
95 | 99 | ||
96 | QTabWidget *tabWidget = new QTabWidget( this ); | 100 | QTabWidget *tabWidget = new QTabWidget( this ); |
97 | topLayout->addWidget( tabWidget ); | 101 | topLayout->addWidget( tabWidget ); |
98 | 102 | ||
99 | // General page | 103 | // General page |
100 | QWidget *generalPage = new QWidget( this ); | 104 | QWidget *generalPage = new QWidget( this ); |
101 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), | 105 | Q3VBoxLayout *layout = new Q3VBoxLayout( generalPage, KDialog::marginHintSmall(), |
102 | KDialog::spacingHintSmall() ); | 106 | KDialog::spacingHintSmall() ); |
103 | 107 | ||
104 | 108 | ||
105 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); | 109 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); |
106 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); | 110 | Q3HBoxLayout *hboxLayout = new Q3HBoxLayout( hBox); |
107 | KPrefsWidFont *detailsFont = | 111 | KPrefsWidFont *detailsFont = |
108 | addWidFont(i18n("phone:123"),i18n("Details view font"), | 112 | addWidFont(i18n("phone:123"),i18n("Details view font"), |
109 | &(KABPrefs::instance()->mDetailsFont),hBox); | 113 | &(KABPrefs::instance()->mDetailsFont),hBox); |
110 | hboxLayout->addWidget(detailsFont->label()); | 114 | hboxLayout->addWidget(detailsFont->label()); |
111 | hboxLayout->addWidget(detailsFont->preview()); | 115 | hboxLayout->addWidget(detailsFont->preview()); |
112 | hboxLayout->addWidget(detailsFont->button()); | 116 | hboxLayout->addWidget(detailsFont->button()); |
@@ -114,13 +118,13 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * | |||
114 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); | 118 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); |
115 | //hBox->setBackgroundColor( black); | 119 | //hBox->setBackgroundColor( black); |
116 | layout->addWidget( hBox ); | 120 | layout->addWidget( hBox ); |
117 | 121 | ||
118 | //general groupbox | 122 | //general groupbox |
119 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); | 123 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); |
120 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); | 124 | Q3VBoxLayout *boxLayout = new Q3VBoxLayout( vBox ); |
121 | boxLayout->setAlignment( Qt::AlignTop ); | 125 | boxLayout->setAlignment( Qt::AlignTop ); |
122 | boxLayout->setMargin(KDialog::marginHintSmall() ); | 126 | boxLayout->setMargin(KDialog::marginHintSmall() ); |
123 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); | 127 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); |
124 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); | 128 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); |
125 | boxLayout->addWidget( mMenuBarBox ); | 129 | boxLayout->addWidget( mMenuBarBox ); |
126 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); | 130 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); |
@@ -151,19 +155,19 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * | |||
151 | layout->addWidget( vBox ); | 155 | layout->addWidget( vBox ); |
152 | 156 | ||
153 | tabWidget->addTab( generalPage, i18n( "General" ) ); | 157 | tabWidget->addTab( generalPage, i18n( "General" ) ); |
154 | 158 | ||
155 | // Extension page | 159 | // Extension page |
156 | QWidget *extensionPage = new QWidget( this ); | 160 | QWidget *extensionPage = new QWidget( this ); |
157 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), | 161 | Q3VBoxLayout *extensionLayout = new Q3VBoxLayout( extensionPage, KDialog::marginHintSmall(), |
158 | KDialog::spacingHintSmall() ); | 162 | KDialog::spacingHintSmall() ); |
159 | 163 | ||
160 | //extensions groupbox | 164 | //extensions groupbox |
161 | 165 | ||
162 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); | 166 | Q3GroupBox* groupBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); |
163 | boxLayout = new QVBoxLayout( groupBox->layout() ); | 167 | boxLayout = new Q3VBoxLayout( groupBox->layout() ); |
164 | boxLayout->setAlignment( Qt::AlignTop ); | 168 | boxLayout->setAlignment( Qt::AlignTop ); |
165 | boxLayout->setMargin(KDialog::marginHintSmall()); | 169 | boxLayout->setMargin(KDialog::marginHintSmall()); |
166 | boxLayout->setSpacing(KDialog::spacingHintSmall()); | 170 | boxLayout->setSpacing(KDialog::spacingHintSmall()); |
167 | groupBox->layout()->setMargin(1) ; | 171 | groupBox->layout()->setMargin(1) ; |
168 | groupBox->layout()->setSpacing(0); | 172 | groupBox->layout()->setSpacing(0); |
169 | mExtensionView = new KListView( groupBox ); | 173 | mExtensionView = new KListView( groupBox ); |
@@ -186,16 +190,16 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * | |||
186 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 190 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
187 | connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 191 | connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
188 | connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 192 | connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
189 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 193 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
190 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 194 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
191 | connect( mAskForDelete, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 195 | connect( mAskForDelete, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
192 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | 196 | connect( mExtensionView, SIGNAL( selectionChanged( Q3ListViewItem* ) ), |
193 | SLOT( selectionChanged( QListViewItem* ) ) ); | 197 | SLOT( selectionChanged( Q3ListViewItem* ) ) ); |
194 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | 198 | connect( mExtensionView, SIGNAL( clicked( Q3ListViewItem* ) ), |
195 | SLOT( itemClicked( QListViewItem* ) ) ); | 199 | SLOT( itemClicked( Q3ListViewItem* ) ) ); |
196 | connect( mConfigureButton, SIGNAL( clicked() ), | 200 | connect( mConfigureButton, SIGNAL( clicked() ), |
197 | SLOT( configureExtension() ) ); | 201 | SLOT( configureExtension() ) ); |
198 | 202 | ||
199 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); | 203 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); |
200 | 204 | ||
201 | // Addressee page | 205 | // Addressee page |
@@ -292,14 +296,14 @@ void KABConfigWidget::restoreExtensionSettings() | |||
292 | } | 296 | } |
293 | 297 | ||
294 | void KABConfigWidget::saveExtensionSettings() | 298 | void KABConfigWidget::saveExtensionSettings() |
295 | { | 299 | { |
296 | QStringList activeExtensions; | 300 | QStringList activeExtensions; |
297 | 301 | ||
298 | QPtrList<QListViewItem> list; | 302 | Q3PtrList<Q3ListViewItem> list; |
299 | QListViewItemIterator it( mExtensionView ); | 303 | Q3ListViewItemIterator it( mExtensionView ); |
300 | while ( it.current() ) { | 304 | while ( it.current() ) { |
301 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); | 305 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); |
302 | if ( item ) { | 306 | if ( item ) { |
303 | if ( item->isOn() ) | 307 | if ( item->isOn() ) |
304 | activeExtensions.append( item->factory()->identifier() ); | 308 | activeExtensions.append( item->factory()->identifier() ); |
305 | } | 309 | } |
@@ -325,40 +329,40 @@ void KABConfigWidget::configureExtension() | |||
325 | ExtensionConfigDialog dlg( item->factory(), &config, this ); | 329 | ExtensionConfigDialog dlg( item->factory(), &config, this ); |
326 | dlg.exec(); | 330 | dlg.exec(); |
327 | 331 | ||
328 | config.sync(); | 332 | config.sync(); |
329 | } | 333 | } |
330 | 334 | ||
331 | void KABConfigWidget::selectionChanged( QListViewItem *i ) | 335 | void KABConfigWidget::selectionChanged( Q3ListViewItem *i ) |
332 | { | 336 | { |
333 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); | 337 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); |
334 | if ( !item ) | 338 | if ( !item ) |
335 | return; | 339 | return; |
336 | 340 | ||
337 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); | 341 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); |
338 | } | 342 | } |
339 | 343 | ||
340 | void KABConfigWidget::itemClicked( QListViewItem *item ) | 344 | void KABConfigWidget::itemClicked( Q3ListViewItem *item ) |
341 | { | 345 | { |
342 | if ( item != 0 ) | 346 | if ( item != 0 ) |
343 | modified(); | 347 | modified(); |
344 | } | 348 | } |
345 | 349 | ||
346 | #ifndef KAB_EMBEDDED | 350 | #ifndef KAB_EMBEDDED |
347 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) | 351 | ExtensionItem::ExtensionItem( Q3ListView *parent, const QString &text ) |
348 | : QCheckListItem( parent, text, CheckBox ) | 352 | : Q3CheckListItem( parent, text, CheckBox ) |
349 | { | 353 | { |
350 | } | 354 | } |
351 | 355 | ||
352 | void ExtensionItem::setService( const KService::Ptr &ptr ) | 356 | void ExtensionItem::setService( const KService::Ptr &ptr ) |
353 | { | 357 | { |
354 | mPtr = ptr; | 358 | mPtr = ptr; |
355 | } | 359 | } |
356 | #else //KAB_EMBEDDED | 360 | #else //KAB_EMBEDDED |
357 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) | 361 | ExtensionItem::ExtensionItem( Q3ListView *parent, const QString &text, const QString &name, const QString &comment ) |
358 | : QCheckListItem( parent, text, CheckBox ) | 362 | : Q3CheckListItem( parent, text, CheckBox ) |
359 | { | 363 | { |
360 | mName = name; | 364 | mName = name; |
361 | mComment = comment; | 365 | mComment = comment; |
362 | } | 366 | } |
363 | 367 | ||
364 | 368 | ||
@@ -415,10 +419,9 @@ QString ExtensionItem::text( int column ) const | |||
415 | return mComment; | 419 | return mComment; |
416 | else | 420 | else |
417 | return QString::null; | 421 | return QString::null; |
418 | #endif //KAB_EMBEDDED | 422 | #endif //KAB_EMBEDDED |
419 | } | 423 | } |
420 | 424 | ||
421 | #ifndef KAB_EMBEDDED | 425 | #ifndef KAB_EMBEDDED_ |
422 | #include "kabconfigwidget.moc" | 426 | #include "moc_kabconfigwidget.cpp" |
423 | #endif //KAB_EMBEDDED | 427 | #endif //KAB_EMBEDDED |
424 | |||