author | zautrix <zautrix> | 2004-09-11 22:40:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-11 22:40:15 (UTC) |
commit | a040c9d56282dae396b02627fafb602e44323837 (patch) (unidiff) | |
tree | 9ee997f51e46a1ae6ab5aeaab709f1b8e138f3df /kaddressbook | |
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 | |||
@@ -27,12 +27,14 @@ | |||
27 | #include <qcombobox.h> | 27 | #include <qcombobox.h> |
28 | 28 | ||
29 | #include <kdialog.h> | 29 | #include <kdialog.h> |
30 | #include <klineedit.h> | 30 | #include <klineedit.h> |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <kglobal.h> | ||
34 | #include "kabprefs.h" | ||
33 | 35 | ||
34 | #include "incsearchwidget.h" | 36 | #include "incsearchwidget.h" |
35 | 37 | ||
36 | IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) | 38 | IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) |
37 | : QWidget( parent, name ) | 39 | : QWidget( parent, name ) |
38 | { | 40 | { |
@@ -64,35 +66,44 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) | |||
64 | // #ifndef KAB_EMBEDDED | 66 | // #ifndef KAB_EMBEDDED |
65 | // resize( QSize(420, 50).expandedTo( sizeHint() ) ); | 67 | // resize( QSize(420, 50).expandedTo( sizeHint() ) ); |
66 | // #else //KAB_EMBEDDED | 68 | // #else //KAB_EMBEDDED |
67 | // resize( QSize(30, 10).expandedTo( sizeHint() ) ); | 69 | // resize( QSize(30, 10).expandedTo( sizeHint() ) ); |
68 | // #endif //KAB_EMBEDDED | 70 | // #endif //KAB_EMBEDDED |
69 | 71 | ||
70 | #ifdef DESKTOP_VERSION | 72 | |
71 | // for performance reasons, we do a search on the pda only after return is pressed | 73 | // for performance reasons, we do a search on the pda only after return is pressed |
72 | connect( mSearchText, SIGNAL( textChanged( const QString& ) ), | 74 | connect( mSearchText, SIGNAL( textChanged( const QString& ) ), |
73 | SLOT( announceDoSearch() ) ); | 75 | SLOT( announceDoSearch2() ) ); |
74 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 76 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
75 | SLOT( announceDoSearch() ) ); | 77 | SLOT( announceDoSearch2() ) ); |
76 | #endif | 78 | |
77 | connect( mSearchText, SIGNAL( returnPressed() ), | 79 | connect( mSearchText, SIGNAL( returnPressed() ), |
78 | SLOT( announceDoSearch() ) ); | 80 | SLOT( announceDoSearch() ) ); |
79 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 81 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
80 | SLOT( announceFieldChanged() ) ); | 82 | SLOT( announceFieldChanged() ) ); |
81 | 83 | ||
82 | setFocusProxy( mSearchText ); | 84 | setFocusProxy( mSearchText ); |
83 | } | 85 | } |
84 | 86 | ||
85 | IncSearchWidget::~IncSearchWidget() | 87 | IncSearchWidget::~IncSearchWidget() |
86 | { | 88 | { |
87 | 89 | ||
88 | } | 90 | } |
91 | void IncSearchWidget::announceDoSearch2() | ||
92 | { | ||
93 | if ( KABPrefs::instance()->mSearchWithReturn ) | ||
94 | return; | ||
95 | emit doSearch( mSearchText->text() ); | ||
96 | //qDebug("emit dosreach "); | ||
97 | } | ||
89 | 98 | ||
90 | void IncSearchWidget::announceDoSearch() | 99 | void IncSearchWidget::announceDoSearch() |
91 | { | 100 | { |
101 | |||
92 | emit doSearch( mSearchText->text() ); | 102 | emit doSearch( mSearchText->text() ); |
103 | // qDebug("emit dosreach "); | ||
93 | } | 104 | } |
94 | 105 | ||
95 | void IncSearchWidget::announceFieldChanged() | 106 | void IncSearchWidget::announceFieldChanged() |
96 | { | 107 | { |
97 | emit fieldChanged(); | 108 | emit fieldChanged(); |
98 | } | 109 | } |
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 | |||
59 | This signal is emmited whenever the search field changes. | 59 | This signal is emmited whenever the search field changes. |
60 | */ | 60 | */ |
61 | void fieldChanged(); | 61 | void fieldChanged(); |
62 | 62 | ||
63 | private slots: | 63 | private slots: |
64 | void announceDoSearch(); | 64 | void announceDoSearch(); |
65 | void announceDoSearch2(); | ||
65 | void announceFieldChanged(); | 66 | void announceFieldChanged(); |
66 | 67 | ||
67 | private: | 68 | private: |
68 | QComboBox* mFieldCombo; | 69 | QComboBox* mFieldCombo; |
69 | KLineEdit* mSearchText; | 70 | KLineEdit* mSearchText; |
70 | KABC::Field::List mFieldList; | 71 | 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, | |||
1382 | name ? name : "editorDialog" ); | 1382 | name ? name : "editorDialog" ); |
1383 | 1383 | ||
1384 | 1384 | ||
1385 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1385 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1386 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1386 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1387 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1387 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1388 | // SLOT( slotEditorDestroyed( const QString& ) ) ); | 1388 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | return mEditorDialog; | 1391 | return mEditorDialog; |
1392 | } | 1392 | } |
1393 | 1393 | ||
1394 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1394 | 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() | |||
47 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); | 47 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); |
48 | 48 | ||
49 | #ifdef KAB_EMBEDDED | 49 | #ifdef KAB_EMBEDDED |
50 | addItemBool("AskForQuit",&mAskForQuit,true); | 50 | addItemBool("AskForQuit",&mAskForQuit,true); |
51 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 51 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
52 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 52 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
53 | addItemBool("SearchWithReturn",&mSearchWithReturn, true ); | ||
54 | |||
53 | 55 | ||
54 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |
55 | 57 | ||
56 | KPrefs::setCurrentGroup( "MainWindow" ); | 58 | KPrefs::setCurrentGroup( "MainWindow" ); |
57 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); | 59 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); |
58 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); | 60 | 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 | |||
63 | 63 | ||
64 | 64 | ||
65 | // GUI | 65 | // GUI |
66 | bool mJumpButtonBarVisible; | 66 | bool mJumpButtonBarVisible; |
67 | bool mDetailsPageVisible; | 67 | bool mDetailsPageVisible; |
68 | bool mMultipleViewsAtOnce; | 68 | bool mMultipleViewsAtOnce; |
69 | bool mSearchWithReturn; | ||
69 | QValueList<int> mExtensionsSplitter; | 70 | QValueList<int> mExtensionsSplitter; |
70 | QValueList<int> mDetailsSplitter; | 71 | QValueList<int> mDetailsSplitter; |
71 | 72 | ||
72 | // Extensions stuff | 73 | // Extensions stuff |
73 | int mCurrentExtension; | 74 | int mCurrentExtension; |
74 | QStringList mActiveExtensions; | 75 | 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 ) | |||
103 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" ); | 103 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox->layout(), -1, "qvboxlayout" ); |
104 | boxLayout->setAlignment( Qt::AlignTop ); | 104 | boxLayout->setAlignment( Qt::AlignTop ); |
105 | boxLayout->setMargin(KDialog::marginHintSmall() ); | 105 | boxLayout->setMargin(KDialog::marginHintSmall() ); |
106 | vBox->layout()->setMargin(KDialog::marginHintSmall()) ; | 106 | vBox->layout()->setMargin(KDialog::marginHintSmall()) ; |
107 | vBox->layout()->setSpacing(KDialog::spacingHintSmall()); | 107 | vBox->layout()->setSpacing(KDialog::spacingHintSmall()); |
108 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); | 108 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); |
109 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); | ||
110 | boxLayout->addWidget( mSearchReturnBox ); | ||
109 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); | 111 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); |
110 | boxLayout->addWidget( mViewsSingleClickBox ); | 112 | boxLayout->addWidget( mViewsSingleClickBox ); |
111 | 113 | ||
112 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); | 114 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); |
113 | boxLayout->addWidget( mNameParsing ); | 115 | boxLayout->addWidget( mNameParsing ); |
114 | 116 | ||
@@ -149,12 +151,13 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) | |||
149 | boxLayout->addWidget( mConfigureButton ); | 151 | boxLayout->addWidget( mConfigureButton ); |
150 | 152 | ||
151 | extensionLayout->addWidget( groupBox ); | 153 | extensionLayout->addWidget( groupBox ); |
152 | 154 | ||
153 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 155 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
154 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 156 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
157 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | ||
155 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 158 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
156 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 159 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
157 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | 160 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), |
158 | SLOT( selectionChanged( QListViewItem* ) ) ); | 161 | SLOT( selectionChanged( QListViewItem* ) ) ); |
159 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | 162 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), |
160 | SLOT( itemClicked( QListViewItem* ) ) ); | 163 | SLOT( itemClicked( QListViewItem* ) ) ); |
@@ -177,12 +180,13 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs) | |||
177 | 180 | ||
178 | bool blocked = signalsBlocked(); | 181 | bool blocked = signalsBlocked(); |
179 | blockSignals( true ); | 182 | blockSignals( true ); |
180 | 183 | ||
181 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); | 184 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); |
182 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); | 185 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); |
186 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); | ||
183 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); | 187 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); |
184 | mAskForQuit->setChecked( prefs->mAskForQuit ); | 188 | mAskForQuit->setChecked( prefs->mAskForQuit ); |
185 | 189 | ||
186 | mAddresseeWidget->restoreSettings(); | 190 | mAddresseeWidget->restoreSettings(); |
187 | 191 | ||
188 | restoreExtensionSettings(); | 192 | restoreExtensionSettings(); |
@@ -193,12 +197,13 @@ void KABConfigWidget::restoreSettings(KABPrefs* prefs) | |||
193 | } | 197 | } |
194 | 198 | ||
195 | void KABConfigWidget::saveSettings(KABPrefs* prefs) | 199 | void KABConfigWidget::saveSettings(KABPrefs* prefs) |
196 | { | 200 | { |
197 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); | 201 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); |
198 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); | 202 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); |
203 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); | ||
199 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); | 204 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); |
200 | prefs->mAskForQuit = mAskForQuit->isChecked(); | 205 | prefs->mAskForQuit = mAskForQuit->isChecked(); |
201 | 206 | ||
202 | mAddresseeWidget->saveSettings(); | 207 | mAddresseeWidget->saveSettings(); |
203 | 208 | ||
204 | saveExtensionSettings(); | 209 | saveExtensionSettings(); |
@@ -209,12 +214,13 @@ void KABConfigWidget::saveSettings(KABPrefs* prefs) | |||
209 | 214 | ||
210 | void KABConfigWidget::defaults(KABPrefs* prefs) | 215 | void KABConfigWidget::defaults(KABPrefs* prefs) |
211 | { | 216 | { |
212 | mNameParsing->setChecked( true ); | 217 | mNameParsing->setChecked( true ); |
213 | mViewsSingleClickBox->setChecked( false ); | 218 | mViewsSingleClickBox->setChecked( false ); |
214 | mMultipleViewsAtOnce->setChecked( true ); | 219 | mMultipleViewsAtOnce->setChecked( true ); |
220 | mSearchReturnBox->setChecked( true ); | ||
215 | mAskForQuit->setChecked (true); | 221 | mAskForQuit->setChecked (true); |
216 | 222 | ||
217 | emit changed( true ); | 223 | emit changed( true ); |
218 | } | 224 | } |
219 | 225 | ||
220 | void KABConfigWidget::modified() | 226 | 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 | |||
62 | 62 | ||
63 | private: | 63 | private: |
64 | void restoreExtensionSettings(); | 64 | void restoreExtensionSettings(); |
65 | void saveExtensionSettings(); | 65 | void saveExtensionSettings(); |
66 | 66 | ||
67 | KListView *mExtensionView; | 67 | KListView *mExtensionView; |
68 | 68 | QCheckBox *mSearchReturnBox; | |
69 | QCheckBox *mNameParsing; | 69 | QCheckBox *mNameParsing; |
70 | QCheckBox *mViewsSingleClickBox; | 70 | QCheckBox *mViewsSingleClickBox; |
71 | QCheckBox *mMultipleViewsAtOnce; | 71 | QCheckBox *mMultipleViewsAtOnce; |
72 | QCheckBox *mAskForQuit; | 72 | QCheckBox *mAskForQuit; |
73 | 73 | ||
74 | QPushButton *mConfigureButton; | 74 | 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 ) | |||
147 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 147 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
148 | #else | 148 | #else |
149 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 149 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
150 | #endif | 150 | #endif |
151 | { | 151 | { |
152 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 152 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
153 | continue; | 153 | break; |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } | 157 | } |
158 | // Sometimes the background pixmap gets messed up when we add lots | 158 | // Sometimes the background pixmap gets messed up when we add lots |
159 | // of items. | 159 | // of items. |