summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp22
-rw-r--r--kaddressbook/incsearchwidget.h1
-rw-r--r--kaddressbook/kabcore.cpp23
-rw-r--r--kaddressbook/kabprefs.cpp2
-rw-r--r--kaddressbook/kabprefs.h2
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp15
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h2
-rw-r--r--kaddressbook/viewmanager.cpp4
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
@@ -109,39 +109,45 @@ void IncSearchWidget::announceDoSearch()
emit doSearch( mSearchText->text() );
// qDebug("emit dosreach ");
}
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 )
{
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;
}
mFieldList = list;
announceDoSearch();
announceFieldChanged();
- mFieldCombo->setMaximumWidth( wid+60 );
+ setSize();
}
KABC::Field::List IncSearchWidget::fields() const
{
return mFieldList;
}
KABC::Field *IncSearchWidget::currentField()const
diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h
index 1546a51..cae55cd 100644
--- a/kaddressbook/incsearchwidget.h
+++ b/kaddressbook/incsearchwidget.h
@@ -41,16 +41,17 @@ class IncSearchWidget : public QWidget
void setFields( const KABC::Field::List &list );
KABC::Field::List fields() const;
KABC::Field *currentField() const;
void setCurrentItem( int pos );
int currentItem() const;
+ void setSize();
signals:
void scrollUP();
void scrollDOWN();
/**
This signal is emmited whenever the text in the input
widget is changed. You can get the sorting field by
@ref currentField.
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 59aa5a5..09d8523 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -293,16 +293,17 @@ KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, con
KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
: QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
mReadWrite( readWrite ), mModified( false )
#endif //KAB_EMBEDDED
{
// syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
// syncManager->setBlockSave(false);
+ mIncSearchWidget = 0;
mMiniSplitter = 0;
mExtensionBarSplitter = 0;
mIsPart = !parent->inherits( "KAddressBookMain" );
mAddressBook = KABC::StdAddressBook::self();
KABC::StdAddressBook::setAutomaticSave( false );
#ifndef KAB_EMBEDDED
mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
@@ -814,46 +815,54 @@ void KABCore::beamMySelf()
} else {
KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
}
}
void KABCore::updateMainWindow()
{
-
mMainWindow->showMaximized();
mMainWindow->update();
}
void KABCore::resizeEvent(QResizeEvent* e )
{
if ( !mMiniSplitter )
return;
//qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
if ( QApplication::desktop()->width() >= 480 ) {
if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
if ( mMiniSplitter->orientation() == Qt::Vertical ) {
mMiniSplitter->setOrientation( Qt::Horizontal);
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
+ }
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 ( KABPrefs::instance()->mHideSearchOnSwitch ) {
+ if ( mIncSearchWidget ) {
+ mIncSearchWidget->setSize();
+ }
+ } else {
mViewManager->getFilterAction()->setComboWidth( 0 );
- QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
}
+ QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
}
}
}
}
void KABCore::export2phone()
{
@@ -1148,17 +1157,23 @@ void KABCore::setCategories()
void KABCore::setSearchFields( const KABC::Field::List &fields )
{
mIncSearchWidget->setFields( 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() );
}
void KABCore::setModified()
{
setModified( true );
}
void KABCore::setModifiedWOrefresh()
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index b96d28a..ea254b7 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -55,16 +55,18 @@ KABPrefs::KABPrefs()
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, false );
+ addItemBool("AutoSearchWithWildcard",&mAutoSearchWithWildcard, false );
+ addItemBool("HideSearchOnSwitch",&mHideSearchOnSwitch, false );
addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont());
#endif //KAB_EMBEDDED
KPrefs::setCurrentGroup( "MainWindow" );
bool m_visible = false;
#ifdef DESKTOP_VERSION
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index 1e3b48f..2bb173d 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -65,16 +65,18 @@ class KABPrefs : public KPimPrefs
// GUI
bool mFullMenuBarVisible;
bool mJumpButtonBarVisible;
bool mDetailsPageVisible;
bool mMultipleViewsAtOnce;
bool mSearchWithReturn;
+ bool mAutoSearchWithWildcard;
+ bool mHideSearchOnSwitch;
QValueList<int> mExtensionsSplitter;
QValueList<int> mDetailsSplitter;
// Extensions stuff
int mCurrentExtension;
QStringList mActiveExtensions;
// Views stuff
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
@@ -118,16 +118,24 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *
QVBoxLayout *boxLayout = new QVBoxLayout( vBox );
boxLayout->setAlignment( Qt::AlignTop );
boxLayout->setMargin(KDialog::marginHintSmall() );
boxLayout->setSpacing( KDialog::spacingHintSmall() );
mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" );
boxLayout->addWidget( mMenuBarBox );
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 );
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 );
@@ -166,16 +174,18 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *
boxLayout->addWidget( mConfigureButton );
extensionLayout->addWidget( groupBox );
connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
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( 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() ) );
connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
SLOT( selectionChanged( QListViewItem* ) ) );
connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
SLOT( itemClicked( QListViewItem* ) ) );
connect( mConfigureButton, SIGNAL( clicked() ),
SLOT( configureExtension() ) );
@@ -194,16 +204,18 @@ void KABConfigWidget::usrReadConfig()
KABPrefs* prefs = KABPrefs::instance();
bool blocked = signalsBlocked();
blockSignals( true );
mMenuBarBox->setChecked( prefs->mFullMenuBarVisible);
mNameParsing->setChecked( prefs->mAutomaticNameParsing );
mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
+ mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard );
+ mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch );
mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
mAskForQuit->setChecked( prefs->mAskForQuit );
mAddresseeWidget->restoreSettings();
restoreExtensionSettings();
blockSignals( blocked );
@@ -212,16 +224,19 @@ void KABConfigWidget::usrReadConfig()
void KABConfigWidget::usrWriteConfig()
{
KABPrefs* prefs = KABPrefs::instance();
prefs->mFullMenuBarVisible = mMenuBarBox->isChecked();
prefs->mAutomaticNameParsing = mNameParsing->isChecked();
prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
prefs->mSearchWithReturn = mSearchReturnBox->isChecked();
+ prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked();
+ prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked();
+
prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
prefs->mAskForQuit = mAskForQuit->isChecked();
mAddresseeWidget->saveSettings();
saveExtensionSettings();
}
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
@@ -59,16 +59,18 @@ class KABConfigWidget : public KPrefsWidget
private:
void restoreExtensionSettings();
void saveExtensionSettings();
KListView *mExtensionView;
QCheckBox *mSearchReturnBox;
QCheckBox *mNameParsing;
QCheckBox *mViewsSingleClickBox;
+ QCheckBox *mAutoSearchWithWildcardBox;
+ QCheckBox *mHideSearchOnSwitchBox;
QCheckBox *mMultipleViewsAtOnce;
QCheckBox *mAskForQuit;
QCheckBox *mMenuBarBox;
QPushButton *mConfigureButton;
AddresseeWidget *mAddresseeWidget;
};
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 04759a7..c2b1bb0 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -103,17 +103,17 @@ void ViewManager::restoreSettings()
mActionSelectView->setItems( mViewNameList );
// Filter
mFilterList = Filter::restore( mCore->config(), "Filter" );
mActionSelectFilter->setItems( filterNames() );
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 );
// Tell the views to reread their config, since they may have
// been modified by global settings
QString _oldgroup = mCore->config()->group();
QDictIterator<KAddressBookView> it( mViewDict );
for ( it.toFirst(); it.current(); ++it ) {
@@ -599,17 +599,17 @@ void ViewManager::configureFilters()
if ( dlg.exec() )
mFilterList = dlg.filters();
uint pos = mActionSelectFilter->currentItem();
mActionSelectFilter->setItems( filterNames() );
mActionSelectFilter->setCurrentItem( pos );
setActiveFilter( pos );
int cw = 150;
- if (QApplication::desktop()->width() == 480 )
+ if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch)
cw = 0;
mActionSelectFilter->setComboWidth( cw );
saveSettings();
}
QStringList ViewManager::filterNames() const
{
QStringList names( i18n( "No Filter" ) );