-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 |
8 files changed, 57 insertions, 14 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index dd2121a..cd198c4 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp | |||
@@ -114,29 +114,35 @@ void IncSearchWidget::announceFieldChanged() | |||
114 | { | 114 | { |
115 | emit fieldChanged(); | 115 | emit fieldChanged(); |
116 | } | 116 | } |
117 | 117 | void IncSearchWidget::setSize() | |
118 | { | ||
119 | if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) { | ||
120 | mFieldCombo->setMaximumWidth( 40 ); | ||
121 | mSearchText->setMaximumWidth( 30 ); | ||
122 | } else { | ||
123 | QFontMetrics fm ( mFieldCombo->font() ); | ||
124 | int wid = fm.width(i18n( "All Fields" ) ); | ||
125 | int max = wid; | ||
126 | mFieldCombo->setMaximumWidth( wid+60 ); | ||
127 | mSearchText->setMaximumWidth( 1024 ); | ||
128 | } | ||
129 | } | ||
118 | void IncSearchWidget::setFields( const KABC::Field::List &list ) | 130 | void IncSearchWidget::setFields( const KABC::Field::List &list ) |
119 | { | 131 | { |
120 | 132 | ||
121 | mFieldCombo->clear(); | 133 | mFieldCombo->clear(); |
122 | mFieldCombo->insertItem( i18n( "All Fields" ) ); | 134 | mFieldCombo->insertItem( i18n( "All Fields" ) ); |
123 | QFontMetrics fm ( mFieldCombo->font() ); | ||
124 | int wid = fm.width(i18n( "All Fields" ) ); | ||
125 | int max = wid; | ||
126 | 135 | ||
127 | KABC::Field::List::ConstIterator it; | 136 | KABC::Field::List::ConstIterator it; |
128 | for ( it = list.begin(); it != list.end(); ++it ) { | 137 | for ( it = list.begin(); it != list.end(); ++it ) { |
129 | mFieldCombo->insertItem( (*it)->label() ); | 138 | mFieldCombo->insertItem( (*it)->label() ); |
130 | // wid = fm.width((*it)->label() ); | ||
131 | //if ( wid > max ) | ||
132 | // max = wid; | ||
133 | } | 139 | } |
134 | 140 | ||
135 | mFieldList = list; | 141 | mFieldList = list; |
136 | 142 | ||
137 | announceDoSearch(); | 143 | announceDoSearch(); |
138 | announceFieldChanged(); | 144 | announceFieldChanged(); |
139 | mFieldCombo->setMaximumWidth( wid+60 ); | 145 | setSize(); |
140 | } | 146 | } |
141 | 147 | ||
142 | KABC::Field::List IncSearchWidget::fields() const | 148 | KABC::Field::List IncSearchWidget::fields() const |
diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h index 1546a51..cae55cd 100644 --- a/kaddressbook/incsearchwidget.h +++ b/kaddressbook/incsearchwidget.h | |||
@@ -46,6 +46,7 @@ class IncSearchWidget : public QWidget | |||
46 | 46 | ||
47 | void setCurrentItem( int pos ); | 47 | void setCurrentItem( int pos ); |
48 | int currentItem() const; | 48 | int currentItem() const; |
49 | void setSize(); | ||
49 | 50 | ||
50 | signals: | 51 | signals: |
51 | void scrollUP(); | 52 | void scrollUP(); |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 59aa5a5..09d8523 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -298,6 +298,7 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
298 | { | 298 | { |
299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
300 | // syncManager->setBlockSave(false); | 300 | // syncManager->setBlockSave(false); |
301 | mIncSearchWidget = 0; | ||
301 | mMiniSplitter = 0; | 302 | mMiniSplitter = 0; |
302 | mExtensionBarSplitter = 0; | 303 | mExtensionBarSplitter = 0; |
303 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 304 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
@@ -819,7 +820,6 @@ void KABCore::beamMySelf() | |||
819 | } | 820 | } |
820 | void KABCore::updateMainWindow() | 821 | void KABCore::updateMainWindow() |
821 | { | 822 | { |
822 | |||
823 | mMainWindow->showMaximized(); | 823 | mMainWindow->showMaximized(); |
824 | mMainWindow->update(); | 824 | mMainWindow->update(); |
825 | } | 825 | } |
@@ -833,22 +833,31 @@ void KABCore::resizeEvent(QResizeEvent* e ) | |||
833 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 833 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
834 | mMiniSplitter->setOrientation( Qt::Horizontal); | 834 | mMiniSplitter->setOrientation( Qt::Horizontal); |
835 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 835 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
836 | } | ||
836 | if ( QApplication::desktop()->width() <= 640 ) { | 837 | if ( QApplication::desktop()->width() <= 640 ) { |
837 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 838 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
838 | mViewManager->getFilterAction()->setComboWidth( 150 ); | 839 | mViewManager->getFilterAction()->setComboWidth( 150 ); |
840 | if ( mIncSearchWidget ) | ||
841 | mIncSearchWidget->setSize(); | ||
839 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 842 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
840 | } | 843 | } |
841 | } | 844 | |
842 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 845 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
843 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 846 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
844 | mMiniSplitter->setOrientation( Qt::Vertical ); | 847 | mMiniSplitter->setOrientation( Qt::Vertical ); |
845 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 848 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
849 | } | ||
846 | if ( QApplication::desktop()->width() <= 640 ) { | 850 | if ( QApplication::desktop()->width() <= 640 ) { |
847 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 851 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
848 | mMainWindow->showMinimized(); | 852 | mMainWindow->showMinimized(); |
853 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { | ||
854 | if ( mIncSearchWidget ) { | ||
855 | mIncSearchWidget->setSize(); | ||
856 | } | ||
857 | } else { | ||
849 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 858 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
850 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
851 | } | 859 | } |
860 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
852 | } | 861 | } |
853 | } | 862 | } |
854 | } | 863 | } |
@@ -1153,7 +1162,13 @@ void KABCore::setSearchFields( const KABC::Field::List &fields ) | |||
1153 | 1162 | ||
1154 | void KABCore::incrementalSearch( const QString& text ) | 1163 | void KABCore::incrementalSearch( const QString& text ) |
1155 | { | 1164 | { |
1156 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1165 | QString stext; |
1166 | if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { | ||
1167 | stext = "*" + text; | ||
1168 | } else { | ||
1169 | stext = text; | ||
1170 | } | ||
1171 | mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); | ||
1157 | } | 1172 | } |
1158 | 1173 | ||
1159 | void KABCore::setModified() | 1174 | void KABCore::setModified() |
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index b96d28a..ea254b7 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -60,6 +60,8 @@ KABPrefs::KABPrefs() | |||
60 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 60 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
61 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 61 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
62 | addItemBool("SearchWithReturn",&mSearchWithReturn, false ); | 62 | addItemBool("SearchWithReturn",&mSearchWithReturn, false ); |
63 | addItemBool("AutoSearchWithWildcard",&mAutoSearchWithWildcard, false ); | ||
64 | addItemBool("HideSearchOnSwitch",&mHideSearchOnSwitch, false ); | ||
63 | addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); | 65 | addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); |
64 | 66 | ||
65 | 67 | ||
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index 1e3b48f..2bb173d 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h | |||
@@ -70,6 +70,8 @@ class KABPrefs : public KPimPrefs | |||
70 | bool mDetailsPageVisible; | 70 | bool mDetailsPageVisible; |
71 | bool mMultipleViewsAtOnce; | 71 | bool mMultipleViewsAtOnce; |
72 | bool mSearchWithReturn; | 72 | bool mSearchWithReturn; |
73 | bool mAutoSearchWithWildcard; | ||
74 | bool mHideSearchOnSwitch; | ||
73 | QValueList<int> mExtensionsSplitter; | 75 | QValueList<int> mExtensionsSplitter; |
74 | QValueList<int> mDetailsSplitter; | 76 | QValueList<int> mDetailsSplitter; |
75 | 77 | ||
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 | |||
@@ -123,6 +123,14 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * | |||
123 | boxLayout->addWidget( mMenuBarBox ); | 123 | boxLayout->addWidget( mMenuBarBox ); |
124 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); | 124 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); |
125 | boxLayout->addWidget( mSearchReturnBox ); | 125 | boxLayout->addWidget( mSearchReturnBox ); |
126 | mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); | ||
127 | boxLayout->addWidget( mAutoSearchWithWildcardBox); | ||
128 | mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); | ||
129 | boxLayout->addWidget( mHideSearchOnSwitchBox ); | ||
130 | |||
131 | #ifdef DESKTOP_VERSION | ||
132 | mHideSearchOnSwitchBox->hide(); | ||
133 | #endif | ||
126 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); | 134 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); |
127 | boxLayout->addWidget( mViewsSingleClickBox ); | 135 | boxLayout->addWidget( mViewsSingleClickBox ); |
128 | 136 | ||
@@ -171,6 +179,8 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * | |||
171 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 179 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
172 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 180 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
173 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 181 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
182 | connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | ||
183 | connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | ||
174 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 184 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
175 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 185 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
176 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | 186 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), |
@@ -199,6 +209,8 @@ void KABConfigWidget::usrReadConfig() | |||
199 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); | 209 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); |
200 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); | 210 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); |
201 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); | 211 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); |
212 | mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); | ||
213 | mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); | ||
202 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); | 214 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); |
203 | mAskForQuit->setChecked( prefs->mAskForQuit ); | 215 | mAskForQuit->setChecked( prefs->mAskForQuit ); |
204 | 216 | ||
@@ -217,6 +229,9 @@ void KABConfigWidget::usrWriteConfig() | |||
217 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); | 229 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); |
218 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); | 230 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); |
219 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); | 231 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); |
232 | prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); | ||
233 | prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); | ||
234 | |||
220 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); | 235 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); |
221 | prefs->mAskForQuit = mAskForQuit->isChecked(); | 236 | prefs->mAskForQuit = mAskForQuit->isChecked(); |
222 | 237 | ||
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 | |||
@@ -64,6 +64,8 @@ class KABConfigWidget : public KPrefsWidget | |||
64 | QCheckBox *mSearchReturnBox; | 64 | QCheckBox *mSearchReturnBox; |
65 | QCheckBox *mNameParsing; | 65 | QCheckBox *mNameParsing; |
66 | QCheckBox *mViewsSingleClickBox; | 66 | QCheckBox *mViewsSingleClickBox; |
67 | QCheckBox *mAutoSearchWithWildcardBox; | ||
68 | QCheckBox *mHideSearchOnSwitchBox; | ||
67 | QCheckBox *mMultipleViewsAtOnce; | 69 | QCheckBox *mMultipleViewsAtOnce; |
68 | QCheckBox *mAskForQuit; | 70 | QCheckBox *mAskForQuit; |
69 | QCheckBox *mMenuBarBox; | 71 | QCheckBox *mMenuBarBox; |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 04759a7..c2b1bb0 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -108,7 +108,7 @@ void ViewManager::restoreSettings() | |||
108 | mActionSelectFilter->setItems( filterNames() ); | 108 | mActionSelectFilter->setItems( filterNames() ); |
109 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); | 109 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); |
110 | int cw = 150; | 110 | int cw = 150; |
111 | if (QApplication::desktop()->width() == 480 ) | 111 | if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) |
112 | cw = 0; | 112 | cw = 0; |
113 | mActionSelectFilter->setComboWidth( cw ); | 113 | mActionSelectFilter->setComboWidth( cw ); |
114 | // Tell the views to reread their config, since they may have | 114 | // Tell the views to reread their config, since they may have |
@@ -604,7 +604,7 @@ void ViewManager::configureFilters() | |||
604 | mActionSelectFilter->setCurrentItem( pos ); | 604 | mActionSelectFilter->setCurrentItem( pos ); |
605 | setActiveFilter( pos ); | 605 | setActiveFilter( pos ); |
606 | int cw = 150; | 606 | int cw = 150; |
607 | if (QApplication::desktop()->width() == 480 ) | 607 | if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) |
608 | cw = 0; | 608 | cw = 0; |
609 | mActionSelectFilter->setComboWidth( cw ); | 609 | mActionSelectFilter->setComboWidth( cw ); |
610 | saveSettings(); | 610 | saveSettings(); |