From a040c9d56282dae396b02627fafb602e44323837 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 11 Sep 2004 22:40:15 +0000 Subject: Added configure for search --- (limited to 'kaddressbook') diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index 2ffa357..3533427 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp @@ -30,6 +30,8 @@ #include #include #include +#include +#include "kabprefs.h" #include "incsearchwidget.h" @@ -67,13 +69,13 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) // resize( QSize(30, 10).expandedTo( sizeHint() ) ); // #endif //KAB_EMBEDDED -#ifdef DESKTOP_VERSION + // for performance reasons, we do a search on the pda only after return is pressed connect( mSearchText, SIGNAL( textChanged( const QString& ) ), - SLOT( announceDoSearch() ) ); + SLOT( announceDoSearch2() ) ); connect( mFieldCombo, SIGNAL( activated( const QString& ) ), - SLOT( announceDoSearch() ) ); -#endif + SLOT( announceDoSearch2() ) ); + connect( mSearchText, SIGNAL( returnPressed() ), SLOT( announceDoSearch() ) ); connect( mFieldCombo, SIGNAL( activated( const QString& ) ), @@ -86,10 +88,19 @@ IncSearchWidget::~IncSearchWidget() { } +void IncSearchWidget::announceDoSearch2() +{ + if ( KABPrefs::instance()->mSearchWithReturn ) + return; + emit doSearch( mSearchText->text() ); + //qDebug("emit dosreach "); +} void IncSearchWidget::announceDoSearch() { + emit doSearch( mSearchText->text() ); + // qDebug("emit dosreach "); } void IncSearchWidget::announceFieldChanged() diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h index 09fb8ac..5c95438 100644 --- a/kaddressbook/incsearchwidget.h +++ b/kaddressbook/incsearchwidget.h @@ -62,6 +62,7 @@ class IncSearchWidget : public QWidget private slots: void announceDoSearch(); + void announceDoSearch2(); void announceFieldChanged(); private: diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index bbf8e1b..f0a49f8 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1385,7 +1385,7 @@ AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), SLOT( contactModified( const KABC::Addressee& ) ) ); //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), - // SLOT( slotEditorDestroyed( const QString& ) ) ); + // SLOT( slotEditorDestroyed( const QString& ) ) ; } return mEditorDialog; diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 2425158..552c933 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp @@ -50,6 +50,8 @@ KABPrefs::KABPrefs() addItemBool("AskForQuit",&mAskForQuit,true); addItemBool("ToolBarHor",&mToolBarHor, true ); addItemBool("ToolBarUp",&mToolBarUp, false ); + addItemBool("SearchWithReturn",&mSearchWithReturn, true ); + #endif //KAB_EMBEDDED diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index 03e529f..e4f359c 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h @@ -66,6 +66,7 @@ class KABPrefs : public KPimPrefs bool mJumpButtonBarVisible; bool mDetailsPageVisible; bool mMultipleViewsAtOnce; + bool mSearchWithReturn; QValueList mExtensionsSplitter; QValueList mDetailsSplitter; diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 3a2ccbb..0c3a199 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp @@ -106,6 +106,8 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) vBox->layout()->setMargin(KDialog::marginHintSmall()) ; vBox->layout()->setSpacing(KDialog::spacingHintSmall()); boxLayout->setSpacing( KDialog::spacingHintSmall() ); + mSearchReturnBox = new QCheckBox( i18n( "Search only after key pressed" ), vBox, "mreturn" ); + boxLayout->addWidget( mSearchReturnBox ); mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); boxLayout->addWidget( mViewsSingleClickBox ); @@ -152,6 +154,7 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) 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( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), @@ -180,6 +183,7 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs) mNameParsing->setChecked( prefs->mAutomaticNameParsing ); mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); + mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); mAskForQuit->setChecked( prefs->mAskForQuit ); @@ -196,6 +200,7 @@ void KABConfigWidget::saveSettings(KABPrefs* prefs) { prefs->mAutomaticNameParsing = mNameParsing->isChecked(); prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); + prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); prefs->mAskForQuit = mAskForQuit->isChecked(); @@ -212,6 +217,7 @@ void KABConfigWidget::defaults(KABPrefs* prefs) mNameParsing->setChecked( true ); mViewsSingleClickBox->setChecked( false ); mMultipleViewsAtOnce->setChecked( true ); + mSearchReturnBox->setChecked( true ); mAskForQuit->setChecked (true); emit changed( true ); diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h index 831efc1..6cd4223 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.h +++ b/kaddressbook/kcmconfigs/kabconfigwidget.h @@ -65,7 +65,7 @@ class KABConfigWidget : public QWidget void saveExtensionSettings(); KListView *mExtensionView; - + QCheckBox *mSearchReturnBox; QCheckBox *mNameParsing; QCheckBox *mViewsSingleClickBox; QCheckBox *mMultipleViewsAtOnce; diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 12f7c27..63ad0ed 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -150,7 +150,7 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) #endif { ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); - continue; + break; } } } -- cgit v0.9.0.2