summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-09-11 22:40:15 (UTC)
committer zautrix <zautrix>2004-09-11 22:40:15 (UTC)
commita040c9d56282dae396b02627fafb602e44323837 (patch) (side-by-side diff)
tree9ee997f51e46a1ae6ab5aeaab709f1b8e138f3df /kaddressbook
parent53dda80aaab72d7efdbed8a206dc1fa64fed10ee (diff)
downloadkdepimpi-a040c9d56282dae396b02627fafb602e44323837.zip
kdepimpi-a040c9d56282dae396b02627fafb602e44323837.tar.gz
kdepimpi-a040c9d56282dae396b02627fafb602e44323837.tar.bz2
Added configure for search
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp19
-rw-r--r--kaddressbook/incsearchwidget.h1
-rw-r--r--kaddressbook/kabcore.cpp2
-rw-r--r--kaddressbook/kabprefs.cpp2
-rw-r--r--kaddressbook/kabprefs.h1
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp6
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h2
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp2
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
@@ -27,12 +27,14 @@
#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 )
{
@@ -64,35 +66,44 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
// #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();
}
diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h
index 09fb8ac..5c95438 100644
--- a/kaddressbook/incsearchwidget.h
+++ b/kaddressbook/incsearchwidget.h
@@ -59,12 +59,13 @@ 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
@@ -1382,13 +1382,13 @@ AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *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 )
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 2425158..552c933 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -47,12 +47,14 @@ KABPrefs::KABPrefs()
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 );
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index 03e529f..e4f359c 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -63,12 +63,13 @@ class KABPrefs : public KPimPrefs
// GUI
bool mJumpButtonBarVisible;
bool mDetailsPageVisible;
bool mMultipleViewsAtOnce;
+ bool mSearchWithReturn;
QValueList<int> mExtensionsSplitter;
QValueList<int> mDetailsSplitter;
// Extensions stuff
int mCurrentExtension;
QStringList mActiveExtensions;
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
@@ -103,12 +103,14 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
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 );
@@ -149,12 +151,13 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
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* ) ) );
@@ -177,12 +180,13 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs)
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();
@@ -193,12 +197,13 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs)
}
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();
@@ -209,12 +214,13 @@ void KABConfigWidget::saveSettings(KABPrefs* prefs)
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()
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
@@ -62,13 +62,13 @@ class KABConfigWidget : public QWidget
private:
void restoreExtensionSettings();
void saveExtensionSettings();
KListView *mExtensionView;
-
+ QCheckBox *mSearchReturnBox;
QCheckBox *mNameParsing;
QCheckBox *mViewsSingleClickBox;
QCheckBox *mMultipleViewsAtOnce;
QCheckBox *mAskForQuit;
QPushButton *mConfigureButton;
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
@@ -147,13 +147,13 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
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.