summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/TODO2
-rw-r--r--core/pim/today/changelog1
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp14
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.h6
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp53
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.h8
-rw-r--r--core/pim/today/plugins/mail/mailplugin.cpp17
-rw-r--r--core/pim/today/plugins/mail/mailplugin.h6
-rw-r--r--core/pim/today/plugins/mail/mailpluginwidget.cpp33
-rw-r--r--core/pim/today/plugins/mail/mailpluginwidget.h6
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.cpp16
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.h8
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.cpp34
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.h4
-rw-r--r--core/pim/today/today.cpp42
15 files changed, 174 insertions, 76 deletions
diff --git a/core/pim/today/TODO b/core/pim/today/TODO
index 4dc22aa..04354e7 100644
--- a/core/pim/today/TODO
+++ b/core/pim/today/TODO
@@ -1,13 +1,11 @@
1TODO for today: 1TODO for today:
2 2
3- retail rom mail plugin (z) 3- retail rom mail plugin (z)
4 4
5- autostart on retail rom (Z) 5- autostart on retail rom (Z)
6 6
7* show "upcoming appointents the next days
8
9* show alarm icons on alarm events (partly done) 7* show alarm icons on alarm events (partly done)
10 8
11* qcop integration for updating events? 9* qcop integration for updating events?
12 10
13 11
diff --git a/core/pim/today/changelog b/core/pim/today/changelog
index ea618c8..500090d 100644
--- a/core/pim/today/changelog
+++ b/core/pim/today/changelog
@@ -1,99 +1,100 @@
10.6.1 10.6.1
2 2
3* datebook plugin now can now also show following days 3* datebook plugin now can now also show following days
4+ changed refresh
4* fixed one mem leak 5* fixed one mem leak
5 6
60.6 70.6
7 8
8* longer refresh intervals possible 9* longer refresh intervals possible
9* plugins can decide now if they want to take part in refresh cycles 10* plugins can decide now if they want to take part in refresh cycles
10 11
110.5.2 120.5.2
12 13
13* refresh settings 14* refresh settings
14* only launch datebook config when clicked on a date ( opie only ) 15* only launch datebook config when clicked on a date ( opie only )
15* less qcop trouble on sharps retail rom 16* less qcop trouble on sharps retail rom
16 17
170.5.1 180.5.1
18 19
19* icons scalable and clickable again 20* icons scalable and clickable again
20 21
210.5 220.5
22 23
23* now fully plugin based 24* now fully plugin based
24 25
250.3.4 260.3.4
26 27
27* "fill our business card now a clickable label" 28* "fill our business card now a clickable label"
28* Several bugfixes regarding todo section. 29* Several bugfixes regarding todo section.
29 30
300.3.3 310.3.3
31 32
32* Changed the logo so it better scales to bigger display and also 33* Changed the logo so it better scales to bigger display and also
33 made the "Today" string translatable. 34 made the "Today" string translatable.
34* some am/pm fixes 35* some am/pm fixes
35* clickable labels now in libopie 36* clickable labels now in libopie
36 37
370.3.2 380.3.2
38 39
39* Autostart is now more configurable. You can decide how long 40* Autostart is now more configurable. You can decide how long
40 the ipaq has to has been suspended, before autostart is triggered.(Opie 41 the ipaq has to has been suspended, before autostart is triggered.(Opie
41 only) 42 only)
42* am/pm time optinal (autodetect) 43* am/pm time optinal (autodetect)
43 44
440.3.1 450.3.1
45 46
46* fixed the wrong color of the buttons 47* fixed the wrong color of the buttons
47* better translation (thanks carsten and others) 48* better translation (thanks carsten and others)
48* fixes memory leaks 49* fixes memory leaks
49* bugfixes in calendar part, now location and note are working again. 50* bugfixes in calendar part, now location and note are working again.
50 51
510.3.0 520.3.0
52 53
53* today uses now tododb from libopie. So major changes in the todo part: 54* today uses now tododb from libopie. So major changes in the todo part:
54 - overdue items on top 55 - overdue items on top
55 - then sorted by date, then by priority 56 - then sorted by date, then by priority
56* some cleanups 57* some cleanups
57* speed optimisations 58* speed optimisations
58 59
590.2.9 600.2.9
60 61
61* Many bugfixes. 62* Many bugfixes.
62* Today now apparently sorts the dates _allways_ right, i would assume it 63* Today now apparently sorts the dates _allways_ right, i would assume it
63to be a qt bug 64to be a qt bug
64 65
650.2.8 660.2.8
66 67
67* Appointments are now clickable (connection to datebook still missing) 68* Appointments are now clickable (connection to datebook still missing)
68* autostart support (opie only) 69* autostart support (opie only)
69 70
700.2.7 710.2.7
71 72
72* check if todolist.xml was changed before parsing it 73* check if todolist.xml was changed before parsing it
73* check only every 30 sec for changes. 74* check only every 30 sec for changes.
74* some visual stuff 75* some visual stuff
75* as usual many little improvements .-) 76* as usual many little improvements .-)
76 77
770.2.6 780.2.6
78 79
79* added scrollbars to dates and todo 80* added scrollbars to dates and todo
80* all day detection 81* all day detection
81* some smaller bugfixes 82* some smaller bugfixes
82 83
830.2.5 840.2.5
84 85
85* some other minor fixes regarding autoupdate 86* some other minor fixes regarding autoupdate
86* fixed segfault with todolist > 7 entries 87* fixed segfault with todolist > 7 entries
87* fixed the "ugly grey border around buttons" issue 88* fixed the "ugly grey border around buttons" issue
88* fixed the "empty calendar field" "bug" 89* fixed the "empty calendar field" "bug"
89* shown only later appointments as option 90* shown only later appointments as option
90 91
91 92
920.2.4 930.2.4
93 94
94* added support for email 95* added support for email
95* autoupdates after 1 min 96* autoupdates after 1 min
96* QCopEnvelope instead of system() 97* QCopEnvelope instead of system()
97* starting to use qvbox in gui 98* starting to use qvbox in gui
98 99
99 100
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp
index eda84be..2ac7d01 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.cpp
+++ b/core/pim/today/plugins/datebook/datebookplugin.cpp
@@ -1,62 +1,72 @@
1 1
2/* 2/*
3 * datebookplugin.cpp 3 * datebookplugin.cpp
4 * 4 *
5 * copyright : (c) 2002 by Maximilian Reiß 5 * copyright : (c) 2002 by Maximilian Reiß
6 * email : harlekin@handhelds.org 6 * email : harlekin@handhelds.org
7 * 7 *
8 */ 8 */
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18 18
19 19
20#include "datebookevent.h" 20#include "datebookevent.h"
21#include "datebookplugin.h" 21#include "datebookplugin.h"
22#include "datebookpluginwidget.h"
23#include "datebookpluginconfig.h" 22#include "datebookpluginconfig.h"
24 23
25 24
26DatebookPlugin::DatebookPlugin() { 25DatebookPlugin::DatebookPlugin() {
26 m_widget = 0;
27} 27}
28 28
29DatebookPlugin::~DatebookPlugin() { 29DatebookPlugin::~DatebookPlugin() {
30 delete m_widget;
30} 31}
31 32
32QString DatebookPlugin::pluginName() const { 33QString DatebookPlugin::pluginName() const {
33 return QObject::tr( "Datebook plugin"); 34 return QObject::tr( "Datebook plugin");
34} 35}
35 36
36double DatebookPlugin::versionNumber() const { 37double DatebookPlugin::versionNumber() const {
37 return 1.0; 38 return 1.0;
38} 39}
39 40
40QString DatebookPlugin::pixmapNameWidget() const { 41QString DatebookPlugin::pixmapNameWidget() const {
41 return "DateBook"; 42 return "DateBook";
42} 43}
43 44
44QWidget* DatebookPlugin::widget( QWidget* wid ) { 45QWidget* DatebookPlugin::widget( QWidget* wid ) {
45 return new DatebookPluginWidget( wid, "Datebook" ); 46 if(!m_widget) {
47 m_widget = new DatebookPluginWidget( wid, "Datebook" );
48 }
49 return m_widget;
46} 50}
47 51
48QString DatebookPlugin::pixmapNameConfig() const { 52QString DatebookPlugin::pixmapNameConfig() const {
49 return "DateBook"; 53 return "DateBook";
50} 54}
51 55
52TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { 56TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) {
53 return new DatebookPluginConfig( wid , "Datebook" ); 57 return new DatebookPluginConfig( wid , "Datebook" );
54} 58}
55 59
56QString DatebookPlugin::appName() const { 60QString DatebookPlugin::appName() const {
57 return "datebook"; 61 return "datebook";
58} 62}
59 63
60bool DatebookPlugin::excludeFromRefresh() const { 64bool DatebookPlugin::excludeFromRefresh() const {
61 return false; 65 return false;
62} 66}
67
68void DatebookPlugin::refresh() {
69 if ( m_widget ) {
70 m_widget->refresh();
71 }
72}
diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h
index 13c62a9..644a614 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.h
+++ b/core/pim/today/plugins/datebook/datebookplugin.h
@@ -1,43 +1,49 @@
1/* 1/*
2 * datebookplugin.h 2 * datebookplugin.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 DATEBOOK_PLUGIN_H 17#ifndef DATEBOOK_PLUGIN_H
18#define DATEBOOK_PLUGIN_H 18#define DATEBOOK_PLUGIN_H
19 19
20#include <qstring.h> 20#include <qstring.h>
21#include <qwidget.h> 21#include <qwidget.h>
22 22
23#include <opie/oclickablelabel.h> 23#include <opie/oclickablelabel.h>
24#include <opie/todayplugininterface.h> 24#include <opie/todayplugininterface.h>
25 25
26#include "datebookpluginwidget.h"
27
26class DatebookPlugin : public TodayPluginObject { 28class DatebookPlugin : public TodayPluginObject {
27 29
28public: 30public:
29 DatebookPlugin(); 31 DatebookPlugin();
30 ~DatebookPlugin(); 32 ~DatebookPlugin();
31 33
32 QString pluginName() const; 34 QString pluginName() const;
33 double versionNumber() const; 35 double versionNumber() const;
34 QString pixmapNameWidget() const; 36 QString pixmapNameWidget() const;
35 QWidget* widget( QWidget *); 37 QWidget* widget( QWidget *);
36 QString pixmapNameConfig() const; 38 QString pixmapNameConfig() const;
37 TodayConfigWidget* configWidget( QWidget *); 39 TodayConfigWidget* configWidget( QWidget *);
38 QString appName() const; 40 QString appName() const;
39 bool excludeFromRefresh() const; 41 bool excludeFromRefresh() const;
42 void refresh();
43
44 private:
45 DatebookPluginWidget *m_widget;
40}; 46};
41 47
42 48
43#endif 49#endif
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index c6aa2a6..e2f492e 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -1,112 +1,117 @@
1/* 1 /*
2 * datebookpluginwidget.cpp 2 * datebookpluginwidget.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 "datebookpluginwidget.h" 18#include "datebookpluginwidget.h"
19#include "datebookevent.h"
20 19
21#include <qpe/timestring.h> 20#include <qpe/timestring.h>
22#include <qpe/config.h> 21#include <qpe/config.h>
23 22
24#include <qdatetime.h> 23#include <qdatetime.h>
25#include <qlabel.h> 24#include <qlabel.h>
26#include <qlayout.h> 25#include <qlayout.h>
27#include <qtl.h> 26#include <qtl.h>
28#include <qscrollview.h> 27#include <qscrollview.h>
29#include <qtimer.h> 28#include <qtimer.h>
30 29
31DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name) 30DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name)
32 : QWidget(parent, name ) { 31 : QWidget(parent, name ) {
32
33 db = 0l; 33 db = 0l;
34 m_layoutDates = 0l;
35
36 if ( db ) {
37 delete db;
38 }
39 db = new DateBookDB;
40
41 if ( m_layoutDates ) {
42 delete m_layoutDates;
43 }
44 m_layoutDates = new QVBoxLayout( this );
45 m_layoutDates->setAutoAdd( true );
46
34 readConfig(); 47 readConfig();
35 getDates(); 48 getDates();
36} 49}
37 50
38DatebookPluginWidget::~DatebookPluginWidget() { 51DatebookPluginWidget::~DatebookPluginWidget() {
39 delete db; 52 delete db;
53 delete m_layoutDates;
40} 54}
41 55
42 56
43void DatebookPluginWidget::readConfig() { 57void DatebookPluginWidget::readConfig() {
44 Config cfg( "todaydatebookplugin" ); 58 Config cfg( "todaydatebookplugin" );
45 cfg.setGroup( "config" ); 59 cfg.setGroup( "config" );
46 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); 60 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
47 m_show_location = cfg.readNumEntry( "showlocation", 1 ); 61 m_show_location = cfg.readNumEntry( "showlocation", 1 );
48 m_show_notes = cfg.readNumEntry( "shownotes", 0 ); 62 m_show_notes = cfg.readNumEntry( "shownotes", 0 );
49 m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); 63 m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
50 m_moreDays = cfg.readNumEntry( "moredays", 0 ); 64 m_moreDays = cfg.readNumEntry( "moredays", 0 );
51} 65}
52 66
67void DatebookPluginWidget::refresh() {
68 DateBookEvent* ev;
69 for ( ev = m_eventsList.first(); ev != 0; ev = m_eventsList.next() ) {
70 delete ev;
71 }
72 getDates();
73}
53 74
54/** 75/**
55 * Get all events that are in the datebook xml file for today 76 * Get all events that are in the datebook xml file for today
56 */ 77 */
57void DatebookPluginWidget::getDates() { 78void DatebookPluginWidget::getDates() {
58 79
59
60 QDate date = QDate::currentDate(); 80 QDate date = QDate::currentDate();
61 81
62 QVBoxLayout* layoutDates = new QVBoxLayout( this );
63 layoutDates->setSpacing( 1 );
64 layoutDates->setMargin( 1 );
65
66 if ( db ) {
67 delete db;
68 }
69
70 db = new DateBookDB;
71
72 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); 82 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
73
74 qBubbleSort( list ); 83 qBubbleSort( list );
75 84 //Config config( "qpe" );
76 Config config( "qpe" );
77
78 int count=0; 85 int count=0;
79 86
80 if ( list.count() > 0 ) { 87 if ( list.count() > 0 ) {
81 88
82 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { 89 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
83 90
84 if ( count <= m_max_lines_meet ) { 91 if ( count <= m_max_lines_meet ) {
85 QTime time = QTime::currentTime(); 92 QTime time = QTime::currentTime();
86 93
87 if ( !m_onlyLater ) { 94 if ( !m_onlyLater ) {
88 count++; 95 count++;
89 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); 96 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
90 layoutDates->addWidget( l ); 97 m_eventsList.append( l );
91 QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); 98 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
92 } else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) { 99 } else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) {
93 count++; 100 count++;
94 // show only later appointments 101 // show only later appointments
95 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); 102 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
96 layoutDates->addWidget( l ); 103 m_eventsList.append( l );
97 QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); 104 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
98 } 105 }
99 } 106 }
100 } 107 }
101 if ( m_onlyLater && count == 0 ) { 108 if ( m_onlyLater && count == 0 ) {
102 QLabel* noMoreEvents = new QLabel( this ); 109 QLabel* noMoreEvents = new QLabel( this );
103 noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); 110 noMoreEvents->setText( QObject::tr( "No more appointments today" ) );
104 layoutDates->addWidget( noMoreEvents );
105 } 111 }
106 } else { 112 } else {
107 QLabel* noEvents = new QLabel( this ); 113 QLabel* noEvents = new QLabel( this );
108 noEvents->setText( QObject::tr( "No appointments today" ) ); 114 noEvents->setText( QObject::tr( "No appointments today" ) );
109 layoutDates->addWidget( noEvents );
110 } 115 }
111} 116}
112 117
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h
index 3ebbc3d..8380bc7 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.h
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h
@@ -1,53 +1,59 @@
1/* 1/*
2 * datebookpluginwidget.h 2 * datebookpluginwidget.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 DATEBOOK_PLUGIN_WIDGET_H 17#ifndef DATEBOOK_PLUGIN_WIDGET_H
18#define DATEBOOK_PLUGIN_WIDGET_H 18#define DATEBOOK_PLUGIN_WIDGET_H
19 19
20#include <qstring.h> 20#include <qstring.h>
21#include <qwidget.h> 21#include <qwidget.h>
22#include <qlayout.h>
23#include <qlist.h>
22 24
23#include <qpe/datebookdb.h> 25#include <qpe/datebookdb.h>
24#include <opie/oclickablelabel.h> 26#include <opie/oclickablelabel.h>
25 27
28#include "datebookevent.h"
26 29
27class DatebookPluginWidget : public QWidget { 30class DatebookPluginWidget : public QWidget {
28 31
29 Q_OBJECT 32 Q_OBJECT
30 33
31public: 34public:
32 DatebookPluginWidget( QWidget *parent, const char *name ); 35 DatebookPluginWidget( QWidget *parent, const char *name );
33 ~DatebookPluginWidget(); 36 ~DatebookPluginWidget();
34 37 void refresh();
35 38
36private: 39private:
37 DateBookDB* db; 40 DateBookDB* db;
41 QVBoxLayout* m_layoutDates;
42 QList<DateBookEvent> m_eventsList;
38 void readConfig(); 43 void readConfig();
39 void getDates(); 44 void getDates();
40 45
46
41 // how many lines should be showed in the datebook section 47 // how many lines should be showed in the datebook section
42 int m_max_lines_meet; 48 int m_max_lines_meet;
43 // If location is to be showed too, 1 to activate it. 49 // If location is to be showed too, 1 to activate it.
44 bool m_show_location; 50 bool m_show_location;
45 // if notes should be shown 51 // if notes should be shown
46 bool m_show_notes; 52 bool m_show_notes;
47 // should only later appointments be shown or all for the current day. 53 // should only later appointments be shown or all for the current day.
48 bool m_onlyLater; 54 bool m_onlyLater;
49 int m_moreDays; 55 int m_moreDays;
50 56
51}; 57};
52 58
53#endif 59#endif
diff --git a/core/pim/today/plugins/mail/mailplugin.cpp b/core/pim/today/plugins/mail/mailplugin.cpp
index d497970..a37d506 100644
--- a/core/pim/today/plugins/mail/mailplugin.cpp
+++ b/core/pim/today/plugins/mail/mailplugin.cpp
@@ -1,60 +1,69 @@
1/* 1/*
2 * mailplugin.cpp 2 * mailplugin.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 "mailplugin.h" 18#include "mailplugin.h"
19#include "mailpluginwidget.h"
20
21 19
22MailPlugin::MailPlugin() { 20MailPlugin::MailPlugin() {
21 m_widget = 0l;
23} 22}
24 23
25MailPlugin::~MailPlugin() { 24MailPlugin::~MailPlugin() {
25 delete m_widget;
26} 26}
27 27
28QString MailPlugin::pluginName() const { 28QString MailPlugin::pluginName() const {
29 return QObject::tr( "Mail plugin" ); 29 return QObject::tr( "Mail plugin" );
30} 30}
31 31
32double MailPlugin::versionNumber() const { 32double MailPlugin::versionNumber() const {
33 return 0.6; 33 return 0.6;
34} 34}
35 35
36QString MailPlugin::pixmapNameWidget() const { 36QString MailPlugin::pixmapNameWidget() const {
37 return "mail/desktopicon"; 37 return "mail/desktopicon";
38} 38}
39 39
40QWidget* MailPlugin::widget( QWidget * wid ) { 40QWidget* MailPlugin::widget( QWidget * wid ) {
41 return new MailPluginWidget( wid, "Mail" ); 41 if(!m_widget) {
42 m_widget = new MailPluginWidget( wid, "Datebook" );
43 }
44 return m_widget;
42} 45}
43 46
47
44QString MailPlugin::pixmapNameConfig() const { 48QString MailPlugin::pixmapNameConfig() const {
45 return 0l; 49 return 0l;
46} 50}
47 51
48TodayConfigWidget* MailPlugin::configWidget( QWidget* wid ) { 52TodayConfigWidget* MailPlugin::configWidget( QWidget* ) {
49 return 0l; 53 return 0l;
50} 54}
51 55
52QString MailPlugin::appName() const { 56QString MailPlugin::appName() const {
53 return "mail"; 57 return "mail";
54} 58}
55 59
56 60
57bool MailPlugin::excludeFromRefresh() const { 61bool MailPlugin::excludeFromRefresh() const {
58 return false; 62 return false;
59} 63}
60 64
65void MailPlugin::refresh() {
66 if ( m_widget ) {
67 m_widget->refresh();
68 }
69}
diff --git a/core/pim/today/plugins/mail/mailplugin.h b/core/pim/today/plugins/mail/mailplugin.h
index c937b9e..67fac0c 100644
--- a/core/pim/today/plugins/mail/mailplugin.h
+++ b/core/pim/today/plugins/mail/mailplugin.h
@@ -1,46 +1,52 @@
1/* 1/*
2 * mailplugin.h 2 * mailplugin.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 MAIL_PLUGIN_H 18#ifndef MAIL_PLUGIN_H
19#define MAIL_PLUGIN_H 19#define MAIL_PLUGIN_H
20 20
21#include <qstring.h> 21#include <qstring.h>
22#include <qwidget.h> 22#include <qwidget.h>
23 23
24#include <opie/tododb.h> 24#include <opie/tododb.h>
25#include <opie/oclickablelabel.h> 25#include <opie/oclickablelabel.h>
26 26
27#include <opie/todayplugininterface.h> 27#include <opie/todayplugininterface.h>
28#include <opie/todayconfigwidget.h> 28#include <opie/todayconfigwidget.h>
29 29
30#include "mailpluginwidget.h"
31
30class MailPlugin : public TodayPluginObject { 32class MailPlugin : public TodayPluginObject {
31 33
32public: 34public:
33 MailPlugin(); 35 MailPlugin();
34 ~MailPlugin(); 36 ~MailPlugin();
35 37
36 QString pluginName() const; 38 QString pluginName() const;
37 double versionNumber() const; 39 double versionNumber() const;
38 QString pixmapNameWidget() const; 40 QString pixmapNameWidget() const;
39 QWidget* widget(QWidget *); 41 QWidget* widget(QWidget *);
40 QString pixmapNameConfig() const; 42 QString pixmapNameConfig() const;
41 TodayConfigWidget* configWidget(QWidget *); 43 TodayConfigWidget* configWidget(QWidget *);
42 QString appName() const; 44 QString appName() const;
43 bool excludeFromRefresh() const; 45 bool excludeFromRefresh() const;
46 void refresh();
47
48 private:
49 MailPluginWidget *m_widget;
44}; 50};
45 51
46#endif 52#endif
diff --git a/core/pim/today/plugins/mail/mailpluginwidget.cpp b/core/pim/today/plugins/mail/mailpluginwidget.cpp
index a6f3562..aad1d07 100644
--- a/core/pim/today/plugins/mail/mailpluginwidget.cpp
+++ b/core/pim/today/plugins/mail/mailpluginwidget.cpp
@@ -1,73 +1,88 @@
1/* 1/*
2 * mailpluginwidget.cpp 2 * mailpluginwidget.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 <qvaluelist.h> 18#include <qvaluelist.h>
19#include <qtl.h> 19#include <qtl.h>
20#include <qstring.h> 20#include <qstring.h>
21#include <qobject.h> 21#include <qobject.h>
22#include <qlayout.h> 22#include <qlayout.h>
23 23
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qpe/timestring.h> 25#include <qpe/timestring.h>
26#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
27 27
28#include "mailpluginwidget.h" 28#include "mailpluginwidget.h"
29 29
30MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) 30MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name)
31 : QWidget(parent, name ) { 31 : QWidget(parent, name ) {
32 32
33 m_mailLabel = 0l;
34 m_layout = 0l;
35
36 if ( m_mailLabel ) {
37 delete m_mailLabel;
38 }
39 m_mailLabel = new OClickableLabel( this );
40 m_mailLabel->setMaximumHeight( 15 );
41 connect( m_mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) );
42
43 if ( m_layout ) {
44 delete m_layout;
45 }
46 m_layout = new QHBoxLayout( this );
47 m_layout->setAutoAdd( true );
48
33 readConfig(); 49 readConfig();
34 getInfo(); 50 getInfo();
35} 51}
36 52
37MailPluginWidget::~MailPluginWidget() { 53MailPluginWidget::~MailPluginWidget() {
54 delete m_mailLabel;
55 delete m_layout;
38} 56}
39 57
40 58
41void MailPluginWidget::readConfig() { 59void MailPluginWidget::readConfig() {
42 Config cfg( "todaymailplugin" ); 60 Config cfg( "todaymailplugin" );
43 cfg.setGroup( "config" ); 61 cfg.setGroup( "config" );
44} 62}
45 63
46 64
47void MailPluginWidget::getInfo() { 65void MailPluginWidget::refresh() {
48 66 getInfo();
49 QHBoxLayout* layout = new QHBoxLayout( this ); 67}
50 68
51 mailLabel = new OClickableLabel( this ); 69void MailPluginWidget::getInfo() {
52 mailLabel->setMaximumHeight( 15 );
53 connect( mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) );
54 70
55 Config cfg( "opiemail" ); 71 Config cfg( "opiemail" );
56 cfg.setGroup( "today" ); 72 cfg.setGroup( "today" );
57 73
58 int NEW_MAILS = cfg.readNumEntry( "newmails", 0 ); 74 int NEW_MAILS = cfg.readNumEntry( "newmails", 0 );
59 int OUTGOING = cfg.readNumEntry( "outgoing", 0 ); 75 int OUTGOING = cfg.readNumEntry( "outgoing", 0 );
60 76
61 QString output = QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ); 77 //QString output = QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING );
62 78
63 mailLabel->setText( output ); 79 m_mailLabel->setText( QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING ) );
64 layout->addWidget( mailLabel );
65} 80}
66 81
67/** 82/**
68 * launches datebook 83 * launches datebook
69 */ 84 */
70void MailPluginWidget::startMail() { 85void MailPluginWidget::startMail() {
71 QCopEnvelope e("QPE/System", "execute(QString)"); 86 QCopEnvelope e("QPE/System", "execute(QString)");
72 e << QString( "mail" ); 87 e << QString( "mail" );
73} 88}
diff --git a/core/pim/today/plugins/mail/mailpluginwidget.h b/core/pim/today/plugins/mail/mailpluginwidget.h
index 2feef80..c678833 100644
--- a/core/pim/today/plugins/mail/mailpluginwidget.h
+++ b/core/pim/today/plugins/mail/mailpluginwidget.h
@@ -1,45 +1,49 @@
1/* 1/*
2 * mailpluginwidget.h 2 * mailpluginwidget.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 MAIL_PLUGIN_WIDGET_H 18#ifndef MAIL_PLUGIN_WIDGET_H
19#define MAIL_PLUGIN_WIDGET_H 19#define MAIL_PLUGIN_WIDGET_H
20 20
21#include <qstring.h> 21#include <qstring.h>
22#include <qwidget.h> 22#include <qwidget.h>
23#include <qlayout.h>
23 24
24#include <opie/tododb.h> 25#include <opie/tododb.h>
25#include <opie/oclickablelabel.h> 26#include <opie/oclickablelabel.h>
26 27
27class MailPluginWidget : public QWidget { 28class MailPluginWidget : public QWidget {
28 29
29 Q_OBJECT 30 Q_OBJECT
30 31
31 32
32public: 33public:
33 MailPluginWidget( QWidget *parent, const char *name ); 34 MailPluginWidget( QWidget *parent, const char *name );
34 ~MailPluginWidget(); 35 ~MailPluginWidget();
36
37 void refresh();
35 38
36protected slots: 39protected slots:
37 void startMail(); 40 void startMail();
38 41
39private: 42private:
40 OClickableLabel *mailLabel; 43 OClickableLabel* m_mailLabel;
44 QHBoxLayout* m_layout;
41 void readConfig(); 45 void readConfig();
42 void getInfo(); 46 void getInfo();
43}; 47};
44 48
45#endif 49#endif
diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp
index b5abbd3..1238f92 100644
--- a/core/pim/today/plugins/todolist/todoplugin.cpp
+++ b/core/pim/today/plugins/todolist/todoplugin.cpp
@@ -1,61 +1,71 @@
1/* 1/*
2 * todoplugin.cpp 2 * todoplugin.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 18
19#include "todoplugin.h" 19#include "todoplugin.h"
20#include "todopluginconfig.h" 20#include "todopluginconfig.h"
21#include "todopluginwidget.h"
22 21
23 22
24TodolistPlugin::TodolistPlugin() { 23TodolistPlugin::TodolistPlugin() {
24 m_widget = 0l;
25} 25}
26 26
27TodolistPlugin::~TodolistPlugin() { 27TodolistPlugin::~TodolistPlugin() {
28 delete m_widget;
28} 29}
29 30
30QString TodolistPlugin::pluginName() const { 31QString TodolistPlugin::pluginName() const {
31 return QObject::tr( "Todolist plugin" ); 32 return QObject::tr( "Todolist plugin" );
32} 33}
33 34
34double TodolistPlugin::versionNumber() const { 35double TodolistPlugin::versionNumber() const {
35 return 0.8; 36 return 0.9;
36} 37}
37 38
38QString TodolistPlugin::pixmapNameWidget() const { 39QString TodolistPlugin::pixmapNameWidget() const {
39 return "TodoList"; 40 return "TodoList";
40} 41}
41 42
42QWidget* TodolistPlugin::widget( QWidget *wid ) { 43QWidget* TodolistPlugin::widget( QWidget *wid ) {
43 return new TodolistPluginWidget( wid, "Todolist" ); 44 if(!m_widget) {
45 m_widget = new TodolistPluginWidget( wid, "Todolist" );
46 }
47 return m_widget;
44} 48}
45 49
46QString TodolistPlugin::pixmapNameConfig() const { 50QString TodolistPlugin::pixmapNameConfig() const {
47 return "TodoList"; 51 return "TodoList";
48} 52}
49 53
50TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { 54TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) {
51 return new TodolistPluginConfig( wid , "Todolist" ); 55 return new TodolistPluginConfig( wid , "Todolist" );
52} 56}
53 57
54QString TodolistPlugin::appName() const { 58QString TodolistPlugin::appName() const {
55 return "todolist"; 59 return "todolist";
56} 60}
57 61
58 62
59bool TodolistPlugin::excludeFromRefresh() const { 63bool TodolistPlugin::excludeFromRefresh() const {
60 return false; 64 return false;
61} 65}
66
67void TodolistPlugin::refresh() {
68 if ( m_widget ) {
69 m_widget->refresh();
70 }
71}
diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h
index f98afdb..6106d0c 100644
--- a/core/pim/today/plugins/todolist/todoplugin.h
+++ b/core/pim/today/plugins/todolist/todoplugin.h
@@ -1,43 +1,49 @@
1/* 1/*
2 * todoplugin.h 2 * todoplugin.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 TODOLIST_PLUGIN_H 17#ifndef TODOLIST_PLUGIN_H
18#define TODOLIST_PLUGIN_H 18#define TODOLIST_PLUGIN_H
19 19
20#include <qstring.h> 20#include <qstring.h>
21#include <qwidget.h> 21#include <qwidget.h>
22 22
23#include <opie/tododb.h> 23#include <opie/tododb.h>
24#include <opie/oclickablelabel.h> 24#include <opie/oclickablelabel.h>
25#include <opie/todayplugininterface.h> 25#include <opie/todayplugininterface.h>
26 26
27#include "todopluginwidget.h"
28
27class TodolistPlugin : public TodayPluginObject { 29class TodolistPlugin : public TodayPluginObject {
28 30
29public: 31public:
30 TodolistPlugin(); 32 TodolistPlugin();
31 ~TodolistPlugin(); 33 ~TodolistPlugin();
32 34
33 QString pluginName() const; 35 QString pluginName() const;
34 double versionNumber() const; 36 double versionNumber() const;
35 QString pixmapNameWidget() const; 37 QString pixmapNameWidget() const;
36 QWidget* widget(QWidget *); 38 QWidget* widget(QWidget *);
37 QString pixmapNameConfig() const; 39 QString pixmapNameConfig() const;
38 TodayConfigWidget* configWidget(QWidget *); 40 TodayConfigWidget* configWidget(QWidget *);
39 QString appName() const; 41 QString appName() const;
40 bool excludeFromRefresh() const; 42 bool excludeFromRefresh() const;
43 void refresh();
44
45 private:
46 TodolistPluginWidget *m_widget;
41}; 47};
42 48
43#endif 49#endif
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp
index 773e5cf..3242dac 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.cpp
+++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp
@@ -1,130 +1,140 @@
1/* 1/*
2 * todopluginwidget.cpp 2 * todopluginwidget.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 "todopluginwidget.h" 17#include "todopluginwidget.h"
18 18
19#include <qvaluelist.h> 19#include <qvaluelist.h>
20#include <qtl.h> 20#include <qtl.h>
21#include <qstring.h> 21#include <qstring.h>
22#include <qscrollview.h> 22#include <qscrollview.h>
23#include <qobject.h> 23#include <qobject.h>
24#include <qlayout.h> 24#include <qlayout.h>
25 25
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/timestring.h> 27#include <qpe/timestring.h>
28#include <qpe/qcopenvelope_qws.h> 28#include <qpe/qcopenvelope_qws.h>
29 29
30TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) 30TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name )
31 : QWidget( parent, name ) { 31 : QWidget( parent, name ) {
32 32
33 todoLabel = 0l;
34 todo = 0l; 33 todo = 0l;
34 layoutTodo = 0l;
35 todoLabel = 0l;
35 36
36 if ( todo ) { 37 if ( todo ) {
37 delete todo; 38 delete todo;
38 } 39 }
39
40 todo = new OTodoAccess(); 40 todo = new OTodoAccess();
41 todo->load(); 41 todo->load();
42 42
43 if ( layoutTodo ) {
44 delete layoutTodo;
45 }
46 layoutTodo = new QVBoxLayout( this );
47 layoutTodo->setAutoAdd( true );
48
49
50 if ( todoLabel ) {
51 delete todoLabel;
52 }
53 todoLabel = new OClickableLabel( this );
54
55 connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
56
43 readConfig(); 57 readConfig();
44 getTodo(); 58 getTodo();
45} 59}
46 60
47TodolistPluginWidget::~TodolistPluginWidget() { 61TodolistPluginWidget::~TodolistPluginWidget() {
48 delete todo; 62 delete todo;
63 delete todoLabel;
64 delete layoutTodo;
49} 65}
50 66
51 67
52void TodolistPluginWidget::readConfig() { 68void TodolistPluginWidget::readConfig() {
53 Config cfg( "todaytodoplugin" ); 69 Config cfg( "todaytodoplugin" );
54 cfg.setGroup( "config" ); 70 cfg.setGroup( "config" );
55 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); 71 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
56 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 72 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
57} 73}
58 74
75void TodolistPluginWidget:: refresh() {
76 getTodo();
77}
59 78
60/** 79/**
61 * Get the todos 80 * Get the todos
62 */ 81 */
63void TodolistPluginWidget::getTodo() { 82void TodolistPluginWidget::getTodo() {
64 83
65 QVBoxLayout* layoutTodo = new QVBoxLayout( this );
66
67 if ( todoLabel ) {
68 delete todoLabel;
69 }
70
71 todoLabel = new OClickableLabel( this );
72 connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
73 84
74 QString output; 85 QString output;
75 QString tmpout; 86 QString tmpout;
76 int count = 0; 87 int count = 0;
77 int ammount = 0; 88 int ammount = 0;
78 89
79 // get overdue todos first 90 // get overdue todos first
80 m_list = todo->overDue(); 91 m_list = todo->overDue();
81 92
82 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 93 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
83 if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) { 94 if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) {
84 QString desc = (*m_it).summary(); 95 QString desc = (*m_it).summary();
85 if( desc.isEmpty() ) { 96 if( desc.isEmpty() ) {
86 desc = (*m_it).description(); 97 desc = (*m_it).description();
87 } 98 }
88 tmpout += "<font color=#e00000><b>-" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; 99 tmpout += "<font color=#e00000><b>-" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>";
89 ammount++; 100 ammount++ ;
90 } 101 }
91 } 102 }
92 103
93 // get total number of still open todos 104 // get total number of still open todos
94 m_list = todo->sorted( true, 1, 4, 1); 105 m_list = todo->sorted( true, 1, 4, 1);
95 106
96 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 107 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
97 count +=1; 108 count +=1;
98 // not the overdues, we allready got them, and not if we are 109 // not the overdues, we allready got them, and not if we are
99 // over the maxlines 110 // over the maxlines
100 if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) { 111 if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) {
101 QString desc = (*m_it).summary(); 112 QString desc = (*m_it).summary();
102 if( desc.isEmpty() ) { 113 if( desc.isEmpty() ) {
103 desc = (*m_it).description(); 114 desc = (*m_it).description();
104 } 115 }
105 tmpout += "<b>-</b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; 116 tmpout += "<b>-</b>" + desc.mid( 0, m_maxCharClip ) + "<br>";
106 ammount++; 117 ammount++;
107 } 118 }
108 } 119 }
109 120
110 if ( count > 0 ) { 121 if ( count > 0 ) {
111 if( count == 1 ) { 122 if( count == 1 ) {
112 output += QObject::tr( "There is <b> 1</b> active task: <br>" ); 123 output += QObject::tr( "There is <b> 1</b> active task: <br>" );
113 } else { 124 } else {
114 output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg( count ); 125 output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg( count );
115 } 126 }
116 output += tmpout; 127 output += tmpout;
117 } else { 128 } else {
118 output = QObject::tr( "No active tasks" ); 129 output = QObject::tr( "No active tasks" );
119 } 130 }
120 todoLabel->setText( output ); 131 todoLabel->setText( output );
121 layoutTodo->addWidget( todoLabel );
122} 132}
123 133
124/** 134/**
125 * start the todolist 135 * start the todolist
126 */ 136 */
127void TodolistPluginWidget::startTodolist() { 137void TodolistPluginWidget::startTodolist() {
128 QCopEnvelope e( "QPE/System", "execute(QString)" ); 138 QCopEnvelope e( "QPE/System", "execute(QString)" );
129 e << QString( "todolist" ); 139 e << QString( "todolist" );
130} 140}
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h
index 37b0ee1..0d0deb5 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.h
+++ b/core/pim/today/plugins/todolist/todopluginwidget.h
@@ -1,52 +1,56 @@
1/* 1/*
2 * todopluginwidget.h 2 * todopluginwidget.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 TODOLIST_PLUGIN_WIDGET_H 17#ifndef TODOLIST_PLUGIN_WIDGET_H
18#define TODOLIST_PLUGIN_WIDGET_H 18#define TODOLIST_PLUGIN_WIDGET_H
19 19
20#include <qstring.h> 20#include <qstring.h>
21#include <qwidget.h> 21#include <qwidget.h>
22#include <qlayout.h>
22 23
23#include <opie/otodo.h> 24#include <opie/otodo.h>
24#include <opie/otodoaccess.h> 25#include <opie/otodoaccess.h>
25#include <opie/oclickablelabel.h> 26#include <opie/oclickablelabel.h>
26 27
27 28
28class TodolistPluginWidget : public QWidget { 29class TodolistPluginWidget : public QWidget {
29 30
30 Q_OBJECT 31 Q_OBJECT
31 32
32public: 33public:
33 TodolistPluginWidget( QWidget *parent, const char *name ); 34 TodolistPluginWidget( QWidget *parent, const char *name );
34 ~TodolistPluginWidget(); 35 ~TodolistPluginWidget();
35 36
37 void refresh();
38
36protected slots: 39protected slots:
37 void startTodolist(); 40 void startTodolist();
38 41
39private: 42private:
40 OClickableLabel *todoLabel; 43 OClickableLabel *todoLabel;
44 QVBoxLayout* layoutTodo;
41 45
42 OTodoAccess *todo; 46 OTodoAccess *todo;
43 OTodoAccess::List m_list; 47 OTodoAccess::List m_list;
44 OTodoAccess::List::Iterator m_it; 48 OTodoAccess::List::Iterator m_it;
45 49
46 void readConfig(); 50 void readConfig();
47 void getTodo(); 51 void getTodo();
48 int m_maxLinesTask; 52 int m_maxLinesTask;
49 int m_maxCharClip; 53 int m_maxCharClip;
50}; 54};
51 55
52#endif 56#endif
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 91028c8..1f758f2 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,390 +1,398 @@
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 init();
74 loadPlugins();
74 showMaximized(); 75 showMaximized();
75} 76}
76 77
77/** 78/**
78 * Qcop receive method. 79 * Qcop receive method.
79 */ 80 */
80void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 81void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
81 QDataStream stream( data, IO_ReadOnly ); 82 QDataStream stream( data, IO_ReadOnly );
82 if ( msg == "message(QString)" ) { 83 if ( msg == "message(QString)" ) {
83 QString message; 84 QString message;
84 stream >> message; 85 stream >> message;
85 setOwnerField( message ); 86 setOwnerField( message );
86 } 87 }
87} 88}
88 89
89void Today::setRefreshTimer( int interval ) { 90void Today::setRefreshTimer( int interval ) {
90 91
91 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 92 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
92 93
93 // 0 is "never" case 94 // 0 is "never" case
94 if ( !interval == 0 ) { 95 if ( !interval == 0 ) {
95 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 96 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
96 m_refreshTimer->changeInterval( interval ); 97 m_refreshTimer->changeInterval( interval );
97 } 98 }
98} 99}
99 100
100 101
101/** 102/**
102 * Initialises the owner field with the default value, the username 103 * Initialises the owner field with the default value, the username
103 */ 104 */
104void Today::setOwnerField() { 105void Today::setOwnerField() {
105 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 106 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
106 if ( QFile::exists( file ) ) { 107 if ( QFile::exists( file ) ) {
107 Contact cont = Contact::readVCard( file )[0]; 108 Contact cont = Contact::readVCard( file )[0];
108 QString returnString = cont.fullName(); 109 QString returnString = cont.fullName();
109 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 110 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
110 } else { 111 } else {
111 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 112 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
112 } 113 }
113} 114}
114 115
115/** 116/**
116 * 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.
117 */ 118 */
118void Today::setOwnerField( QString &message ) { 119void Today::setOwnerField( QString &message ) {
119 if ( !message.isEmpty() ) { 120 if ( !message.isEmpty() ) {
120 OwnerField->setText( "<b>" + message + "</b>" ); 121 OwnerField->setText( "<b>" + message + "</b>" );
121 } 122 }
122} 123}
123 124
124 125
125/** 126/**
126 * Init stuff needed for today. Reads the config file. 127 * Init stuff needed for today. Reads the config file.
127 */ 128 */
128void Today::init() { 129void Today::init() {
129 // read config 130 // read config
130 Config cfg( "today" ); 131 Config cfg( "today" );
131 132
132 cfg.setGroup( "Plugins" ); 133 cfg.setGroup( "Plugins" );
133 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 134 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
134 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 135 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
135 136
136 cfg.setGroup( "General" ); 137 cfg.setGroup( "General" );
137 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 138 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
138 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 139 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
140
141
142 // qDebug(" refresh ");
143 // set the date in top label
144 QDate date = QDate::currentDate();
145 QString time = ( tr( date.toString() ) );
146
147 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
148
149 if ( layout ) {
150 delete layout;
151 }
152 layout = new QVBoxLayout( this );
153 layout->addWidget( Frame );
154 layout->addWidget( OwnerField );
139} 155}
140 156
141 157
142/** 158/**
143 * Load the plugins 159 * Load the plugins
144 */ 160 */
145void Today::loadPlugins() { 161void Today::loadPlugins() {
146 162
147 // extra list for plugins that exclude themself from periodic refresh 163 // extra list for plugins that exclude themself from periodic refresh
148 QMap<QString, TodayPlugin> pluginListRefreshExclude; 164 QMap<QString, TodayPlugin> pluginListRefreshExclude;
149 165
150 QValueList<TodayPlugin>::Iterator tit; 166 QValueList<TodayPlugin>::Iterator tit;
151 if ( !pluginList.isEmpty() ) { 167 if ( !pluginList.isEmpty() ) {
152 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 168 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
153 if ( (*tit).excludeRefresh ) { 169 if ( (*tit).excludeRefresh ) {
154 pluginListRefreshExclude.insert( (*tit).name , (*tit) ); 170 pluginListRefreshExclude.insert( (*tit).name , (*tit) );
155 qDebug( "Found a plugin that does not want refresh feature" ); 171 qDebug( "Found a plugin that does not want refresh feature" );
156 } else { 172 } else {
157 (*tit).guiBox->hide(); 173 (*tit).guiBox->hide();
158 (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); 174 (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) );
159 (*tit).library->unload(); 175 (*tit).library->unload();
160 delete (*tit).guiBox; 176 delete (*tit).guiBox;
161 delete (*tit).library; 177 delete (*tit).library;
162 } 178 }
163 } 179 }
164 pluginList.clear(); 180 pluginList.clear();
165 } 181 }
166 182
167 QString path = QPEApplication::qpeDir() + "/plugins/today"; 183 QString path = QPEApplication::qpeDir() + "/plugins/today";
168 QDir dir( path, "lib*.so" ); 184 QDir dir( path, "lib*.so" );
169 185
170 QStringList list = dir.entryList(); 186 QStringList list = dir.entryList();
171 QStringList::Iterator it; 187 QStringList::Iterator it;
172 188
173 QMap<QString, TodayPlugin> tempList; 189 QMap<QString, TodayPlugin> tempList;
174 190
175 for ( it = list.begin(); it != list.end(); ++it ) { 191 for ( it = list.begin(); it != list.end(); ++it ) {
176 //TodayPluginInterface *iface = 0; 192 //TodayPluginInterface *iface = 0;
177 QInterfacePtr<TodayPluginInterface> iface; 193 QInterfacePtr<TodayPluginInterface> iface;
178 QLibrary *lib = new QLibrary( path + "/" + *it ); 194 QLibrary *lib = new QLibrary( path + "/" + *it );
179 195
180 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 196 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
181 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 197 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
182 qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); 198 qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() );
183 qDebug( QString(*it) ); 199 qDebug( QString(*it) );
184 200
185 // If plugin is exludes from refresh, get it in the list again here. 201 // If plugin is exludes from refresh, get it in the list again here.
186 202
187 if ( pluginListRefreshExclude.contains( (*it) ) ) { 203 if ( pluginListRefreshExclude.contains( (*it) ) ) {
188 // if its not in allApplets list, add it to a layout 204 // if its not in allApplets list, add it to a layout
189 if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) { 205 if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) {
190 layout->addWidget( pluginListRefreshExclude[(*it)].guiBox ); 206 layout->addWidget( pluginListRefreshExclude[(*it)].guiBox );
191 pluginList.append( pluginListRefreshExclude[(*it)] ); 207 pluginList.append( pluginListRefreshExclude[(*it)] );
192 } else { 208 } else {
193 tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); 209 tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] );
194 } 210 }
195 } else { 211 } else {
196 212
197 TodayPlugin plugin; 213 TodayPlugin plugin;
198 plugin.library = lib; 214 plugin.library = lib;
199 plugin.iface = iface; 215 plugin.iface = iface;
200 plugin.name = QString(*it); 216 plugin.name = QString(*it);
201 217
202 // find out if plugins should be shown 218 // find out if plugins should be shown
203 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 219 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
204 plugin.active = true; 220 plugin.active = true;
205 } else { 221 } else {
206 plugin.active = false; 222 plugin.active = false;
207 } 223 }
208 224
209 plugin.guiPart = plugin.iface->guiPart(); 225 plugin.guiPart = plugin.iface->guiPart();
210 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); 226 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh();
211 227
212 // package the whole thing into a qwidget so it can be shown and hidden 228 // package the whole thing into a qwidget so it can be shown and hidden
213 plugin.guiBox = new QWidget( this ); 229 plugin.guiBox = new QWidget( this );
214 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); 230 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
215 QPixmap plugPix; 231 QPixmap plugPix;
216 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); 232 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 );
217 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); 233 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
218 plugIcon->setPixmap( plugPix ); 234 plugIcon->setPixmap( plugPix );
219 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); 235 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") );
220 plugIcon->setName( plugin.guiPart->appName() ); 236 plugIcon->setName( plugin.guiPart->appName() );
221 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); 237 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) );
222 // a scrollview for each plugin 238 // a scrollview for each plugin
223 QScrollView* sv = new QScrollView( plugin.guiBox ); 239 QScrollView* sv = new QScrollView( plugin.guiBox );
224 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); 240 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() );
225 // not sure if that is good .-) 241 // not sure if that is good .-)
226 sv->setMinimumHeight( 10 ); 242 sv->setMinimumHeight( 10 );
227 sv->setResizePolicy( QScrollView::AutoOneFit ); 243 sv->setResizePolicy( QScrollView::AutoOneFit );
228 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 244 sv->setHScrollBarMode( QScrollView::AlwaysOff );
229 sv->setFrameShape( QFrame::NoFrame ); 245 sv->setFrameShape( QFrame::NoFrame );
230 sv->addChild( plugWidget ); 246 sv->addChild( plugWidget );
231 // make sure the icon is on the top alligned 247 // make sure the icon is on the top alligned
232 boxLayout->addWidget( plugIcon, 0, AlignTop ); 248 boxLayout->addWidget( plugIcon, 0, AlignTop );
233 boxLayout->addWidget( sv, 0, AlignTop ); 249 boxLayout->addWidget( sv, 0, AlignTop );
234 boxLayout->setStretchFactor( plugIcon, 1 ); 250 boxLayout->setStretchFactor( plugIcon, 1 );
235 boxLayout->setStretchFactor( sv, 9 ); 251 boxLayout->setStretchFactor( sv, 9 );
236 // "prebuffer" it in one more list, to get the sorting done 252 // "prebuffer" it in one more list, to get the sorting done
237 tempList.insert( plugin.name, plugin ); 253 tempList.insert( plugin.name, plugin );
238 254
239 // on first start the list is off course empty 255 // on first start the list is off course empty
240 if ( m_allApplets.isEmpty() ) { 256 if ( m_allApplets.isEmpty() ) {
241 layout->addWidget( plugin.guiBox ); 257 layout->addWidget( plugin.guiBox );
242 pluginList.append( plugin ); 258 pluginList.append( plugin );
243 } 259 }
244 260
245 // if plugin is not yet in the list, add it to the layout too 261 // if plugin is not yet in the list, add it to the layout too
246 else if ( !m_allApplets.contains( plugin.name ) ) { 262 else if ( !m_allApplets.contains( plugin.name ) ) {
247 layout->addWidget( plugin.guiBox ); 263 layout->addWidget( plugin.guiBox );
248 pluginList.append( plugin ); 264 pluginList.append( plugin );
249 } 265 }
250 } 266 }
251 } else { 267 } else {
252 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); 268 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
253 delete lib; 269 delete lib;
254 } 270 }
255 } 271 }
256 272
257 if ( !m_allApplets.isEmpty() ) { 273 if ( !m_allApplets.isEmpty() ) {
258 TodayPlugin tempPlugin; 274 TodayPlugin tempPlugin;
259 QStringList::Iterator stringit; 275 QStringList::Iterator stringit;
260 276
261 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { 277 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
262 tempPlugin = ( tempList.find( *stringit ) ).data(); 278 tempPlugin = ( tempList.find( *stringit ) ).data();
263 if ( !( (tempPlugin.name).isEmpty() ) ) { 279 if ( !( (tempPlugin.name).isEmpty() ) ) {
264 layout->addWidget( tempPlugin.guiBox ); 280 layout->addWidget( tempPlugin.guiBox );
265 pluginList.append( tempPlugin ); 281 pluginList.append( tempPlugin );
266 } 282 }
267 } 283 }
268 } 284 }
285 draw();
269} 286}
270 287
271 288
272/** 289/**
273 * Repaint method. Reread all fields. 290 * Repaint method. Reread all fields.
274 */ 291 */
275void Today::draw() { 292void Today::draw() {
276 293
277 if ( pluginList.count() == 0 ) { 294 if ( pluginList.count() == 0 ) {
278 QLabel *noPlugins = new QLabel( this ); 295 QLabel *noPlugins = new QLabel( this );
279 noPlugins->setText( tr( "No plugins found" ) ); 296 noPlugins->setText( tr( "No plugins found" ) );
280 layout->addWidget( noPlugins ); 297 layout->addWidget( noPlugins );
281 return; 298 return;
282 } 299 }
283 300
284 uint count = 0; 301 uint count = 0;
285 TodayPlugin plugin; 302 TodayPlugin plugin;
286 for ( uint i = 0; i < pluginList.count(); i++ ) { 303 for ( uint i = 0; i < pluginList.count(); i++ ) {
287 plugin = pluginList[i]; 304 plugin = pluginList[i];
288 305
289 if ( plugin.active ) { 306 if ( plugin.active ) {
290 // qDebug( plugin.name + " is ACTIVE " ); 307 // qDebug( plugin.name + " is ACTIVE " );
291 plugin.guiBox->show(); 308 plugin.guiBox->show();
292 } else { 309 } else {
293 // qDebug( plugin.name + " is INACTIVE" ); 310 // qDebug( plugin.name + " is INACTIVE" );
294 plugin.guiBox->hide(); 311 plugin.guiBox->hide();
295 } 312 }
296 count++; 313 count++;
297 } 314 }
298 315
299 if ( count == 0 ) { 316 if ( count == 0 ) {
300 QLabel *noPluginsActive = new QLabel( this ); 317 QLabel *noPluginsActive = new QLabel( this );
301 noPluginsActive->setText( tr( "No plugins activated" ) ); 318 noPluginsActive->setText( tr( "No plugins activated" ) );
302 layout->addWidget( noPluginsActive ); 319 layout->addWidget( noPluginsActive );
303 } 320 }
304 layout->addStretch(0); 321 layout->addStretch(0);
305} 322}
306 323
307 324
308/** 325/**
309 * The method for the configuration dialog. 326 * The method for the configuration dialog.
310 */ 327 */
311void Today::startConfig() { 328void Today::startConfig() {
312 329
313 // disconnect timer to prevent problems while being on config dialog 330 // disconnect timer to prevent problems while being on config dialog
314 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 331 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
315 332
316 TodayConfig conf( this, "dialog", true ); 333 TodayConfig conf( this, "dialog", true );
317 334
318 TodayPlugin plugin; 335 TodayPlugin plugin;
319 QList<TodayConfigWidget> configWidgetList; 336 QList<TodayConfigWidget> configWidgetList;
320 337
321 for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { 338 for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) {
322 plugin = pluginList[i]; 339 plugin = pluginList[i];
323 340
324 // load the config widgets in the tabs 341 // load the config widgets in the tabs
325 if ( plugin.guiPart->configWidget( this ) != 0l ) { 342 if ( plugin.guiPart->configWidget( this ) != 0l ) {
326 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); 343 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
327 configWidgetList.append( widget ); 344 configWidgetList.append( widget );
328 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() 345 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig()
329 , plugin.guiPart->appName() ); 346 , plugin.guiPart->appName() );
330 } 347 }
331 // set the order/activate tab 348 // set the order/activate tab
332 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), 349 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(),
333 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); 350 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) );
334 } 351 }
335 352
336 if ( conf.exec() == QDialog::Accepted ) { 353 if ( conf.exec() == QDialog::Accepted ) {
337 conf.writeConfig(); 354 conf.writeConfig();
338 TodayConfigWidget *confWidget; 355 TodayConfigWidget *confWidget;
339 for ( confWidget = configWidgetList.first(); confWidget != 0; 356 for ( confWidget = configWidgetList.first(); confWidget != 0;
340 confWidget = configWidgetList.next() ) { 357 confWidget = configWidgetList.next() ) {
341 confWidget->writeConfig(); 358 confWidget->writeConfig();
342 } 359 }
343 refresh(); 360 loadPlugins();
344 } else { 361 } else {
345 // since refresh is not called in that case , reconnect the signal 362 // since refresh is not called in that case , reconnect the signal
346 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 363 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
347 } 364 }
348} 365}
349 366
350 367
351/** 368/**
352 * Refresh for the view. Reload all applets 369 * Refresh for the view. Reload all applets
353 * 370 *
354 */ 371 */
355void Today::refresh() { 372void Today::refresh() {
356 init(); 373 init();
357 374
358 // qDebug(" refresh "); 375 QValueList<TodayPlugin>::Iterator it;
359 // set the date in top label 376 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
360 QDate date = QDate::currentDate(); 377 if ( !(*it).excludeRefresh ) {
361 QString time = ( tr( date.toString() ) ); 378 (*it).guiPart->refresh();
362 379 qDebug( "refresh" );
363 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); 380 }
364
365 if ( layout ) {
366 delete layout;
367 } 381 }
368 layout = new QVBoxLayout( this );
369 layout->addWidget( Frame );
370 layout->addWidget( OwnerField );
371
372 loadPlugins();
373 draw();
374} 382}
375 383
376void Today::startApplication() { 384void Today::startApplication() {
377 QCopEnvelope e( "QPE/System", "execute(QString)" ); 385 QCopEnvelope e( "QPE/System", "execute(QString)" );
378 e << QString( sender()->name() ); 386 e << QString( sender()->name() );
379} 387}
380 388
381/** 389/**
382 * launch addressbook (personal card) 390 * launch addressbook (personal card)
383 */ 391 */
384void Today::editCard() { 392void Today::editCard() {
385 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); 393 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" );
386} 394}
387 395
388Today::~Today() { 396Today::~Today() {
389} 397}
390 398