summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/configwidget.h4
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp8
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.h1
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.cpp3
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.h6
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.h2
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.h1
-rw-r--r--core/pim/today/today.cpp167
-rw-r--r--core/pim/today/today.h10
-rw-r--r--core/pim/today/todayconfig.cpp15
10 files changed, 105 insertions, 112 deletions
diff --git a/core/pim/today/configwidget.h b/core/pim/today/configwidget.h
index f449db4..02ce37a 100644
--- a/core/pim/today/configwidget.h
+++ b/core/pim/today/configwidget.h
@@ -4,10 +4,10 @@
4 4
5 5
6
7class ConfigWidget : public QWidget { 6class ConfigWidget : public QWidget {
8 7
8
9public: 9public:
10 10
11 ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {}; 11 ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ;
12 virtual ~ConfigWidget() {}; 12 virtual ~ConfigWidget() {};
13 13
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp
index d2a73df..9800e61 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.cpp
+++ b/core/pim/today/plugins/datebook/datebookplugin.cpp
@@ -22,9 +22,4 @@
22#include "datebookpluginconfig.h" 22#include "datebookpluginconfig.h"
23 23
24#include "../../configwidget.h"
25
26#include <qpe/timestring.h>
27#include <qpe/config.h>
28
29 24
30DatebookPlugin::DatebookPlugin() { 25DatebookPlugin::DatebookPlugin() {
@@ -71,3 +66,4 @@ int DatebookPlugin::maxHeight() const {
71 66
72 67
73 68int main() {
69}
diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h
index f2c4446..61dc9f3 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.h
+++ b/core/pim/today/plugins/datebook/datebookplugin.h
@@ -21,5 +21,4 @@
21#include <qwidget.h> 21#include <qwidget.h>
22 22
23#include <qpe/datebookdb.h>
24#include <opie/oclickablelabel.h> 23#include <opie/oclickablelabel.h>
25 24
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
index 7482f5e..51be40e 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
@@ -3,5 +3,4 @@
3#include "datebookpluginconfig.h" 3#include "datebookpluginconfig.h"
4 4
5
6#include <qpe/config.h> 5#include <qpe/config.h>
7 6
@@ -13,5 +12,5 @@
13 12
14DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) 13DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name)
15 : ConfigWidget( parent, name ) { 14 : ConfigWidget( parent, name ) {
16 15
17 QVBoxLayout * layout = new QVBoxLayout( this ); 16 QVBoxLayout * layout = new QVBoxLayout( this );
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h
index 33d3c4e..9505a2d 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.h
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h
@@ -3,5 +3,5 @@
3#define DATEBOOK_PLUGIN_CONFIG_H 3#define DATEBOOK_PLUGIN_CONFIG_H
4 4
5#include <qwidget.h> 5//#include <qwidget.h>
6#include <qcheckbox.h> 6#include <qcheckbox.h>
7#include <qspinbox.h> 7#include <qspinbox.h>
@@ -11,9 +11,9 @@
11class DatebookPluginConfig : public ConfigWidget { 11class DatebookPluginConfig : public ConfigWidget {
12 12
13 Q_OBJECT 13
14 14
15public: 15public:
16 DatebookPluginConfig( QWidget *parent, const char *name ); 16 DatebookPluginConfig( QWidget *parent, const char *name );
17 ~DatebookPluginConfig(); 17 ~DatebookPluginConfig();
18 18
19 void writeConfig(); 19 void writeConfig();
diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h
index 77889d6..7e5006f 100644
--- a/core/pim/today/plugins/todolist/todoplugin.h
+++ b/core/pim/today/plugins/todolist/todoplugin.h
@@ -25,9 +25,7 @@
25 25
26#include "../../todayplugininterface.h" 26#include "../../todayplugininterface.h"
27#include "../../configwidget.h"
28 27
29class TodolistPlugin : public TodayPluginObject { 28class TodolistPlugin : public TodayPluginObject {
30 29
31
32public: 30public:
33 TodolistPlugin(); 31 TodolistPlugin();
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.h b/core/pim/today/plugins/todolist/todopluginconfig.h
index a46cc7c..6be4b1e 100644
--- a/core/pim/today/plugins/todolist/todopluginconfig.h
+++ b/core/pim/today/plugins/todolist/todopluginconfig.h
@@ -25,5 +25,4 @@
25class TodolistPluginConfig : public ConfigWidget { 25class TodolistPluginConfig : public ConfigWidget {
26 26
27 Q_OBJECT
28 27
29public: 28public:
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 09540bd..d78b5b5 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -33,8 +33,19 @@
33#include <qpixmap.h> 33#include <qpixmap.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qhbox.h>
35#include <qtabwidget.h> 36#include <qtabwidget.h>
36#include <qdialog.h> 37#include <qdialog.h>
37 38
38 39
40struct TodayPlugin {
41 QLibrary *library;
42 TodayPluginInterface *iface;
43 TodayPluginObject *guiPart;
44 QHBox *guiBox;
45 QString name;
46 bool active;
47 int pos;
48};
49
39static QValueList<TodayPlugin> pluginList; 50static QValueList<TodayPlugin> pluginList;
40 51
@@ -53,9 +64,10 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
53#endif 64#endif
54 65
55 pluginLayout = 0l; 66 // pluginLayout = 0l;
56 67
57 setOwnerField(); 68 setOwnerField();
58 init(); 69 init();
59 refresh(); 70 loadPlugins();
71 draw();
60 showMaximized(); 72 showMaximized();
61} 73}
@@ -125,4 +137,5 @@ void Today::loadPlugins() {
125 delete (*tit).library; 137 delete (*tit).library;
126 } 138 }
139 pluginList.clear();
127 140
128 QString path = QPEApplication::qpeDir() + "/plugins/today"; 141 QString path = QPEApplication::qpeDir() + "/plugins/today";
@@ -140,9 +153,9 @@ void Today::loadPlugins() {
140 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 153 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
141 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); 154 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
142 qDebug( QString(*it).latin1() ); 155 qDebug( QString(*it) );
143 TodayPlugin plugin; 156 TodayPlugin plugin;
144 plugin.library = lib; 157 plugin.library = lib;
145 plugin.iface = iface; 158 plugin.iface = iface;
146 plugin.name = QString(*it).latin1(); 159 plugin.name = QString(*it);
147 160
148 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 161 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
@@ -152,4 +165,25 @@ void Today::loadPlugins() {
152 } 165 }
153 plugin.guiPart = plugin.iface->guiPart(); 166 plugin.guiPart = plugin.iface->guiPart();
167
168 plugin.guiBox = new QHBox( this );
169 QPixmap plugPix;
170 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 );
171 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
172 plugIcon->setPixmap( plugPix );
173 QScrollView* sv = new QScrollView( plugin.guiBox );
174 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() );
175 sv->setMinimumHeight( plugin.guiPart->minHeight() );
176 //sv->setMaximumHeight( plugin.guiPart->maxHeight() );
177 sv->setResizePolicy( QScrollView::AutoOneFit );
178 sv->setHScrollBarMode( QScrollView::AlwaysOff );
179 sv->setFrameShape( QFrame::NoFrame );
180 sv->addChild( plugWidget );
181
182 //plugin.guiBox->addWidget( plugIcon, 0, AlignTop );
183 //plugin.guiBox->addWidget( sv, 0, AlignTop );
184 plugin.guiBox->setStretchFactor( plugIcon, 1 );
185 plugin.guiBox->setStretchFactor( sv, 9 );
186 layout->addWidget( plugin.guiBox );
187
154 pluginList.append( plugin ); 188 pluginList.append( plugin );
155 count++; 189 count++;
@@ -167,9 +201,4 @@ void Today::loadPlugins() {
167void Today::draw() { 201void Today::draw() {
168 202
169 if ( pluginLayout ) {
170 delete pluginLayout;
171 }
172 pluginLayout = new QVBoxLayout( layout );
173
174 if ( pluginList.count() == 0 ) { 203 if ( pluginList.count() == 0 ) {
175 QLabel *noPlugins = new QLabel( this ); 204 QLabel *noPlugins = new QLabel( this );
@@ -185,27 +214,13 @@ void Today::draw() {
185 214
186 if ( plugin.active ) { 215 if ( plugin.active ) {
187 QHBoxLayout* plugLayout = new QHBoxLayout( this ); 216 qDebug( plugin.name + " is ACTIVE " );
188 QPixmap plugPix; 217 // QHBoxLayout* plugLayout = new QHBoxLayout( this );
189 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); 218 plugin.guiBox->show();
190 OClickableLabel* plugIcon = new OClickableLabel( this ); 219 } else {
191 plugIcon->setPixmap( plugPix ); 220 // plugin.guiWidget->hide();
192 QScrollView* sv = new QScrollView( this ); 221 qDebug( plugin.name + " is INACTIVE" );
193 QWidget* plugWidget = plugin.guiPart->widget( sv->viewport() ); 222 plugin.guiBox->hide();
194 // plugWidget->reparent( sv->viewport(), QPoint( 0, 0 ) ); 223 }
195 sv->setMinimumHeight( plugin.guiPart->minHeight() ); 224 count++;
196 //sv->setMaximumHeight( plugin.guiPart->maxHeight() );
197
198 sv->setResizePolicy( QScrollView::AutoOneFit );
199 sv->setHScrollBarMode( QScrollView::AlwaysOff );
200 sv->setFrameShape( QFrame::NoFrame );
201 sv->addChild( plugWidget );
202
203 plugLayout->addWidget( plugIcon, 0, AlignTop );
204 plugLayout->addWidget( sv, 0, AlignTop );
205 plugLayout->setStretchFactor( plugIcon, 1 );
206 plugLayout->setStretchFactor( sv, 9 );
207 pluginLayout->addLayout( plugLayout );
208 count++;
209 }
210 } 225 }
211 226
@@ -217,16 +232,4 @@ void Today::draw() {
217 232
218 layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 233 layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
219
220
221 // how often refresh - later have qcop update calls in *db
222 // QTimer::singleShot( 20*1000, this, SLOT( draw() ) );
223}
224
225
226void Today::refresh() {
227 loadPlugins();
228 draw();
229 qDebug( "redraw" );
230// QTimer::singleShot( 30*1000, this, SLOT( refresh() ) );
231} 234}
232 235
@@ -236,41 +239,51 @@ void Today::refresh() {
236 */ 239 */
237void Today::startConfig() { 240void Today::startConfig() {
238 conf = new TodayConfig ( this, "", true ); 241
239 242 TodayConfig conf( this, "dialog", true );
240 uint count = 0; 243
241 TodayPlugin plugin; 244 TodayPlugin plugin;
242 245
243 QList<ConfigWidget> configWidgetList; 246 QList<ConfigWidget> configWidgetList;
244 for ( uint i = 0; i < pluginList.count(); i++ ) { 247 for ( uint i = 0; i < pluginList.count(); i++ ) {
245 plugin = pluginList[i]; 248 plugin = pluginList[i];
246 249
247 // load the config widgets in the tabs 250 // load the config widgets in the tabs
248 if ( plugin.guiPart->configWidget( this ) != 0l ) { 251 if ( plugin.guiPart->configWidget( this ) != 0l ) {
249 ConfigWidget* widget = plugin.guiPart->configWidget( this ); 252 ConfigWidget* widget = plugin.guiPart->configWidget( this );
250 widget->reparent( conf , QPoint( 0,0 ) ); 253 configWidgetList.append( widget );
251 configWidgetList.append( widget ); 254 conf.TabWidget3->insertTab( widget, plugin.guiPart->appName() );
252 conf->TabWidget3->insertTab( widget, plugin.guiPart->appName() ); 255 }
253 } 256 // set the order/activate tab
254 // set the order/activate tab 257 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(),
255 conf->pluginManagement( plugin.name, plugin.guiPart->pluginName(),
256 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); 258 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) );
257 count++; 259 }
258 }
259 260
260 conf->showMaximized(); 261 conf.exec();
262 if ( conf.exec() == QDialog::Accepted ) {
263 conf.writeConfig();
264 ConfigWidget *confWidget;
265 for ( confWidget = configWidgetList.first(); confWidget != 0;
266 confWidget = configWidgetList.next() ) {
267 confWidget->writeConfig();
268 }
269 init();
261 270
262 if ( conf->exec() == QDialog::Accepted ) {
263 ConfigWidget *confWidget;
264 for ( confWidget=configWidgetList.first(); confWidget != 0;
265 confWidget = configWidgetList.next() ) {
266 confWidget->writeConfig();
267 }
268 conf->writeConfig();
269 271
270 init(); 272 TodayPlugin plugin;
271 loadPlugins(); 273 for ( uint i = 0; i < pluginList.count(); i++ ) {
272 draw(); 274 plugin = pluginList[i];
273 } 275
274 delete conf; 276 if ( m_excludeApplets.grep( plugin.name ).isEmpty() ) {
277 qDebug("CONFIG" + plugin.name + "ACTIVE");
278 plugin.active = true;
279 } else {
280 qDebug("CONFIG" + plugin.name + "INACTIVE");
281
282 plugin.active = false;
283 }
284 }
285
286 draw();
287 }
275} 288}
276 289
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index ca17020..0a9a705 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -23,4 +23,5 @@
23#include <qdatetime.h> 23#include <qdatetime.h>
24#include <qlist.h> 24#include <qlist.h>
25#include <qhbox.h>
25 26
26#include <qpe/qlibrary.h> 27#include <qpe/qlibrary.h>
@@ -33,12 +34,4 @@
33class QVBoxLayout; 34class QVBoxLayout;
34 35
35struct TodayPlugin {
36 QLibrary *library;
37 TodayPluginInterface *iface;
38 TodayPluginObject *guiPart;
39 QString name;
40 bool active;
41 int pos;
42};
43 36
44class Today : public TodayBase { 37class Today : public TodayBase {
@@ -56,5 +49,4 @@ class Today : public TodayBase {
56 void editCard(); 49 void editCard();
57 void draw(); 50 void draw();
58 void refresh();
59 51
60private: 52private:
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index 08e59c0..79c4d1f 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -31,12 +31,10 @@
31#include <qtoolbutton.h> 31#include <qtoolbutton.h>
32 32
33// for getenv
34#include <stdlib.h>
35
36class ToolButton : public QToolButton { 33class ToolButton : public QToolButton {
34
37public: 35public:
38 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 36 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
39 : QToolButton( parent, name ) { 37 : QToolButton( parent, name ) {
40 setTextLabel( name ); 38 // setTextLabel( name );
41 setPixmap( Resource::loadPixmap( icon ) ); 39 setPixmap( Resource::loadPixmap( icon ) );
42 setAutoRaise( TRUE ); 40 setAutoRaise( TRUE );
@@ -53,15 +51,13 @@ public:
53 * 51 *
54 */ 52 */
55TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags fl ) 53TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags fl )
56 : QDialog( parent, name, modal, fl ) { 54 : QDialog( parent, name, modal, fl ) {
57 55
58 if ( !name ) {
59 setName( "todayconfig" );
60 }
61 setCaption( tr( "Today config" ) ); 56 setCaption( tr( "Today config" ) );
62 57
63 QVBoxLayout *layout = new QVBoxLayout( this ); 58 QVBoxLayout *layout = new QVBoxLayout( this );
64 TabWidget3 = new QTabWidget( this, "TabWidget3" ); 59 TabWidget3 = new QTabWidget( this, "TabWidget3" );
65 TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) ); 60 // TabWidget3->setFrameShape( QFrame::NoFrame );
61 //TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) );
66 TabWidget3->setAutoMask( FALSE ); 62 TabWidget3->setAutoMask( FALSE );
67 TabWidget3->setTabShape( QTabWidget::Rounded ); 63 TabWidget3->setTabShape( QTabWidget::Rounded );
@@ -108,4 +104,5 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags
108 104
109 readConfig(); 105 readConfig();
106 showMaximized();
110} 107}
111 108