summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (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
@@ -21,24 +21,26 @@
without including the source code for Qt in the source distribution.
*/
#include <qlabel.h>
#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" ) );
#endif //KAB_EMBEDDED
QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() );
@@ -58,47 +60,56 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
mFieldCombo = new QComboBox( false, this );
layout->addWidget( mFieldCombo );
mFieldCombo->setMaximumHeight( 34 );
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 )
{
mFieldCombo->clear();
mFieldCombo->insertItem( i18n( "All Fields" ) );
diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h
index 09fb8ac..5c95438 100644
--- a/kaddressbook/incsearchwidget.h
+++ b/kaddressbook/incsearchwidget.h
@@ -53,21 +53,22 @@ class IncSearchWidget : public QWidget
widget is changed. You can get the sorting field by
@ref currentField.
*/
void doSearch( const QString& text );
/**
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;
};
#endif
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index bbf8e1b..f0a49f8 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1376,25 +1376,25 @@ void KABCore::addressBookChanged()
AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
const char *name )
{
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 );
}
void KABCore::initGUI()
{
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 2425158..552c933 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -41,24 +41,26 @@ KABPrefs::KABPrefs()
{
KPrefs::setCurrentGroup( "Views" );
addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
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 );
addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
KPrefs::setCurrentGroup( "Extensions_General" );
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index 03e529f..e4f359c 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -57,24 +57,25 @@ class KABPrefs : public KPimPrefs
/** Read preferences from config file */
// void usrReadConfig();
/** Write preferences to config file */
// 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
QString mCurrentView;
QStringList mViewNames;
// Filter
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
@@ -97,24 +97,26 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
// General page
QWidget *generalPage = new QWidget( this );
QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
//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 );
mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" );
boxLayout->addWidget( mAskForQuit );
@@ -143,24 +145,25 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
mExtensionView->setMaximumHeight(80);
boxLayout->addWidget( mExtensionView );
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() ) );
tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
// Addressee page
@@ -171,56 +174,59 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
}
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 );
}
void KABConfigWidget::restoreExtensionSettings()
{
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
@@ -56,24 +56,24 @@ class KABConfigWidget : public QWidget
private slots:
void configureExtension();
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;
};
#endif
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
@@ -141,25 +141,25 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
} else {
KABC::Field::List fieldList = fields();
KABC::Field::List::ConstIterator fieldIt;
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
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);
}
void KAddressBookTableView::writeConfig(KConfig *config)
{