Diffstat (limited to 'core/pim/today/plugins/todolist') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/today/plugins/todolist/.cvsignore | 1 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/config.in | 2 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todolist.pro | 19 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.cpp | 8 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.h | 1 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginwidget.cpp | 15 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginwidget.h | 1 |
7 files changed, 41 insertions, 6 deletions
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 |