22 files changed, 165 insertions, 56 deletions
diff --git a/core/pim/today/plugins/datebook/.cvsignore b/core/pim/today/plugins/datebook/.cvsignore index 2888d4a..10cf625 100644 --- a/core/pim/today/plugins/datebook/.cvsignore +++ b/core/pim/today/plugins/datebook/.cvsignore | |||
@@ -1,2 +1,3 @@ | |||
1 | Makefile* | 1 | Makefile* |
2 | datebookpluginconfigbase* | ||
2 | moc* | 3 | moc* |
diff --git a/core/pim/today/plugins/datebook/config.in b/core/pim/today/plugins/datebook/config.in index 621510f..7a14438 100644 --- a/core/pim/today/plugins/datebook/config.in +++ b/core/pim/today/plugins/datebook/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config TODAY_DATEBOOK | 1 | config TODAY_DATEBOOK |
2 | boolean "opie-today-datebookplugin (datebook plugin)" | 2 | boolean "datebook" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE |
diff --git a/core/pim/today/plugins/datebook/datebook.pro b/core/pim/today/plugins/datebook/datebook.pro index bd45f71..1f75964 100644 --- a/core/pim/today/plugins/datebook/datebook.pro +++ b/core/pim/today/plugins/datebook/datebook.pro | |||
@@ -1,21 +1,40 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG -= moc | 2 | CONFIG -= moc |
3 | CONFIG += qt release | 3 | CONFIG += qt release |
4 | # Input | 4 | # Input |
5 | HEADERS = datebookplugin.h datebookpluginimpl.h datebookpluginconfig.h \ | 5 | HEADERS = datebookplugin.h datebookpluginimpl.h datebookpluginconfig.h \ |
6 | datebookevent.h datebookpluginwidget.h | 6 | datebookevent.h datebookpluginwidget.h |
7 | SOURCES = datebookplugin.cpp datebookpluginimpl.cpp datebookpluginconfig.cpp \ | 7 | SOURCES = datebookplugin.cpp datebookpluginimpl.cpp datebookpluginconfig.cpp \ |
8 | datebookevent.cpp datebookpluginwidget.cpp | 8 | datebookevent.cpp datebookpluginwidget.cpp |
9 | INTERFACES = datebookpluginconfigbase.ui | 9 | INTERFACES = datebookpluginconfigbase.ui |
10 | 10 | ||
11 | INCLUDEPATH += $(OPIEDIR)/include \ | 11 | INCLUDEPATH += $(OPIEDIR)/include \ |
12 | ../ ../library | 12 | ../ ../library |
13 | DEPENDPATH += $(OPIEDIR)/include \ | 13 | DEPENDPATH += $(OPIEDIR)/include \ |
14 | ../ ../library | 14 | ../ ../library |
15 | 15 | ||
16 | LIBS+= -lqpe -lopie | 16 | LIBS+= -lqpe -lopie |
17 | 17 | ||
18 | DESTDIR = $(OPIEDIR)/plugins/today | 18 | DESTDIR = $(OPIEDIR)/plugins/today |
19 | TARGET = todaydatebookplugin | 19 | TARGET = todaydatebookplugin |
20 | 20 | ||
21 | TRANSLATIONS = ../../../../../i18n/de/libtodaydatebookplugin.ts \ | ||
22 | ../../../../../i18n/nl/libtodaydatebookplugin.ts \ | ||
23 | ../../../../../i18n/xx/libtodaydatebookplugin.ts \ | ||
24 | ../../../../../i18n/en/libtodaydatebookplugin.ts \ | ||
25 | ../../../../../i18n/es/libtodaydatebookplugin.ts \ | ||
26 | ../../../../../i18n/fr/libtodaydatebookplugin.ts \ | ||
27 | ../../../../../i18n/hu/libtodaydatebookplugin.ts \ | ||
28 | ../../../../../i18n/ja/libtodaydatebookplugin.ts \ | ||
29 | ../../../../../i18n/ko/libtodaydatebookplugin.ts \ | ||
30 | ../../../../../i18n/no/libtodaydatebookplugin.ts \ | ||
31 | ../../../../../i18n/pl/libtodaydatebookplugin.ts \ | ||
32 | ../../../../../i18n/pt/libtodaydatebookplugin.ts \ | ||
33 | ../../../../../i18n/pt_BR/libtodaydatebookplugin.ts \ | ||
34 | ../../../../../i18n/sl/libtodaydatebookplugin.ts \ | ||
35 | ../../../../../i18n/zh_CN/libtodaydatebookplugin.ts \ | ||
36 | ../../../../../i18n/zh_TW/libtodaydatebookplugin.ts \ | ||
37 | ../../../../../i18n/it/libtodaydatebookplugin.ts \ | ||
38 | ../../../../../i18n/da/libtodaydatebookplugin.ts | ||
39 | |||
21 | include ( $(OPIEDIR)/include.pro ) | 40 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp index 3c1e97a..e595047 100644 --- a/core/pim/today/plugins/datebook/datebookevent.cpp +++ b/core/pim/today/plugins/datebook/datebookevent.cpp | |||
@@ -1,138 +1,148 @@ | |||
1 | /* | 1 | /* |
2 | * datebookevent.cpp | 2 | * datebookevent.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002, 2003 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "datebookevent.h" | 17 | #include "datebookevent.h" |
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpe/timestring.h> | 19 | #include <qpe/timestring.h> |
20 | #include <qpe/qcopenvelope_qws.h> | 20 | #include <qpe/qcopenvelope_qws.h> |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/calendar.h> | ||
22 | 23 | ||
23 | #include <opie/odevice.h> | 24 | #include <opie/odevice.h> |
24 | 25 | ||
25 | using namespace Opie; | 26 | using namespace Opie; |
26 | 27 | ||
27 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | 28 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, |
28 | QWidget* parent, | 29 | QWidget* parent, |
29 | bool show_location, | 30 | bool show_location, |
30 | bool show_notes, | 31 | bool show_notes, |
32 | bool timeExtraLine, | ||
31 | int maxCharClip, | 33 | int maxCharClip, |
32 | const char* name, | 34 | const char* name, |
33 | WFlags fl) : | 35 | WFlags fl) : |
34 | OClickableLabel(parent,name,fl), event(ev) { | 36 | OClickableLabel(parent,name,fl), event(ev) { |
35 | 37 | ||
36 | // setAlignment( AlignTop ); | 38 | // setAlignment( AlignTop ); |
37 | 39 | ||
38 | QString msg; | 40 | QString msg; |
39 | 41 | ||
40 | Config config( "qpe" ); | 42 | Config config( "qpe" ); |
41 | config.setGroup( "Time" ); | 43 | config.setGroup( "Time" ); |
42 | // if 24 h format | 44 | // if 24 h format |
43 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 45 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
44 | 46 | ||
45 | msg += "<B>" + (ev).description() + "</B>"; | 47 | msg += "<B>" + (ev).description() + "</B>"; |
46 | if ( (ev).event().hasAlarm() ) { | 48 | if ( (ev).event().hasAlarm() ) { |
47 | msg += " <b>" + tr("[with alarm]") +"</b>"; | 49 | msg += " <b>" + tr("[with alarm]") +"</b>"; |
48 | } | 50 | } |
49 | 51 | ||
50 | // include location or not | 52 | // include location or not |
51 | if ( show_location ) { | 53 | if ( show_location ) { |
52 | msg += "<BR><i>" + (ev).location() + "</i>"; | 54 | msg += "<BR><i>" + (ev).location() + "</i>"; |
53 | } | 55 | } |
54 | 56 | ||
57 | QString timeSpacer = " "; | ||
58 | if ( timeExtraLine ) { | ||
59 | timeSpacer = "<br>"; | ||
60 | } | ||
61 | |||
55 | if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) | 62 | if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) |
56 | && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { | 63 | && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { |
57 | msg += "<br>All day"; | 64 | msg += tr ( "All day" ); |
58 | } else { | 65 | } else { |
59 | // start time of event | 66 | // start time of event |
60 | QDate tempDate = (ev).event().start().date(); | 67 | // QDate tempDate = (ev).event().start().date(); |
61 | msg += "<br>" | 68 | msg += timeSpacer; |
62 | + ampmTime( QTime( (ev).event().start().time() ) ) | 69 | msg += ampmTime( QTime( (ev).event().start().time() ) ) |
63 | // end time of event | 70 | // end time of event |
64 | + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ) | 71 | + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ); |
65 | + differDate( tempDate ); | 72 | } |
73 | |||
74 | if ( (ev).date() != QDate::currentDate() ) { | ||
75 | msg += differDate( (ev).date() /* tempDate*/ ); | ||
66 | } | 76 | } |
67 | 77 | ||
68 | // include possible note or not | 78 | // include possible note or not |
69 | if ( show_notes ) { | 79 | if ( show_notes ) { |
70 | msg += "<br> <i>" + tr("note") + "</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); | 80 | msg += "<br> <i>" + tr("note") + "</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); |
71 | } | 81 | } |
72 | setText( msg ); | 82 | setText( msg ); |
73 | connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); | 83 | connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); |
74 | } | 84 | } |
75 | 85 | ||
76 | DateBookEvent::~DateBookEvent() { | 86 | DateBookEvent::~DateBookEvent() { |
77 | } | 87 | } |
78 | 88 | ||
79 | /** | 89 | /** |
80 | * AM/PM timestring conversion. | 90 | * AM/PM timestring conversion. |
81 | * @param tm the timestring | 91 | * @param tm the timestring |
82 | * @return formatted to am/pm is system is set to it | 92 | * @return formatted to am/pm is system is set to it |
83 | */ | 93 | */ |
84 | QString DateBookEvent::ampmTime( QTime tm ) { | 94 | QString DateBookEvent::ampmTime( QTime tm ) { |
85 | QString s; | 95 | QString s; |
86 | if( ampm ) { | 96 | if( ampm ) { |
87 | int hour = tm.hour(); | 97 | int hour = tm.hour(); |
88 | if ( hour == 0 ) { | 98 | if ( hour == 0 ) { |
89 | hour = 12; | 99 | hour = 12; |
90 | } | 100 | } |
91 | if ( hour > 12 ) { | 101 | if ( hour > 12 ) { |
92 | hour -= 12; | 102 | hour -= 12; |
93 | } | 103 | } |
94 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | 104 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), |
95 | (tm.hour() >= 12) ? "PM" : "AM" ); | 105 | (tm.hour() >= 12) ? "PM" : "AM" ); |
96 | return s; | 106 | return s; |
97 | } else { | 107 | } else { |
98 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 108 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
99 | return s; | 109 | return s; |
100 | } | 110 | } |
101 | } | 111 | } |
102 | 112 | ||
103 | QString DateBookEvent::differDate( QDate date ) { | 113 | QString DateBookEvent::differDate( QDate date ) { |
104 | QDate currentDate = QDate::currentDate(); | 114 | // QDate currentDate = QDate::currentDate(); |
105 | QString returnText = "<font color = #407DD9><b> "; | 115 | QString returnText = "<font color = #407DD9><b> "; |
106 | int differDate = currentDate.daysTo( date ); | 116 | // int differDate = currentDate.daysTo( date ); |
107 | if ( currentDate.dayOfWeek() == date.dayOfWeek() ) { | 117 | // if ( currentDate.dayOfWeek() == date.dayOfWeek() ) { |
108 | returnText += "" ; | 118 | // returnText += "" ; |
109 | // not working right for recurring events | 119 | // // not working right for recurring events |
110 | //} else if ( differDate == 1 ) { | 120 | // //} else if ( differDate == 1 ) { |
111 | //returnText += tr( "tomorrow" ); | 121 | // //returnText += tr( "tomorrow" ); |
112 | } else { | 122 | // } else { |
113 | //returnText += tr( "in %1 days" ).arg( differDate ); | 123 | // returnText += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] "; |
114 | returnText += " [ " + date.dayName( date.dayOfWeek() ) + " ] "; | 124 | // } |
115 | } | 125 | returnText += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] "; |
116 | returnText += "</b></font>"; | 126 | returnText += "</b></font>"; |
117 | return returnText; | 127 | return returnText; |
118 | } | 128 | } |
119 | 129 | ||
120 | 130 | ||
121 | /** | 131 | /** |
122 | * starts the edit dialog as known from datebook | 132 | * starts the edit dialog as known from datebook |
123 | */ | 133 | */ |
124 | void DateBookEvent::editEventSlot( const Event &e ) { | 134 | void DateBookEvent::editEventSlot( const Event &e ) { |
125 | 135 | ||
126 | if ( ODevice::inst()->system() == System_Zaurus ) { | 136 | if ( ODevice::inst()->system() == System_Zaurus ) { |
127 | QCopEnvelope env( "QPE/Application/datebook", "raise()" ); | 137 | QCopEnvelope env( "QPE/Application/datebook", "raise()" ); |
128 | } else { | 138 | } else { |
129 | QCopEnvelope env( "QPE/Datebook", "editEvent(int)" ); | 139 | QCopEnvelope env( "QPE/Application/datebook", "editEvent(int)" ); |
130 | env << e.uid(); | 140 | env << e.uid(); |
131 | } | 141 | } |
132 | } | 142 | } |
133 | 143 | ||
134 | 144 | ||
135 | void DateBookEvent::editMe() { | 145 | void DateBookEvent::editMe() { |
136 | emit editEvent( event.event() ); | 146 | emit editEvent( event.event() ); |
137 | } | 147 | } |
138 | 148 | ||
diff --git a/core/pim/today/plugins/datebook/datebookevent.h b/core/pim/today/plugins/datebook/datebookevent.h index 8027809..1a090e3 100644 --- a/core/pim/today/plugins/datebook/datebookevent.h +++ b/core/pim/today/plugins/datebook/datebookevent.h | |||
@@ -1,51 +1,54 @@ | |||
1 | /* | 1 | /* |
2 | * datebookplugin.h | 2 | * datebookplugin.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002, 2003 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #ifndef DATEBOOKEVENT_PLUGIN_H | 17 | #ifndef DATEBOOKEVENT_PLUGIN_H |
18 | #define DATEBOOKEVENT_PLUGIN_H | 18 | #define DATEBOOKEVENT_PLUGIN_H |
19 | 19 | ||
20 | #include <opie/oclickablelabel.h> | 20 | #include <opie/oclickablelabel.h> |
21 | #include <qpe/datebookdb.h> | 21 | #include <qpe/datebookdb.h> |
22 | 22 | ||
23 | 23 | ||
24 | class DateBookEvent: public OClickableLabel { | 24 | class DateBookEvent: public OClickableLabel { |
25 | 25 | ||
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | 27 | ||
28 | public: | 28 | public: |
29 | DateBookEvent( const EffectiveEvent &ev, | 29 | DateBookEvent( const EffectiveEvent &ev, |
30 | QWidget* parent = 0, | 30 | QWidget* parent = 0, |
31 | bool show_location = 0, | 31 | bool show_location = 0, |
32 | bool show_notes = 0, | 32 | bool show_notes = 0, |
33 | bool timeExtraLine = 0, | ||
33 | int maxCharClip = 0, | 34 | int maxCharClip = 0, |
34 | const char* name = 0, | 35 | const char* name = 0, |
35 | WFlags fl = 0 ); | 36 | WFlags fl = 0 ); |
36 | ~DateBookEvent(); | 37 | ~DateBookEvent(); |
38 | |||
37 | signals: | 39 | signals: |
38 | void editEvent( const Event &e ); | 40 | void editEvent( const Event &e ); |
39 | 41 | ||
40 | private slots: | 42 | private slots: |
41 | void editEventSlot( const Event &e ); | 43 | void editEventSlot( const Event &e ); |
42 | void editMe(); | 44 | void editMe(); |
45 | |||
43 | private: | 46 | private: |
44 | 47 | ||
45 | QString ampmTime( QTime ); | 48 | QString ampmTime( QTime ); |
46 | QString differDate( QDate date ); | 49 | QString differDate( QDate date ); |
47 | const EffectiveEvent event; | 50 | const EffectiveEvent event; |
48 | bool ampm; | 51 | bool ampm; |
49 | }; | 52 | }; |
50 | 53 | ||
51 | #endif | 54 | #endif |
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp index 4e650ee..f77e440 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.cpp +++ b/core/pim/today/plugins/datebook/datebookplugin.cpp | |||
@@ -48,24 +48,31 @@ QWidget* DatebookPlugin::widget( QWidget* wid ) { | |||
48 | return m_widget; | 48 | return m_widget; |
49 | } | 49 | } |
50 | 50 | ||
51 | QString DatebookPlugin::pixmapNameConfig() const { | 51 | QString DatebookPlugin::pixmapNameConfig() const { |
52 | return "datebook/DateBook"; | 52 | return "datebook/DateBook"; |
53 | } | 53 | } |
54 | 54 | ||
55 | TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { | 55 | TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { |
56 | return new DatebookPluginConfig( wid , "Datebook" ); | 56 | return new DatebookPluginConfig( wid , "Datebook" ); |
57 | } | 57 | } |
58 | 58 | ||
59 | QString DatebookPlugin::appName() const { | 59 | QString DatebookPlugin::appName() const { |
60 | return "datebook"; | 60 | return "datebook"; |
61 | } | 61 | } |
62 | 62 | ||
63 | bool DatebookPlugin::excludeFromRefresh() const { | 63 | bool DatebookPlugin::excludeFromRefresh() const { |
64 | return false; | 64 | return false; |
65 | } | 65 | } |
66 | 66 | ||
67 | void DatebookPlugin::refresh() { | 67 | void DatebookPlugin::refresh() { |
68 | if ( m_widget ) { | 68 | if ( m_widget ) { |
69 | m_widget->refresh(); | 69 | m_widget->refresh(); |
70 | } | 70 | } |
71 | } | 71 | } |
72 | |||
73 | void DatebookPlugin::reinitialize() { | ||
74 | if ( m_widget ) { | ||
75 | m_widget->reinitialize(); | ||
76 | } | ||
77 | } | ||
78 | |||
diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h index db899e8..890c59b 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.h +++ b/core/pim/today/plugins/datebook/datebookplugin.h | |||
@@ -18,31 +18,32 @@ | |||
18 | #define DATEBOOK_PLUGIN_H | 18 | #define DATEBOOK_PLUGIN_H |
19 | 19 | ||
20 | #include <qguardedptr.h> | 20 | #include <qguardedptr.h> |
21 | 21 | ||
22 | #include <opie/oclickablelabel.h> | 22 | #include <opie/oclickablelabel.h> |
23 | #include <opie/todayplugininterface.h> | 23 | #include <opie/todayplugininterface.h> |
24 | 24 | ||
25 | #include "datebookpluginwidget.h" | 25 | #include "datebookpluginwidget.h" |
26 | 26 | ||
27 | class DatebookPlugin : public TodayPluginObject { | 27 | class DatebookPlugin : public TodayPluginObject { |
28 | 28 | ||
29 | public: | 29 | public: |
30 | DatebookPlugin(); | 30 | DatebookPlugin(); |
31 | ~DatebookPlugin(); | 31 | ~DatebookPlugin(); |
32 | 32 | ||
33 | QString pluginName() const; | 33 | QString pluginName() const; |
34 | double versionNumber() const; | 34 | double versionNumber() const; |
35 | QString pixmapNameWidget() const; | 35 | QString pixmapNameWidget() const; |
36 | QWidget* widget( QWidget *); | 36 | QWidget* widget( QWidget *); |
37 | QString pixmapNameConfig() const; | 37 | QString pixmapNameConfig() const; |
38 | TodayConfigWidget* configWidget( QWidget *); | 38 | TodayConfigWidget* configWidget( QWidget *); |
39 | QString appName() const; | 39 | QString appName() const; |
40 | bool excludeFromRefresh() const; | 40 | bool excludeFromRefresh() const; |
41 | void refresh(); | 41 | void refresh(); |
42 | void reinitialize(); | ||
42 | 43 | ||
43 | private: | 44 | private: |
44 | QGuardedPtr<DatebookPluginWidget> m_widget; | 45 | QGuardedPtr<DatebookPluginWidget> m_widget; |
45 | }; | 46 | }; |
46 | 47 | ||
47 | 48 | ||
48 | #endif | 49 | #endif |
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index 1970654..9e95bcd 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp | |||
@@ -9,117 +9,135 @@ | |||
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 | 19 | ||
20 | #include <qpe/timestring.h> | 20 | #include <qpe/timestring.h> |
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | 22 | ||
23 | #include <qdatetime.h> | 23 | #include <qdatetime.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qtl.h> | 25 | #include <qtl.h> |
26 | 26 | ||
27 | DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) | 27 | DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) |
28 | : QWidget(parent, name ) { | 28 | : QWidget(parent, name ) { |
29 | 29 | ||
30 | db = 0l; | 30 | db = 0l; |
31 | m_layoutDates = 0l; | 31 | m_layoutDates = 0l; |
32 | 32 | ||
33 | if ( db ) { | ||
34 | delete db; | ||
35 | } | ||
36 | db = new DateBookDB; | ||
37 | |||
38 | if ( m_layoutDates ) { | 33 | if ( m_layoutDates ) { |
39 | delete m_layoutDates; | 34 | delete m_layoutDates; |
40 | } | 35 | } |
41 | m_layoutDates = new QVBoxLayout( this ); | 36 | m_layoutDates = new QVBoxLayout( this ); |
42 | m_layoutDates->setAutoAdd( true ); | 37 | m_layoutDates->setAutoAdd( true ); |
43 | 38 | ||
44 | m_eventsList.setAutoDelete( true ); | 39 | m_eventsList.setAutoDelete( true ); |
45 | 40 | ||
46 | readConfig(); | 41 | readConfig(); |
47 | getDates(); | 42 | getDates(); |
48 | m_layoutDates->addStretch(5); | ||
49 | } | 43 | } |
50 | 44 | ||
51 | DatebookPluginWidget::~DatebookPluginWidget() { | 45 | DatebookPluginWidget::~DatebookPluginWidget() { |
52 | delete db; | 46 | delete db; |
53 | delete m_layoutDates; | 47 | delete m_layoutDates; |
54 | } | 48 | } |
55 | 49 | ||
56 | 50 | ||
57 | void DatebookPluginWidget::readConfig() { | 51 | void DatebookPluginWidget::readConfig() { |
58 | Config cfg( "todaydatebookplugin" ); | 52 | Config cfg( "todaydatebookplugin" ); |
59 | cfg.setGroup( "config" ); | 53 | cfg.setGroup( "config" ); |
60 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); | 54 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); |
61 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); | 55 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); |
62 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); | 56 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); |
63 | m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); | 57 | m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); |
64 | m_moreDays = cfg.readNumEntry( "moredays", 0 ); | 58 | m_moreDays = cfg.readNumEntry( "moredays", 0 ); |
59 | m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 ); | ||
60 | } | ||
61 | |||
62 | void DatebookPluginWidget::reinitialize() { | ||
63 | readConfig(); | ||
64 | refresh(); | ||
65 | } | 65 | } |
66 | 66 | ||
67 | void DatebookPluginWidget::refresh() { | 67 | void DatebookPluginWidget::refresh() { |
68 | m_eventsList.clear(); | 68 | m_eventsList.clear(); |
69 | 69 | ||
70 | if ( m_layoutDates ) { | 70 | if ( m_layoutDates ) { |
71 | delete m_layoutDates; | 71 | delete m_layoutDates; |
72 | } | 72 | } |
73 | m_layoutDates = new QVBoxLayout( this ); | 73 | m_layoutDates = new QVBoxLayout( this ); |
74 | m_layoutDates->setAutoAdd( true ); | 74 | m_layoutDates->setAutoAdd( true ); |
75 | 75 | ||
76 | getDates(); | 76 | getDates(); |
77 | m_layoutDates->addStretch(5); | ||
78 | } | 77 | } |
79 | 78 | ||
80 | /** | 79 | /** |
81 | * Get all events that are in the datebook xml file for today | 80 | * Get all events that are in the datebook xml file for today |
82 | */ | 81 | */ |
83 | void DatebookPluginWidget::getDates() { | 82 | void DatebookPluginWidget::getDates() { |
84 | 83 | ||
84 | |||
85 | if ( db ) { | ||
86 | delete db; | ||
87 | } | ||
88 | db = new DateBookDB; | ||
89 | |||
85 | QDate date = QDate::currentDate(); | 90 | QDate date = QDate::currentDate(); |
86 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); | 91 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); |
87 | qBubbleSort( list ); | 92 | qBubbleSort( list ); |
88 | int count = 0; | 93 | int count = 0; |
89 | 94 | ||
90 | if ( list.count() > 0 ) { | 95 | if ( list.count() > 0 ) { |
91 | 96 | ||
92 | for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { | 97 | for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { |
93 | 98 | ||
94 | if ( count < m_max_lines_meet ) { | 99 | if ( count < m_max_lines_meet ) { |
95 | if ( !m_onlyLater ) { | 100 | if ( !m_onlyLater ) { |
96 | count++; | 101 | count++; |
97 | 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, m_timeExtraLine ); |
98 | m_eventsList.append( l ); | ||
99 | l->show(); | ||
100 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); | ||
101 | } else if ( QDateTime::currentDateTime() <= (*it).event().end() || (*it).event().start().date() != date ) { | ||
102 | count++; | ||
103 | // show only later appointments | ||
104 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | ||
105 | m_eventsList.append( l ); | 103 | m_eventsList.append( l ); |
106 | l->show(); | 104 | l->show(); |
107 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); | 105 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); |
108 | } | 106 | } else { |
107 | if ( ( QDateTime::currentDateTime() <= (*it).event().end() ) | ||
108 | // Show events which span over many days and are not elapsed. | ||
109 | || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) ) | ||
110 | // Show repeated event for today that is not elapsed. | ||
111 | || ( ( (*it).event().repeatType() != Event::NoRepeat ) | ||
112 | && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() ) | ||
113 | && ( QTime::currentTime() < (*it).event().start().time() ) ) ) | ||
114 | // Show repeated event for next days. | ||
115 | || ( ( (*it).event().repeatType() != Event::NoRepeat ) | ||
116 | && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) ) | ||
117 | ) | ||
118 | { | ||
119 | count++; | ||
120 | // show only later appointments | ||
121 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); | ||
122 | m_eventsList.append( l ); | ||
123 | l->show(); | ||
124 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); | ||
125 | } | ||
126 | } | ||
109 | } | 127 | } |
110 | } | 128 | } |
111 | if ( m_onlyLater && count == 0 ) { | 129 | if ( m_onlyLater && count == 0 ) { |
112 | QLabel* noMoreEvents = new QLabel( this ); | 130 | QLabel* noMoreEvents = new QLabel( this ); |
113 | m_eventsList.append( noMoreEvents ); | 131 | m_eventsList.append( noMoreEvents ); |
114 | noMoreEvents->show(); | 132 | noMoreEvents->show(); |
115 | noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); | 133 | noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); |
116 | } | 134 | } |
117 | } else { | 135 | } else { |
118 | QLabel* noEvents = new QLabel( this ); | 136 | QLabel* noEvents = new QLabel( this ); |
119 | m_eventsList.append( noEvents ); | 137 | m_eventsList.append( noEvents ); |
120 | noEvents->show(); | 138 | noEvents->show(); |
121 | noEvents->setText( QObject::tr( "No appointments today" ) ); | 139 | noEvents->setText( QObject::tr( "No appointments today" ) ); |
122 | } | 140 | } |
123 | } | 141 | } |
124 | 142 | ||
125 | 143 | ||
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h index 35d43cd..8988073 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.h +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h | |||
@@ -13,46 +13,48 @@ | |||
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 <qlayout.h> | 20 | #include <qlayout.h> |
21 | #include <qguardedptr.h> | 21 | #include <qguardedptr.h> |
22 | #include <qlist.h> | 22 | #include <qlist.h> |
23 | 23 | ||
24 | #include <qpe/datebookdb.h> | 24 | #include <qpe/datebookdb.h> |
25 | #include <opie/oclickablelabel.h> | 25 | #include <opie/oclickablelabel.h> |
26 | 26 | ||
27 | #include "datebookevent.h" | 27 | #include "datebookevent.h" |
28 | 28 | ||
29 | class DatebookPluginWidget : public QWidget { | 29 | class DatebookPluginWidget : public QWidget { |
30 | 30 | ||
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | 32 | ||
33 | public: | 33 | public: |
34 | DatebookPluginWidget( QWidget *parent, const char *name ); | 34 | DatebookPluginWidget( QWidget *parent, const char *name ); |
35 | ~DatebookPluginWidget(); | 35 | ~DatebookPluginWidget(); |
36 | void refresh(); | 36 | void refresh(); |
37 | void reinitialize(); | ||
37 | 38 | ||
38 | private: | 39 | private: |
39 | DateBookDB* db; | 40 | DateBookDB* db; |
40 | QGuardedPtr<QVBoxLayout> m_layoutDates; | 41 | QGuardedPtr<QVBoxLayout> m_layoutDates; |
41 | QList<QWidget> m_eventsList; | 42 | QList<QWidget> m_eventsList; |
42 | void readConfig(); | 43 | void readConfig(); |
43 | void getDates(); | 44 | void getDates(); |
44 | 45 | ||
45 | 46 | ||
46 | // how many lines should be showed in the datebook section | 47 | // how many lines should be showed in the datebook section |
47 | int m_max_lines_meet; | 48 | int m_max_lines_meet; |
48 | // If location is to be showed too, 1 to activate it. | 49 | // If location is to be showed too, 1 to activate it. |
49 | bool m_show_location; | 50 | bool m_show_location; |
50 | // if notes should be shown | 51 | // if notes should be shown |
51 | bool m_show_notes; | 52 | bool m_show_notes; |
52 | // 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. |
53 | bool m_onlyLater; | 54 | bool m_onlyLater; |
54 | int m_moreDays; | 55 | int m_moreDays; |
55 | 56 | // true if time of an appointment should be an extra line | |
57 | bool m_timeExtraLine; | ||
56 | }; | 58 | }; |
57 | 59 | ||
58 | #endif | 60 | #endif |
diff --git a/core/pim/today/plugins/mail/config.in b/core/pim/today/plugins/mail/config.in index 6f3e06d..6f4450f 100644 --- a/core/pim/today/plugins/mail/config.in +++ b/core/pim/today/plugins/mail/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config TODAY_MAIL | 1 | config TODAY_MAIL |
2 | boolean "opie-today-mailplugin (mail plugin)" | 2 | boolean "mail" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE |
diff --git a/core/pim/today/plugins/mail/mail.pro b/core/pim/today/plugins/mail/mail.pro index 60ed87d..70c484d 100644 --- a/core/pim/today/plugins/mail/mail.pro +++ b/core/pim/today/plugins/mail/mail.pro | |||
@@ -1,19 +1,37 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG -= moc | 2 | CONFIG -= moc |
3 | CONFIG += qt plugin release | 3 | CONFIG += qt release |
4 | 4 | ||
5 | # Input | 5 | # Input |
6 | HEADERS = mailplugin.h mailpluginimpl.h mailpluginwidget.h | 6 | HEADERS = mailplugin.h mailpluginimpl.h mailpluginwidget.h |
7 | SOURCES = mailplugin.cpp mailpluginimpl.cpp mailpluginwidget.cpp | 7 | SOURCES = mailplugin.cpp mailpluginimpl.cpp mailpluginwidget.cpp |
8 | 8 | ||
9 | INCLUDEPATH += $(OPIEDIR)/include \ | 9 | INCLUDEPATH += $(OPIEDIR)/include \ |
10 | ../ ../library | 10 | ../ ../library |
11 | DEPENDPATH += $(OPIEDIR)/include \ | 11 | DEPENDPATH += $(OPIEDIR)/include \ |
12 | ../ ../library | 12 | ../ ../library |
13 | 13 | ||
14 | LIBS+= -lqpe -lopie | 14 | LIBS+= -lqpe -lopie |
15 | 15 | ||
16 | DESTDIR = $(OPIEDIR)/plugins/today | 16 | DESTDIR = $(OPIEDIR)/plugins/today |
17 | TARGET = todaymailplugin | 17 | TARGET = todaymailplugin |
18 | 18 | ||
19 | TRANSLATIONS = ../../../../../i18n/de/libtodaymailplugin.ts \ | ||
20 | ../../../../../i18n/nl/libtodaymailplugin.ts \ | ||
21 | ../../../../../i18n/xx/libtodaymailplugin.ts \ | ||
22 | ../../../../../i18n/en/libtodaymailplugin.ts \ | ||
23 | ../../../../../i18n/es/libtodaymailplugin.ts \ | ||
24 | ../../../../../i18n/fr/libtodaymailplugin.ts \ | ||
25 | ../../../../../i18n/hu/libtodaymailplugin.ts \ | ||
26 | ../../../../../i18n/ja/libtodaymailplugin.ts \ | ||
27 | ../../../../../i18n/ko/libtodaymailplugin.ts \ | ||
28 | ../../../../../i18n/no/libtodaymailplugin.ts \ | ||
29 | ../../../../../i18n/pl/libtodaymailplugin.ts \ | ||
30 | ../../../../../i18n/pt/libtodaymailplugin.ts \ | ||
31 | ../../../../../i18n/pt_BR/libtodaymailplugin.ts \ | ||
32 | ../../../../../i18n/sl/libtodaymailplugin.ts \ | ||
33 | ../../../../../i18n/zh_CN/libtodaymailplugin.ts \ | ||
34 | ../../../../../i18n/zh_TW/libtodaymailplugin.ts \ | ||
35 | ../../../../../i18n/it/libtodaymailplugin.ts \ | ||
36 | ../../../../../i18n/da/libtodaymailplugin.ts | ||
19 | include ( $(OPIEDIR)/include.pro ) | 37 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/pim/today/plugins/mail/mailplugin.cpp b/core/pim/today/plugins/mail/mailplugin.cpp index 9430c30..bf30538 100644 --- a/core/pim/today/plugins/mail/mailplugin.cpp +++ b/core/pim/today/plugins/mail/mailplugin.cpp | |||
@@ -46,24 +46,27 @@ QWidget* MailPlugin::widget( QWidget * wid ) { | |||
46 | 46 | ||
47 | 47 | ||
48 | QString MailPlugin::pixmapNameConfig() const { | 48 | QString MailPlugin::pixmapNameConfig() const { |
49 | return 0l; | 49 | return 0l; |
50 | } | 50 | } |
51 | 51 | ||
52 | TodayConfigWidget* MailPlugin::configWidget( QWidget* ) { | 52 | TodayConfigWidget* MailPlugin::configWidget( QWidget* ) { |
53 | return 0l; | 53 | return 0l; |
54 | } | 54 | } |
55 | 55 | ||
56 | QString MailPlugin::appName() const { | 56 | QString MailPlugin::appName() const { |
57 | return "mail"; | 57 | return "mail"; |
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | bool MailPlugin::excludeFromRefresh() const { | 61 | bool MailPlugin::excludeFromRefresh() const { |
62 | return false; | 62 | return false; |
63 | } | 63 | } |
64 | 64 | ||
65 | void MailPlugin::refresh() { | 65 | void MailPlugin::refresh() { |
66 | if ( m_widget ) { | 66 | if ( m_widget ) { |
67 | m_widget->refresh(); | 67 | m_widget->refresh(); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | |||
71 | void MailPlugin::reinitialize() { | ||
72 | } | ||
diff --git a/core/pim/today/plugins/mail/mailplugin.h b/core/pim/today/plugins/mail/mailplugin.h index 295a88c..5b93314 100644 --- a/core/pim/today/plugins/mail/mailplugin.h +++ b/core/pim/today/plugins/mail/mailplugin.h | |||
@@ -20,30 +20,31 @@ | |||
20 | 20 | ||
21 | #include <qwidget.h> | 21 | #include <qwidget.h> |
22 | #include <qguardedptr.h> | 22 | #include <qguardedptr.h> |
23 | 23 | ||
24 | #include <opie/todayplugininterface.h> | 24 | #include <opie/todayplugininterface.h> |
25 | #include <opie/todayconfigwidget.h> | 25 | #include <opie/todayconfigwidget.h> |
26 | 26 | ||
27 | #include "mailpluginwidget.h" | 27 | #include "mailpluginwidget.h" |
28 | 28 | ||
29 | class MailPlugin : public TodayPluginObject { | 29 | class MailPlugin : public TodayPluginObject { |
30 | 30 | ||
31 | public: | 31 | public: |
32 | MailPlugin(); | 32 | MailPlugin(); |
33 | ~MailPlugin(); | 33 | ~MailPlugin(); |
34 | 34 | ||
35 | QString pluginName() const; | 35 | QString pluginName() const; |
36 | double versionNumber() const; | 36 | double versionNumber() const; |
37 | QString pixmapNameWidget() const; | 37 | QString pixmapNameWidget() const; |
38 | QWidget* widget(QWidget *); | 38 | QWidget* widget(QWidget *); |
39 | QString pixmapNameConfig() const; | 39 | QString pixmapNameConfig() const; |
40 | TodayConfigWidget* configWidget(QWidget *); | 40 | TodayConfigWidget* configWidget(QWidget *); |
41 | QString appName() const; | 41 | QString appName() const; |
42 | bool excludeFromRefresh() const; | 42 | bool excludeFromRefresh() const; |
43 | void refresh(); | 43 | void refresh(); |
44 | void reinitialize(); | ||
44 | 45 | ||
45 | private: | 46 | private: |
46 | QGuardedPtr<MailPluginWidget> m_widget; | 47 | QGuardedPtr<MailPluginWidget> m_widget; |
47 | }; | 48 | }; |
48 | 49 | ||
49 | #endif | 50 | #endif |
diff --git a/core/pim/today/plugins/mail/mailpluginwidget.cpp b/core/pim/today/plugins/mail/mailpluginwidget.cpp index 3c1d908..646996a 100644 --- a/core/pim/today/plugins/mail/mailpluginwidget.cpp +++ b/core/pim/today/plugins/mail/mailpluginwidget.cpp | |||
@@ -8,49 +8,49 @@ | |||
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 <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
19 | 19 | ||
20 | #include "mailpluginwidget.h" | 20 | #include "mailpluginwidget.h" |
21 | 21 | ||
22 | MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) | 22 | MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name) |
23 | : QWidget(parent, name ) { | 23 | : QWidget(parent, name ) { |
24 | 24 | ||
25 | m_mailLabel = 0l; | 25 | m_mailLabel = 0l; |
26 | m_layout = 0l; | 26 | m_layout = 0l; |
27 | 27 | ||
28 | if ( m_mailLabel ) { | 28 | if ( m_mailLabel ) { |
29 | delete m_mailLabel; | 29 | delete m_mailLabel; |
30 | } | 30 | } |
31 | m_mailLabel = new OClickableLabel( this ); | 31 | m_mailLabel = new OClickableLabel( this ); |
32 | m_mailLabel->setMaximumHeight( 15 ); | 32 | //m_mailLabel->setMaximumHeight( 15 ); |
33 | connect( m_mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) ); | 33 | connect( m_mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) ); |
34 | 34 | ||
35 | if ( m_layout ) { | 35 | if ( m_layout ) { |
36 | delete m_layout; | 36 | delete m_layout; |
37 | } | 37 | } |
38 | m_layout = new QHBoxLayout( this ); | 38 | m_layout = new QHBoxLayout( this ); |
39 | m_layout->setAutoAdd( true ); | 39 | m_layout->setAutoAdd( true ); |
40 | 40 | ||
41 | readConfig(); | 41 | readConfig(); |
42 | getInfo(); | 42 | getInfo(); |
43 | } | 43 | } |
44 | 44 | ||
45 | MailPluginWidget::~MailPluginWidget() { | 45 | MailPluginWidget::~MailPluginWidget() { |
46 | delete m_mailLabel; | 46 | delete m_mailLabel; |
47 | delete m_layout; | 47 | delete m_layout; |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | void MailPluginWidget::readConfig() { | 51 | void MailPluginWidget::readConfig() { |
52 | Config cfg( "todaymailplugin" ); | 52 | Config cfg( "todaymailplugin" ); |
53 | cfg.setGroup( "config" ); | 53 | cfg.setGroup( "config" ); |
54 | } | 54 | } |
55 | 55 | ||
56 | 56 | ||
diff --git a/core/pim/today/plugins/mail/opie-today-mailplugin.control b/core/pim/today/plugins/mail/opie-today-mailplugin.control index 1419557..e69de29 100644 --- a/core/pim/today/plugins/mail/opie-today-mailplugin.control +++ b/core/pim/today/plugins/mail/opie-today-mailplugin.control | |||
@@ -1,9 +0,0 @@ | |||
1 | Package: opie-today-mailplugin | ||
2 | Files: plugins/today/libtodaymailplugin.so* | ||
3 | Priority: optional | ||
4 | Section: opie/applications | ||
5 | Maintainer: Maximilian Reiss <harlekin@handhelds.org> | ||
6 | Architecture: arm | ||
7 | Version: $QPE_VERSION-$SUB_VERSION | ||
8 | Depends: libqte2, opie-today | ||
9 | Description: Mail plugin for today | ||
diff --git a/core/pim/today/plugins/todolist/.cvsignore b/core/pim/today/plugins/todolist/.cvsignore index 2888d4a..b9284b8 100644 --- a/core/pim/today/plugins/todolist/.cvsignore +++ b/core/pim/today/plugins/todolist/.cvsignore | |||
@@ -1,2 +1,3 @@ | |||
1 | Makefile* | 1 | Makefile* |
2 | todopluginconfigbase* | ||
2 | moc* | 3 | moc* |
diff --git a/core/pim/today/plugins/todolist/config.in b/core/pim/today/plugins/todolist/config.in index c862f37..48ba226 100644 --- a/core/pim/today/plugins/todolist/config.in +++ b/core/pim/today/plugins/todolist/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config TODAY_TODOLIST | 1 | config TODAY_TODOLIST |
2 | boolean "opie-today-todolistplugin (shows the next todo entries)" | 2 | boolean "todolist" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE |
diff --git a/core/pim/today/plugins/todolist/todolist.pro b/core/pim/today/plugins/todolist/todolist.pro index 0343223..6a63f4e 100644 --- a/core/pim/today/plugins/todolist/todolist.pro +++ b/core/pim/today/plugins/todolist/todolist.pro | |||
@@ -1,22 +1,41 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG -= moc | 2 | CONFIG -= moc |
3 | CONFIG += qt release | 3 | CONFIG += qt release |
4 | 4 | ||
5 | # Input | 5 | # Input |
6 | HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \ | 6 | HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \ |
7 | todopluginwidget.h | 7 | todopluginwidget.h |
8 | SOURCES = todoplugin.cpp todopluginimpl.cpp todopluginconfig.cpp \ | 8 | SOURCES = todoplugin.cpp todopluginimpl.cpp todopluginconfig.cpp \ |
9 | todopluginwidget.cpp | 9 | todopluginwidget.cpp |
10 | INTERFACES= todopluginconfigbase.ui | 10 | INTERFACES= todopluginconfigbase.ui |
11 | 11 | ||
12 | INCLUDEPATH += $(OPIEDIR)/include \ | 12 | INCLUDEPATH += $(OPIEDIR)/include \ |
13 | ../ ../library | 13 | ../ ../library |
14 | DEPENDPATH += $(OPIEDIR)/include \ | 14 | DEPENDPATH += $(OPIEDIR)/include \ |
15 | ../ ../library | 15 | ../ ../library |
16 | 16 | ||
17 | LIBS+= -lqpe -lopie | 17 | LIBS+= -lqpe -lopie |
18 | 18 | ||
19 | DESTDIR = $(OPIEDIR)/plugins/today | 19 | DESTDIR = $(OPIEDIR)/plugins/today |
20 | TARGET = todaytodolistplugin | 20 | TARGET = todaytodolistplugin |
21 | 21 | ||
22 | TRANSLATIONS = ../../../../../i18n/de/libtodaytodolistplugin.ts \ | ||
23 | ../../../../../i18n/nl/libtodaytodolistplugin.ts \ | ||
24 | ../../../../../i18n/xx/libtodaytodolistplugin.ts \ | ||
25 | ../../../../../i18n/en/libtodaytodolistplugin.ts \ | ||
26 | ../../../../../i18n/es/libtodaytodolistplugin.ts \ | ||
27 | ../../../../../i18n/fr/libtodaytodolistplugin.ts \ | ||
28 | ../../../../../i18n/hu/libtodaytodolistplugin.ts \ | ||
29 | ../../../../../i18n/ja/libtodaytodolistplugin.ts \ | ||
30 | ../../../../../i18n/ko/libtodaytodolistplugin.ts \ | ||
31 | ../../../../../i18n/no/libtodaytodolistplugin.ts \ | ||
32 | ../../../../../i18n/pl/libtodaytodolistplugin.ts \ | ||
33 | ../../../../../i18n/pt/libtodaytodolistplugin.ts \ | ||
34 | ../../../../../i18n/pt_BR/libtodaytodolistplugin.ts \ | ||
35 | ../../../../../i18n/sl/libtodaytodolistplugin.ts \ | ||
36 | ../../../../../i18n/zh_CN/libtodaytodolistplugin.ts \ | ||
37 | ../../../../../i18n/zh_TW/libtodaytodolistplugin.ts \ | ||
38 | ../../../../../i18n/it/libtodaytodolistplugin.ts \ | ||
39 | ../../../../../i18n/da/libtodaytodolistplugin.ts | ||
40 | |||
22 | include ( $(OPIEDIR)/include.pro ) | 41 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp index 7eeb8f1..801de9d 100644 --- a/core/pim/today/plugins/todolist/todoplugin.cpp +++ b/core/pim/today/plugins/todolist/todoplugin.cpp | |||
@@ -1,28 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | * todoplugin.cpp | 2 | * todoplugin.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002,2003 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | 18 | ||
19 | #include "todoplugin.h" | 19 | #include "todoplugin.h" |
20 | #include "todopluginconfig.h" | 20 | #include "todopluginconfig.h" |
21 | 21 | ||
22 | 22 | ||
23 | TodolistPlugin::TodolistPlugin() { | 23 | TodolistPlugin::TodolistPlugin() { |
24 | } | 24 | } |
25 | 25 | ||
26 | TodolistPlugin::~TodolistPlugin() { | 26 | TodolistPlugin::~TodolistPlugin() { |
27 | delete (TodolistPluginWidget*)m_widget; | 27 | delete (TodolistPluginWidget*)m_widget; |
28 | } | 28 | } |
@@ -47,24 +47,30 @@ QWidget* TodolistPlugin::widget( QWidget *wid ) { | |||
47 | } | 47 | } |
48 | 48 | ||
49 | QString TodolistPlugin::pixmapNameConfig() const { | 49 | QString TodolistPlugin::pixmapNameConfig() const { |
50 | return "todo/TodoList"; | 50 | return "todo/TodoList"; |
51 | } | 51 | } |
52 | 52 | ||
53 | TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { | 53 | TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { |
54 | return new TodolistPluginConfig( wid , "Todolist" ); | 54 | return new TodolistPluginConfig( wid , "Todolist" ); |
55 | } | 55 | } |
56 | 56 | ||
57 | QString TodolistPlugin::appName() const { | 57 | QString TodolistPlugin::appName() const { |
58 | return "todolist"; | 58 | return "todolist"; |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | bool TodolistPlugin::excludeFromRefresh() const { | 62 | bool TodolistPlugin::excludeFromRefresh() const { |
63 | return false; | 63 | return false; |
64 | } | 64 | } |
65 | 65 | ||
66 | void TodolistPlugin::refresh() { | 66 | void TodolistPlugin::refresh() { |
67 | if ( m_widget ) { | 67 | if ( m_widget ) { |
68 | m_widget->refresh(); | 68 | m_widget->refresh(); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | |||
72 | void TodolistPlugin::reinitialize() { | ||
73 | if ( m_widget ) { | ||
74 | m_widget->reinitialize(); | ||
75 | } | ||
76 | } | ||
diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h index d7b51b4..f68162f 100644 --- a/core/pim/today/plugins/todolist/todoplugin.h +++ b/core/pim/today/plugins/todolist/todoplugin.h | |||
@@ -20,30 +20,31 @@ | |||
20 | #include <qstring.h> | 20 | #include <qstring.h> |
21 | #include <qguardedptr.h> | 21 | #include <qguardedptr.h> |
22 | #include <qwidget.h> | 22 | #include <qwidget.h> |
23 | 23 | ||
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" | 27 | #include "todopluginwidget.h" |
28 | 28 | ||
29 | class TodolistPlugin : public TodayPluginObject { | 29 | class TodolistPlugin : public TodayPluginObject { |
30 | 30 | ||
31 | public: | 31 | public: |
32 | TodolistPlugin(); | 32 | TodolistPlugin(); |
33 | ~TodolistPlugin(); | 33 | ~TodolistPlugin(); |
34 | 34 | ||
35 | QString pluginName() const; | 35 | QString pluginName() const; |
36 | double versionNumber() const; | 36 | double versionNumber() const; |
37 | QString pixmapNameWidget() const; | 37 | QString pixmapNameWidget() const; |
38 | QWidget* widget(QWidget *); | 38 | QWidget* widget(QWidget *); |
39 | QString pixmapNameConfig() const; | 39 | QString pixmapNameConfig() const; |
40 | TodayConfigWidget* configWidget(QWidget *); | 40 | TodayConfigWidget* configWidget(QWidget *); |
41 | QString appName() const; | 41 | QString appName() const; |
42 | bool excludeFromRefresh() const; | 42 | bool excludeFromRefresh() const; |
43 | void refresh(); | 43 | void refresh(); |
44 | void reinitialize(); | ||
44 | 45 | ||
45 | private: | 46 | private: |
46 | QGuardedPtr<TodolistPluginWidget> m_widget; | 47 | QGuardedPtr<TodolistPluginWidget> m_widget; |
47 | }; | 48 | }; |
48 | 49 | ||
49 | #endif | 50 | #endif |
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp index 15081ec..0364f94 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.cpp +++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp | |||
@@ -42,90 +42,97 @@ TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) | |||
42 | delete todoLabel; | 42 | delete todoLabel; |
43 | } | 43 | } |
44 | todoLabel = new OClickableLabel( this ); | 44 | todoLabel = new OClickableLabel( this ); |
45 | 45 | ||
46 | connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); | 46 | connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); |
47 | 47 | ||
48 | readConfig(); | 48 | readConfig(); |
49 | getTodo(); | 49 | getTodo(); |
50 | } | 50 | } |
51 | 51 | ||
52 | TodolistPluginWidget::~TodolistPluginWidget() { | 52 | TodolistPluginWidget::~TodolistPluginWidget() { |
53 | delete todo; | 53 | delete todo; |
54 | delete todoLabel; | 54 | delete todoLabel; |
55 | delete layoutTodo; | 55 | delete layoutTodo; |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | void TodolistPluginWidget::readConfig() { | 59 | void TodolistPluginWidget::readConfig() { |
60 | Config cfg( "todaytodoplugin" ); | 60 | Config cfg( "todaytodoplugin" ); |
61 | cfg.setGroup( "config" ); | 61 | cfg.setGroup( "config" ); |
62 | m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); | 62 | m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); |
63 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | 63 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); |
64 | } | 64 | } |
65 | 65 | ||
66 | void TodolistPluginWidget:: refresh() { | 66 | void TodolistPluginWidget:: refresh() { |
67 | todo->reload(); | ||
68 | getTodo(); | ||
69 | } | ||
70 | |||
71 | void TodolistPluginWidget::reinitialize() { | ||
72 | readConfig(); | ||
73 | todo->reload(); | ||
67 | getTodo(); | 74 | getTodo(); |
68 | } | 75 | } |
69 | 76 | ||
70 | /** | 77 | /** |
71 | * Get the todos | 78 | * Get the todos |
72 | */ | 79 | */ |
73 | void TodolistPluginWidget::getTodo() { | 80 | void TodolistPluginWidget::getTodo() { |
74 | 81 | ||
75 | 82 | ||
76 | QString output; | 83 | QString output; |
77 | QString tmpout; | 84 | QString tmpout; |
78 | int count = 0; | 85 | int count = 0; |
79 | int ammount = 0; | 86 | int ammount = 0; |
80 | 87 | ||
81 | // get overdue todos first | 88 | // get overdue todos first |
82 | m_list = todo->overDue(); | 89 | m_list = todo->sorted( true, 3, 2, 1); |
83 | 90 | ||
84 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 91 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
85 | if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) { | 92 | if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) { |
86 | QString desc = (*m_it).summary(); | 93 | QString desc = (*m_it).summary(); |
87 | if( desc.isEmpty() ) { | 94 | if( desc.isEmpty() ) { |
88 | desc = (*m_it).description(); | 95 | desc = (*m_it).description(); |
89 | } | 96 | } |
90 | tmpout += "<font color=#e00000><b>-" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; | 97 | tmpout += "<font color=#e00000><b>[" + QString("%1").arg((*m_it).priority() ) + "]" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; |
91 | ammount++ ; | 98 | ammount++ ; |
92 | } | 99 | } |
93 | } | 100 | } |
94 | 101 | ||
95 | // get total number of still open todos | 102 | // get total number of still open todos |
96 | m_list = todo->sorted( true, 1, 4, 1); | 103 | m_list = todo->sorted( true, 1, 4, 1); |
97 | 104 | ||
98 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 105 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
99 | count +=1; | 106 | count +=1; |
100 | // not the overdues, we allready got them, and not if we are | 107 | // not the overdues, we allready got them, and not if we are |
101 | // over the maxlines | 108 | // over the maxlines |
102 | if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) { | 109 | if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) { |
103 | QString desc = (*m_it).summary(); | 110 | QString desc = (*m_it).summary(); |
104 | if( desc.isEmpty() ) { | 111 | if( desc.isEmpty() ) { |
105 | desc = (*m_it).description(); | 112 | desc = (*m_it).description(); |
106 | } | 113 | } |
107 | tmpout += "<b>-</b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; | 114 | tmpout += "<b> [" + QString("%1").arg((*m_it).priority() ) + "] </b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; |
108 | ammount++; | 115 | ammount++; |
109 | } | 116 | } |
110 | } | 117 | } |
111 | 118 | ||
112 | if ( count > 0 ) { | 119 | if ( count > 0 ) { |
113 | if( count == 1 ) { | 120 | if( count == 1 ) { |
114 | output += QObject::tr( "There is <b> 1</b> active task: <br>" ); | 121 | output += QObject::tr( "There is <b> 1</b> active task: <br>" ); |
115 | } else { | 122 | } else { |
116 | output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg( count ); | 123 | output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg( count ); |
117 | } | 124 | } |
118 | output += tmpout; | 125 | output += tmpout; |
119 | } else { | 126 | } else { |
120 | output = QObject::tr( "No active tasks" ); | 127 | output = QObject::tr( "No active tasks" ); |
121 | } | 128 | } |
122 | todoLabel->setText( output ); | 129 | todoLabel->setText( output ); |
123 | } | 130 | } |
124 | 131 | ||
125 | /** | 132 | /** |
126 | * start the todolist | 133 | * start the todolist |
127 | */ | 134 | */ |
128 | void TodolistPluginWidget::startTodolist() { | 135 | void TodolistPluginWidget::startTodolist() { |
129 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 136 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
130 | e << QString( "todolist" ); | 137 | e << QString( "todolist" ); |
131 | } | 138 | } |
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h index 0db65c4..9cac43d 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.h +++ b/core/pim/today/plugins/todolist/todopluginwidget.h | |||
@@ -11,43 +11,44 @@ | |||
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 <qlayout.h> | 20 | #include <qlayout.h> |
21 | 21 | ||
22 | #include <opie/otodoaccess.h> | 22 | #include <opie/otodoaccess.h> |
23 | #include <opie/oclickablelabel.h> | 23 | #include <opie/oclickablelabel.h> |
24 | 24 | ||
25 | 25 | ||
26 | class TodolistPluginWidget : public QWidget { | 26 | class TodolistPluginWidget : public QWidget { |
27 | 27 | ||
28 | Q_OBJECT | 28 | Q_OBJECT |
29 | 29 | ||
30 | public: | 30 | public: |
31 | TodolistPluginWidget( QWidget *parent, const char *name ); | 31 | TodolistPluginWidget( QWidget *parent, const char *name ); |
32 | ~TodolistPluginWidget(); | 32 | ~TodolistPluginWidget(); |
33 | 33 | ||
34 | void refresh(); | 34 | void refresh(); |
35 | void reinitialize(); | ||
35 | 36 | ||
36 | protected slots: | 37 | protected slots: |
37 | void startTodolist(); | 38 | void startTodolist(); |
38 | 39 | ||
39 | private: | 40 | private: |
40 | OClickableLabel *todoLabel; | 41 | OClickableLabel *todoLabel; |
41 | QVBoxLayout* layoutTodo; | 42 | QVBoxLayout* layoutTodo; |
42 | 43 | ||
43 | OTodoAccess *todo; | 44 | OTodoAccess *todo; |
44 | OTodoAccess::List m_list; | 45 | OTodoAccess::List m_list; |
45 | OTodoAccess::List::Iterator m_it; | 46 | OTodoAccess::List::Iterator m_it; |
46 | 47 | ||
47 | void readConfig(); | 48 | void readConfig(); |
48 | void getTodo(); | 49 | void getTodo(); |
49 | int m_maxLinesTask; | 50 | int m_maxLinesTask; |
50 | int m_maxCharClip; | 51 | int m_maxCharClip; |
51 | }; | 52 | }; |
52 | 53 | ||
53 | #endif | 54 | #endif |