summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp1
-rw-r--r--kaddressbook/kabcore.cpp19
-rw-r--r--kaddressbook/mainembedded.cpp26
-rw-r--r--kaddressbook/viewmanager.cpp4
4 files changed, 27 insertions, 23 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index 7577079..b1ffe04 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -103,48 +103,49 @@ void IncSearchWidget::announceDoSearch2()
103 emit doSearch( mSearchText->text() ); 103 emit doSearch( mSearchText->text() );
104 //qDebug("emit dosreach "); 104 //qDebug("emit dosreach ");
105} 105}
106 106
107void IncSearchWidget::announceDoSearch() 107void IncSearchWidget::announceDoSearch()
108{ 108{
109 109
110 emit doSearch( mSearchText->text() ); 110 emit doSearch( mSearchText->text() );
111 // qDebug("emit dosreach "); 111 // qDebug("emit dosreach ");
112} 112}
113 113
114void IncSearchWidget::announceFieldChanged() 114void IncSearchWidget::announceFieldChanged()
115{ 115{
116 emit fieldChanged(); 116 emit fieldChanged();
117} 117}
118void IncSearchWidget::setSize() 118void IncSearchWidget::setSize()
119{ 119{
120 if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) { 120 if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) {
121 mFieldCombo->setMaximumWidth( 40 ); 121 mFieldCombo->setMaximumWidth( 40 );
122 mSearchText->setMaximumWidth( 30 ); 122 mSearchText->setMaximumWidth( 30 );
123 } else { 123 } else {
124 QFontMetrics fm ( mFieldCombo->font() ); 124 QFontMetrics fm ( mFieldCombo->font() );
125 int wid = fm.width(i18n( "All Fields" ) ); 125 int wid = fm.width(i18n( "All Fields" ) );
126#ifdef DESKTOP_VERSION 126#ifdef DESKTOP_VERSION
127 mFieldCombo->setMinimumWidth( wid+60 );
127 wid = wid * 2; 128 wid = wid * 2;
128#endif 129#endif
129 mFieldCombo->setMaximumWidth( wid+60 ); 130 mFieldCombo->setMaximumWidth( wid+60 );
130 mSearchText->setMaximumWidth( 1024 ); 131 mSearchText->setMaximumWidth( 1024 );
131 } 132 }
132} 133}
133void IncSearchWidget::setFields( const KABC::Field::List &list ) 134void IncSearchWidget::setFields( const KABC::Field::List &list )
134{ 135{
135 136
136 mFieldCombo->clear(); 137 mFieldCombo->clear();
137 mFieldCombo->insertItem( i18n( "All Fields" ) ); 138 mFieldCombo->insertItem( i18n( "All Fields" ) );
138 139
139 KABC::Field::List::ConstIterator it; 140 KABC::Field::List::ConstIterator it;
140 for ( it = list.begin(); it != list.end(); ++it ) { 141 for ( it = list.begin(); it != list.end(); ++it ) {
141 mFieldCombo->insertItem( (*it)->label() ); 142 mFieldCombo->insertItem( (*it)->label() );
142 } 143 }
143 144
144 mFieldList = list; 145 mFieldList = list;
145 146
146 announceDoSearch(); 147 announceDoSearch();
147 announceFieldChanged(); 148 announceFieldChanged();
148 setSize(); 149 setSize();
149} 150}
150 151
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index a4f3579..cba5850 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -564,66 +564,49 @@ void KABCore::restoreSettings()
564 topLevelWidget()->setGeometry(x,y,w,h); 564 topLevelWidget()->setGeometry(x,y,w,h);
565 565
566 } else { 566 } else {
567 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 567 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
568 } 568 }
569#endif 569#endif
570} 570}
571 571
572void KABCore::saveSettings() 572void KABCore::saveSettings()
573{ 573{
574 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 574 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
575 if ( mExtensionBarSplitter ) 575 if ( mExtensionBarSplitter )
576 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 576 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
577 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 577 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
578 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 578 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
579#ifndef KAB_EMBEDDED 579#ifndef KAB_EMBEDDED
580 580
581 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 581 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
582 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 582 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
583#endif //KAB_EMBEDDED 583#endif //KAB_EMBEDDED
584 mExtensionManager->saveSettings(); 584 mExtensionManager->saveSettings();
585 mViewManager->saveSettings(); 585 mViewManager->saveSettings();
586 586
587 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 587 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
588#ifdef DESKTOP_VERSION 588
589 KConfig *config = KABPrefs::instance()->getConfig();
590 config->setGroup("WidgetLayout");
591 QStringList list ;//= config->readListEntry("MainLayout");
592 int x,y,w,h;
593 QWidget* wid;
594 wid = topLevelWidget();
595 x = wid->geometry().x();
596 y = wid->geometry().y();
597 w = wid->width();
598 h = wid->height();
599 list.clear();
600 list << QString::number( x );
601 list << QString::number( y );
602 list << QString::number( w );
603 list << QString::number( h );
604 config->writeEntry("MainLayout",list );
605#endif
606 KABPrefs::instance()->writeConfig(); 589 KABPrefs::instance()->writeConfig();
607 qDebug("KA: KABCore::saveSettings() "); 590 qDebug("KA: KABCore::saveSettings() ");
608} 591}
609 592
610KABC::AddressBook *KABCore::addressBook() const 593KABC::AddressBook *KABCore::addressBook() const
611{ 594{
612 return mAddressBook; 595 return mAddressBook;
613} 596}
614 597
615KConfig *KABCore::config() 598KConfig *KABCore::config()
616{ 599{
617#ifndef KAB_EMBEDDED 600#ifndef KAB_EMBEDDED
618 return KABPrefs::instance()->config(); 601 return KABPrefs::instance()->config();
619#else //KAB_EMBEDDED 602#else //KAB_EMBEDDED
620 return KABPrefs::instance()->getConfig(); 603 return KABPrefs::instance()->getConfig();
621#endif //KAB_EMBEDDED 604#endif //KAB_EMBEDDED
622} 605}
623 606
624KActionCollection *KABCore::actionCollection() const 607KActionCollection *KABCore::actionCollection() const
625{ 608{
626 return mGUIClient->actionCollection(); 609 return mGUIClient->actionCollection();
627} 610}
628 611
629KABC::Field *KABCore::currentSearchField() const 612KABC::Field *KABCore::currentSearchField() const
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 336e350..50db377 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -68,36 +68,52 @@ int main( int argc, char **argv )
68 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 68 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
69#else 69#else
70 QString fileName ; 70 QString fileName ;
71 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 71 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
72 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 72 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
73 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 73 QApplication::addLibraryPath ( qApp->applicationDirPath () );
74 74
75#endif 75#endif
76 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 76 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
77 // init language 77 // init language
78 KPimGlobalPrefs::instance()->setGlobalConfig(); 78 KPimGlobalPrefs::instance()->setGlobalConfig();
79 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); 79 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
80 KAddressBookMain m ; 80 KAddressBookMain m ;
81//US MainWindow m; 81//US MainWindow m;
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 83 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
84#endif 84#endif
85 85
86 86
87#ifndef DESKTOP_VERSION 87#ifndef DESKTOP_VERSION
88 a.showMainWidget( &m ); 88 a.showMainWidget( &m );
89 89
90#else 90#else
91 a.setMainWidget( &m ); 91 a.setMainWidget( &m );
92 m.resize (640, 480 );
93 m.show(); 92 m.show();
94#endif 93#endif
95 a.exec(); 94 a.exec();
96 95#ifdef DESKTOP_VERSION
97 dumpMissing(); 96 KConfig *config = KABPrefs::instance()->getConfig();
98 97 config->setGroup("WidgetLayout");
99 KPimGlobalPrefs::instance()->writeConfig(); 98 QStringList list ;//= config->readListEntry("MainLayout");
99 int x,y,w,h;
100 QWidget* wid;
101 wid = &m;
102 x = wid->geometry().x();
103 y = wid->geometry().y();
104 w = wid->width();
105 h = wid->height();
106 list.clear();
107 list << QString::number( x );
108 list << QString::number( y );
109 list << QString::number( w );
110 list << QString::number( h );
111 config->writeEntry("MainLayout",list );
112#endif
113 dumpMissing();
114
115 KPimGlobalPrefs::instance()->writeConfig();
100 } 116 }
101 qDebug("KA: Bye! "); 117 qDebug("KA: Bye! ");
102} 118}
103 119
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 0614d06..c738ad8 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -87,48 +87,50 @@ ViewManager::~ViewManager()
87 mViewFactoryDict.clear(); 87 mViewFactoryDict.clear();
88} 88}
89void ViewManager::scrollUP() 89void ViewManager::scrollUP()
90{ 90{
91 if ( mActiveView ) 91 if ( mActiveView )
92 mActiveView->scrollUP(); 92 mActiveView->scrollUP();
93} 93}
94void ViewManager::scrollDOWN() 94void ViewManager::scrollDOWN()
95{ 95{
96 if ( mActiveView ) 96 if ( mActiveView )
97 mActiveView->scrollDOWN(); 97 mActiveView->scrollDOWN();
98} 98}
99void ViewManager::restoreSettings() 99void ViewManager::restoreSettings()
100{ 100{
101 mViewNameList = KABPrefs::instance()->mViewNames; 101 mViewNameList = KABPrefs::instance()->mViewNames;
102 QString activeViewName = KABPrefs::instance()->mCurrentView; 102 QString activeViewName = KABPrefs::instance()->mCurrentView;
103 103
104 mActionSelectView->setItems( mViewNameList ); 104 mActionSelectView->setItems( mViewNameList );
105 105
106 // Filter 106 // Filter
107 mFilterList = Filter::restore( mCore->config(), "Filter" ); 107 mFilterList = Filter::restore( mCore->config(), "Filter" );
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() >= 800 )
112 cw = 200;
111 if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) 113 if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch)
112 cw = 0; 114 cw = 0;
113 mActionSelectFilter->setComboWidth( cw ); 115 mActionSelectFilter->setComboWidth( cw );
114 // Tell the views to reread their config, since they may have 116 // Tell the views to reread their config, since they may have
115 // been modified by global settings 117 // been modified by global settings
116 QString _oldgroup = mCore->config()->group(); 118 QString _oldgroup = mCore->config()->group();
117 119
118 QDictIterator<KAddressBookView> it( mViewDict ); 120 QDictIterator<KAddressBookView> it( mViewDict );
119 for ( it.toFirst(); it.current(); ++it ) { 121 for ( it.toFirst(); it.current(); ++it ) {
120 KConfigGroupSaver saver( mCore->config(), it.currentKey() ); 122 KConfigGroupSaver saver( mCore->config(), it.currentKey() );
121 it.current()->readConfig( mCore->config() ); 123 it.current()->readConfig( mCore->config() );
122 } 124 }
123 setActiveView( activeViewName ); 125 setActiveView( activeViewName );
124 126
125 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 127 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
126} 128}
127 129
128void ViewManager::saveSettings() 130void ViewManager::saveSettings()
129{ 131{
130 QString _oldgroup = mCore->config()->group(); 132 QString _oldgroup = mCore->config()->group();
131 133
132 QDictIterator<KAddressBookView> it( mViewDict ); 134 QDictIterator<KAddressBookView> it( mViewDict );
133 for ( it.toFirst(); it.current(); ++it ) { 135 for ( it.toFirst(); it.current(); ++it ) {
134 KConfigGroupSaver saver( mCore->config(), it.currentKey() ); 136 KConfigGroupSaver saver( mCore->config(), it.currentKey() );
@@ -583,48 +585,50 @@ void ViewManager::setActiveFilter( int index )
583 585
584 // Check if we have a view. Since the filter combo is created before 586 // Check if we have a view. Since the filter combo is created before
585 // the view, this slot could be called before there is a valid view. 587 // the view, this slot could be called before there is a valid view.
586 if ( mActiveView ) { 588 if ( mActiveView ) {
587 mActiveView->setFilter( currentFilter ); 589 mActiveView->setFilter( currentFilter );
588 mActiveView->refresh(); 590 mActiveView->refresh();
589 emit selected( QString::null ); 591 emit selected( QString::null );
590 } 592 }
591} 593}
592 594
593void ViewManager::configureFilters() 595void ViewManager::configureFilters()
594{ 596{
595 FilterDialog dlg( this ); 597 FilterDialog dlg( this );
596 598
597 dlg.setFilters( mFilterList ); 599 dlg.setFilters( mFilterList );
598 600
599 if ( dlg.exec() ) 601 if ( dlg.exec() )
600 mFilterList = dlg.filters(); 602 mFilterList = dlg.filters();
601 603
602 uint pos = mActionSelectFilter->currentItem(); 604 uint pos = mActionSelectFilter->currentItem();
603 mActionSelectFilter->setItems( filterNames() ); 605 mActionSelectFilter->setItems( filterNames() );
604 mActionSelectFilter->setCurrentItem( pos ); 606 mActionSelectFilter->setCurrentItem( pos );
605 setActiveFilter( pos ); 607 setActiveFilter( pos );
606 int cw = 150; 608 int cw = 150;
609 if ( QApplication::desktop()->width() >= 800 )
610 cw = 200;
607 if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) 611 if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch)
608 cw = 0; 612 cw = 0;
609 mActionSelectFilter->setComboWidth( cw ); 613 mActionSelectFilter->setComboWidth( cw );
610 saveSettings(); 614 saveSettings();
611} 615}
612 616
613QStringList ViewManager::filterNames() const 617QStringList ViewManager::filterNames() const
614{ 618{
615 QStringList names( i18n( "No Filter" ) ); 619 QStringList names( i18n( "No Filter" ) );
616 620
617 Filter::List::ConstIterator it; 621 Filter::List::ConstIterator it;
618 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) 622 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
619 names.append( (*it).name() ); 623 names.append( (*it).name() );
620 624
621 return names; 625 return names;
622} 626}
623Filter ViewManager::getFilterByName( const QString &name ) const 627Filter ViewManager::getFilterByName( const QString &name ) const
624{ 628{
625 Filter::List::ConstIterator it; 629 Filter::List::ConstIterator it;
626 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) 630 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
627 if ( name == (*it).name() ) 631 if ( name == (*it).name() )
628 return (*it); 632 return (*it);
629 633
630 return Filter(); 634 return Filter();