summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-29 13:23:53 (UTC)
committer harlekin <harlekin>2003-03-29 13:23:53 (UTC)
commit7c43e678395bbf781195686b34cc596ea72aa512 (patch) (unidiff)
treee201eb358c019ea5e116c704c49729d1fe9c0d91
parent22e941e4cbc9e8906287d1e352b66092c6a84c0d (diff)
downloadopie-7c43e678395bbf781195686b34cc596ea72aa512.zip
opie-7c43e678395bbf781195686b34cc596ea72aa512.tar.gz
opie-7c43e678395bbf781195686b34cc596ea72aa512.tar.bz2
added option to made the banner on top much smaller and also the date should adapt to local settings now ( hopefully )
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp24
-rw-r--r--core/pim/today/today.h1
-rw-r--r--core/pim/today/todaybase.cpp4
-rw-r--r--core/pim/today/todaybase.h2
-rw-r--r--core/pim/today/todayconfig.cpp13
-rw-r--r--core/pim/today/todayconfig.h4
6 files changed, 40 insertions, 8 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 5e5d373..0b61bf8 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,206 +1,224 @@
1/* 1/*
2 * today.cpp 2 * today.cpp
3 * 3 *
4 * copyright : (c) 2002,2003 by Maximilian Reiß 4 * copyright : (c) 2002,2003 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 18
19#define QTOPIA_INTERNAL_LANGLIST 19#define QTOPIA_INTERNAL_LANGLIST
20 20
21#include "today.h" 21#include "today.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/global.h> 26#include <qpe/global.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/contact.h> 28#include <qpe/contact.h>
29#include <qpe/timestring.h>
29 30
30#include <qdir.h> 31#include <qdir.h>
31#include <qfile.h> 32#include <qfile.h>
32#include <qtimer.h> 33#include <qtimer.h>
33#include <qwhatsthis.h> 34#include <qwhatsthis.h>
34#include <qtranslator.h> 35#include <qtranslator.h>
35 36
36struct TodayPlugin { 37struct TodayPlugin {
37 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} 38 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
38 QLibrary *library; 39 QLibrary *library;
39 QInterfacePtr<TodayPluginInterface> iface; 40 QInterfacePtr<TodayPluginInterface> iface;
40 TodayPluginObject *guiPart; 41 TodayPluginObject *guiPart;
41 QWidget *guiBox; 42 QWidget *guiBox;
42 QString name; 43 QString name;
43 bool active; 44 bool active;
44 bool excludeRefresh; 45 bool excludeRefresh;
45 int pos; 46 int pos;
46}; 47};
47 48
48static QValueList<TodayPlugin> pluginList; 49static QValueList<TodayPlugin> pluginList;
49 50
50Today::Today( QWidget* parent, const char* name, WFlags fl ) 51Today::Today( QWidget* parent, const char* name, WFlags fl )
51 : TodayBase( parent, name, fl ) { 52 : TodayBase( parent, name, fl ) {
52 53
53 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 54 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
54 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 55 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
55 56
56#if defined(Q_WS_QWS) 57#if defined(Q_WS_QWS)
57#if !defined(QT_NO_COP) 58#if !defined(QT_NO_COP)
58 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 59 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
59 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 60 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
60 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 61 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
61#endif 62#endif
62#endif 63#endif
63 64
64 setOwnerField(); 65 setOwnerField();
65 m_refreshTimer = new QTimer( this ); 66 m_refreshTimer = new QTimer( this );
66 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 67 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
67 m_refreshTimer->start( 15000 ); 68 m_refreshTimer->start( 15000 );
68 //init(); 69 //init();
69 loadPlugins(); 70 loadPlugins();
70 showMaximized(); 71 showMaximized();
71} 72}
72 73
73/** 74/**
74 * Qcop receive method. 75 * Qcop receive method.
75 */ 76 */
76void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 77void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
77 QDataStream stream( data, IO_ReadOnly ); 78 QDataStream stream( data, IO_ReadOnly );
78 if ( msg == "message(QString)" ) { 79 if ( msg == "message(QString)" ) {
79 QString message; 80 QString message;
80 stream >> message; 81 stream >> message;
81 setOwnerField( message ); 82 setOwnerField( message );
82 } 83 }
83} 84}
84 85
85void Today::setRefreshTimer( int interval ) { 86void Today::setRefreshTimer( int interval ) {
86 87
87 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 88 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
88 89
89 // 0 is "never" case 90 // 0 is "never" case
90 if ( !interval == 0 ) { 91 if ( !interval == 0 ) {
91 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 92 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
92 m_refreshTimer->changeInterval( interval ); 93 m_refreshTimer->changeInterval( interval );
93 } 94 }
94} 95}
95 96
96 97
97/** 98/**
98 * Initialises the owner field with the default value, the username 99 * Initialises the owner field with the default value, the username
99 */ 100 */
100void Today::setOwnerField() { 101void Today::setOwnerField() {
101 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 102 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
102 if ( QFile::exists( file ) ) { 103 if ( QFile::exists( file ) ) {
103 Contact cont = Contact::readVCard( file )[0]; 104 Contact cont = Contact::readVCard( file )[0];
104 QString returnString = cont.fullName(); 105 QString returnString = cont.fullName();
105 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 106 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
106 } else { 107 } else {
107 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 108 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
108 } 109 }
109} 110}
110 111
111/** 112/**
112 * Set the owner field with a given QString, for example per qcop. 113 * Set the owner field with a given QString, for example per qcop.
113 */ 114 */
114void Today::setOwnerField( QString &message ) { 115void Today::setOwnerField( QString &message ) {
115 if ( !message.isEmpty() ) { 116 if ( !message.isEmpty() ) {
116 OwnerField->setText( "<b>" + message + "</b>" ); 117 OwnerField->setText( "<b>" + message + "</b>" );
117 } 118 }
118} 119}
119 120
120/** 121/**
121 * Init stuff needed for today. Reads the config file. 122 * Init stuff needed for today. Reads the config file.
122 */ 123 */
123void Today::init() { 124void Today::init() {
124 // read config 125 // read config
125 Config cfg( "today" ); 126 Config cfg( "today" );
126 127
127 cfg.setGroup( "Plugins" ); 128 cfg.setGroup( "Plugins" );
128 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 129 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
129 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 130 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
130 131
131 cfg.setGroup( "General" ); 132 cfg.setGroup( "General" );
132 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 133 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
134 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 );
133 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 135 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
134 136
135 // set the date in top label 137 // set the date in top label
136 QDate date = QDate::currentDate(); 138 QDate date = QDate::currentDate();
137 QString time = ( tr( date.toString() ) ); 139 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) );
138 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
139 140
140 if ( layout ) { 141 if ( layout ) {
141 delete layout; 142 delete layout;
142 } 143 }
144
145 if ( m_hideBanner ) {
146 Opiezilla->hide();
147 TodayLabel->hide();
148 Frame->setMaximumHeight( 18 );
149 Frame->setMinimumHeight( 18 );
150 DateLabel->setGeometry( QRect( 10, 2, 168, 12 ) );
151 ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-20, 0, 25, 20 ) );
152 } else {
153 Opiezilla->show();
154 TodayLabel->show();
155 Frame->setMaximumHeight( 50 );
156 Frame->setMinimumHeight( 50 );
157 DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) );
158 ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 29, 25, 20 ) );
159 }
160
143 layout = new QVBoxLayout( this ); 161 layout = new QVBoxLayout( this );
144 layout->addWidget( Frame ); 162 layout->addWidget( Frame );
145 layout->addWidget( OwnerField ); 163 layout->addWidget( OwnerField );
146} 164}
147 165
148/** 166/**
149 * Load the plugins 167 * Load the plugins
150 */ 168 */
151void Today::loadPlugins() { 169void Today::loadPlugins() {
152 170
153 init(); 171 init();
154 QValueList<TodayPlugin>::Iterator tit; 172 QValueList<TodayPlugin>::Iterator tit;
155 if ( !pluginList.isEmpty() ) { 173 if ( !pluginList.isEmpty() ) {
156 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 174 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
157 (*tit).guiBox->hide(); 175 (*tit).guiBox->hide();
158 (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); 176 (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) );
159 delete (*tit).guiBox; 177 delete (*tit).guiBox;
160 (*tit).library->unload(); 178 (*tit).library->unload();
161 delete (*tit).library; 179 delete (*tit).library;
162 } 180 }
163 pluginList.clear(); 181 pluginList.clear();
164 } 182 }
165 183
166 QString path = QPEApplication::qpeDir() + "/plugins/today"; 184 QString path = QPEApplication::qpeDir() + "/plugins/today";
167 QDir dir( path, "lib*.so" ); 185 QDir dir( path, "lib*.so" );
168 186
169 QStringList list = dir.entryList(); 187 QStringList list = dir.entryList();
170 QStringList::Iterator it; 188 QStringList::Iterator it;
171 189
172 QMap<QString, TodayPlugin> tempList; 190 QMap<QString, TodayPlugin> tempList;
173 191
174 for ( it = list.begin(); it != list.end(); ++it ) { 192 for ( it = list.begin(); it != list.end(); ++it ) {
175 QInterfacePtr<TodayPluginInterface> iface; 193 QInterfacePtr<TodayPluginInterface> iface;
176 QLibrary *lib = new QLibrary( path + "/" + *it ); 194 QLibrary *lib = new QLibrary( path + "/" + *it );
177 195
178 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 196 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
179 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 197 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
180 qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); 198 qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() );
181 qDebug( QString(*it) ); 199 qDebug( QString(*it) );
182 200
183 TodayPlugin plugin; 201 TodayPlugin plugin;
184 plugin.library = lib; 202 plugin.library = lib;
185 plugin.iface = iface; 203 plugin.iface = iface;
186 plugin.name = QString(*it); 204 plugin.name = QString(*it);
187 205
188 QString type = (*it).left( (*it).find(".") ); 206 QString type = (*it).left( (*it).find(".") );
189 QStringList langs = Global::languageList(); 207 QStringList langs = Global::languageList();
190 for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) { 208 for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) {
191 QString lang = *lit; 209 QString lang = *lit;
192 qDebug( "Languages: " + lang ); 210 qDebug( "Languages: " + lang );
193 QTranslator * trans = new QTranslator( qApp ); 211 QTranslator * trans = new QTranslator( qApp );
194 QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; 212 QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm";
195 if ( trans->load( tfn ) ) { 213 if ( trans->load( tfn ) ) {
196 qApp->installTranslator( trans ); 214 qApp->installTranslator( trans );
197 } else { 215 } else {
198 delete trans; 216 delete trans;
199 } 217 }
200 } 218 }
201 219
202 // find out if plugins should be shown 220 // find out if plugins should be shown
203 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 221 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
204 plugin.active = true; 222 plugin.active = true;
205 } else { 223 } else {
206 plugin.active = false; 224 plugin.active = false;
@@ -258,127 +276,127 @@ void Today::loadPlugins() {
258 QStringList::Iterator stringit; 276 QStringList::Iterator stringit;
259 277
260 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { 278 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
261 tempPlugin = ( tempList.find( *stringit ) ).data(); 279 tempPlugin = ( tempList.find( *stringit ) ).data();
262 if ( !( (tempPlugin.name).isEmpty() ) ) { 280 if ( !( (tempPlugin.name).isEmpty() ) ) {
263 layout->addWidget( tempPlugin.guiBox ); 281 layout->addWidget( tempPlugin.guiBox );
264 pluginList.append( tempPlugin ); 282 pluginList.append( tempPlugin );
265 } 283 }
266 } 284 }
267 } 285 }
268 draw(); 286 draw();
269} 287}
270 288
271 289
272/** 290/**
273 * Repaint method. Reread all fields. 291 * Repaint method. Reread all fields.
274 */ 292 */
275void Today::draw() { 293void Today::draw() {
276 294
277 if ( pluginList.count() == 0 ) { 295 if ( pluginList.count() == 0 ) {
278 QLabel *noPlugins = new QLabel( this ); 296 QLabel *noPlugins = new QLabel( this );
279 noPlugins->setText( tr( "No plugins found" ) ); 297 noPlugins->setText( tr( "No plugins found" ) );
280 layout->addWidget( noPlugins ); 298 layout->addWidget( noPlugins );
281 return; 299 return;
282 } 300 }
283 301
284 uint count = 0; 302 uint count = 0;
285 TodayPlugin plugin; 303 TodayPlugin plugin;
286 for ( uint i = 0; i < pluginList.count(); i++ ) { 304 for ( uint i = 0; i < pluginList.count(); i++ ) {
287 plugin = pluginList[i]; 305 plugin = pluginList[i];
288 306
289 if ( plugin.active ) { 307 if ( plugin.active ) {
290 // qDebug( plugin.name + " is ACTIVE " ); 308 // qDebug( plugin.name + " is ACTIVE " );
291 plugin.guiBox->show(); 309 plugin.guiBox->show();
292 } else { 310 } else {
293 // qDebug( plugin.name + " is INACTIVE" ); 311 // qDebug( plugin.name + " is INACTIVE" );
294 plugin.guiBox->hide(); 312 plugin.guiBox->hide();
295 } 313 }
296 count++; 314 count++;
297 } 315 }
298 316
299 if ( count == 0 ) { 317 if ( count == 0 ) {
300 QLabel *noPluginsActive = new QLabel( this ); 318 QLabel *noPluginsActive = new QLabel( this );
301 noPluginsActive->setText( tr( "No plugins activated" ) ); 319 noPluginsActive->setText( tr( "No plugins activated" ) );
302 layout->addWidget( noPluginsActive ); 320 layout->addWidget( noPluginsActive );
303 } 321 }
304 layout->addStretch(0); 322 layout->addStretch(0);
305} 323}
306 324
307 325
308/** 326/**
309 * The method for the configuration dialog. 327 * The method for the configuration dialog.
310 */ 328 */
311void Today::startConfig() { 329void Today::startConfig() {
312 330
313 // disconnect timer to prevent problems while being on config dialog 331 // disconnect timer to prevent problems while being on config dialog
314 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 332 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
315 m_refreshTimer->stop( ); 333 m_refreshTimer->stop( );
316 334
317 TodayConfig conf( this, "dialog", true ); 335 TodayConfig conf( this, "dialog", true );
318 336
319 TodayPlugin plugin; 337 TodayPlugin plugin;
320 QList<TodayConfigWidget> configWidgetList; 338 QList<TodayConfigWidget> configWidgetList;
321 339
322 for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { 340 for ( int i = pluginList.count() - 1; i >= 0; i-- ) {
323 plugin = pluginList[i]; 341 plugin = pluginList[i];
324 342
325 // load the config widgets in the tabs 343 // load the config widgets in the tabs
326 if ( plugin.guiPart->configWidget( this ) != 0l ) { 344 if ( plugin.guiPart->configWidget( this ) != 0l ) {
327 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); 345 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
328 configWidgetList.append( widget ); 346 configWidgetList.append( widget );
329 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() 347 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig()
330 , plugin.guiPart->appName() ); 348 , plugin.guiPart->appName() );
331 } 349 }
332 // set the order/activate tab 350 // set the order/activate tab
333 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), 351 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(),
334 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); 352 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) );
335 } 353 }
336 354
337 if ( conf.exec() == QDialog::Accepted ) { 355 if ( conf.exec() == QDialog::Accepted ) {
338 conf.writeConfig(); 356 conf.writeConfig();
339 TodayConfigWidget *confWidget; 357 TodayConfigWidget *confWidget;
340 for ( confWidget = configWidgetList.first(); confWidget != 0; 358 for ( confWidget = configWidgetList.first(); confWidget != 0;
341 confWidget = configWidgetList.next() ) { 359 confWidget = configWidgetList.next() ) {
342 confWidget->writeConfig(); 360 confWidget->writeConfig();
343 } 361 }
344 loadPlugins(); 362 loadPlugins();
345 } else { 363 } else {
346 // since refresh is not called in that case , reconnect the signal 364 // since refresh is not called in that case , reconnect the signal
347 m_refreshTimer->start( 15000 ); // get the config value in here later 365 m_refreshTimer->start( 15000 ); // get the config value in here later
348 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 366 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
349 } 367 }
350} 368}
351 369
352 370
353/** 371/**
354 * Refresh for the view. Reload all applets 372 * Refresh for the view. Reload all applets
355 * 373 *
356 */ 374 */
357void Today::refresh() { 375void Today::refresh() {
358 376
359 init(); 377 init();
360 378
361 QValueList<TodayPlugin>::Iterator it; 379 QValueList<TodayPlugin>::Iterator it;
362 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { 380 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
363 if ( !(*it).excludeRefresh ) { 381 if ( !(*it).excludeRefresh ) {
364 (*it).guiPart->refresh(); 382 (*it).guiPart->refresh();
365 qDebug( "refresh" ); 383 qDebug( "refresh" );
366 } 384 }
367 } 385 }
368} 386}
369 387
370void Today::startApplication() { 388void Today::startApplication() {
371 QCopEnvelope e( "QPE/System", "execute(QString)" ); 389 QCopEnvelope e( "QPE/System", "execute(QString)" );
372 e << QString( sender()->name() ); 390 e << QString( sender()->name() );
373} 391}
374 392
375/** 393/**
376 * launch addressbook (personal card) 394 * launch addressbook (personal card)
377 */ 395 */
378void Today::editCard() { 396void Today::editCard() {
379 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); 397 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" );
380} 398}
381 399
382Today::~Today() { 400Today::~Today() {
383} 401}
384 402
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index 3802feb..b28ac96 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -5,67 +5,68 @@
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 21
22#include <qpe/qlibrary.h> 22#include <qpe/qlibrary.h>
23 23
24#include "todayconfig.h" 24#include "todayconfig.h"
25#include "todaybase.h" 25#include "todaybase.h"
26 26
27#include <opie/todayplugininterface.h> 27#include <opie/todayplugininterface.h>
28 28
29class QVBoxLayout; 29class QVBoxLayout;
30class OClickableLabel; 30class OClickableLabel;
31 31
32 32
33class Today : public TodayBase { 33class Today : public TodayBase {
34 34
35 Q_OBJECT 35 Q_OBJECT
36 36
37 public: 37 public:
38 Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 38 Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
39 ~Today(); 39 ~Today();
40 40
41private slots: 41private slots:
42 void startConfig(); 42 void startConfig();
43 void startApplication(); 43 void startApplication();
44 void editCard(); 44 void editCard();
45 void refresh(); 45 void refresh();
46 46
47private: 47private:
48 void init(); 48 void init();
49 void setOwnerField(); 49 void setOwnerField();
50 void setOwnerField(QString &string); 50 void setOwnerField(QString &string);
51 void loadPlugins(); 51 void loadPlugins();
52 void draw(); 52 void draw();
53 void setRefreshTimer( int ); 53 void setRefreshTimer( int );
54 54
55private slots: 55private slots:
56 void channelReceived(const QCString &msg, const QByteArray & data); 56 void channelReceived(const QCString &msg, const QByteArray & data);
57 57
58 private: 58 private:
59 TodayConfig *conf; 59 TodayConfig *conf;
60 QStringList m_excludeApplets; 60 QStringList m_excludeApplets;
61 QStringList m_allApplets; 61 QStringList m_allApplets;
62 62
63 QTimer *m_refreshTimer; 63 QTimer *m_refreshTimer;
64 64
65 bool m_refreshTimerEnabled; 65 bool m_refreshTimerEnabled;
66 int m_newStart; 66 int m_newStart;
67 int m_iconSize; 67 int m_iconSize;
68 int m_maxCharClip; 68 int m_maxCharClip;
69 int m_hideBanner;
69}; 70};
70 71
71#endif 72#endif
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp
index da4efa3..a36ecaa 100644
--- a/core/pim/today/todaybase.cpp
+++ b/core/pim/today/todaybase.cpp
@@ -1,105 +1,105 @@
1/* 1/*
2 * todaybase.cpp 2 * todaybase.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#include "todaybase.h" 17#include "todaybase.h"
18 18
19#include <qlabel.h> 19#include <qlabel.h>
20#include <qimage.h> 20#include <qimage.h>
21#include <qpixmap.h> 21#include <qpixmap.h>
22#include <qapplication.h> 22#include <qapplication.h>
23#include <qwhatsthis.h> 23#include <qwhatsthis.h>
24 24
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26 26
27 27
28TodayBase::TodayBase( QWidget* parent, const char* name, WFlags ) 28TodayBase::TodayBase( QWidget* parent, const char* name, WFlags )
29 : QWidget( parent, name, WStyle_ContextHelp ) { 29 : QWidget( parent, name, WStyle_ContextHelp ) {
30 30
31 QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo 31 QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo
32 QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla 32 QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla
33 QPixmap config = Resource::loadPixmap( "SettingsIcon" ); // config icon 33 QPixmap config = Resource::loadPixmap( "SettingsIcon" ); // config icon
34 34
35 layout = new QVBoxLayout( this ); 35 layout = new QVBoxLayout( this );
36 36
37 QPalette pal = this->palette(); 37 QPalette pal = this->palette();
38 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 38 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
39 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 39 pal.setColor( QPalette::Active, QColorGroup::Button, col );
40 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 40 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
41 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 41 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
42 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 42 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
43 this->setPalette( pal ); 43 this->setPalette( pal );
44 44
45 // --- logo Section --- 45 // --- logo Section ---
46 QPalette pal2; 46 QPalette pal2;
47 QColorGroup cg; 47 QColorGroup cg;
48 cg.setColor( QColorGroup::Text, white ); 48 cg.setColor( QColorGroup::Text, white );
49 cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); 49 cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) );
50 pal2.setActive( cg ); 50 pal2.setActive( cg );
51 // today logo 51 // today logo
52 Frame = new QLabel( this, "Frame" ); 52 Frame = new QLabel( this, "Frame" );
53 Frame->setPalette( pal2 ); 53 Frame->setPalette( pal2 );
54 Frame->setFrameShape( QFrame::StyledPanel ); 54 Frame->setFrameShape( QFrame::StyledPanel );
55 Frame->setFrameShadow( QFrame::Raised ); 55 Frame->setFrameShadow( QFrame::Raised );
56 Frame->setLineWidth( 0 ); 56 Frame->setLineWidth( 0 );
57 Frame->setMaximumHeight( 50 ); 57 Frame->setMaximumHeight( 50 );
58 Frame->setMinimumHeight( 50 ); 58 Frame->setMinimumHeight( 50 );
59 59
60 // Today text 60 // Today text
61 QLabel* TodayLabel = new QLabel( Frame, "TodayText" ); 61 TodayLabel = new QLabel( Frame, "TodayText" );
62 TodayLabel->setGeometry( QRect( 10, 1, 168, 40 ) ); 62 TodayLabel->setGeometry( QRect( 10, 1, 168, 40 ) );
63 QFont TodayLabel_font( TodayLabel->font() ); 63 QFont TodayLabel_font( TodayLabel->font() );
64 TodayLabel_font.setBold( TRUE ); 64 TodayLabel_font.setBold( TRUE );
65 TodayLabel_font.setPointSize( 40 ); 65 TodayLabel_font.setPointSize( 40 );
66 TodayLabel->setFont( TodayLabel_font ); 66 TodayLabel->setFont( TodayLabel_font );
67 TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); 67 TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin );
68 TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today") +"</font>" ); 68 TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today") +"</font>" );
69 69
70 // date 70 // date
71 DateLabel = new QLabel( Frame, "TextLabel1" ); 71 DateLabel = new QLabel( Frame, "TextLabel1" );
72 DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) ); 72 DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) );
73 QFont DateLabel_font( DateLabel->font() ); 73 QFont DateLabel_font( DateLabel->font() );
74 DateLabel_font.setBold( TRUE ); 74 DateLabel_font.setBold( TRUE );
75 DateLabel->setFont( DateLabel_font ); 75 DateLabel->setFont( DateLabel_font );
76 DateLabel->setBackgroundOrigin( QLabel::ParentOrigin ); 76 DateLabel->setBackgroundOrigin( QLabel::ParentOrigin );
77 DateLabel->setTextFormat( RichText ); 77 DateLabel->setTextFormat( RichText );
78 78
79 // Opiezilla 79 // Opiezilla
80 QLabel* Opiezilla = new QLabel( Frame, "OpieZilla" ); 80 Opiezilla = new QLabel( Frame, "OpieZilla" );
81 Opiezilla->setPixmap( opiezilla ); 81 Opiezilla->setPixmap( opiezilla );
82 Opiezilla->setGeometry( QApplication::desktop()->width()-50 ,1, 45, 47 ); 82 Opiezilla->setGeometry( QApplication::desktop()->width()-50 ,1, 45, 47 );
83 QWhatsThis::add( Opiezilla , tr( "Today by Maximilian Reiß" ) ); 83 QWhatsThis::add( Opiezilla , tr( "Today by Maximilian Reiß" ) );
84 Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); 84 Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin );
85 85
86 // Ownerfield 86 // Ownerfield
87 OwnerField = new OClickableLabel( this , "Owner" ); 87 OwnerField = new OClickableLabel( this , "Owner" );
88 OwnerField->setGeometry( QRect( 0, 0, this->width(), 12 ) ); 88 OwnerField->setGeometry( QRect( 0, 0, this->width(), 12 ) );
89 OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) ); 89 OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) );
90 OwnerField->setMaximumHeight(12); 90 OwnerField->setMaximumHeight(12);
91 91
92 // config 92 // config
93 ConfigButton = new OClickableLabel ( Frame, "PushButton1" ); 93 ConfigButton = new OClickableLabel ( Frame, "PushButton1" );
94 ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 29, 25, 20 ) ); 94 ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 29, 25, 20 ) );
95 ConfigButton->setPixmap( config ); 95 ConfigButton->setPixmap( config );
96 QWhatsThis::add( ConfigButton, tr( "Click here to get to the config dialog" ) ); 96 QWhatsThis::add( ConfigButton, tr( "Click here to get to the config dialog" ) );
97 ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); 97 ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin );
98} 98}
99 99
100/** 100/**
101 * D' tor 101 * D' tor
102 */ 102 */
103TodayBase::~TodayBase() { 103TodayBase::~TodayBase() {
104} 104}
105 105
diff --git a/core/pim/today/todaybase.h b/core/pim/today/todaybase.h
index 340c7a6..b0b2e14 100644
--- a/core/pim/today/todaybase.h
+++ b/core/pim/today/todaybase.h
@@ -1,53 +1,55 @@
1/* 1/*
2 * todaybase.h 2 * todaybase.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#ifndef TODAYBASE_H 17#ifndef TODAYBASE_H
18#define TODAYBASE_H 18#define TODAYBASE_H
19 19
20#include <qlayout.h> 20#include <qlayout.h>
21#include <opie/oclickablelabel.h> 21#include <opie/oclickablelabel.h>
22 22
23class QVBox; 23class QVBox;
24class QGridLayout; 24class QGridLayout;
25class QFrame; 25class QFrame;
26class QLabel; 26class QLabel;
27class QPushButton; 27class QPushButton;
28class QBoxLayout; 28class QBoxLayout;
29 29
30 30
31class TodayBase : public QWidget 31class TodayBase : public QWidget
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35public: 35public:
36 TodayBase( QWidget* parent = 0, const char* name = 0, WFlags = 0 ); 36 TodayBase( QWidget* parent = 0, const char* name = 0, WFlags = 0 );
37 ~TodayBase(); 37 ~TodayBase();
38 38
39 QFrame* Frame4; 39 QFrame* Frame4;
40 QPushButton* DatesButton; 40 QPushButton* DatesButton;
41 QVBoxLayout* layout; 41 QVBoxLayout* layout;
42 OClickableLabel* OwnerField; 42 OClickableLabel* OwnerField;
43 QLabel* Frame; 43 QLabel* Frame;
44 QLabel* DateLabel; 44 QLabel* DateLabel;
45 QFrame* Frame15; 45 QFrame* Frame15;
46 QLabel* Opiezilla;
47 QLabel* TodayLabel;
46 OClickableLabel* ConfigButton; 48 OClickableLabel* ConfigButton;
47 49
48protected: 50protected:
49 51
50 52
51}; 53};
52 54
53#endif 55#endif
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index 0774ccb..a60f1d2 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -1,262 +1,273 @@
1/* 1/*
2 * todayconfig.cpp 2 * todayconfig.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#include "todayconfig.h" 17#include "todayconfig.h"
18 18
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22 22
23#include <qcheckbox.h> 23#include <qcheckbox.h>
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qspinbox.h> 25#include <qspinbox.h>
26#include <qtabwidget.h> 26#include <qtabwidget.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qheader.h> 28#include <qheader.h>
29#include <qhbox.h> 29#include <qhbox.h>
30#include <qvbox.h> 30#include <qvbox.h>
31#include <qtoolbutton.h> 31#include <qtoolbutton.h>
32#include <qtooltip.h> 32#include <qtooltip.h>
33#include <qwhatsthis.h> 33#include <qwhatsthis.h>
34 34
35class ToolButton : public QToolButton { 35class ToolButton : public QToolButton {
36 36
37public: 37public:
38 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 38 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
39 : QToolButton( parent, name ) { 39 : QToolButton( parent, name ) {
40 setPixmap( Resource::loadPixmap( icon ) ); 40 setPixmap( Resource::loadPixmap( icon ) );
41 setAutoRaise( TRUE ); 41 setAutoRaise( TRUE );
42 setFocusPolicy( QWidget::NoFocus ); 42 setFocusPolicy( QWidget::NoFocus );
43 setToggleButton( t ); 43 setToggleButton( t );
44 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 44 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
45 } 45 }
46}; 46};
47 47
48 48
49/** 49/**
50 * The class has currently quite some duplicate code. 50 * The class has currently quite some duplicate code.
51 * By that way it would be real easy to have it as seperate app in settings tab 51 * By that way it would be real easy to have it as seperate app in settings tab
52 * 52 *
53 */ 53 */
54TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) 54TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal )
55 : QDialog( parent, name, modal, WStyle_ContextHelp ) { 55 : QDialog( parent, name, modal, WStyle_ContextHelp ) {
56 56
57 setCaption( tr( "Today config" ) ); 57 setCaption( tr( "Today Config" ) );
58 58
59 QVBoxLayout *layout = new QVBoxLayout( this ); 59 QVBoxLayout *layout = new QVBoxLayout( this );
60 TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 60 TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
61 layout->addWidget( TabWidget3 ); 61 layout->addWidget( TabWidget3 );
62 62
63 tab_2 = new QWidget( TabWidget3, "tab_2" ); 63 tab_2 = new QWidget( TabWidget3, "tab_2" );
64 QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); 64 QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 );
65 QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); 65 QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 );
66 tab2Layout->addWidget( l ); 66 tab2Layout->addWidget( l );
67 QHBox *hbox1 = new QHBox( tab_2 ); 67 QHBox *hbox1 = new QHBox( tab_2 );
68 m_appletListView = new QListView( hbox1 ); 68 m_appletListView = new QListView( hbox1 );
69 m_appletListView->addColumn( "PluginList" ); 69 m_appletListView->addColumn( "PluginList" );
70 m_appletListView->header()->hide(); 70 m_appletListView->header()->hide();
71 m_appletListView->setSorting( -1 ); 71 m_appletListView->setSorting( -1 );
72 QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) ); 72 QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) );
73 QVBox *vbox1 = new QVBox( hbox1 ); 73 QVBox *vbox1 = new QVBox( hbox1 );
74 new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); 74 new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) );
75 new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); 75 new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) );
76 tab2Layout->addWidget( hbox1 ); 76 tab2Layout->addWidget( hbox1 );
77 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); 77 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) );
78 78
79 tab_3 = new QWidget( TabWidget3, "tab_3" ); 79 tab_3 = new QWidget( TabWidget3, "tab_3" );
80 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); 80 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 );
81 tab3Layout->setMargin( 20 ); 81 tab3Layout->setMargin( 20 );
82 QHBox *hbox_auto = new QHBox( tab_3 ); 82 QHBox *hbox_auto = new QHBox( tab_3 );
83 TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); 83 TextLabel2 = new QLabel( hbox_auto, "AutoStart" );
84 TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); 84 TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) );
85 QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) ); 85 QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) );
86 CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); 86 CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" );
87 QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) ); 87 QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) );
88
89 QHBox *hbox_hide = new QHBox( tab_3 );
90 TextLabel4 = new QLabel( hbox_hide, "HideBanner" );
91 TextLabel4->setText( tr( "Tiny Banner" ) );
92 //QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) );
93 CheckBoxHide = new QCheckBox( hbox_hide, "CheckBoxHide" );
94 // QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) );
95
88 QHBox *hbox_inactive = new QHBox( tab_3 ); 96 QHBox *hbox_inactive = new QHBox( tab_3 );
89 TimeLabel = new QLabel( hbox_inactive, "TimeLabel" ); 97 TimeLabel = new QLabel( hbox_inactive, "TimeLabel" );
90 TimeLabel->setText( tr( "minutes inactive" ) ); 98 TimeLabel->setText( tr( "minutes inactive" ) );
91 QWhatsThis::add( TimeLabel , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) ); 99 QWhatsThis::add( TimeLabel , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) );
92 SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" ); 100 SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" );
93 SpinBoxTime->setMaxValue ( 1440 ); 101 SpinBoxTime->setMaxValue ( 1440 );
94 QWhatsThis::add( SpinBoxTime , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) ); 102 QWhatsThis::add( SpinBoxTime , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) );
95 QHBox *hbox_iconSize = new QHBox( tab_3 ); 103 QHBox *hbox_iconSize = new QHBox( tab_3 );
96 QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" ); 104 QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" );
97 iconSizeLabel->setText( tr( "Icon size" ) ); 105 iconSizeLabel->setText( tr( "Icon size" ) );
98 QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) ); 106 QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) );
99 SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" ); 107 SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" );
100 SpinBoxIconSize->setMaxValue( 32 ); 108 SpinBoxIconSize->setMaxValue( 32 );
101 QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) ); 109 QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) );
102 110
103 QHBox *hbox_refresh = new QHBox( tab_3 ); 111 QHBox *hbox_refresh = new QHBox( tab_3 );
104 QLabel *refreshLabel = new QLabel( hbox_refresh ); 112 QLabel *refreshLabel = new QLabel( hbox_refresh );
105 refreshLabel->setText( tr( "Refresh" ) ); 113 refreshLabel->setText( tr( "Refresh" ) );
106 QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) ); 114 QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) );
107 SpinRefresh = new QSpinBox( hbox_refresh ); 115 SpinRefresh = new QSpinBox( hbox_refresh );
108 SpinRefresh->setMinValue( 0 ); 116 SpinRefresh->setMinValue( 0 );
109 SpinRefresh->setSuffix( tr( " sec" ) ); 117 SpinRefresh->setSuffix( tr( " sec" ) );
110 SpinRefresh->setMaxValue ( 7200 ); 118 SpinRefresh->setMaxValue ( 7200 );
111 SpinRefresh->setSpecialValueText ( tr("never") ); 119 SpinRefresh->setSpecialValueText ( tr("never") );
112 QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) ); 120 QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) );
113 121
114 tab3Layout->addWidget( hbox_auto ); 122 tab3Layout->addWidget( hbox_auto );
123 tab3Layout->addWidget( hbox_hide );
115 tab3Layout->addWidget( hbox_inactive ); 124 tab3Layout->addWidget( hbox_inactive );
116 tab3Layout->addWidget( hbox_iconSize ); 125 tab3Layout->addWidget( hbox_iconSize );
117 tab3Layout->addWidget( hbox_refresh ); 126 tab3Layout->addWidget( hbox_refresh );
118 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); 127 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) );
119 128
120 m_applets_changed = false; 129 m_applets_changed = false;
121 130
122 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); 131 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) );
123 132
124 readConfig(); 133 readConfig();
125 showMaximized(); 134 showMaximized();
126} 135}
127 136
128 137
129/** 138/**
130 * Autostart, uses the new (opie only) autostart method in the launcher code. 139 * Autostart, uses the new (opie only) autostart method in the launcher code.
131 * If registered against that today ist started on each resume. 140 * If registered against that today ist started on each resume.
132 */ 141 */
133void TodayConfig::setAutoStart() { 142void TodayConfig::setAutoStart() {
134 Config cfg( "today" ); 143 Config cfg( "today" );
135 cfg.setGroup( "Autostart" ); 144 cfg.setGroup( "Autostart" );
136 if ( m_autoStart ) { 145 if ( m_autoStart ) {
137 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); 146 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" );
138 e << QString( "add" ); 147 e << QString( "add" );
139 e << QString( "today" ); 148 e << QString( "today" );
140 e << QString( "%1" ).arg( m_autoStartTimer ); 149 e << QString( "%1" ).arg( m_autoStartTimer );
141 } else { 150 } else {
142 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); 151 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" );
143 e << QString( "remove" ); 152 e << QString( "remove" );
144 e << QString( "today" ); 153 e << QString( "today" );
145 } 154 }
146} 155}
147 156
148/** 157/**
149 * Read the config part 158 * Read the config part
150 */ 159 */
151void TodayConfig::readConfig() { 160void TodayConfig::readConfig() {
152 Config cfg( "today" ); 161 Config cfg( "today" );
153 cfg.setGroup( "Autostart" ); 162 cfg.setGroup( "Autostart" );
154 m_autoStart = cfg.readNumEntry( "autostart", 1 ); 163 m_autoStart = cfg.readNumEntry( "autostart", 1 );
155 CheckBoxAuto->setChecked( m_autoStart ); 164 CheckBoxAuto->setChecked( m_autoStart );
156 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); 165 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 );
157 SpinBoxTime->setValue( m_autoStartTimer ); 166 SpinBoxTime->setValue( m_autoStartTimer );
158 167
159 cfg.setGroup( "General" ); 168 cfg.setGroup( "General" );
160 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 169 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
161 SpinBoxIconSize->setValue( m_iconSize ); 170 SpinBoxIconSize->setValue( m_iconSize );
162 SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); 171 SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 );
172 CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) );
163 173
164 174
165 cfg.setGroup( "Plugins" ); 175 cfg.setGroup( "Plugins" );
166 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 176 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
167} 177}
168 178
169/** 179/**
170 * Write the config part 180 * Write the config part
171 */ 181 */
172void TodayConfig::writeConfig() { 182void TodayConfig::writeConfig() {
173 Config cfg( "today" ); 183 Config cfg( "today" );
174 cfg.setGroup( "Plugins" ); 184 cfg.setGroup( "Plugins" );
175 if ( m_applets_changed ) { 185 if ( m_applets_changed ) {
176 QStringList exclude; 186 QStringList exclude;
177 QStringList include; 187 QStringList include;
178 QStringList all_applets; 188 QStringList all_applets;
179 189
180 QListViewItemIterator list_it( m_appletListView ); 190 QListViewItemIterator list_it( m_appletListView );
181 191
182 // this makes sure the names get saved in the order selected 192 // this makes sure the names get saved in the order selected
183 for ( ; list_it.current(); ++list_it ) { 193 for ( ; list_it.current(); ++list_it ) {
184 QMap <QString, QCheckListItem *>::Iterator it; 194 QMap <QString, QCheckListItem *>::Iterator it;
185 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { 195 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) {
186 if ( list_it.current() == (*it) && !(*it)-> isOn () ) { 196 if ( list_it.current() == (*it) && !(*it)-> isOn () ) {
187 exclude << it.key(); 197 exclude << it.key();
188 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ 198 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){
189 include << it.key(); 199 include << it.key();
190 } 200 }
191 if ( list_it.current() == (*it) ) { 201 if ( list_it.current() == (*it) ) {
192 all_applets << it.key(); 202 all_applets << it.key();
193 } 203 }
194 } 204 }
195 } 205 }
196 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 206 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
197 cfg.writeEntry( "IncludeApplets", include, ',' ); 207 cfg.writeEntry( "IncludeApplets", include, ',' );
198 cfg.writeEntry( "AllApplets", all_applets, ',' ); 208 cfg.writeEntry( "AllApplets", all_applets, ',' );
199 } 209 }
200 210
201 cfg.setGroup( "Autostart" ); 211 cfg.setGroup( "Autostart" );
202 m_autoStart = CheckBoxAuto->isChecked(); 212 m_autoStart = CheckBoxAuto->isChecked();
203 cfg.writeEntry( "autostart", m_autoStart ); 213 cfg.writeEntry( "autostart", m_autoStart );
204 m_autoStartTimer = SpinBoxTime->value(); 214 m_autoStartTimer = SpinBoxTime->value();
205 cfg.writeEntry( "autostartdelay", m_autoStartTimer ); 215 cfg.writeEntry( "autostartdelay", m_autoStartTimer );
206 m_iconSize = SpinBoxIconSize->value(); 216 m_iconSize = SpinBoxIconSize->value();
207 217
208 cfg.setGroup( "General" ); 218 cfg.setGroup( "General" );
209 cfg.writeEntry( "IconSize", m_iconSize ); 219 cfg.writeEntry( "IconSize", m_iconSize );
220 cfg.writeEntry( "HideBanner", CheckBoxHide->isChecked() );
210 cfg.writeEntry( "checkinterval", SpinRefresh->value()*1000 ); 221 cfg.writeEntry( "checkinterval", SpinRefresh->value()*1000 );
211 222
212 // set autostart settings 223 // set autostart settings
213 setAutoStart(); 224 setAutoStart();
214} 225}
215 226
216 227
217void TodayConfig::moveSelectedUp() { 228void TodayConfig::moveSelectedUp() {
218 QListViewItem *item = m_appletListView->selectedItem(); 229 QListViewItem *item = m_appletListView->selectedItem();
219 if ( item && item->itemAbove() ) { 230 if ( item && item->itemAbove() ) {
220 item->itemAbove()->moveItem( item ); 231 item->itemAbove()->moveItem( item );
221 } 232 }
222} 233}
223 234
224 235
225void TodayConfig::moveSelectedDown() { 236void TodayConfig::moveSelectedDown() {
226 QListViewItem *item = m_appletListView->selectedItem(); 237 QListViewItem *item = m_appletListView->selectedItem();
227 if ( item && item->itemBelow() ) { 238 if ( item && item->itemBelow() ) {
228 item->moveItem( item->itemBelow() ); 239 item->moveItem( item->itemBelow() );
229 } 240 }
230} 241}
231 242
232 243
233/** 244/**
234 * Set up the icons in the order/active tab 245 * Set up the icons in the order/active tab
235 */ 246 */
236void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon ) { 247void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon ) {
237 248
238 QCheckListItem *item; 249 QCheckListItem *item;
239 item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox ); 250 item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox );
240 251
241 if ( !icon.isNull() ) { 252 if ( !icon.isNull() ) {
242 item->setPixmap( 0, icon ); 253 item->setPixmap( 0, icon );
243 } 254 }
244 255
245 if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { 256 if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) {
246 item->setOn( TRUE ); 257 item->setOn( TRUE );
247 } 258 }
248 259
249 m_applets[libName] = item; 260 m_applets[libName] = item;
250 261
251 // kind of hack to get the first tab as default. 262 // kind of hack to get the first tab as default.
252 TabWidget3->setCurrentTab( tab_2 ); 263 TabWidget3->setCurrentTab( tab_2 );
253} 264}
254 265
255void TodayConfig::appletChanged() { 266void TodayConfig::appletChanged() {
256 m_applets_changed = true; 267 m_applets_changed = true;
257} 268}
258 269
259 270
260TodayConfig::~TodayConfig() { 271TodayConfig::~TodayConfig() {
261} 272}
262 273
diff --git a/core/pim/today/todayconfig.h b/core/pim/today/todayconfig.h
index 68483c2..41bd44b 100644
--- a/core/pim/today/todayconfig.h
+++ b/core/pim/today/todayconfig.h
@@ -1,74 +1,74 @@
1/* 1/*
2 * todayconfig.h 2 * todayconfig.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#ifndef TODAYCONFIG_H 17#ifndef TODAYCONFIG_H
18#define TODAYCONFIG_H 18#define TODAYCONFIG_H
19 19
20#include <qvariant.h> 20#include <qvariant.h>
21#include <qdialog.h> 21#include <qdialog.h>
22#include <qlistview.h> 22#include <qlistview.h>
23#include <opie/otabwidget.h> 23#include <opie/otabwidget.h>
24 24
25class QCheckBox; 25class QCheckBox;
26class QLabel; 26class QLabel;
27class QSpinBox; 27class QSpinBox;
28class QTabWidget; 28class QTabWidget;
29 29
30class TodayConfig : public QDialog { 30class TodayConfig : public QDialog {
31 31
32 Q_OBJECT 32 Q_OBJECT
33 33
34public: 34public:
35 TodayConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE ); 35 TodayConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE );
36 ~TodayConfig(); 36 ~TodayConfig();
37 37
38 OTabWidget* TabWidget3; 38 OTabWidget* TabWidget3;
39 39
40 void writeConfig(); 40 void writeConfig();
41 void pluginManagement( QString libName, QString name, QPixmap icon ); 41 void pluginManagement( QString libName, QString name, QPixmap icon );
42 42
43 43
44protected slots: 44protected slots:
45 void appletChanged(); 45 void appletChanged();
46 void moveSelectedUp(); 46 void moveSelectedUp();
47 void moveSelectedDown(); 47 void moveSelectedDown();
48 48
49private: 49private:
50 void setAutoStart(); 50 void setAutoStart();
51 void readConfig(); 51 void readConfig();
52 52
53 QListView* m_appletListView; 53 QListView* m_appletListView;
54 QMap<QString,QCheckListItem*> m_applets; 54 QMap<QString,QCheckListItem*> m_applets;
55 55
56 int m_autoStart; 56 int m_autoStart;
57 int m_autoStartTimer; 57 int m_autoStartTimer;
58 int m_iconSize; 58 int m_iconSize;
59 QStringList m_excludeApplets; 59 QStringList m_excludeApplets;
60 bool m_applets_changed; 60 bool m_applets_changed;
61 61
62 QLabel* TextLabel2; 62 QLabel* TextLabel2;
63 QCheckBox* CheckBoxAuto; 63 QCheckBox* CheckBoxAuto, *CheckBoxHide;
64 QWidget* tab_2; 64 QWidget* tab_2;
65 QWidget* tab_3; 65 QWidget* tab_3;
66 QLabel* TextLabel1; 66 QLabel* TextLabel1, *TextLabel4;
67 QSpinBox* SpinBox7; 67 QSpinBox* SpinBox7;
68 QLabel* TimeLabel; 68 QLabel* TimeLabel;
69 QSpinBox* SpinBoxTime; 69 QSpinBox* SpinBoxTime;
70 QSpinBox* SpinRefresh; 70 QSpinBox* SpinRefresh;
71 QSpinBox* SpinBoxIconSize; 71 QSpinBox* SpinBoxIconSize;
72}; 72};
73 73
74#endif 74#endif