-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 19 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 20 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 4 |
4 files changed, 24 insertions, 20 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index 7577079..b1ffe04 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp @@ -95,64 +95,65 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) 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::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" ) ); #ifdef DESKTOP_VERSION + mFieldCombo->setMinimumWidth( wid+60 ); wid = wid * 2; #endif mFieldCombo->setMaximumWidth( wid+60 ); mSearchText->setMaximumWidth( 1024 ); } } void IncSearchWidget::setFields( const KABC::Field::List &list ) { mFieldCombo->clear(); mFieldCombo->insertItem( i18n( "All Fields" ) ); KABC::Field::List::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) { mFieldCombo->insertItem( (*it)->label() ); } mFieldList = list; announceDoSearch(); announceFieldChanged(); setSize(); } KABC::Field::List IncSearchWidget::fields() const { return mFieldList; } KABC::Field *IncSearchWidget::currentField()const { if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index a4f3579..cba5850 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -556,82 +556,65 @@ void KABCore::restoreSettings() list = config->readListEntry("MainLayout"); int x,y,w,h; if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); KApplication::testCoords( &x,&y,&w,&h ); topLevelWidget()->setGeometry(x,y,w,h); } else { topLevelWidget()->setGeometry( 40 ,40 , 640, 440); } #endif } void KABCore::saveSettings() { KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); if ( mExtensionBarSplitter ) KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); #ifndef KAB_EMBEDDED KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); #endif //KAB_EMBEDDED mExtensionManager->saveSettings(); mViewManager->saveSettings(); KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); -#ifdef DESKTOP_VERSION - KConfig *config = KABPrefs::instance()->getConfig(); - config->setGroup("WidgetLayout"); - QStringList list ;//= config->readListEntry("MainLayout"); - int x,y,w,h; - QWidget* wid; - wid = topLevelWidget(); - x = wid->geometry().x(); - y = wid->geometry().y(); - w = wid->width(); - h = wid->height(); - list.clear(); - list << QString::number( x ); - list << QString::number( y ); - list << QString::number( w ); - list << QString::number( h ); - config->writeEntry("MainLayout",list ); -#endif + KABPrefs::instance()->writeConfig(); qDebug("KA: KABCore::saveSettings() "); } KABC::AddressBook *KABCore::addressBook() const { return mAddressBook; } KConfig *KABCore::config() { #ifndef KAB_EMBEDDED return KABPrefs::instance()->config(); #else //KAB_EMBEDDED return KABPrefs::instance()->getConfig(); #endif //KAB_EMBEDDED } KActionCollection *KABCore::actionCollection() const { return mGUIClient->actionCollection(); } KABC::Field *KABCore::currentSearchField() const { if (mIncSearchWidget) return mIncSearchWidget->currentField(); else return 0; } QStringList KABCore::selectedUIDs() const diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 336e350..50db377 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp @@ -60,44 +60,60 @@ int main( int argc, char **argv ) } if ( ! exitHelp ) { KGlobal::setAppName( "kaddressbook" ); #ifndef DESKTOP_VERSION if ( QApplication::desktop()->width() > 320 ) KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); else KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); #else QString fileName ; fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); QApplication::addLibraryPath ( qApp->applicationDirPath () ); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); // init language KPimGlobalPrefs::instance()->setGlobalConfig(); QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); KAddressBookMain m ; //US MainWindow m; #ifndef DESKTOP_VERSION QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); #endif #ifndef DESKTOP_VERSION a.showMainWidget( &m ); #else a.setMainWidget( &m ); - m.resize (640, 480 ); m.show(); #endif a.exec(); - +#ifdef DESKTOP_VERSION + KConfig *config = KABPrefs::instance()->getConfig(); + config->setGroup("WidgetLayout"); + QStringList list ;//= config->readListEntry("MainLayout"); + int x,y,w,h; + QWidget* wid; + wid = &m; + x = wid->geometry().x(); + y = wid->geometry().y(); + w = wid->width(); + h = wid->height(); + list.clear(); + list << QString::number( x ); + list << QString::number( y ); + list << QString::number( w ); + list << QString::number( h ); + config->writeEntry("MainLayout",list ); +#endif dumpMissing(); KPimGlobalPrefs::instance()->writeConfig(); } qDebug("KA: Bye! "); } diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 0614d06..c738ad8 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -79,64 +79,66 @@ ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) mViewDict.setAutoDelete( true ); createViewFactories(); } ViewManager::~ViewManager() { unloadViews(); mViewFactoryDict.clear(); } void ViewManager::scrollUP() { if ( mActiveView ) mActiveView->scrollUP(); } void ViewManager::scrollDOWN() { if ( mActiveView ) mActiveView->scrollDOWN(); } void ViewManager::restoreSettings() { mViewNameList = KABPrefs::instance()->mViewNames; QString activeViewName = KABPrefs::instance()->mCurrentView; 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() >= 800 ) + cw = 200; 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 ) { KConfigGroupSaver saver( mCore->config(), it.currentKey() ); it.current()->readConfig( mCore->config() ); } setActiveView( activeViewName ); mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); } void ViewManager::saveSettings() { QString _oldgroup = mCore->config()->group(); QDictIterator<KAddressBookView> it( mViewDict ); for ( it.toFirst(); it.current(); ++it ) { KConfigGroupSaver saver( mCore->config(), it.currentKey() ); #ifdef DESKTOP_VERSION (*it)->writeConfig( mCore->config() ); #else (*it).writeConfig( mCore->config() ); #endif } Filter::save( mCore->config(), "Filter", mFilterList ); @@ -575,64 +577,66 @@ void ViewManager::doSearch( const QString& s,KABC::Field *field ) void ViewManager::setActiveFilter( int index ) { Filter currentFilter; if ( ( index - 1 ) < 0 ) currentFilter = Filter(); else currentFilter = mFilterList[ index - 1 ]; // Check if we have a view. Since the filter combo is created before // the view, this slot could be called before there is a valid view. if ( mActiveView ) { mActiveView->setFilter( currentFilter ); mActiveView->refresh(); emit selected( QString::null ); } } void ViewManager::configureFilters() { FilterDialog dlg( this ); dlg.setFilters( mFilterList ); 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() >= 800 ) + cw = 200; if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) cw = 0; mActionSelectFilter->setComboWidth( cw ); saveSettings(); } QStringList ViewManager::filterNames() const { QStringList names( i18n( "No Filter" ) ); Filter::List::ConstIterator it; for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) names.append( (*it).name() ); return names; } Filter ViewManager::getFilterByName( const QString &name ) const { Filter::List::ConstIterator it; for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) if ( name == (*it).name() ) return (*it); return Filter(); } int ViewManager::filterPosition( const QString &name ) const { int pos = 0; Filter::List::ConstIterator it; for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) |