summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/extensionmanager.cpp54
-rw-r--r--kaddressbook/extensionmanager.h3
2 files changed, 30 insertions, 27 deletions
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp
index 9114cdc..98561dc 100644
--- a/kaddressbook/extensionmanager.cpp
+++ b/kaddressbook/extensionmanager.cpp
@@ -27,9 +27,9 @@
27#include <kdebug.h> 27#include <kdebug.h>
28#include <klocale.h> 28#include <klocale.h>
29 29
30#ifndef KAB_EMBEDDED 30#ifndef KAB_EMBEDDED
31#include <ktrader.h> 31#include <ktrader.h>
32#else //KAB_EMBEDDED 32#else //KAB_EMBEDDED
33#include <features/mergewidget.h> 33#include <features/mergewidget.h>
34#include <features/distributionlistwidget.h> 34#include <features/distributionlistwidget.h>
35#endif //KAB_EMBEDDED 35#endif //KAB_EMBEDDED
@@ -54,7 +54,7 @@ ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent,
54 "options_show_extensions" ); 54 "options_show_extensions" );
55 55
56 mActionExtensions->plug( settingsmenu ); 56 mActionExtensions->plug( settingsmenu );
57 57
58 connect( mActionExtensions, SIGNAL( activated( int ) ), 58 connect( mActionExtensions, SIGNAL( activated( int ) ),
59 SLOT( setActiveExtension( int ) ) ); 59 SLOT( setActiveExtension( int ) ) );
60 mWidgetBox = new QWidget( viewport() ); 60 mWidgetBox = new QWidget( viewport() );
@@ -74,10 +74,10 @@ void ExtensionManager::restoreSettings()
74 int i = 1; 74 int i = 1;
75 mCurrentExtensionWidget = mExtensionWidgetList.at( i-1 ); 75 mCurrentExtensionWidget = mExtensionWidgetList.at( i-1 );
76 while ( mCurrentExtensionWidget ) { 76 while ( mCurrentExtensionWidget ) {
77 if( i != KABPrefs::instance()->mCurrentExtension ) 77 if( i != KABPrefs::instance()->mCurrentExtension )
78 mCurrentExtensionWidget->hide(); 78 mCurrentExtensionWidget->hide();
79 mCurrentExtensionWidget = mExtensionWidgetList.at( ++i-1 ); 79 mCurrentExtensionWidget = mExtensionWidgetList.at( ++i-1 );
80 80
81 } 81 }
82 setActiveExtension( mActionExtensions->currentItem() ); 82 setActiveExtension( mActionExtensions->currentItem() );
83} 83}
@@ -91,7 +91,7 @@ void ExtensionManager::reconfigure()
91{ 91{
92 saveSettings(); 92 saveSettings();
93 createExtensionWidgets(); 93 createExtensionWidgets();
94 restoreSettings(); 94 restoreSettings();
95} 95}
96 96
97bool ExtensionManager::isQuickEditVisible() const 97bool ExtensionManager::isQuickEditVisible() const
@@ -112,33 +112,35 @@ void ExtensionManager::setActiveExtension( int id )
112 if ( id == 0 ) { 112 if ( id == 0 ) {
113 hide(); 113 hide();
114 mCurrentExtensionWidget = 0; 114 mCurrentExtensionWidget = 0;
115#ifndef DESKTOP_VERSION 115#ifndef DESKTOP_VERSION
116//US our screen is so small, that we better hide the detailscreen, just in case. 116//US our screen is so small, that we better hide the detailscreen, just in case.
117 mCore->setDetailsToState( ); 117//US mCore->setDetailsToState( );
118#endif //KAB_EMBEDDED 118#endif //KAB_EMBEDDED
119 } else if ( id > 0 ) { 119 } else if ( id > 0 ) {
120 if ( mCurrentExtensionWidget ) 120 if ( mCurrentExtensionWidget )
121 mCurrentExtensionWidget->hide(); 121 mCurrentExtensionWidget->hide();
122 122
123 mCurrentExtensionWidget = mExtensionWidgetList.at( id - 1 ); 123 mCurrentExtensionWidget = mExtensionWidgetList.at( id - 1 );
124 124
125 if ( mCurrentExtensionWidget ) { 125 if ( mCurrentExtensionWidget ) {
126#ifndef DESKTOP_VERSION 126#ifndef DESKTOP_VERSION
127//US our screen is so small, that we better hide the detailscreen, just in case. 127//US our screen is so small, that we better hide the detailscreen, just in case.
128 mCore->setDetailsVisible( false ); 128//US mCore->setDetailsVisible( false );
129#endif //KAB_EMBEDDED 129#endif //KAB_EMBEDDED
130 show(); 130 show();
131 mWidgetBox->show(); 131 mWidgetBox->show();
132 mCurrentExtensionWidget->show(); 132 mCurrentExtensionWidget->show();
133 } else { 133 } else {
134 hide(); 134 hide();
135 mCurrentExtensionWidget = 0; 135 mCurrentExtensionWidget = 0;
136#ifndef DESKTOP_VERSION 136#ifndef DESKTOP_VERSION
137//US our screen is so small, that we better hide the detailscreen, just in case. 137//US our screen is so small, that we better hide the detailscreen, just in case.
138 mCore->setDetailsToState( ); 138//US mCore->setDetailsToState( );
139#endif //KAB_EMBEDDED 139#endif //KAB_EMBEDDED
140 } 140 }
141 } 141 }
142
143 emit changedActiveExtension( id );
142} 144}
143 145
144void ExtensionManager::createExtensionWidgets() 146void ExtensionManager::createExtensionWidgets()
@@ -169,7 +171,7 @@ void ExtensionManager::createExtensionWidgets()
169 // load the other extensions 171 // load the other extensions
170 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 172 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
171 173
172#ifndef KAB_EMBEDDED 174#ifndef KAB_EMBEDDED
173 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 175 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
174 KTrader::OfferList::ConstIterator it; 176 KTrader::OfferList::ConstIterator it;
175 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 177 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
@@ -216,7 +218,7 @@ void ExtensionManager::createExtensionWidgets()
216 extensionNames.append( wdg->title() ); 218 extensionNames.append( wdg->title() );
217 } 219 }
218 } 220 }
219 221
220 //load DistributionListfactory/extension 222 //load DistributionListfactory/extension
221 extensionFactory = new DistributionListFactory(); 223 extensionFactory = new DistributionListFactory();
222 if (activeExtensions.contains( extensionFactory->identifier() ) ) 224 if (activeExtensions.contains( extensionFactory->identifier() ) )
@@ -231,16 +233,16 @@ void ExtensionManager::createExtensionWidgets()
231 extensionNames.append( wdg->title() ); 233 extensionNames.append( wdg->title() );
232 } 234 }
233 } 235 }
234 236
235 hbl->addStretch(); 237 hbl->addStretch();
236 238
237#endif //KAB_EMBEDDED 239#endif //KAB_EMBEDDED
238 240
239 241
240 mActionExtensions->setItems( extensionNames ); 242 mActionExtensions->setItems( extensionNames );
241 mCurrentExtensionWidget = 0; 243 mCurrentExtensionWidget = 0;
242} 244}
243 245
244#ifndef KAB_EMBEDDED 246#ifndef KAB_EMBEDDED
245#include "extensionmanager.moc" 247#include "extensionmanager.moc"
246#endif //KAB_EMBEDDED 248#endif //KAB_EMBEDDED
diff --git a/kaddressbook/extensionmanager.h b/kaddressbook/extensionmanager.h
index 8f64a50..611a037 100644
--- a/kaddressbook/extensionmanager.h
+++ b/kaddressbook/extensionmanager.h
@@ -68,6 +68,7 @@ class ExtensionManager : public QScrollView
68 68
69 signals: 69 signals:
70 void modified( const KABC::Addressee::List& ); 70 void modified( const KABC::Addressee::List& );
71 void changedActiveExtension( int id );
71 72
72 private slots: 73 private slots:
73 void setActiveExtension( int id ); 74 void setActiveExtension( int id );
@@ -82,7 +83,7 @@ class ExtensionManager : public QScrollView
82 QPtrList<ExtensionWidget> mExtensionWidgetList; 83 QPtrList<ExtensionWidget> mExtensionWidgetList;
83 84
84 KSelectAction *mActionExtensions; 85 KSelectAction *mActionExtensions;
85 86
86}; 87};
87 88
88#endif 89#endif