-rw-r--r-- | core/pim/today/TODO | 2 | ||||
-rw-r--r-- | core/pim/today/changelog | 1 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookplugin.cpp | 14 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookplugin.h | 6 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginwidget.cpp | 45 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginwidget.h | 8 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailplugin.cpp | 17 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailplugin.h | 6 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailpluginwidget.cpp | 33 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailpluginwidget.h | 6 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.cpp | 16 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.h | 6 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginwidget.cpp | 32 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginwidget.h | 4 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 42 |
15 files changed, 168 insertions, 70 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 | |||
@@ -3,10 +3,8 @@ TODO for today: | |||
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 | ||
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,7 +1,8 @@ | |||
1 | 0.6.1 | 1 | 0.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 | ||
6 | 0.6 | 7 | 0.6 |
7 | 8 | ||
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 | |||
@@ -18,16 +18,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 | ||
26 | DatebookPlugin::DatebookPlugin() { | 25 | DatebookPlugin::DatebookPlugin() { |
26 | m_widget = 0; | ||
27 | } | 27 | } |
28 | 28 | ||
29 | DatebookPlugin::~DatebookPlugin() { | 29 | DatebookPlugin::~DatebookPlugin() { |
30 | delete m_widget; | ||
30 | } | 31 | } |
31 | 32 | ||
32 | QString DatebookPlugin::pluginName() const { | 33 | QString DatebookPlugin::pluginName() const { |
33 | return QObject::tr( "Datebook plugin"); | 34 | return QObject::tr( "Datebook plugin"); |
@@ -41,9 +42,12 @@ QString DatebookPlugin::pixmapNameWidget() const { | |||
41 | return "DateBook"; | 42 | return "DateBook"; |
42 | } | 43 | } |
43 | 44 | ||
44 | QWidget* DatebookPlugin::widget( QWidget* wid ) { | 45 | QWidget* 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 | ||
48 | QString DatebookPlugin::pixmapNameConfig() const { | 52 | QString DatebookPlugin::pixmapNameConfig() const { |
49 | return "DateBook"; | 53 | return "DateBook"; |
@@ -59,4 +63,10 @@ QString DatebookPlugin::appName() const { | |||
59 | 63 | ||
60 | bool DatebookPlugin::excludeFromRefresh() const { | 64 | bool DatebookPlugin::excludeFromRefresh() const { |
61 | return false; | 65 | return false; |
62 | } | 66 | } |
67 | |||
68 | void 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 | |||
@@ -22,8 +22,10 @@ | |||
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 | |||
26 | class DatebookPlugin : public TodayPluginObject { | 28 | class DatebookPlugin : public TodayPluginObject { |
27 | 29 | ||
28 | public: | 30 | public: |
29 | DatebookPlugin(); | 31 | DatebookPlugin(); |
@@ -36,8 +38,12 @@ public: | |||
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 | |||
@@ -15,9 +15,8 @@ | |||
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 | ||
@@ -29,15 +28,30 @@ | |||
29 | #include <qtimer.h> | 28 | #include <qtimer.h> |
30 | 29 | ||
31 | DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name) | 30 | DatebookPluginWidget::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 | ||
38 | DatebookPluginWidget::~DatebookPluginWidget() { | 51 | DatebookPluginWidget::~DatebookPluginWidget() { |
39 | delete db; | 52 | delete db; |
53 | delete m_layoutDates; | ||
40 | } | 54 | } |
41 | 55 | ||
42 | 56 | ||
43 | void DatebookPluginWidget::readConfig() { | 57 | void DatebookPluginWidget::readConfig() { |
@@ -49,33 +63,26 @@ void DatebookPluginWidget::readConfig() { | |||
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 | ||
67 | void 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 | */ |
57 | void DatebookPluginWidget::getDates() { | 78 | void 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 | ||
@@ -86,27 +93,25 @@ void DatebookPluginWidget::getDates() { | |||
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 | |||
@@ -18,27 +18,33 @@ | |||
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 | ||
27 | class DatebookPluginWidget : public QWidget { | 30 | class DatebookPluginWidget : public QWidget { |
28 | 31 | ||
29 | Q_OBJECT | 32 | Q_OBJECT |
30 | 33 | ||
31 | public: | 34 | public: |
32 | DatebookPluginWidget( QWidget *parent, const char *name ); | 35 | DatebookPluginWidget( QWidget *parent, const char *name ); |
33 | ~DatebookPluginWidget(); | 36 | ~DatebookPluginWidget(); |
34 | 37 | void refresh(); | |
35 | 38 | ||
36 | private: | 39 | private: |
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; |
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 | |||
@@ -15,15 +15,15 @@ | |||
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | #include "mailplugin.h" | 18 | #include "mailplugin.h" |
19 | #include "mailpluginwidget.h" | ||
20 | |||
21 | 19 | ||
22 | MailPlugin::MailPlugin() { | 20 | MailPlugin::MailPlugin() { |
21 | m_widget = 0l; | ||
23 | } | 22 | } |
24 | 23 | ||
25 | MailPlugin::~MailPlugin() { | 24 | MailPlugin::~MailPlugin() { |
25 | delete m_widget; | ||
26 | } | 26 | } |
27 | 27 | ||
28 | QString MailPlugin::pluginName() const { | 28 | QString MailPlugin::pluginName() const { |
29 | return QObject::tr( "Mail plugin" ); | 29 | return QObject::tr( "Mail plugin" ); |
@@ -37,16 +37,20 @@ QString MailPlugin::pixmapNameWidget() const { | |||
37 | return "mail/desktopicon"; | 37 | return "mail/desktopicon"; |
38 | } | 38 | } |
39 | 39 | ||
40 | QWidget* MailPlugin::widget( QWidget * wid ) { | 40 | QWidget* 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 | |||
44 | QString MailPlugin::pixmapNameConfig() const { | 48 | QString MailPlugin::pixmapNameConfig() const { |
45 | return 0l; | 49 | return 0l; |
46 | } | 50 | } |
47 | 51 | ||
48 | TodayConfigWidget* MailPlugin::configWidget( QWidget* wid ) { | 52 | TodayConfigWidget* MailPlugin::configWidget( QWidget* ) { |
49 | return 0l; | 53 | return 0l; |
50 | } | 54 | } |
51 | 55 | ||
52 | QString MailPlugin::appName() const { | 56 | QString MailPlugin::appName() const { |
@@ -57,4 +61,9 @@ QString MailPlugin::appName() const { | |||
57 | bool MailPlugin::excludeFromRefresh() const { | 61 | bool MailPlugin::excludeFromRefresh() const { |
58 | return false; | 62 | return false; |
59 | } | 63 | } |
60 | 64 | ||
65 | void 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 | |||
@@ -26,8 +26,10 @@ | |||
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 | |||
30 | class MailPlugin : public TodayPluginObject { | 32 | class MailPlugin : public TodayPluginObject { |
31 | 33 | ||
32 | public: | 34 | public: |
33 | MailPlugin(); | 35 | MailPlugin(); |
@@ -40,7 +42,11 @@ public: | |||
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 | |||
@@ -29,13 +29,31 @@ | |||
29 | 29 | ||
30 | MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) | 30 | MailPluginWidget::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 | ||
37 | MailPluginWidget::~MailPluginWidget() { | 53 | MailPluginWidget::~MailPluginWidget() { |
54 | delete m_mailLabel; | ||
55 | delete m_layout; | ||
38 | } | 56 | } |
39 | 57 | ||
40 | 58 | ||
41 | void MailPluginWidget::readConfig() { | 59 | void MailPluginWidget::readConfig() { |
@@ -43,26 +61,23 @@ void MailPluginWidget::readConfig() { | |||
43 | cfg.setGroup( "config" ); | 61 | cfg.setGroup( "config" ); |
44 | } | 62 | } |
45 | 63 | ||
46 | 64 | ||
47 | void MailPluginWidget::getInfo() { | 65 | void MailPluginWidget::refresh() { |
48 | 66 | getInfo(); | |
49 | QHBoxLayout* layout = new QHBoxLayout( this ); | 67 | } |
50 | 68 | ||
51 | mailLabel = new OClickableLabel( this ); | 69 | void 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 |
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 | |||
@@ -19,8 +19,9 @@ | |||
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 | ||
@@ -32,13 +33,16 @@ class MailPluginWidget : public QWidget { | |||
32 | public: | 33 | public: |
33 | MailPluginWidget( QWidget *parent, const char *name ); | 34 | MailPluginWidget( QWidget *parent, const char *name ); |
34 | ~MailPluginWidget(); | 35 | ~MailPluginWidget(); |
35 | 36 | ||
37 | void refresh(); | ||
38 | |||
36 | protected slots: | 39 | protected slots: |
37 | void startMail(); | 40 | void startMail(); |
38 | 41 | ||
39 | private: | 42 | private: |
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 | ||
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 | |||
@@ -17,31 +17,35 @@ | |||
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 | ||
24 | TodolistPlugin::TodolistPlugin() { | 23 | TodolistPlugin::TodolistPlugin() { |
24 | m_widget = 0l; | ||
25 | } | 25 | } |
26 | 26 | ||
27 | TodolistPlugin::~TodolistPlugin() { | 27 | TodolistPlugin::~TodolistPlugin() { |
28 | delete m_widget; | ||
28 | } | 29 | } |
29 | 30 | ||
30 | QString TodolistPlugin::pluginName() const { | 31 | QString TodolistPlugin::pluginName() const { |
31 | return QObject::tr( "Todolist plugin" ); | 32 | return QObject::tr( "Todolist plugin" ); |
32 | } | 33 | } |
33 | 34 | ||
34 | double TodolistPlugin::versionNumber() const { | 35 | double TodolistPlugin::versionNumber() const { |
35 | return 0.8; | 36 | return 0.9; |
36 | } | 37 | } |
37 | 38 | ||
38 | QString TodolistPlugin::pixmapNameWidget() const { | 39 | QString TodolistPlugin::pixmapNameWidget() const { |
39 | return "TodoList"; | 40 | return "TodoList"; |
40 | } | 41 | } |
41 | 42 | ||
42 | QWidget* TodolistPlugin::widget( QWidget *wid ) { | 43 | QWidget* 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 | ||
46 | QString TodolistPlugin::pixmapNameConfig() const { | 50 | QString TodolistPlugin::pixmapNameConfig() const { |
47 | return "TodoList"; | 51 | return "TodoList"; |
@@ -58,4 +62,10 @@ QString TodolistPlugin::appName() const { | |||
58 | 62 | ||
59 | bool TodolistPlugin::excludeFromRefresh() const { | 63 | bool TodolistPlugin::excludeFromRefresh() const { |
60 | return false; | 64 | return false; |
61 | } | 65 | } |
66 | |||
67 | void 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 | |||
@@ -23,8 +23,10 @@ | |||
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 | |||
27 | class TodolistPlugin : public TodayPluginObject { | 29 | class TodolistPlugin : public TodayPluginObject { |
28 | 30 | ||
29 | public: | 31 | public: |
30 | TodolistPlugin(); | 32 | TodolistPlugin(); |
@@ -37,7 +39,11 @@ public: | |||
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 | |||
@@ -29,24 +29,40 @@ | |||
29 | 29 | ||
30 | TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) | 30 | TodolistPluginWidget::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 | ||
47 | TodolistPluginWidget::~TodolistPluginWidget() { | 61 | TodolistPluginWidget::~TodolistPluginWidget() { |
48 | delete todo; | 62 | delete todo; |
63 | delete todoLabel; | ||
64 | delete layoutTodo; | ||
49 | } | 65 | } |
50 | 66 | ||
51 | 67 | ||
52 | void TodolistPluginWidget::readConfig() { | 68 | void TodolistPluginWidget::readConfig() { |
@@ -55,22 +71,17 @@ void TodolistPluginWidget::readConfig() { | |||
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 | ||
75 | void TodolistPluginWidget:: refresh() { | ||
76 | getTodo(); | ||
77 | } | ||
59 | 78 | ||
60 | /** | 79 | /** |
61 | * Get the todos | 80 | * Get the todos |
62 | */ | 81 | */ |
63 | void TodolistPluginWidget::getTodo() { | 82 | void 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; |
@@ -117,9 +128,8 @@ void TodolistPluginWidget::getTodo() { | |||
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 |
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 | |||
@@ -18,8 +18,9 @@ | |||
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> |
@@ -32,13 +33,16 @@ class TodolistPluginWidget : public QWidget { | |||
32 | public: | 33 | public: |
33 | TodolistPluginWidget( QWidget *parent, const char *name ); | 34 | TodolistPluginWidget( QWidget *parent, const char *name ); |
34 | ~TodolistPluginWidget(); | 35 | ~TodolistPluginWidget(); |
35 | 36 | ||
37 | void refresh(); | ||
38 | |||
36 | protected slots: | 39 | protected slots: |
37 | void startTodolist(); | 40 | void startTodolist(); |
38 | 41 | ||
39 | private: | 42 | private: |
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; |
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 | |||
@@ -69,9 +69,10 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
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 | /** |
@@ -135,8 +136,23 @@ void Today::init() { | |||
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 | /** |
@@ -265,8 +281,9 @@ void Today::loadPlugins() { | |||
265 | pluginList.append( tempPlugin ); | 281 | pluginList.append( tempPlugin ); |
266 | } | 282 | } |
267 | } | 283 | } |
268 | } | 284 | } |
285 | draw(); | ||
269 | } | 286 | } |
270 | 287 | ||
271 | 288 | ||
272 | /** | 289 | /** |
@@ -339,9 +356,9 @@ void Today::startConfig() { | |||
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 | } |
@@ -354,24 +371,15 @@ void Today::startConfig() { | |||
354 | */ | 371 | */ |
355 | void Today::refresh() { | 372 | void 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 | ||
376 | void Today::startApplication() { | 384 | void Today::startApplication() { |
377 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 385 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |