summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-04-04 17:22:44 (UTC)
committer mickeyl <mickeyl>2004-04-04 17:22:44 (UTC)
commitea3708cbc40ebc5f1db70546f0a93e8a23ba967c (patch) (unidiff)
tree7262b5c61f96db0062d8e079dbb50d9ad5f2045e
parent5dc77f8c1ef0b22d208a629ebbb61476909569be (diff)
downloadopie-ea3708cbc40ebc5f1db70546f0a93e8a23ba967c.zip
opie-ea3708cbc40ebc5f1db70546f0a93e8a23ba967c.tar.gz
opie-ea3708cbc40ebc5f1db70546f0a93e8a23ba967c.tar.bz2
fix odebug usage
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 3ddb88d..0a6269e 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,478 +1,478 @@
1/* 1/*
2 * today.cpp 2 * today.cpp
3 * 3 *
4 * copyright : (c) 2002,2003,2004 by Maximilian Reiß 4 * copyright : (c) 2002,2003,2004 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#define QTOPIA_INTERNAL_LANGLIST 17#define QTOPIA_INTERNAL_LANGLIST
18 18
19#include "today.h" 19#include "today.h"
20 20
21#include <opie2/odebug.h> 21#include <opie2/odebug.h>
22 22
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qpe/contact.h> 27#include <qpe/contact.h>
28 28
29#include <qdir.h> 29#include <qdir.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qwhatsthis.h> 31#include <qwhatsthis.h>
32 32
33using namespace Opie::Ui; 33using namespace Opie::Ui;
34struct TodayPlugin { 34struct TodayPlugin {
35 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} 35 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
36 QLibrary *library; 36 QLibrary *library;
37 QInterfacePtr<TodayPluginInterface> iface; 37 QInterfacePtr<TodayPluginInterface> iface;
38 TodayPluginObject *guiPart; 38 TodayPluginObject *guiPart;
39 QWidget *guiBox; 39 QWidget *guiBox;
40 QString name; 40 QString name;
41 bool active; 41 bool active;
42 bool excludeRefresh; 42 bool excludeRefresh;
43 int pos; 43 int pos;
44}; 44};
45 45
46static QValueList<TodayPlugin> pluginList; 46static QValueList<TodayPlugin> pluginList;
47 47
48static QMap<QString, TodayPlugin> tempList; 48static QMap<QString, TodayPlugin> tempList;
49 49
50Today::Today( QWidget* parent, const char* name, WFlags fl ) 50Today::Today( QWidget* parent, const char* name, WFlags fl )
51 : TodayBase( parent, name, fl ) { 51 : TodayBase( parent, name, fl ) {
52 52
53 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 53 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
54 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 54 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
55 55
56#if defined(Q_WS_QWS) 56#if defined(Q_WS_QWS)
57#if !defined(QT_NO_COP) 57#if !defined(QT_NO_COP)
58 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 58 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
59 connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), 59 connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
60 this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); 60 this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) );
61#endif 61#endif
62#endif 62#endif
63 63
64 setOwnerField(); 64 setOwnerField();
65 m_refreshTimer = new QTimer( this ); 65 m_refreshTimer = new QTimer( this );
66 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 66 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
67 m_refreshTimer->start( 15000 ); 67 m_refreshTimer->start( 15000 );
68 m_big_box = 0L; 68 m_big_box = 0L;
69 69
70 70
71 layout = new QVBoxLayout( this ); 71 layout = new QVBoxLayout( this );
72 layout->addWidget( Frame ); 72 layout->addWidget( Frame );
73 layout->addWidget( OwnerField ); 73 layout->addWidget( OwnerField );
74 74
75 m_sv = new QScrollView( this ); 75 m_sv = new QScrollView( this );
76 m_sv->setResizePolicy( QScrollView::AutoOneFit ); 76 m_sv->setResizePolicy( QScrollView::AutoOneFit );
77 m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); 77 m_sv->setHScrollBarMode( QScrollView::AlwaysOff );
78 m_sv->setFrameShape( QFrame::NoFrame ); 78 m_sv->setFrameShape( QFrame::NoFrame );
79 79
80 layout->addWidget( m_sv ); 80 layout->addWidget( m_sv );
81 layout->setStretchFactor( m_sv,4 ); 81 layout->setStretchFactor( m_sv,4 );
82 82
83 qApp->processEvents(); 83 qApp->processEvents();
84 loadPlugins(); 84 loadPlugins();
85 QPEApplication::showWidget( this ); 85 QPEApplication::showWidget( this );
86} 86}
87 87
88/** 88/**
89 * Qcop receive method. 89 * Qcop receive method.
90 */ 90 */
91void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 91void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
92 QDataStream stream( data, IO_ReadOnly ); 92 QDataStream stream( data, IO_ReadOnly );
93 if ( msg == "message(QString)" ) { 93 if ( msg == "message(QString)" ) {
94 QString message; 94 QString message;
95 stream >> message; 95 stream >> message;
96 setOwnerField( message ); 96 setOwnerField( message );
97 } 97 }
98} 98}
99 99
100void Today::setRefreshTimer( int interval ) { 100void Today::setRefreshTimer( int interval ) {
101 101
102 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 102 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
103 103
104 // 0 is "never" case 104 // 0 is "never" case
105 if ( !interval == 0 ) { 105 if ( !interval == 0 ) {
106 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 106 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
107 m_refreshTimer->changeInterval( interval ); 107 m_refreshTimer->changeInterval( interval );
108 } 108 }
109} 109}
110 110
111 111
112/** 112/**
113 * Initialises the owner field with the default value, the username 113 * Initialises the owner field with the default value, the username
114 */ 114 */
115void Today::setOwnerField() { 115void Today::setOwnerField() {
116 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 116 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
117 if ( QFile::exists( file ) ) { 117 if ( QFile::exists( file ) ) {
118 Contact cont = Contact::readVCard( file )[0]; 118 Contact cont = Contact::readVCard( file )[0];
119 QString returnString = cont.fullName(); 119 QString returnString = cont.fullName();
120 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 120 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
121 } else { 121 } else {
122 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 122 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
123 } 123 }
124} 124}
125 125
126/** 126/**
127 * Set the owner field with a given QString, for example per qcop. 127 * Set the owner field with a given QString, for example per qcop.
128 */ 128 */
129void Today::setOwnerField( QString &message ) { 129void Today::setOwnerField( QString &message ) {
130 if ( !message.isEmpty() ) { 130 if ( !message.isEmpty() ) {
131 OwnerField->setText( "<b>" + message + "</b>" ); 131 OwnerField->setText( "<b>" + message + "</b>" );
132 } 132 }
133} 133}
134 134
135/** 135/**
136 * Init stuff needed for today. Reads the config file. 136 * Init stuff needed for today. Reads the config file.
137 */ 137 */
138void Today::init() { 138void Today::init() {
139 // read config 139 // read config
140 Config cfg( "today" ); 140 Config cfg( "today" );
141 141
142 cfg.setGroup( "Plugins" ); 142 cfg.setGroup( "Plugins" );
143 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 143 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
144 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 144 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
145 145
146 cfg.setGroup( "General" ); 146 cfg.setGroup( "General" );
147 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 147 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
148 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); 148 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 );
149 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 149 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
150 150
151 // set the date in top label 151 // set the date in top label
152 QDate date = QDate::currentDate(); 152 QDate date = QDate::currentDate();
153 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); 153 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) );
154 154
155 if ( m_hideBanner ) { 155 if ( m_hideBanner ) {
156 Opiezilla->hide(); 156 Opiezilla->hide();
157 TodayLabel->hide(); 157 TodayLabel->hide();
158 } else { 158 } else {
159 Opiezilla->show(); 159 Opiezilla->show();
160 TodayLabel->show(); 160 TodayLabel->show();
161 } 161 }
162 162
163 if ( m_big_box ) { 163 if ( m_big_box ) {
164 delete m_big_box; 164 delete m_big_box;
165 } 165 }
166 166
167 m_big_box = new QWidget( m_sv->viewport() ); 167 m_big_box = new QWidget( m_sv->viewport() );
168 m_sv->addChild( m_big_box ); 168 m_sv->addChild( m_big_box );
169 m_bblayout = new QVBoxLayout ( m_big_box ); 169 m_bblayout = new QVBoxLayout ( m_big_box );
170} 170}
171 171
172/** 172/**
173 * Load the plugins 173 * Load the plugins
174 */ 174 */
175void Today::loadPlugins() { 175void Today::loadPlugins() {
176 176
177 init(); 177 init();
178 178
179 QValueList<TodayPlugin>::Iterator tit; 179 QValueList<TodayPlugin>::Iterator tit;
180 if ( !pluginList.isEmpty() ) { 180 if ( !pluginList.isEmpty() ) {
181 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 181 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
182 (*tit).guiBox->hide(); 182 (*tit).guiBox->hide();
183 (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); 183 (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) );
184 delete (*tit).guiBox; 184 delete (*tit).guiBox;
185 (*tit).library->unload(); 185 (*tit).library->unload();
186 delete (*tit).library; 186 delete (*tit).library;
187 } 187 }
188 pluginList.clear(); 188 pluginList.clear();
189 } 189 }
190 190
191 QString path = QPEApplication::qpeDir() + "/plugins/today"; 191 QString path = QPEApplication::qpeDir() + "/plugins/today";
192#ifdef Q_OS_MACX 192#ifdef Q_OS_MACX
193 Opie::Core::owarn << "Searching for Plugins in: " << path << oendl; 193 owarn << "Searching for Plugins in: " << path << oendl;
194 QDir dir( path, "lib*.dylib" ); 194 QDir dir( path, "lib*.dylib" );
195#else 195#else
196 QDir dir( path, "lib*.so" ); 196 QDir dir( path, "lib*.so" );
197#endif 197#endif
198 198
199 QStringList list = dir.entryList(); 199 QStringList list = dir.entryList();
200 QStringList::Iterator it; 200 QStringList::Iterator it;
201 201
202 // QMap<QString, TodayPlugin> tempList; 202 // QMap<QString, TodayPlugin> tempList;
203 203
204 for ( it = list.begin(); it != list.end(); ++it ) { 204 for ( it = list.begin(); it != list.end(); ++it ) {
205 QInterfacePtr<TodayPluginInterface> iface; 205 QInterfacePtr<TodayPluginInterface> iface;
206 QLibrary *lib = new QLibrary( path + "/" + *it ); 206 QLibrary *lib = new QLibrary( path + "/" + *it );
207 207
208 Opie::Core::odebug << "querying: " << path + "/" + *it << oendl; 208 odebug << "querying: " << path + "/" + *it << oendl;
209 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 209 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
210 Opie::Core::odebug << "accepted: " << path + "/" + *it << oendl; 210 odebug << "accepted: " << path + "/" + *it << oendl;
211 Opie::Core::odebug << *it << oendl; 211 odebug << *it << oendl;
212 212
213 TodayPlugin plugin; 213 TodayPlugin plugin;
214 plugin.library = lib; 214 plugin.library = lib;
215 plugin.iface = iface; 215 plugin.iface = iface;
216 plugin.name = QString(*it); 216 plugin.name = QString(*it);
217 217
218 QString type = (*it).left( (*it).find(".") ); 218 QString type = (*it).left( (*it).find(".") );
219 219
220 QString lang; 220 QString lang;
221 Config config("locale"); 221 Config config("locale");
222 config.setGroup("Language"); 222 config.setGroup("Language");
223 lang = config.readEntry( "Language", "en" ); 223 lang = config.readEntry( "Language", "en" );
224 224
225 Opie::Core::odebug << "Languages: " << lang << oendl; 225 odebug << "Languages: " << lang << oendl;
226 QTranslator * trans = new QTranslator( qApp ); 226 QTranslator * trans = new QTranslator( qApp );
227 QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; 227 QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm";
228 if ( trans->load( tfn ) ) { 228 if ( trans->load( tfn ) ) {
229 qApp->installTranslator( trans ); 229 qApp->installTranslator( trans );
230 } else { 230 } else {
231 delete trans; 231 delete trans;
232 } 232 }
233 233
234 234
235 // find out if plugins should be shown 235 // find out if plugins should be shown
236 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 236 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
237 plugin.active = true; 237 plugin.active = true;
238 } else { 238 } else {
239 plugin.active = false; 239 plugin.active = false;
240 } 240 }
241 241
242 plugin.guiPart = plugin.iface->guiPart(); 242 plugin.guiPart = plugin.iface->guiPart();
243 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); 243 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh();
244 244
245 // package the whole thing into a qwidget so it can be shown and hidden 245 // package the whole thing into a qwidget so it can be shown and hidden
246 plugin.guiBox = new QWidget( m_big_box ); 246 plugin.guiBox = new QWidget( m_big_box );
247 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); 247 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
248 QPixmap plugPix; 248 QPixmap plugPix;
249 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); 249 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 );
250 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); 250 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
251 plugIcon->setPixmap( plugPix ); 251 plugIcon->setPixmap( plugPix );
252 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); 252 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") );
253 plugIcon->setName( plugin.guiPart->appName() ); 253 plugIcon->setName( plugin.guiPart->appName() );
254 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); 254 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) );
255 255
256 QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox ); 256 QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox );
257 boxLayout->addWidget( plugIcon, 0, AlignTop ); 257 boxLayout->addWidget( plugIcon, 0, AlignTop );
258 boxLayout->addWidget( plugWidget, 0, AlignTop ); 258 boxLayout->addWidget( plugWidget, 0, AlignTop );
259 boxLayout->setStretchFactor( plugIcon, 1 ); 259 boxLayout->setStretchFactor( plugIcon, 1 );
260 boxLayout->setStretchFactor( plugWidget, 9 ); 260 boxLayout->setStretchFactor( plugWidget, 9 );
261 261
262 // "prebuffer" it in one more list, to get the sorting done 262 // "prebuffer" it in one more list, to get the sorting done
263 tempList.insert( plugin.name, plugin ); 263 tempList.insert( plugin.name, plugin );
264 264
265 // on first start the list is off course empty 265 // on first start the list is off course empty
266 if ( m_allApplets.isEmpty() ) { 266 if ( m_allApplets.isEmpty() ) {
267 pluginList.append( plugin ); 267 pluginList.append( plugin );
268 m_bblayout->addWidget( plugin.guiBox ); 268 m_bblayout->addWidget( plugin.guiBox );
269 } 269 }
270 270
271 // if plugin is not yet in the list, add it to the layout too 271 // if plugin is not yet in the list, add it to the layout too
272 else if ( !m_allApplets.contains( plugin.name ) ) { 272 else if ( !m_allApplets.contains( plugin.name ) ) {
273 pluginList.append( plugin ); 273 pluginList.append( plugin );
274 } 274 }
275 } else { 275 } else {
276 Opie::Core::odebug << "could not recognize " << path + "/" + *it << oendl; 276 odebug << "could not recognize " << path + "/" + *it << oendl;
277 delete lib; 277 delete lib;
278 } 278 }
279 279
280 } 280 }
281 281
282 282
283 if ( !m_allApplets.isEmpty() ) { 283 if ( !m_allApplets.isEmpty() ) {
284 TodayPlugin tempPlugin; 284 TodayPlugin tempPlugin;
285 QStringList::Iterator stringit; 285 QStringList::Iterator stringit;
286 286
287 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { 287 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
288 tempPlugin = ( tempList.find( *stringit ) ).data(); 288 tempPlugin = ( tempList.find( *stringit ) ).data();
289 if ( !( (tempPlugin.name).isEmpty() ) ) { 289 if ( !( (tempPlugin.name).isEmpty() ) ) {
290 pluginList.append( tempPlugin ); 290 pluginList.append( tempPlugin );
291 m_bblayout->addWidget( tempPlugin.guiBox ); 291 m_bblayout->addWidget( tempPlugin.guiBox );
292 } 292 }
293 } 293 }
294 } 294 }
295 m_bblayout->addStretch( 2 ); 295 m_bblayout->addStretch( 2 );
296 draw(); 296 draw();
297} 297}
298 298
299 299
300 300
301 301
302/** 302/**
303 * Repaint method. Reread all fields. 303 * Repaint method. Reread all fields.
304 */ 304 */
305void Today::draw() { 305void Today::draw() {
306 306
307 if ( pluginList.count() == 0 ) { 307 if ( pluginList.count() == 0 ) {
308 QLabel *noPlugins = new QLabel( this ); 308 QLabel *noPlugins = new QLabel( this );
309 noPlugins->setText( tr( "No plugins found" ) ); 309 noPlugins->setText( tr( "No plugins found" ) );
310 layout->addWidget( noPlugins ); 310 layout->addWidget( noPlugins );
311 return; 311 return;
312 } 312 }
313 313
314 uint count = 0; 314 uint count = 0;
315 TodayPlugin plugin; 315 TodayPlugin plugin;
316 for ( uint i = 0; i < pluginList.count(); i++ ) { 316 for ( uint i = 0; i < pluginList.count(); i++ ) {
317 plugin = pluginList[i]; 317 plugin = pluginList[i];
318 318
319 if ( plugin.active ) { 319 if ( plugin.active ) {
320 //Opie::Core::odebug << plugin.name << " is ACTIVE " << oendl; 320 //odebug << plugin.name << " is ACTIVE " << oendl;
321 plugin.guiBox->show(); 321 plugin.guiBox->show();
322 } else { 322 } else {
323 //Opie::Core::odebug << plugin.name << " is INACTIVE " << oendl; 323 //odebug << plugin.name << " is INACTIVE " << oendl;
324 plugin.guiBox->hide(); 324 plugin.guiBox->hide();
325 } 325 }
326 count++; 326 count++;
327 } 327 }
328 328
329 if ( count == 0 ) { 329 if ( count == 0 ) {
330 QLabel *noPluginsActive = new QLabel( this ); 330 QLabel *noPluginsActive = new QLabel( this );
331 noPluginsActive->setText( tr( "No plugins activated" ) ); 331 noPluginsActive->setText( tr( "No plugins activated" ) );
332 layout->addWidget( noPluginsActive ); 332 layout->addWidget( noPluginsActive );
333 } 333 }
334 repaint(); 334 repaint();
335} 335}
336 336
337 337
338/** 338/**
339 * The method for the configuration dialog. 339 * The method for the configuration dialog.
340 */ 340 */
341void Today::startConfig() { 341void Today::startConfig() {
342 342
343 // disconnect timer to prevent problems while being on config dialog 343 // disconnect timer to prevent problems while being on config dialog
344 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 344 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
345 m_refreshTimer->stop( ); 345 m_refreshTimer->stop( );
346 346
347 TodayConfig conf( this, "dialog", true ); 347 TodayConfig conf( this, "dialog", true );
348 348
349 TodayPlugin plugin; 349 TodayPlugin plugin;
350 QList<TodayConfigWidget> configWidgetList; 350 QList<TodayConfigWidget> configWidgetList;
351 351
352 for ( int i = pluginList.count() - 1; i >= 0; i-- ) { 352 for ( int i = pluginList.count() - 1; i >= 0; i-- ) {
353 plugin = pluginList[i]; 353 plugin = pluginList[i];
354 354
355 // load the config widgets in the tabs 355 // load the config widgets in the tabs
356 if ( plugin.guiPart->configWidget( this ) != 0l ) { 356 if ( plugin.guiPart->configWidget( this ) != 0l ) {
357 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); 357 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
358 configWidgetList.append( widget ); 358 configWidgetList.append( widget );
359 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() 359 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig()
360 , plugin.guiPart->appName() ); 360 , plugin.guiPart->appName() );
361 } 361 }
362 // set the order/activate tab 362 // set the order/activate tab
363 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), 363 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(),
364 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); 364 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) );
365 } 365 }
366 366
367 if ( conf.exec() == QDialog::Accepted ) { 367 if ( conf.exec() == QDialog::Accepted ) {
368 conf.writeConfig(); 368 conf.writeConfig();
369 TodayConfigWidget *confWidget; 369 TodayConfigWidget *confWidget;
370 for ( confWidget = configWidgetList.first(); confWidget != 0; 370 for ( confWidget = configWidgetList.first(); confWidget != 0;
371 confWidget = configWidgetList.next() ) { 371 confWidget = configWidgetList.next() ) {
372 confWidget->writeConfig(); 372 confWidget->writeConfig();
373 } 373 }
374 374
375 // make the plugins to reinitialize ( reread its configs ) 375 // make the plugins to reinitialize ( reread its configs )
376 reinitialize(); 376 reinitialize();
377 draw(); 377 draw();
378 378
379 } else { 379 } else {
380 // since refresh is not called in that case , reconnect the signal 380 // since refresh is not called in that case , reconnect the signal
381 m_refreshTimer->start( 15000 ); // get the config value in here later 381 m_refreshTimer->start( 15000 ); // get the config value in here later
382 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 382 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
383 } 383 }
384} 384}
385 385
386 386
387 387
388void Today::reinitialize() { 388void Today::reinitialize() {
389 389
390 Config cfg( "today" ); 390 Config cfg( "today" );
391 cfg.setGroup( "Plugins" ); 391 cfg.setGroup( "Plugins" );
392 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 392 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
393 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 393 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
394 394
395 /* reinitialize all plugins */ 395 /* reinitialize all plugins */
396 QValueList<TodayPlugin>::Iterator it; 396 QValueList<TodayPlugin>::Iterator it;
397 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { 397 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
398 if ( !(*it).excludeRefresh ) { 398 if ( !(*it).excludeRefresh ) {
399 (*it).guiPart->reinitialize(); 399 (*it).guiPart->reinitialize();
400 Opie::Core::odebug << "reinit" << oendl; 400 odebug << "reinit" << oendl;
401 } 401 }
402 402
403 /* check if plugins is still to be shown */ 403 /* check if plugins is still to be shown */
404 if ( m_excludeApplets.grep( (*it).name ).isEmpty() ) { 404 if ( m_excludeApplets.grep( (*it).name ).isEmpty() ) {
405 (*it).active = true; 405 (*it).active = true;
406 } else { 406 } else {
407 (*it).active = false; 407 (*it).active = false;
408 } 408 }
409 409
410 } 410 }
411 411
412 cfg.setGroup( "General" ); 412 cfg.setGroup( "General" );
413 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 413 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
414 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); 414 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 );
415 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 415 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
416 416
417 // set the date in top label 417 // set the date in top label
418 QDate date = QDate::currentDate(); 418 QDate date = QDate::currentDate();
419 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); 419 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) );
420 420
421 if ( m_hideBanner ) { 421 if ( m_hideBanner ) {
422 Opiezilla->hide(); 422 Opiezilla->hide();
423 TodayLabel->hide(); 423 TodayLabel->hide();
424 } else { 424 } else {
425 Opiezilla->show(); 425 Opiezilla->show();
426 TodayLabel->show(); 426 TodayLabel->show();
427 } 427 }
428 428
429 delete m_bblayout; 429 delete m_bblayout;
430 m_bblayout = new QVBoxLayout( m_big_box ); 430 m_bblayout = new QVBoxLayout( m_big_box );
431 TodayPlugin tempPlugin; 431 TodayPlugin tempPlugin;
432 QStringList::Iterator stringit; 432 QStringList::Iterator stringit;
433 433
434 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { 434 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
435 tempPlugin = ( tempList.find( *stringit ) ).data(); 435 tempPlugin = ( tempList.find( *stringit ) ).data();
436 if ( !( (tempPlugin.name).isEmpty() ) ) { 436 if ( !( (tempPlugin.name).isEmpty() ) ) {
437 m_bblayout->addWidget( tempPlugin.guiBox ); 437 m_bblayout->addWidget( tempPlugin.guiBox );
438 } 438 }
439 } 439 }
440 m_bblayout->addStretch( 2 ); 440 m_bblayout->addStretch( 2 );
441 441
442} 442}
443 443
444/** 444/**
445 * Refresh for the view. Reload all applets 445 * Refresh for the view. Reload all applets
446 * 446 *
447 */ 447 */
448void Today::refresh() { 448void Today::refresh() {
449 449
450 QValueList<TodayPlugin>::Iterator it; 450 QValueList<TodayPlugin>::Iterator it;
451 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { 451 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
452 if ( !(*it).excludeRefresh ) { 452 if ( !(*it).excludeRefresh ) {
453 (*it).guiPart->refresh(); 453 (*it).guiPart->refresh();
454 Opie::Core::odebug << "refresh" << oendl; 454 odebug << "refresh" << oendl;
455 } 455 }
456 } 456 }
457 457
458 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) ); 458 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) );
459 459
460 updateGeometry(); 460 updateGeometry();
461 repaint(); 461 repaint();
462} 462}
463 463
464void Today::startApplication() { 464void Today::startApplication() {
465 QCopEnvelope e( "QPE/System", "execute(QString)" ); 465 QCopEnvelope e( "QPE/System", "execute(QString)" );
466 e << QString( sender()->name() ); 466 e << QString( sender()->name() );
467} 467}
468 468
469/** 469/**
470 * launch addressbook (personal card) 470 * launch addressbook (personal card)
471 */ 471 */
472void Today::editCard() { 472void Today::editCard() {
473 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); 473 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" );
474} 474}
475 475
476Today::~Today() { 476Today::~Today() {
477} 477}
478 478