-rw-r--r-- | core/pim/today/today.cpp | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index f052a9f..7537631 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -64,9 +64,7 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | setOwnerField(); | 66 | setOwnerField(); |
67 | init(); | 67 | refresh(); |
68 | loadPlugins(); | ||
69 | draw(); | ||
70 | showMaximized(); | 68 | showMaximized(); |
71 | } | 69 | } |
72 | 70 | ||
@@ -118,7 +116,6 @@ void Today::init() { | |||
118 | 116 | ||
119 | // read config | 117 | // read config |
120 | Config cfg( "today" ); | 118 | Config cfg( "today" ); |
121 | |||
122 | cfg.setGroup( "Applets" ); | 119 | cfg.setGroup( "Applets" ); |
123 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 120 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
124 | } | 121 | } |
@@ -136,13 +133,13 @@ void Today::loadPlugins() { | |||
136 | } | 133 | } |
137 | pluginList.clear(); | 134 | pluginList.clear(); |
138 | 135 | ||
136 | |||
139 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 137 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
140 | QDir dir( path, "lib*.so" ); | 138 | QDir dir( path, "lib*.so" ); |
141 | 139 | ||
142 | QStringList list = dir.entryList(); | 140 | QStringList list = dir.entryList(); |
143 | QStringList::Iterator it; | 141 | QStringList::Iterator it; |
144 | 142 | ||
145 | uint count = 0; | ||
146 | for ( it = list.begin(); it != list.end(); ++it ) { | 143 | for ( it = list.begin(); it != list.end(); ++it ) { |
147 | TodayPluginInterface *iface = 0; | 144 | TodayPluginInterface *iface = 0; |
148 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 145 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
@@ -156,6 +153,7 @@ void Today::loadPlugins() { | |||
156 | plugin.iface = iface; | 153 | plugin.iface = iface; |
157 | plugin.name = QString(*it); | 154 | plugin.name = QString(*it); |
158 | 155 | ||
156 | // find out if plugins should be shown | ||
159 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 157 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
160 | plugin.active = true; | 158 | plugin.active = true; |
161 | } else { | 159 | } else { |
@@ -176,7 +174,6 @@ void Today::loadPlugins() { | |||
176 | QScrollView* sv = new QScrollView( plugin.guiBox ); | 174 | QScrollView* sv = new QScrollView( plugin.guiBox ); |
177 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); | 175 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); |
178 | sv->setMinimumHeight( plugin.guiPart->minHeight() ); | 176 | sv->setMinimumHeight( plugin.guiPart->minHeight() ); |
179 | //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); | ||
180 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 177 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
181 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 178 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
182 | sv->setFrameShape( QFrame::NoFrame ); | 179 | sv->setFrameShape( QFrame::NoFrame ); |
@@ -190,7 +187,6 @@ void Today::loadPlugins() { | |||
190 | layout->addWidget( plugin.guiBox ); | 187 | layout->addWidget( plugin.guiBox ); |
191 | 188 | ||
192 | pluginList.append( plugin ); | 189 | pluginList.append( plugin ); |
193 | count++; | ||
194 | } else { | 190 | } else { |
195 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); | 191 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); |
196 | delete lib; | 192 | delete lib; |
@@ -231,8 +227,8 @@ void Today::draw() { | |||
231 | noPluginsActive->setText( tr( "No plugins activated" ) ); | 227 | noPluginsActive->setText( tr( "No plugins activated" ) ); |
232 | layout->addWidget( noPluginsActive ); | 228 | layout->addWidget( noPluginsActive ); |
233 | } | 229 | } |
234 | 230 | //layout->addStretch(0); | |
235 | layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 231 | //layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
236 | } | 232 | } |
237 | 233 | ||
238 | 234 | ||
@@ -244,7 +240,6 @@ void Today::startConfig() { | |||
244 | TodayConfig conf( this, "dialog", true ); | 240 | TodayConfig conf( this, "dialog", true ); |
245 | 241 | ||
246 | TodayPlugin plugin; | 242 | TodayPlugin plugin; |
247 | |||
248 | QList<ConfigWidget> configWidgetList; | 243 | QList<ConfigWidget> configWidgetList; |
249 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 244 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
250 | plugin = pluginList[i]; | 245 | plugin = pluginList[i]; |
@@ -267,29 +262,28 @@ void Today::startConfig() { | |||
267 | confWidget = configWidgetList.next() ) { | 262 | confWidget = configWidgetList.next() ) { |
268 | confWidget->writeConfig(); | 263 | confWidget->writeConfig(); |
269 | } | 264 | } |
265 | refresh(); | ||
266 | } | ||
267 | } | ||
270 | 268 | ||
271 | init(); | ||
272 | |||
273 | TodayPlugin plugin; | ||
274 | QValueList<TodayPlugin> plugList; | ||
275 | for ( uint i = 0; i < pluginList.count(); i++ ) { | ||
276 | plugin = pluginList[i]; | ||
277 | 269 | ||
278 | if ( m_excludeApplets.grep( plugin.name ).isEmpty() ) { | 270 | /** |
279 | qDebug("CONFIG " + plugin.name + " ACTIVE"); | 271 | * Refresh for the view. Reload all applets |
280 | plugin.active = true; | 272 | * |
281 | } else { | 273 | */ |
282 | qDebug("CONFIG " + plugin.name + " INACTIVE"); | 274 | void Today::refresh() { |
283 | plugin.active = false; | 275 | init(); |
284 | } | ||
285 | plugList.append( plugin ); | ||
286 | } | ||
287 | pluginList = plugList; | ||
288 | 276 | ||
289 | draw(); | 277 | if ( layout ) { |
278 | delete layout; | ||
290 | } | 279 | } |
291 | } | 280 | layout = new QVBoxLayout( this ); |
281 | layout->addWidget( Frame ); | ||
282 | layout->addWidget( OwnerField ); | ||
292 | 283 | ||
284 | loadPlugins(); | ||
285 | draw(); | ||
286 | } | ||
293 | 287 | ||
294 | void Today::startAddressbook() { | 288 | void Today::startAddressbook() { |
295 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 289 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
@@ -308,14 +302,6 @@ void Today::editCard() { | |||
308 | QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); | 302 | QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); |
309 | } | 303 | } |
310 | 304 | ||
311 | /* | ||
312 | * launches an App | ||
313 | */ | ||
314 | void Today::launchApp( QString appName ) { | ||
315 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | ||
316 | e << QString( appName ); | ||
317 | } | ||
318 | |||
319 | Today::~Today() { | 305 | Today::~Today() { |
320 | } | 306 | } |
321 | 307 | ||