author | zautrix <zautrix> | 2004-09-11 22:40:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-11 22:40:15 (UTC) |
commit | a040c9d56282dae396b02627fafb602e44323837 (patch) (side-by-side diff) | |
tree | 9ee997f51e46a1ae6ab5aeaab709f1b8e138f3df | |
parent | 53dda80aaab72d7efdbed8a206dc1fa64fed10ee (diff) | |
download | kdepimpi-a040c9d56282dae396b02627fafb602e44323837.zip kdepimpi-a040c9d56282dae396b02627fafb602e44323837.tar.gz kdepimpi-a040c9d56282dae396b02627fafb602e44323837.tar.bz2 |
Added configure for search
-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 19 | ||||
-rw-r--r-- | kaddressbook/incsearchwidget.h | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabprefs.h | 1 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 2 |
8 files changed, 28 insertions, 7 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index 2ffa357..3533427 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp @@ -25,16 +25,18 @@ #include <qlayout.h> #include <qtooltip.h> #include <qcombobox.h> #include <kdialog.h> #include <klineedit.h> #include <klocale.h> #include <kglobal.h> +#include <kglobal.h> +#include "kabprefs.h" #include "incsearchwidget.h" IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) { #ifndef KAB_EMBEDDED //US setCaption( i18n( "Incremental Search" ) ); @@ -62,39 +64,48 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); // #ifndef KAB_EMBEDDED // resize( QSize(420, 50).expandedTo( sizeHint() ) ); // #else //KAB_EMBEDDED // 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& ) ), SLOT( announceFieldChanged() ) ); setFocusProxy( mSearchText ); } 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() { emit fieldChanged(); } void IncSearchWidget::setFields( const KABC::Field::List &list ) diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h index 09fb8ac..5c95438 100644 --- a/kaddressbook/incsearchwidget.h +++ b/kaddressbook/incsearchwidget.h @@ -57,16 +57,17 @@ class IncSearchWidget : public QWidget /** This signal is emmited whenever the search field changes. */ void fieldChanged(); private slots: void announceDoSearch(); + void announceDoSearch2(); void announceFieldChanged(); private: QComboBox* mFieldCombo; KLineEdit* mSearchText; KABC::Field::List mFieldList; }; diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index bbf8e1b..f0a49f8 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1380,17 +1380,17 @@ AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, if ( mEditorDialog == 0 ) { mEditorDialog = new AddresseeEditorDialog( this, parent, name ? name : "editorDialog" ); 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; } void KABCore::slotEditorDestroyed( const QString &uid ) { //mEditorDict.remove( uid ); diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 2425158..552c933 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp @@ -45,16 +45,18 @@ KABPrefs::KABPrefs() KPrefs::setCurrentGroup( "General" ); addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); #ifdef KAB_EMBEDDED addItemBool("AskForQuit",&mAskForQuit,true); addItemBool("ToolBarHor",&mToolBarHor, true ); addItemBool("ToolBarUp",&mToolBarUp, false ); + addItemBool("SearchWithReturn",&mSearchWithReturn, true ); + #endif //KAB_EMBEDDED KPrefs::setCurrentGroup( "MainWindow" ); addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); addItemIntList( "DetailsSplitter", &mDetailsSplitter ); diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index 03e529f..e4f359c 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h @@ -61,16 +61,17 @@ class KABPrefs : public KPimPrefs // void usrWriteConfig(); #endif //KAB_EMBEDDED // GUI bool mJumpButtonBarVisible; bool mDetailsPageVisible; bool mMultipleViewsAtOnce; + bool mSearchWithReturn; QValueList<int> mExtensionsSplitter; QValueList<int> mDetailsSplitter; // Extensions stuff int mCurrentExtension; QStringList mActiveExtensions; // Views stuff 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 @@ -101,16 +101,18 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) //general groupbox QVBox *vBox = new QVBox( generalPage, "qvbox" ); QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" ); boxLayout->setAlignment( Qt::AlignTop ); boxLayout->setMargin(KDialog::marginHintSmall() ); vBox->layout()->setMargin(KDialog::marginHintSmall()) ; vBox->layout()->setSpacing(KDialog::spacingHintSmall()); boxLayout->setSpacing( KDialog::spacingHintSmall() ); + mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); + boxLayout->addWidget( mSearchReturnBox ); 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 ); @@ -147,16 +149,17 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); mConfigureButton->setEnabled( false ); boxLayout->addWidget( mConfigureButton ); extensionLayout->addWidget( groupBox ); 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* ) ), SLOT( selectionChanged( QListViewItem* ) ) ); connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), SLOT( itemClicked( QListViewItem* ) ) ); connect( mConfigureButton, SIGNAL( clicked() ), SLOT( configureExtension() ) ); @@ -175,48 +178,51 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs) { //US prefs was KABPrefs::instance() before bool blocked = signalsBlocked(); blockSignals( true ); mNameParsing->setChecked( prefs->mAutomaticNameParsing ); mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); + mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); mAskForQuit->setChecked( prefs->mAskForQuit ); mAddresseeWidget->restoreSettings(); restoreExtensionSettings(); blockSignals( blocked ); emit changed( false ); } 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(); mAddresseeWidget->saveSettings(); saveExtensionSettings(); KABPrefs::instance()->writeConfig(); emit changed( false ); } void KABConfigWidget::defaults(KABPrefs* prefs) { mNameParsing->setChecked( true ); mViewsSingleClickBox->setChecked( false ); mMultipleViewsAtOnce->setChecked( true ); + mSearchReturnBox->setChecked( true ); mAskForQuit->setChecked (true); emit changed( true ); } void KABConfigWidget::modified() { 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 @@ -60,17 +60,17 @@ class KABConfigWidget : public QWidget void selectionChanged( QListViewItem* ); void itemClicked( QListViewItem* ); private: void restoreExtensionSettings(); void saveExtensionSettings(); KListView *mExtensionView; - + QCheckBox *mSearchReturnBox; QCheckBox *mNameParsing; QCheckBox *mViewsSingleClickBox; QCheckBox *mMultipleViewsAtOnce; QCheckBox *mAskForQuit; QPushButton *mConfigureButton; AddresseeWidget *mAddresseeWidget; 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 @@ -145,17 +145,17 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { #if QT_VERSION >= 300 if (re.search((*fieldIt)->value( *it ).lower()) != -1) #else if (re.match((*fieldIt)->value( *it ).lower()) != -1) #endif { ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); - continue; + break; } } } } // Sometimes the background pixmap gets messed up when we add lots // of items. mListView->repaint(); emit selected(QString::null); |