-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 15 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 3ad2f74..986c9b8 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp @@ -94,158 +94,173 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * QTabWidget *tabWidget = new QTabWidget( this ); topLayout->addWidget( tabWidget ); // General page QWidget *generalPage = new QWidget( this ); QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), KDialog::spacingHintSmall() ); QWidget *hBox = new QWidget( generalPage, "qhbox" ); QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); KPrefsWidFont *detailsFont = addWidFont(i18n("phone:123"),i18n("Details view font"), &(KABPrefs::instance()->mDetailsFont),hBox); hboxLayout->addWidget(detailsFont->label()); hboxLayout->addWidget(detailsFont->preview()); hboxLayout->addWidget(detailsFont->button()); hboxLayout->setMargin(KDialog::marginHintSmall() ); hboxLayout->setSpacing(KDialog::spacingHintSmall()); //hBox->setBackgroundColor( black); layout->addWidget( hBox ); //general groupbox QWidget *vBox = new QWidget( generalPage, "qvbox" ); QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); boxLayout->setAlignment( Qt::AlignTop ); boxLayout->setMargin(KDialog::marginHintSmall() ); boxLayout->setSpacing( KDialog::spacingHintSmall() ); mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); boxLayout->addWidget( mMenuBarBox ); mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); boxLayout->addWidget( mSearchReturnBox ); + mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); + boxLayout->addWidget( mAutoSearchWithWildcardBox); + mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); + boxLayout->addWidget( mHideSearchOnSwitchBox ); + +#ifdef DESKTOP_VERSION + mHideSearchOnSwitchBox->hide(); +#endif mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); boxLayout->addWidget( mViewsSingleClickBox ); mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); boxLayout->addWidget( mNameParsing ); mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); boxLayout->addWidget( mMultipleViewsAtOnce ); mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); boxLayout->addWidget( mAskForQuit ); layout->addWidget( vBox ); tabWidget->addTab( generalPage, i18n( "General" ) ); // Extension page QWidget *extensionPage = new QWidget( this ); QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), KDialog::spacingHintSmall() ); //extensions groupbox QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); boxLayout = new QVBoxLayout( groupBox->layout() ); boxLayout->setAlignment( Qt::AlignTop ); boxLayout->setMargin(KDialog::marginHintSmall()); boxLayout->setSpacing(KDialog::spacingHintSmall()); groupBox->layout()->setMargin(1) ; groupBox->layout()->setSpacing(0); mExtensionView = new KListView( groupBox ); mExtensionView->setAllColumnsShowFocus( true ); mExtensionView->addColumn( i18n( "Name" ) ); mExtensionView->addColumn( i18n( "Description" ) ); //mExtensionView->setMaximumHeight(80); boxLayout->addWidget( mExtensionView ); mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); mConfigureButton->setEnabled( false ); boxLayout->addWidget( mConfigureButton ); extensionLayout->addWidget( groupBox ); connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); + connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); + connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), SLOT( selectionChanged( QListViewItem* ) ) ); connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), SLOT( itemClicked( QListViewItem* ) ) ); connect( mConfigureButton, SIGNAL( clicked() ), SLOT( configureExtension() ) ); tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); // Addressee page mAddresseeWidget = new AddresseeWidget( this ); tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); } void KABConfigWidget::usrReadConfig() { KABPrefs* prefs = KABPrefs::instance(); bool blocked = signalsBlocked(); blockSignals( true ); mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); mNameParsing->setChecked( prefs->mAutomaticNameParsing ); mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); + mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); + mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); mAskForQuit->setChecked( prefs->mAskForQuit ); mAddresseeWidget->restoreSettings(); restoreExtensionSettings(); blockSignals( blocked ); } void KABConfigWidget::usrWriteConfig() { KABPrefs* prefs = KABPrefs::instance(); prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); prefs->mAutomaticNameParsing = mNameParsing->isChecked(); prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); + prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); + prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); + prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); prefs->mAskForQuit = mAskForQuit->isChecked(); mAddresseeWidget->saveSettings(); saveExtensionSettings(); } void KABConfigWidget::restoreExtensionSettings() { QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; mExtensionView->clear(); #ifndef KAB_EMBEDDED KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); KTrader::OfferList::ConstIterator it; for ( it = plugins.begin(); it != plugins.end(); ++it ) { if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) continue; ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); item->setService( *it ); if ( activeExtensions.contains( item->factory()->identifier() ) ) item->setOn( true ); } #else //KAB_EMBEDDED ExtensionFactory *extensionFactory = new MergeFactory(); ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h index 08d71b4..a172e97 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.h +++ b/kaddressbook/kcmconfigs/kabconfigwidget.h @@ -35,41 +35,43 @@ class KListView; class KABPrefs; class AddresseeWidget; class KABConfigWidget : public KPrefsWidget { Q_OBJECT public: KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 ); protected: /** Implement this to read custom configuration widgets. */ virtual void usrReadConfig(); /** Implement this to write custom configuration widgets. */ virtual void usrWriteConfig(); private slots: void configureExtension(); void selectionChanged( QListViewItem* ); void itemClicked( QListViewItem* ); private: void restoreExtensionSettings(); void saveExtensionSettings(); KListView *mExtensionView; QCheckBox *mSearchReturnBox; QCheckBox *mNameParsing; QCheckBox *mViewsSingleClickBox; + QCheckBox *mAutoSearchWithWildcardBox; + QCheckBox *mHideSearchOnSwitchBox; QCheckBox *mMultipleViewsAtOnce; QCheckBox *mAskForQuit; QCheckBox *mMenuBarBox; QPushButton *mConfigureButton; AddresseeWidget *mAddresseeWidget; }; #endif |