summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-11-21 17:22:36 (UTC)
committer harlekin <harlekin>2002-11-21 17:22:36 (UTC)
commit9e4b4807e89a5ccea45a119db9e7d8d02972dc98 (patch) (unidiff)
tree6f47567e6ea18ce9d54b40678d6fc3cf762d1cee
parent7a425e527b7ed11cd113365e6c45ebecd0d72c79 (diff)
downloadopie-9e4b4807e89a5ccea45a119db9e7d8d02972dc98.zip
opie-9e4b4807e89a5ccea45a119db9e7d8d02972dc98.tar.gz
opie-9e4b4807e89a5ccea45a119db9e7d8d02972dc98.tar.bz2
better way to launch edit personal data
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp16
-rw-r--r--core/pim/today/today.h1
2 files changed, 2 insertions, 15 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 1b31cfd..e6f8c93 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,400 +1,388 @@
1/* 1/*
2 * today.cpp 2 * today.cpp
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 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 17
18#include "today.h" 18#include "today.h"
19#include <opie/todayconfigwidget.h> 19#include <opie/todayconfigwidget.h>
20 20
21#include <qpe/config.h> 21#include <qpe/config.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/global.h> 24#include <qpe/global.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/contact.h> 26#include <qpe/contact.h>
27 27
28#include <qdir.h> 28#include <qdir.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qpixmap.h> 33#include <qpixmap.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <opie/otabwidget.h> 36#include <opie/otabwidget.h>
37#include <qdialog.h> 37#include <qdialog.h>
38#include <qwhatsthis.h> 38#include <qwhatsthis.h>
39 39
40 40
41struct TodayPlugin { 41struct TodayPlugin {
42 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} 42 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
43 QLibrary *library; 43 QLibrary *library;
44 QInterfacePtr<TodayPluginInterface> iface; 44 QInterfacePtr<TodayPluginInterface> iface;
45 TodayPluginObject *guiPart; 45 TodayPluginObject *guiPart;
46 QWidget *guiBox; 46 QWidget *guiBox;
47 QString name; 47 QString name;
48 bool active; 48 bool active;
49 bool excludeRefresh; 49 bool excludeRefresh;
50 int pos; 50 int pos;
51}; 51};
52 52
53static QValueList<TodayPlugin> pluginList; 53static QValueList<TodayPlugin> pluginList;
54 54
55Today::Today( QWidget* parent, const char* name, WFlags fl ) 55Today::Today( QWidget* parent, const char* name, WFlags fl )
56 : TodayBase( parent, name, fl ) { 56 : TodayBase( parent, name, fl ) {
57 57
58 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 58 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
59 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 59 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
60 60
61#if defined(Q_WS_QWS) 61#if defined(Q_WS_QWS)
62#if !defined(QT_NO_COP) 62#if !defined(QT_NO_COP)
63 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 63 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
64 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 64 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
65 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 65 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
66#endif 66#endif
67#endif 67#endif
68 68
69 setOwnerField(); 69 setOwnerField();
70 m_refreshTimer = new QTimer( this ); 70 m_refreshTimer = new QTimer( this );
71 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 71 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
72 m_refreshTimer->start( 15000 ); 72 m_refreshTimer->start( 15000 );
73 refresh(); 73 refresh();
74 showMaximized(); 74 showMaximized();
75} 75}
76 76
77/** 77/**
78 * Qcop receive method. 78 * Qcop receive method.
79 */ 79 */
80void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 80void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
81 QDataStream stream( data, IO_ReadOnly ); 81 QDataStream stream( data, IO_ReadOnly );
82 if ( msg == "message(QString)" ) { 82 if ( msg == "message(QString)" ) {
83 QString message; 83 QString message;
84 stream >> message; 84 stream >> message;
85 setOwnerField( message ); 85 setOwnerField( message );
86 } 86 }
87} 87}
88 88
89void Today::setRefreshTimer( int interval ) { 89void Today::setRefreshTimer( int interval ) {
90 90
91 91
92 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 92 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
93 93
94 // 0 is "never" case 94 // 0 is "never" case
95 if ( !interval == 0 ) { 95 if ( !interval == 0 ) {
96 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 96 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
97 m_refreshTimer->changeInterval( interval ); 97 m_refreshTimer->changeInterval( interval );
98 } 98 }
99} 99}
100 100
101 101
102/** 102/**
103 * Initialises the owner field with the default value, the username 103 * Initialises the owner field with the default value, the username
104 */ 104 */
105void Today::setOwnerField() { 105void Today::setOwnerField() {
106 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 106 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
107 if ( QFile::exists( file ) ) { 107 if ( QFile::exists( file ) ) {
108 Contact cont = Contact::readVCard( file )[0]; 108 Contact cont = Contact::readVCard( file )[0];
109 QString returnString = cont.fullName(); 109 QString returnString = cont.fullName();
110 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 110 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
111 } else { 111 } else {
112 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 112 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
113 } 113 }
114} 114}
115 115
116/** 116/**
117 * Set the owner field with a given QString, for example per qcop. 117 * Set the owner field with a given QString, for example per qcop.
118 */ 118 */
119void Today::setOwnerField( QString &message ) { 119void Today::setOwnerField( QString &message ) {
120 if ( !message.isEmpty() ) { 120 if ( !message.isEmpty() ) {
121 OwnerField->setText( "<b>" + message + "</b>" ); 121 OwnerField->setText( "<b>" + message + "</b>" );
122 } 122 }
123} 123}
124 124
125 125
126/** 126/**
127 * Init stuff needed for today. Reads the config file. 127 * Init stuff needed for today. Reads the config file.
128 */ 128 */
129void Today::init() { 129void Today::init() {
130 // read config 130 // read config
131 Config cfg( "today" ); 131 Config cfg( "today" );
132 132
133 cfg.setGroup( "Plugins" ); 133 cfg.setGroup( "Plugins" );
134 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 134 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
135 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 135 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
136 136
137 cfg.setGroup( "General" ); 137 cfg.setGroup( "General" );
138 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 138 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
139 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 139 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
140} 140}
141 141
142 142
143/** 143/**
144 * Load the plugins 144 * Load the plugins
145 */ 145 */
146void Today::loadPlugins() { 146void Today::loadPlugins() {
147 147
148 // extra list for plugins that exclude themself from periodic refresh 148 // extra list for plugins that exclude themself from periodic refresh
149 QMap<QString, TodayPlugin> pluginListRefreshExclude; 149 QMap<QString, TodayPlugin> pluginListRefreshExclude;
150 150
151 QValueList<TodayPlugin>::Iterator tit; 151 QValueList<TodayPlugin>::Iterator tit;
152 if ( !pluginList.isEmpty() ) { 152 if ( !pluginList.isEmpty() ) {
153 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 153 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
154 if ( (*tit).excludeRefresh ) { 154 if ( (*tit).excludeRefresh ) {
155 pluginListRefreshExclude.insert( (*tit).name , (*tit) ); 155 pluginListRefreshExclude.insert( (*tit).name , (*tit) );
156 qDebug( "Found an plugin that does not want refresh feature" ); 156 qDebug( "Found an plugin that does not want refresh feature" );
157 } else { 157 } else {
158 (*tit).library->unload(); 158 (*tit).library->unload();
159 delete (*tit).library; 159 delete (*tit).library;
160 } 160 }
161 } 161 }
162 pluginList.clear(); 162 pluginList.clear();
163 } 163 }
164 164
165 QString path = QPEApplication::qpeDir() + "/plugins/today"; 165 QString path = QPEApplication::qpeDir() + "/plugins/today";
166 QDir dir( path, "lib*.so" ); 166 QDir dir( path, "lib*.so" );
167 167
168 QStringList list = dir.entryList(); 168 QStringList list = dir.entryList();
169 QStringList::Iterator it; 169 QStringList::Iterator it;
170 170
171 QMap<QString, TodayPlugin> tempList; 171 QMap<QString, TodayPlugin> tempList;
172 172
173 for ( it = list.begin(); it != list.end(); ++it ) { 173 for ( it = list.begin(); it != list.end(); ++it ) {
174 //TodayPluginInterface *iface = 0; 174 //TodayPluginInterface *iface = 0;
175 QInterfacePtr<TodayPluginInterface> iface; 175 QInterfacePtr<TodayPluginInterface> iface;
176 QLibrary *lib = new QLibrary( path + "/" + *it ); 176 QLibrary *lib = new QLibrary( path + "/" + *it );
177 177
178 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 178 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
179 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 179 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
180 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); 180 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
181 qDebug( QString(*it) ); 181 qDebug( QString(*it) );
182 182
183 // If plugin is exludes from refresh, get it in the list again here. 183 // If plugin is exludes from refresh, get it in the list again here.
184 184
185 if ( pluginListRefreshExclude.contains( (*it) ) ) { 185 if ( pluginListRefreshExclude.contains( (*it) ) ) {
186 // if its not in allApplets list, add it to a layout 186 // if its not in allApplets list, add it to a layout
187 if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) { 187 if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) {
188 qDebug( "NUGASDA" );
189 layout->addWidget( pluginListRefreshExclude[(*it)].guiBox ); 188 layout->addWidget( pluginListRefreshExclude[(*it)].guiBox );
190 pluginList.append( pluginListRefreshExclude[(*it)] ); 189 pluginList.append( pluginListRefreshExclude[(*it)] );
191 } else { 190 } else {
192 tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); 191 tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] );
193 qDebug( "TEST2 " + pluginListRefreshExclude[(*it)].name );
194 } 192 }
195 } else { 193 } else {
196 194
197 TodayPlugin plugin; 195 TodayPlugin plugin;
198 plugin.library = lib; 196 plugin.library = lib;
199 plugin.iface = iface; 197 plugin.iface = iface;
200 plugin.name = QString(*it); 198 plugin.name = QString(*it);
201 199
202 // find out if plugins should be shown 200 // find out if plugins should be shown
203 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 201 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
204 plugin.active = true; 202 plugin.active = true;
205 } else { 203 } else {
206 plugin.active = false; 204 plugin.active = false;
207 } 205 }
208 206
209 plugin.guiPart = plugin.iface->guiPart(); 207 plugin.guiPart = plugin.iface->guiPart();
210 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); 208 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh();
211 209
212 // package the whole thing into a qwidget so it can be shown and hidden 210 // package the whole thing into a qwidget so it can be shown and hidden
213 plugin.guiBox = new QWidget( this ); 211 plugin.guiBox = new QWidget( this );
214 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); 212 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
215 QPixmap plugPix; 213 QPixmap plugPix;
216 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); 214 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 );
217 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); 215 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
218 plugIcon->setPixmap( plugPix ); 216 plugIcon->setPixmap( plugPix );
219 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); 217 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") );
220 plugIcon->setName( plugin.guiPart->appName() ); 218 plugIcon->setName( plugin.guiPart->appName() );
221 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); 219 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) );
222 // a scrollview for each plugin 220 // a scrollview for each plugin
223 QScrollView* sv = new QScrollView( plugin.guiBox ); 221 QScrollView* sv = new QScrollView( plugin.guiBox );
224 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); 222 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() );
225 // not sure if that is good .-) 223 // not sure if that is good .-)
226 sv->setMinimumHeight( 10 ); 224 sv->setMinimumHeight( 10 );
227 sv->setResizePolicy( QScrollView::AutoOneFit ); 225 sv->setResizePolicy( QScrollView::AutoOneFit );
228 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 226 sv->setHScrollBarMode( QScrollView::AlwaysOff );
229 sv->setFrameShape( QFrame::NoFrame ); 227 sv->setFrameShape( QFrame::NoFrame );
230 sv->addChild( plugWidget ); 228 sv->addChild( plugWidget );
231 // make sure the icon is on the top alligned 229 // make sure the icon is on the top alligned
232 boxLayout->addWidget( plugIcon, 0, AlignTop ); 230 boxLayout->addWidget( plugIcon, 0, AlignTop );
233 boxLayout->addWidget( sv, 0, AlignTop ); 231 boxLayout->addWidget( sv, 0, AlignTop );
234 boxLayout->setStretchFactor( plugIcon, 1 ); 232 boxLayout->setStretchFactor( plugIcon, 1 );
235 boxLayout->setStretchFactor( sv, 9 ); 233 boxLayout->setStretchFactor( sv, 9 );
236 // "prebuffer" it in one more list, to get the sorting done 234 // "prebuffer" it in one more list, to get the sorting done
237 tempList.insert( plugin.name, plugin ); 235 tempList.insert( plugin.name, plugin );
238 236
239 // on first start the list is off course empty 237 // on first start the list is off course empty
240 if ( m_allApplets.isEmpty() ) { 238 if ( m_allApplets.isEmpty() ) {
241 layout->addWidget( plugin.guiBox ); 239 layout->addWidget( plugin.guiBox );
242 pluginList.append( plugin ); 240 pluginList.append( plugin );
243 } 241 }
244 242
245 // if plugin is not yet in the list, add it to the layout too 243 // if plugin is not yet in the list, add it to the layout too
246 else if ( !m_allApplets.contains( plugin.name ) ) { 244 else if ( !m_allApplets.contains( plugin.name ) ) {
247 layout->addWidget( plugin.guiBox ); 245 layout->addWidget( plugin.guiBox );
248 pluginList.append( plugin ); 246 pluginList.append( plugin );
249 } 247 }
250 } 248 }
251 } else { 249 } else {
252 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); 250 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
253 delete lib; 251 delete lib;
254 } 252 }
255 } 253 }
256 254
257 if ( !m_allApplets.isEmpty() ) { 255 if ( !m_allApplets.isEmpty() ) {
258 TodayPlugin tempPlugin; 256 TodayPlugin tempPlugin;
259 QStringList::Iterator stringit; 257 QStringList::Iterator stringit;
260 258
261 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { 259 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
262 tempPlugin = ( tempList.find( *stringit ) ).data(); 260 tempPlugin = ( tempList.find( *stringit ) ).data();
263 if ( !( (tempPlugin.name).isEmpty() ) ) { 261 if ( !( (tempPlugin.name).isEmpty() ) ) {
264 layout->addWidget( tempPlugin.guiBox ); 262 layout->addWidget( tempPlugin.guiBox );
265 pluginList.append( tempPlugin ); 263 pluginList.append( tempPlugin );
266 } 264 }
267 } 265 }
268 } 266 }
269} 267}
270 268
271 269
272/** 270/**
273 * Repaint method. Reread all fields. 271 * Repaint method. Reread all fields.
274 */ 272 */
275void Today::draw() { 273void Today::draw() {
276 274
277 if ( pluginList.count() == 0 ) { 275 if ( pluginList.count() == 0 ) {
278 QLabel *noPlugins = new QLabel( this ); 276 QLabel *noPlugins = new QLabel( this );
279 noPlugins->setText( tr( "No plugins found" ) ); 277 noPlugins->setText( tr( "No plugins found" ) );
280 layout->addWidget( noPlugins ); 278 layout->addWidget( noPlugins );
281 return; 279 return;
282 } 280 }
283 281
284 uint count = 0; 282 uint count = 0;
285 TodayPlugin plugin; 283 TodayPlugin plugin;
286 for ( uint i = 0; i < pluginList.count(); i++ ) { 284 for ( uint i = 0; i < pluginList.count(); i++ ) {
287 plugin = pluginList[i]; 285 plugin = pluginList[i];
288 286
289 if ( plugin.active ) { 287 if ( plugin.active ) {
290 // qDebug( plugin.name + " is ACTIVE " ); 288 // qDebug( plugin.name + " is ACTIVE " );
291 plugin.guiBox->show(); 289 plugin.guiBox->show();
292 } else { 290 } else {
293 // qDebug( plugin.name + " is INACTIVE" ); 291 // qDebug( plugin.name + " is INACTIVE" );
294 plugin.guiBox->hide(); 292 plugin.guiBox->hide();
295 } 293 }
296 count++; 294 count++;
297 } 295 }
298 296
299 if ( count == 0 ) { 297 if ( count == 0 ) {
300 QLabel *noPluginsActive = new QLabel( this ); 298 QLabel *noPluginsActive = new QLabel( this );
301 noPluginsActive->setText( tr( "No plugins activated" ) ); 299 noPluginsActive->setText( tr( "No plugins activated" ) );
302 layout->addWidget( noPluginsActive ); 300 layout->addWidget( noPluginsActive );
303 } 301 }
304 layout->addStretch(0); 302 layout->addStretch(0);
305} 303}
306 304
307 305
308/** 306/**
309 * The method for the configuration dialog. 307 * The method for the configuration dialog.
310 */ 308 */
311void Today::startConfig() { 309void Today::startConfig() {
312 310
313 // disconnect timer to prevent problems while being on config dialog 311 // disconnect timer to prevent problems while being on config dialog
314 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 312 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
315 313
316 TodayConfig conf( this, "dialog", true ); 314 TodayConfig conf( this, "dialog", true );
317 315
318 TodayPlugin plugin; 316 TodayPlugin plugin;
319 QList<TodayConfigWidget> configWidgetList; 317 QList<TodayConfigWidget> configWidgetList;
320 318
321 for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { 319 for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) {
322 plugin = pluginList[i]; 320 plugin = pluginList[i];
323 321
324 // load the config widgets in the tabs 322 // load the config widgets in the tabs
325 if ( plugin.guiPart->configWidget( this ) != 0l ) { 323 if ( plugin.guiPart->configWidget( this ) != 0l ) {
326 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); 324 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
327 configWidgetList.append( widget ); 325 configWidgetList.append( widget );
328 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() 326 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig()
329 , plugin.guiPart->appName() ); 327 , plugin.guiPart->appName() );
330 } 328 }
331 // set the order/activate tab 329 // set the order/activate tab
332 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), 330 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(),
333 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); 331 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) );
334 } 332 }
335 333
336 if ( conf.exec() == QDialog::Accepted ) { 334 if ( conf.exec() == QDialog::Accepted ) {
337 conf.writeConfig(); 335 conf.writeConfig();
338 TodayConfigWidget *confWidget; 336 TodayConfigWidget *confWidget;
339 for ( confWidget = configWidgetList.first(); confWidget != 0; 337 for ( confWidget = configWidgetList.first(); confWidget != 0;
340 confWidget = configWidgetList.next() ) { 338 confWidget = configWidgetList.next() ) {
341 confWidget->writeConfig(); 339 confWidget->writeConfig();
342 } 340 }
343 refresh(); 341 refresh();
344 } else { 342 } else {
345 // since refresh is not called in that case , reconnect the signal 343 // since refresh is not called in that case , reconnect the signal
346 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 344 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
347 } 345 }
348} 346}
349 347
350 348
351/** 349/**
352 * Refresh for the view. Reload all applets 350 * Refresh for the view. Reload all applets
353 * 351 *
354 */ 352 */
355void Today::refresh() { 353void Today::refresh() {
356 init(); 354 init();
357 355
358 qDebug(" refresh "); 356 // qDebug(" refresh ");
359 // set the date in top label 357 // set the date in top label
360 QDate date = QDate::currentDate(); 358 QDate date = QDate::currentDate();
361 QString time = ( tr( date.toString() ) ); 359 QString time = ( tr( date.toString() ) );
362 360
363 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); 361 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
364 362
365 if ( layout ) { 363 if ( layout ) {
366 delete layout; 364 delete layout;
367 } 365 }
368 layout = new QVBoxLayout( this ); 366 layout = new QVBoxLayout( this );
369 layout->addWidget( Frame ); 367 layout->addWidget( Frame );
370 layout->addWidget( OwnerField ); 368 layout->addWidget( OwnerField );
371 369
372 loadPlugins(); 370 loadPlugins();
373 draw(); 371 draw();
374} 372}
375 373
376void Today::startAddressbook() {
377 QCopEnvelope e( "QPE/System", "execute(QString)" );
378 e << QString( "addressbook" );
379}
380
381
382void Today::startApplication() { 374void Today::startApplication() {
383 QCopEnvelope e( "QPE/System", "execute(QString)" ); 375 QCopEnvelope e( "QPE/System", "execute(QString)" );
384 e << QString( sender()->name() ); 376 e << QString( sender()->name() );
385} 377}
386 378
387/** 379/**
388 * launch addressbook (personal card) 380 * launch addressbook (personal card)
389 */ 381 */
390void Today::editCard() { 382void Today::editCard() {
391 startAddressbook(); 383 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" );
392 while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) {
393 qApp->processEvents();
394 }
395 QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" );
396} 384}
397 385
398Today::~Today() { 386Today::~Today() {
399} 387}
400 388
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index 4485a0b..35b7ee3 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -1,77 +1,76 @@
1/* 1/*
2 * today.h 2 * today.h
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 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 17
18#ifndef TODAY_H 18#ifndef TODAY_H
19#define TODAY_H 19#define TODAY_H
20 20
21#include <opie/tododb.h> 21#include <opie/tododb.h>
22 22
23#include <qdatetime.h> 23#include <qdatetime.h>
24#include <qlist.h> 24#include <qlist.h>
25#include <qhbox.h> 25#include <qhbox.h>
26 26
27#include <qpe/qlibrary.h> 27#include <qpe/qlibrary.h>
28#include <qpe/event.h> 28#include <qpe/event.h>
29 29
30#include "todayconfig.h" 30#include "todayconfig.h"
31#include "todaybase.h" 31#include "todaybase.h"
32#include <opie/todayplugininterface.h> 32#include <opie/todayplugininterface.h>
33 33
34class QVBoxLayout; 34class QVBoxLayout;
35class OClickableLabel; 35class OClickableLabel;
36 36
37 37
38class Today : public TodayBase { 38class Today : public TodayBase {
39 39
40 Q_OBJECT 40 Q_OBJECT
41 41
42 public: 42 public:
43 Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 43 Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
44 ~Today(); 44 ~Today();
45 45
46private slots: 46private slots:
47 void startConfig(); 47 void startConfig();
48 void startAddressbook();
49 void startApplication(); 48 void startApplication();
50 void editCard(); 49 void editCard();
51 void refresh(); 50 void refresh();
52 51
53private: 52private:
54 void init(); 53 void init();
55 void setOwnerField(); 54 void setOwnerField();
56 void setOwnerField(QString &string); 55 void setOwnerField(QString &string);
57 void loadPlugins(); 56 void loadPlugins();
58 void draw(); 57 void draw();
59 void setRefreshTimer( int ); 58 void setRefreshTimer( int );
60 59
61private slots: 60private slots:
62 void channelReceived(const QCString &msg, const QByteArray & data); 61 void channelReceived(const QCString &msg, const QByteArray & data);
63 62
64 private: 63 private:
65 TodayConfig *conf; 64 TodayConfig *conf;
66 QStringList m_excludeApplets; 65 QStringList m_excludeApplets;
67 QStringList m_allApplets; 66 QStringList m_allApplets;
68 67
69 QTimer *m_refreshTimer; 68 QTimer *m_refreshTimer;
70 69
71 bool m_refreshTimerEnabled; 70 bool m_refreshTimerEnabled;
72 int m_newStart; 71 int m_newStart;
73 int m_iconSize; 72 int m_iconSize;
74 int m_maxCharClip; 73 int m_maxCharClip;
75}; 74};
76 75
77#endif 76#endif