4 files changed, 26 insertions, 28 deletions
diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp index f5f6ed6..7ab27a0 100644 --- a/core/pim/today/plugins/todolist/todoplugin.cpp +++ b/core/pim/today/plugins/todolist/todoplugin.cpp | |||
@@ -1,71 +1,65 @@ | |||
1 | /* | 1 | /* |
2 | * todoplugin.cpp | 2 | * todoplugin.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | 18 | ||
19 | #include "todoplugin.h" | 19 | #include "todoplugin.h" |
20 | #include "todopluginconfig.h" | 20 | #include "todopluginconfig.h" |
21 | #include "todopluginwidget.h" | 21 | #include "todopluginwidget.h" |
22 | 22 | ||
23 | 23 | ||
24 | TodolistPlugin::TodolistPlugin() { | 24 | TodolistPlugin::TodolistPlugin() { |
25 | } | 25 | } |
26 | 26 | ||
27 | TodolistPlugin::~TodolistPlugin() { | 27 | TodolistPlugin::~TodolistPlugin() { |
28 | } | 28 | } |
29 | 29 | ||
30 | QString TodolistPlugin::pluginName() const { | 30 | QString TodolistPlugin::pluginName() const { |
31 | return "Todolist plugin"; | 31 | return "Todolist plugin"; |
32 | } | 32 | } |
33 | 33 | ||
34 | double TodolistPlugin::versionNumber() const { | 34 | double TodolistPlugin::versionNumber() const { |
35 | return 0.1; | 35 | return 0.7; |
36 | } | 36 | } |
37 | 37 | ||
38 | QString TodolistPlugin::pixmapNameWidget() const { | 38 | QString TodolistPlugin::pixmapNameWidget() const { |
39 | return "TodoList"; | 39 | return "TodoList"; |
40 | } | 40 | } |
41 | 41 | ||
42 | QWidget* TodolistPlugin::widget( QWidget *wid ) { | 42 | QWidget* TodolistPlugin::widget( QWidget *wid ) { |
43 | return new TodolistPluginWidget( wid, "Todolist" ); | 43 | return new TodolistPluginWidget( wid, "Todolist" ); |
44 | } | 44 | } |
45 | 45 | ||
46 | QString TodolistPlugin::pixmapNameConfig() const { | 46 | QString TodolistPlugin::pixmapNameConfig() const { |
47 | return "TodoList"; | 47 | return "TodoList"; |
48 | } | 48 | } |
49 | 49 | ||
50 | ConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { | 50 | ConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { |
51 | return new TodolistPluginConfig( wid , "Todolist" ); | 51 | return new TodolistPluginConfig( wid , "Todolist" ); |
52 | } | 52 | } |
53 | 53 | ||
54 | QString TodolistPlugin::appName() const { | 54 | QString TodolistPlugin::appName() const { |
55 | return "Todolist"; | 55 | return QObject::tr( "Todolist" ); |
56 | } | 56 | } |
57 | 57 | ||
58 | int TodolistPlugin::minHeight() const { | 58 | int TodolistPlugin::minHeight() const { |
59 | return 10; | 59 | return 10; |
60 | } | 60 | } |
61 | 61 | ||
62 | int TodolistPlugin::maxHeight() const { | 62 | int TodolistPlugin::maxHeight() const { |
63 | return 100; | 63 | return 100; |
64 | } | 64 | } |
65 | 65 | ||
66 | |||
67 | |||
68 | |||
69 | int main() { | ||
70 | } | ||
71 | |||
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.cpp b/core/pim/today/plugins/todolist/todopluginconfig.cpp index da81600..2d8f1b6 100644 --- a/core/pim/today/plugins/todolist/todopluginconfig.cpp +++ b/core/pim/today/plugins/todolist/todopluginconfig.cpp | |||
@@ -1,69 +1,70 @@ | |||
1 | /* | 1 | /* |
2 | * todopluginconfig.cpp | 2 | * todopluginconfig.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "todopluginconfig.h" | 17 | #include "todopluginconfig.h" |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | 20 | ||
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qtoolbutton.h> | 22 | #include <qtoolbutton.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | 24 | ||
25 | 25 | ||
26 | TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name) | 26 | TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name) |
27 | : ConfigWidget(parent, name ) { | 27 | : ConfigWidget(parent, name ) { |
28 | 28 | ||
29 | QVBoxLayout * layout = new QVBoxLayout( this ); | 29 | QVBoxLayout * layout = new QVBoxLayout( this ); |
30 | 30 | ||
31 | QFrame* Frame9 = new QFrame( this, "Frame9" ); | 31 | QFrame* Frame9 = new QFrame( this, "Frame9" ); |
32 | Frame9->setGeometry( QRect( -5, 0, 230, 310 ) ); | 32 | Frame9->setGeometry( QRect( -5, 0, 230, 310 ) ); |
33 | Frame9->setFrameShape( QFrame::StyledPanel ); | 33 | Frame9->setFrameShape( QFrame::StyledPanel ); |
34 | Frame9->setFrameShadow( QFrame::Raised ); | 34 | Frame9->setFrameShadow( QFrame::Raised ); |
35 | 35 | ||
36 | QLabel* TextLabel6 = new QLabel( Frame9, "TextLabel6" ); | 36 | QLabel* TextLabel6 = new QLabel( Frame9, "TextLabel6" ); |
37 | TextLabel6->setGeometry( QRect( 20, 10, 100, 60 ) ); | 37 | TextLabel6->setGeometry( QRect( 20, 10, 100, 60 ) ); |
38 | TextLabel6->setText( tr( "How many\n" | 38 | TextLabel6->setText( tr( "How many\n" |
39 | "tasks should \n" | 39 | "tasks should \n" |
40 | "be shown?" ) ); | 40 | "be shown?" ) ); |
41 | 41 | ||
42 | SpinBox2 = new QSpinBox( Frame9, "SpinBox2" ); | 42 | SpinBox2 = new QSpinBox( Frame9, "SpinBox2" ); |
43 | SpinBox2->setGeometry( QRect( 115, 20, 58, 25 ) ); | 43 | SpinBox2->setGeometry( QRect( 115, 20, 58, 25 ) ); |
44 | SpinBox2->setMaxValue( 20 ); | 44 | SpinBox2->setMaxValue( 20 ); |
45 | SpinBox2->setValue( 5 ); | 45 | SpinBox2->setValue( 5 ); |
46 | 46 | ||
47 | layout->addWidget( Frame9 ); | 47 | layout->addWidget( Frame9 ); |
48 | 48 | ||
49 | readConfig(); | 49 | readConfig(); |
50 | } | 50 | } |
51 | 51 | ||
52 | void TodolistPluginConfig::readConfig() { | 52 | void TodolistPluginConfig::readConfig() { |
53 | Config cfg( "todaydatebookplugin" ); | 53 | Config cfg( "todaytodoplugin" ); |
54 | cfg.setGroup( "config" ); | 54 | cfg.setGroup( "config" ); |
55 | m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); | 55 | m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); |
56 | SpinBox2->setValue( m_max_lines_task ); | 56 | SpinBox2->setValue( m_max_lines_task ); |
57 | } | 57 | } |
58 | 58 | ||
59 | 59 | ||
60 | void TodolistPluginConfig::writeConfig() { | 60 | void TodolistPluginConfig::writeConfig() { |
61 | Config cfg( "todaydatebookplugin" ); | 61 | Config cfg( "todaytodoplugin" ); |
62 | cfg.setGroup( "config" ); | 62 | cfg.setGroup( "config" ); |
63 | m_max_lines_task = SpinBox2->value(); | ||
63 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); | 64 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); |
64 | cfg.write(); | 65 | cfg.write(); |
65 | } | 66 | } |
66 | 67 | ||
67 | 68 | ||
68 | TodolistPluginConfig::~TodolistPluginConfig() { | 69 | TodolistPluginConfig::~TodolistPluginConfig() { |
69 | } | 70 | } |
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp index 2a0e5a3..4731b43 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.cpp +++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp | |||
@@ -1,132 +1,134 @@ | |||
1 | /* | 1 | /* |
2 | * todopluginwidget.cpp | 2 | * todopluginwidget.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "todopluginwidget.h" | 17 | #include "todopluginwidget.h" |
18 | 18 | ||
19 | #include <qvaluelist.h> | 19 | #include <qvaluelist.h> |
20 | #include <qtl.h> | 20 | #include <qtl.h> |
21 | #include <qstring.h> | 21 | #include <qstring.h> |
22 | #include <qscrollview.h> | 22 | #include <qscrollview.h> |
23 | #include <qobject.h> | 23 | #include <qobject.h> |
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | 25 | ||
26 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <qpe/timestring.h> | 27 | #include <qpe/timestring.h> |
28 | #include <qpe/qcopenvelope_qws.h> | 28 | #include <qpe/qcopenvelope_qws.h> |
29 | 29 | ||
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; | 33 | todoLabel= 0l; |
34 | |||
35 | todo = 0l; | 34 | todo = 0l; |
35 | |||
36 | if ( todo ) { | 36 | if ( todo ) { |
37 | delete todo; | 37 | delete todo; |
38 | } | 38 | } |
39 | todo = new ToDoDB(); | 39 | todo = new ToDoDB(); |
40 | 40 | ||
41 | readConfig(); | 41 | readConfig(); |
42 | m_maxCharClip = 36; | 42 | m_maxCharClip = 36; |
43 | getTodo(); | 43 | getTodo(); |
44 | } | 44 | } |
45 | 45 | ||
46 | TodolistPluginWidget::~TodolistPluginWidget() { | 46 | TodolistPluginWidget::~TodolistPluginWidget() { |
47 | delete todo; | 47 | delete todo; |
48 | } | 48 | } |
49 | 49 | ||
50 | |||
50 | void TodolistPluginWidget::readConfig() { | 51 | void TodolistPluginWidget::readConfig() { |
51 | Config cfg( "todaytodolistplugin" ); | 52 | Config cfg( "todaytodoplugin" ); |
52 | cfg.setGroup( "config" ); | 53 | cfg.setGroup( "config" ); |
53 | m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); | 54 | m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); |
54 | } | 55 | } |
55 | 56 | ||
56 | 57 | ||
57 | /** | 58 | /** |
58 | * Get the todos | 59 | * Get the todos |
59 | */ | 60 | */ |
60 | void TodolistPluginWidget::getTodo() { | 61 | void TodolistPluginWidget::getTodo() { |
61 | 62 | ||
62 | QVBoxLayout* layoutTodo = new QVBoxLayout( this ); | 63 | QVBoxLayout* layoutTodo = new QVBoxLayout( this ); |
63 | 64 | ||
64 | if ( todoLabel ) { | 65 | if ( todoLabel ) { |
65 | delete todoLabel; | 66 | delete todoLabel; |
66 | } | 67 | } |
67 | 68 | ||
68 | todoLabel = new OClickableLabel( this ); | 69 | todoLabel = new OClickableLabel( this ); |
69 | todoLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); | 70 | todoLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); |
70 | connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); | 71 | connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); |
72 | |||
71 | QString output; | 73 | QString output; |
72 | QString tmpout; | 74 | QString tmpout; |
73 | int count = 0; | 75 | int count = 0; |
74 | int ammount = 0; | 76 | int ammount = 0; |
75 | 77 | ||
76 | // get overdue todos first | 78 | // get overdue todos first |
77 | QValueList<ToDoEvent> overDueList = todo->overDue(); | 79 | QValueList<ToDoEvent> overDueList = todo->overDue(); |
78 | qBubbleSort(overDueList); | 80 | qBubbleSort( overDueList ); |
79 | for ( QValueList<ToDoEvent>::Iterator it = overDueList.begin(); | 81 | for ( QValueList<ToDoEvent>::Iterator it = overDueList.begin(); |
80 | it!=overDueList.end(); ++it ) { | 82 | it != overDueList.end(); ++it ) { |
81 | if (!(*it).isCompleted() && ( ammount < m_maxLinesTask ) ) { | 83 | if (!(*it).isCompleted() && ( ammount < m_maxLinesTask ) ) { |
82 | QString desc = (*it).summary(); | 84 | QString desc = (*it).summary(); |
83 | if( desc.isEmpty() ) { | 85 | if( desc.isEmpty() ) { |
84 | desc = (*it).description(); | 86 | desc = (*it).description(); |
85 | } | 87 | } |
86 | tmpout += "<font color=#e00000><b>-" + desc.mid(0, m_maxCharClip) + "</b></font><br>"; | 88 | tmpout += "<font color=#e00000><b>-" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; |
87 | ammount++; | 89 | ammount++; |
88 | } | 90 | } |
89 | } | 91 | } |
90 | 92 | ||
91 | // get total number of still open todos | 93 | // get total number of still open todos |
92 | QValueList<ToDoEvent> openTodo = todo->rawToDos(); | 94 | QValueList<ToDoEvent> openTodo = todo->rawToDos(); |
93 | qBubbleSort( openTodo ); | 95 | qBubbleSort( openTodo ); |
94 | for ( QValueList<ToDoEvent>::Iterator it=openTodo.begin(); | 96 | for ( QValueList<ToDoEvent>::Iterator it = openTodo.begin(); |
95 | it!=openTodo.end(); ++it ) { | 97 | it != openTodo.end(); ++it ) { |
96 | if ( !(*it).isCompleted() ){ | 98 | if ( !(*it).isCompleted() ){ |
97 | count +=1; | 99 | count +=1; |
98 | // not the overdues, we allready got them, and not if we are | 100 | // not the overdues, we allready got them, and not if we are |
99 | // over the maxlines | 101 | // over the maxlines |
100 | if ( !(*it).isOverdue() && ( ammount < m_maxLinesTask ) ) { | 102 | if ( !(*it).isOverdue() && ( ammount < m_maxLinesTask ) ) { |
101 | QString desc = (*it).summary(); | 103 | QString desc = (*it).summary(); |
102 | if( desc.isEmpty() ) { | 104 | if( desc.isEmpty() ) { |
103 | desc = (*it).description(); | 105 | desc = (*it).description(); |
104 | } | 106 | } |
105 | tmpout += "<b>-</b>" + desc.mid(0, m_maxCharClip) + "<br>"; | 107 | tmpout += "<b>-</b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; |
106 | ammount++; | 108 | ammount++; |
107 | } | 109 | } |
108 | } | 110 | } |
109 | } | 111 | } |
110 | 112 | ||
111 | 113 | ||
112 | if ( count > 0 ) { | 114 | if ( count > 0 ) { |
113 | if( count == 1 ) { | 115 | if( count == 1 ) { |
114 | output += QObject::tr( "There is <b> 1</b> active task: <br>" ); | 116 | output += QObject::tr( "There is <b> 1</b> active task: <br>" ); |
115 | } else { | 117 | } else { |
116 | output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg(count); | 118 | output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg( count ); |
117 | } | 119 | } |
118 | output += tmpout; | 120 | output += tmpout; |
119 | } else { | 121 | } else { |
120 | output = QObject::tr( "No active tasks" ); | 122 | output = QObject::tr( "No active tasks" ); |
121 | } | 123 | } |
122 | todoLabel->setText( output ); | 124 | todoLabel->setText( output ); |
123 | layoutTodo->addWidget( todoLabel ); | 125 | layoutTodo->addWidget( todoLabel ); |
124 | } | 126 | } |
125 | 127 | ||
126 | /** | 128 | /** |
127 | * start the todolist | 129 | * start the todolist |
128 | */ | 130 | */ |
129 | void TodolistPluginWidget::startTodolist() { | 131 | void TodolistPluginWidget::startTodolist() { |
130 | QCopEnvelope e("QPE/System", "execute(QString)"); | 132 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
131 | e << QString("todolist"); | 133 | e << QString( "todolist" ); |
132 | } | 134 | } |
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h index ccc312a..970f430 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.h +++ b/core/pim/today/plugins/todolist/todopluginwidget.h | |||
@@ -1,47 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | * todopluginwidget.h | 2 | * todopluginwidget.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #ifndef TODOLIST_PLUGIN_WIDGET_H | 17 | #ifndef TODOLIST_PLUGIN_WIDGET_H |
18 | #define TODOLIST_PLUGIN_WIDGET_H | 18 | #define TODOLIST_PLUGIN_WIDGET_H |
19 | 19 | ||
20 | #include <qstring.h> | 20 | #include <qstring.h> |
21 | #include <qwidget.h> | 21 | #include <qwidget.h> |
22 | 22 | ||
23 | #include <opie/tododb.h> | 23 | #include <opie/tododb.h> |
24 | #include <opie/oclickablelabel.h> | 24 | #include <opie/oclickablelabel.h> |
25 | 25 | ||
26 | 26 | ||
27 | class TodolistPluginWidget : public QWidget { | 27 | class TodolistPluginWidget : public QWidget { |
28 | 28 | ||
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | 30 | ||
31 | public: | 31 | public: |
32 | TodolistPluginWidget( QWidget *parent, const char *name ); | 32 | TodolistPluginWidget( QWidget *parent, const char *name ); |
33 | ~TodolistPluginWidget(); | 33 | ~TodolistPluginWidget(); |
34 | 34 | ||
35 | protected slots: | 35 | protected slots: |
36 | void startTodolist(); | 36 | void startTodolist(); |
37 | 37 | ||
38 | private: | 38 | private: |
39 | OClickableLabel *todoLabel; | 39 | OClickableLabel *todoLabel; |
40 | ToDoDB *todo; | 40 | ToDoDB *todo; |
41 | |||
41 | void readConfig(); | 42 | void readConfig(); |
42 | void getTodo(); | 43 | void getTodo(); |
43 | int m_maxLinesTask; | 44 | int m_maxLinesTask; |
44 | int m_maxCharClip; | 45 | int m_maxCharClip; |
45 | }; | 46 | }; |
46 | 47 | ||
47 | #endif | 48 | #endif |