author | zautrix <zautrix> | 2005-03-29 13:52:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-29 13:52:41 (UTC) |
commit | 7046b36fb5dd14598ece00b575554eba2956ef84 (patch) (side-by-side diff) | |
tree | 934579f9f61f09563dfcbfef207d314d510d57ea /kaddressbook | |
parent | 894717798a8d129f4b991a2fe856d2f1e8e9624a (diff) | |
download | kdepimpi-7046b36fb5dd14598ece00b575554eba2956ef84.zip kdepimpi-7046b36fb5dd14598ece00b575554eba2956ef84.tar.gz kdepimpi-7046b36fb5dd14598ece00b575554eba2956ef84.tar.bz2 |
kapi fixes
-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 24 | ||||
-rw-r--r-- | kaddressbook/incsearchwidget.h | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 37 | ||||
-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, 65 insertions, 22 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index dd2121a..cd198c4 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp @@ -115,5 +115,17 @@ void IncSearchWidget::announceFieldChanged() emit fieldChanged(); } - +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 ) { @@ -121,14 +133,8 @@ void IncSearchWidget::setFields( const KABC::Field::List &list ) mFieldCombo->clear(); mFieldCombo->insertItem( i18n( "All Fields" ) ); - QFontMetrics fm ( mFieldCombo->font() ); - int wid = fm.width(i18n( "All Fields" ) ); - int max = wid; - + KABC::Field::List::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) { mFieldCombo->insertItem( (*it)->label() ); - // wid = fm.width((*it)->label() ); - //if ( wid > max ) - // max = wid; } @@ -137,5 +143,5 @@ void IncSearchWidget::setFields( const KABC::Field::List &list ) announceDoSearch(); 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 @@ -47,4 +47,5 @@ class IncSearchWidget : public QWidget void setCurrentItem( int pos ); int currentItem() const; + void setSize(); signals: diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 59aa5a5..09d8523 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -299,4 +299,5 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); // syncManager->setBlockSave(false); + mIncSearchWidget = 0; mMiniSplitter = 0; mExtensionBarSplitter = 0; @@ -820,5 +821,4 @@ void KABCore::beamMySelf() void KABCore::updateMainWindow() { - mMainWindow->showMaximized(); mMainWindow->update(); @@ -834,20 +834,29 @@ void KABCore::resizeEvent(QResizeEvent* e ) mMiniSplitter->setOrientation( Qt::Horizontal); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); - if ( QApplication::desktop()->width() <= 640 ) { - //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); - mViewManager->getFilterAction()->setComboWidth( 150 ); - QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); - } } + if ( QApplication::desktop()->width() <= 640 ) { + //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); + mViewManager->getFilterAction()->setComboWidth( 150 ); + if ( mIncSearchWidget ) + mIncSearchWidget->setSize(); + QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); + } + } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { mMiniSplitter->setOrientation( Qt::Vertical ); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); - if ( QApplication::desktop()->width() <= 640 ) { - //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); - mMainWindow->showMinimized(); + } + if ( QApplication::desktop()->width() <= 640 ) { + //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); + 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())); } } @@ -1154,5 +1163,11 @@ void KABCore::setSearchFields( const KABC::Field::List &fields ) 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 @@ -61,4 +61,6 @@ KABPrefs::KABPrefs() addItemBool("ToolBarUp",&mToolBarUp, false ); 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 @@ -71,4 +71,6 @@ class KABPrefs : public KPimPrefs bool mMultipleViewsAtOnce; bool mSearchWithReturn; + bool mAutoSearchWithWildcard; + bool mHideSearchOnSwitch; QValueList<int> mExtensionsSplitter; QValueList<int> mDetailsSplitter; 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 @@ -124,4 +124,12 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); 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" ); boxLayout->addWidget( mViewsSingleClickBox ); @@ -172,4 +180,6 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 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() ) ); connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); @@ -200,4 +210,6 @@ void KABConfigWidget::usrReadConfig() mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); + mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); + mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); mAskForQuit->setChecked( prefs->mAskForQuit ); @@ -218,4 +230,7 @@ void KABConfigWidget::usrWriteConfig() prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); + prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); + prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); + prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); prefs->mAskForQuit = mAskForQuit->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 @@ -65,4 +65,6 @@ class KABConfigWidget : public KPrefsWidget QCheckBox *mNameParsing; QCheckBox *mViewsSingleClickBox; + QCheckBox *mAutoSearchWithWildcardBox; + QCheckBox *mHideSearchOnSwitchBox; QCheckBox *mMultipleViewsAtOnce; QCheckBox *mAskForQuit; diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 04759a7..c2b1bb0 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -109,5 +109,5 @@ void ViewManager::restoreSettings() mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); int cw = 150; - if (QApplication::desktop()->width() == 480 ) + if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) cw = 0; mActionSelectFilter->setComboWidth( cw ); @@ -605,5 +605,5 @@ void ViewManager::configureFilters() setActiveFilter( pos ); int cw = 150; - if (QApplication::desktop()->width() == 480 ) + if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) cw = 0; mActionSelectFilter->setComboWidth( cw ); |