-rw-r--r-- | bin/kdepim/kaddressbook/germantranslation.txt | 5 | ||||
-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 22 | ||||
-rw-r--r-- | kaddressbook/incsearchwidget.h | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 23 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabprefs.h | 2 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 15 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 2 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 4 |
9 files changed, 60 insertions, 16 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt index a3d465f..6721d5f 100644 --- a/bin/kdepim/kaddressbook/germantranslation.txt +++ b/bin/kdepim/kaddressbook/germantranslation.txt @@ -424,3 +424,3 @@ { "Ask for quit when closing Ka/Pi","Vor Beenden von Ka/Pi nachfragen" },
-{ "General","Algemein" },
+{ "General","Allgemein" },
{ "Extensions (restart)","Extensions (restart)" },
@@ -749,3 +749,4 @@ { "Change search field enable jump bar","Ändere Suchfeld um Jumpbar anzuzeigen" },
-{ "","" },
+{ "Search with '*' prefix (wildcard)","Suche mit '*' Prefix (Wildcard)" },
+{ "Shrink searchfield in portrait view","Verkleinere Suchfeld im Portraitmodus" },
{ "","" },
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index dd2121a..cd198c4 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp @@ -116,3 +116,15 @@ void IncSearchWidget::announceFieldChanged() } - +void IncSearchWidget::setSize() +{ + if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) { + mFieldCombo->setMaximumWidth( 40 ); + mSearchText->setMaximumWidth( 30 ); + } else { + QFontMetrics fm ( mFieldCombo->font() ); + int wid = fm.width(i18n( "All Fields" ) ); + int max = wid; + mFieldCombo->setMaximumWidth( wid+60 ); + mSearchText->setMaximumWidth( 1024 ); + } +} void IncSearchWidget::setFields( const KABC::Field::List &list ) @@ -122,5 +134,2 @@ void IncSearchWidget::setFields( const KABC::Field::List &list ) mFieldCombo->insertItem( i18n( "All Fields" ) ); - QFontMetrics fm ( mFieldCombo->font() ); - int wid = fm.width(i18n( "All Fields" ) ); - int max = wid; @@ -129,5 +138,2 @@ void IncSearchWidget::setFields( const KABC::Field::List &list ) mFieldCombo->insertItem( (*it)->label() ); - // wid = fm.width((*it)->label() ); - //if ( wid > max ) - // max = wid; } @@ -138,3 +144,3 @@ void IncSearchWidget::setFields( const KABC::Field::List &list ) announceFieldChanged(); - mFieldCombo->setMaximumWidth( wid+60 ); + setSize(); } diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h index 1546a51..cae55cd 100644 --- a/kaddressbook/incsearchwidget.h +++ b/kaddressbook/incsearchwidget.h @@ -48,2 +48,3 @@ class IncSearchWidget : public QWidget int currentItem() const; + void setSize(); diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 59aa5a5..09d8523 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -300,2 +300,3 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const // syncManager->setBlockSave(false); + mIncSearchWidget = 0; mMiniSplitter = 0; @@ -821,3 +822,2 @@ void KABCore::updateMainWindow() { - mMainWindow->showMaximized(); @@ -835,2 +835,3 @@ void KABCore::resizeEvent(QResizeEvent* e ) mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); + } if ( QApplication::desktop()->width() <= 640 ) { @@ -838,5 +839,7 @@ void KABCore::resizeEvent(QResizeEvent* e ) mViewManager->getFilterAction()->setComboWidth( 150 ); + if ( mIncSearchWidget ) + mIncSearchWidget->setSize(); QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); } - } + } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 @@ -845,2 +848,3 @@ void KABCore::resizeEvent(QResizeEvent* e ) mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); + } if ( QApplication::desktop()->width() <= 640 ) { @@ -848,5 +852,10 @@ void KABCore::resizeEvent(QResizeEvent* e ) mMainWindow->showMinimized(); + if ( KABPrefs::instance()->mHideSearchOnSwitch ) { + if ( mIncSearchWidget ) { + mIncSearchWidget->setSize(); + } + } else { mViewManager->getFilterAction()->setComboWidth( 0 ); - QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); } + QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); } @@ -1155,3 +1164,9 @@ void KABCore::incrementalSearch( const QString& text ) { - mViewManager->doSearch( text, mIncSearchWidget->currentField() ); + QString stext; + if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { + stext = "*" + text; + } else { + stext = text; + } + mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); } diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index b96d28a..ea254b7 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp @@ -62,2 +62,4 @@ KABPrefs::KABPrefs() addItemBool("SearchWithReturn",&mSearchWithReturn, false ); + addItemBool("AutoSearchWithWildcard",&mAutoSearchWithWildcard, false ); + addItemBool("HideSearchOnSwitch",&mHideSearchOnSwitch, false ); addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index 1e3b48f..2bb173d 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h @@ -72,2 +72,4 @@ class KABPrefs : public KPimPrefs bool mSearchWithReturn; + bool mAutoSearchWithWildcard; + bool mHideSearchOnSwitch; QValueList<int> mExtensionsSplitter; diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 3ad2f74..986c9b8 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp @@ -125,2 +125,10 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * boxLayout->addWidget( mSearchReturnBox ); + mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); + boxLayout->addWidget( mAutoSearchWithWildcardBox); + mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); + boxLayout->addWidget( mHideSearchOnSwitchBox ); + +#ifdef DESKTOP_VERSION + mHideSearchOnSwitchBox->hide(); +#endif mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); @@ -173,2 +181,4 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); + connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); + connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); @@ -201,2 +211,4 @@ void KABConfigWidget::usrReadConfig() mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); + mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); + mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); @@ -219,2 +231,5 @@ void KABConfigWidget::usrWriteConfig() prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); + prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); + prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); + prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h index 08d71b4..a172e97 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.h +++ b/kaddressbook/kcmconfigs/kabconfigwidget.h @@ -66,2 +66,4 @@ class KABConfigWidget : public KPrefsWidget QCheckBox *mViewsSingleClickBox; + QCheckBox *mAutoSearchWithWildcardBox; + QCheckBox *mHideSearchOnSwitchBox; QCheckBox *mMultipleViewsAtOnce; diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 04759a7..c2b1bb0 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -110,3 +110,3 @@ void ViewManager::restoreSettings() int cw = 150; - if (QApplication::desktop()->width() == 480 ) + if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) cw = 0; @@ -606,3 +606,3 @@ void ViewManager::configureFilters() int cw = 150; - if (QApplication::desktop()->width() == 480 ) + if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) cw = 0; |