summaryrefslogtreecommitdiff
path: root/core/pim/today/plugins/todolist
Unidiff
Diffstat (limited to 'core/pim/today/plugins/todolist') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/plugins/todolist/moc_todoplugin.cpp0
-rw-r--r--core/pim/today/plugins/todolist/moc_todoplugin.obin0 -> 2268 bytes
-rw-r--r--core/pim/today/plugins/todolist/opie-today-todolistplugin.control8
-rw-r--r--core/pim/today/plugins/todolist/todolist.pro20
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.cpp71
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.h47
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.cpp69
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.h55
-rw-r--r--core/pim/today/plugins/todolist/todopluginimpl.cpp43
-rw-r--r--core/pim/today/plugins/todolist/todopluginimpl.h40
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.cpp132
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.h47
12 files changed, 532 insertions, 0 deletions
diff --git a/core/pim/today/plugins/todolist/moc_todoplugin.cpp b/core/pim/today/plugins/todolist/moc_todoplugin.cpp
new file mode 100644
index 0000000..e69de29
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/moc_todoplugin.cpp
diff --git a/core/pim/today/plugins/todolist/moc_todoplugin.o b/core/pim/today/plugins/todolist/moc_todoplugin.o
new file mode 100644
index 0000000..1e6a22f
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/moc_todoplugin.o
Binary files differ
diff --git a/core/pim/today/plugins/todolist/opie-today-todolistplugin.control b/core/pim/today/plugins/todolist/opie-today-todolistplugin.control
new file mode 100644
index 0000000..91a7202
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/opie-today-todolistplugin.control
@@ -0,0 +1,8 @@
1Files: $OPIEDIR/lib/today/libtodaytodolistplugin.so*
2Priority: optional
3Section: opie/applications
4Maintainer: Maximilian Reiss <harlekin@handhelds.org>
5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION
7Depends: qt-embedded (>=$QTE_VERSION)
8Description: Todolist plugin for today
diff --git a/core/pim/today/plugins/todolist/todolist.pro b/core/pim/today/plugins/todolist/todolist.pro
new file mode 100644
index 0000000..1f9c61c
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todolist.pro
@@ -0,0 +1,20 @@
1TEMPLATE = lib
2#TEMPLATE = app
3CONFIG -= moc
4CONFIG += qt debug
5
6# Input
7HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \
8 todopluginwidget.h
9SOURCES = todoplugin.cpp todopluginimpl.cpp todopluginconfig.cpp \
10 todopluginwidget.cpp
11
12INCLUDEPATH += $(OPIEDIR)/include \
13 ../ ../library
14DEPENDPATH += $(OPIEDIR)/include \
15 ../ ../library
16
17LIBS+= -lqpe -lopie
18
19DESTDIR = $(OPIEDIR)/plugins/today
20TARGET = todaytodolistplugin \ No newline at end of file
diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp
new file mode 100644
index 0000000..f5f6ed6
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todoplugin.cpp
@@ -0,0 +1,71 @@
1/*
2 * todoplugin.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17
18
19#include "todoplugin.h"
20#include "todopluginconfig.h"
21#include "todopluginwidget.h"
22
23
24TodolistPlugin::TodolistPlugin() {
25}
26
27TodolistPlugin::~TodolistPlugin() {
28}
29
30QString TodolistPlugin::pluginName() const {
31 return "Todolist plugin";
32}
33
34double TodolistPlugin::versionNumber() const {
35 return 0.1;
36}
37
38QString TodolistPlugin::pixmapNameWidget() const {
39 return "TodoList";
40}
41
42QWidget* TodolistPlugin::widget( QWidget *wid ) {
43 return new TodolistPluginWidget( wid, "Todolist" );
44}
45
46QString TodolistPlugin::pixmapNameConfig() const {
47 return "TodoList";
48}
49
50ConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) {
51 return new TodolistPluginConfig( wid , "Todolist" );
52}
53
54QString TodolistPlugin::appName() const {
55 return "Todolist";
56}
57
58int TodolistPlugin::minHeight() const {
59 return 10;
60}
61
62int TodolistPlugin::maxHeight() const {
63 return 100;
64}
65
66
67
68
69 int main() {
70}
71
diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h
new file mode 100644
index 0000000..77889d6
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todoplugin.h
@@ -0,0 +1,47 @@
1/*
2 * todoplugin.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef TODOLIST_PLUGIN_H
18#define TODOLIST_PLUGIN_H
19
20#include <qstring.h>
21#include <qwidget.h>
22
23#include <opie/tododb.h>
24#include <opie/oclickablelabel.h>
25
26#include "../../todayplugininterface.h"
27#include "../../configwidget.h"
28
29class TodolistPlugin : public TodayPluginObject {
30
31
32public:
33 TodolistPlugin();
34 ~TodolistPlugin();
35
36 QString pluginName() const;
37 double versionNumber() const;
38 QString pixmapNameWidget() const;
39 QWidget* widget(QWidget *);
40 QString pixmapNameConfig() const;
41 ConfigWidget* configWidget(QWidget *);
42 QString appName() const;
43 virtual int minHeight() const;
44 virtual int maxHeight() const;
45};
46
47#endif
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.cpp b/core/pim/today/plugins/todolist/todopluginconfig.cpp
new file mode 100644
index 0000000..da81600
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginconfig.cpp
@@ -0,0 +1,69 @@
1/*
2 * todopluginconfig.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#include "todopluginconfig.h"
18
19#include <qpe/config.h>
20
21#include <qlayout.h>
22#include <qtoolbutton.h>
23#include <qlabel.h>
24
25
26TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name)
27 : ConfigWidget(parent, name ) {
28
29 QVBoxLayout * layout = new QVBoxLayout( this );
30
31 QFrame* Frame9 = new QFrame( this, "Frame9" );
32 Frame9->setGeometry( QRect( -5, 0, 230, 310 ) );
33 Frame9->setFrameShape( QFrame::StyledPanel );
34 Frame9->setFrameShadow( QFrame::Raised );
35
36 QLabel* TextLabel6 = new QLabel( Frame9, "TextLabel6" );
37 TextLabel6->setGeometry( QRect( 20, 10, 100, 60 ) );
38 TextLabel6->setText( tr( "How many\n"
39 "tasks should \n"
40 "be shown?" ) );
41
42 SpinBox2 = new QSpinBox( Frame9, "SpinBox2" );
43 SpinBox2->setGeometry( QRect( 115, 20, 58, 25 ) );
44 SpinBox2->setMaxValue( 20 );
45 SpinBox2->setValue( 5 );
46
47 layout->addWidget( Frame9 );
48
49 readConfig();
50}
51
52void TodolistPluginConfig::readConfig() {
53 Config cfg( "todaydatebookplugin" );
54 cfg.setGroup( "config" );
55 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 );
56 SpinBox2->setValue( m_max_lines_task );
57}
58
59
60void TodolistPluginConfig::writeConfig() {
61 Config cfg( "todaydatebookplugin" );
62 cfg.setGroup( "config" );
63 cfg.writeEntry( "maxlinestask", m_max_lines_task );
64 cfg.write();
65}
66
67
68TodolistPluginConfig::~TodolistPluginConfig() {
69}
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.h b/core/pim/today/plugins/todolist/todopluginconfig.h
new file mode 100644
index 0000000..a46cc7c
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginconfig.h
@@ -0,0 +1,55 @@
1/*
2 * todopluginconfig.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef TODOLIST_PLUGIN_CONFIG_H
18#define TODOLIST_PLUGIN_CONFIG_H
19
20#include <qwidget.h>
21#include <qspinbox.h>
22
23#include "../../configwidget.h"
24
25class TodolistPluginConfig : public ConfigWidget {
26
27 Q_OBJECT
28
29public:
30
31 TodolistPluginConfig( QWidget *parent, const char *name );
32 ~TodolistPluginConfig();
33
34private:
35 /**
36 * if changed then save
37 */
38 bool changed();
39 void readConfig();
40 void writeConfig();
41
42 QSpinBox* SpinBox2;
43
44 // how many lines should be showed in the todolist section
45 int m_max_lines_task;
46
47
48
49};
50
51
52
53
54
55#endif
diff --git a/core/pim/today/plugins/todolist/todopluginimpl.cpp b/core/pim/today/plugins/todolist/todopluginimpl.cpp
new file mode 100644
index 0000000..b1849ff
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginimpl.cpp
@@ -0,0 +1,43 @@
1/*
2 * todopluginimpl.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#include "todoplugin.h"
18#include "todopluginimpl.h"
19
20TodolistPluginImpl::TodolistPluginImpl() {
21 todolistPlugin = new TodolistPlugin();
22}
23
24TodolistPluginImpl::~TodolistPluginImpl() {
25}
26
27
28TodayPluginObject* TodolistPluginImpl::guiPart() {
29 return todolistPlugin;
30}
31
32QRESULT TodolistPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) {
33 *iface = 0;
34 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) {
35 *iface = this, (*iface)->addRef();
36 }
37 return QS_OK;
38
39}
40
41Q_EXPORT_INTERFACE() {
42 Q_CREATE_INSTANCE( TodolistPluginImpl );
43}
diff --git a/core/pim/today/plugins/todolist/todopluginimpl.h b/core/pim/today/plugins/todolist/todopluginimpl.h
new file mode 100644
index 0000000..29e0294
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginimpl.h
@@ -0,0 +1,40 @@
1/*
2 * todopluginimpl.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef TODOLIST_PLUGIN_IMPL_H
18#define TODOLIST_PLUGIN_IMPL_H
19
20#include "../../todayplugininterface.h"
21
22class TodolistPlugin;
23
24class TodolistPluginImpl : public TodayPluginInterface{
25
26public:
27 TodolistPluginImpl();
28 virtual ~TodolistPluginImpl();
29
30 QRESULT queryInterface( const QUuid &, QUnknownInterface** );
31 Q_REFCOUNT
32
33 virtual TodayPluginObject *guiPart();
34
35private:
36 TodolistPlugin *todolistPlugin;
37 ulong ref;
38};
39
40#endif
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp
new file mode 100644
index 0000000..2a0e5a3
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp
@@ -0,0 +1,132 @@
1/*
2 * todopluginwidget.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#include "todopluginwidget.h"
18
19#include <qvaluelist.h>
20#include <qtl.h>
21#include <qstring.h>
22#include <qscrollview.h>
23#include <qobject.h>
24#include <qlayout.h>
25
26#include <qpe/config.h>
27#include <qpe/timestring.h>
28#include <qpe/qcopenvelope_qws.h>
29
30TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name)
31 : QWidget(parent, name ) {
32
33 todoLabel= 0l;
34
35 todo = 0l;
36 if ( todo ) {
37 delete todo;
38 }
39 todo = new ToDoDB();
40
41 readConfig();
42 m_maxCharClip = 36;
43 getTodo();
44}
45
46TodolistPluginWidget::~TodolistPluginWidget() {
47 delete todo;
48}
49
50void TodolistPluginWidget::readConfig() {
51 Config cfg( "todaytodolistplugin" );
52 cfg.setGroup( "config" );
53 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
54}
55
56
57/**
58 * Get the todos
59 */
60void TodolistPluginWidget::getTodo() {
61
62 QVBoxLayout* layoutTodo = new QVBoxLayout( this );
63
64 if ( todoLabel ) {
65 delete todoLabel;
66 }
67
68 todoLabel = new OClickableLabel( this );
69 todoLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
70 connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
71 QString output;
72 QString tmpout;
73 int count = 0;
74 int ammount = 0;
75
76 // get overdue todos first
77 QValueList<ToDoEvent> overDueList = todo->overDue();
78 qBubbleSort(overDueList);
79 for ( QValueList<ToDoEvent>::Iterator it = overDueList.begin();
80 it!=overDueList.end(); ++it ) {
81 if (!(*it).isCompleted() && ( ammount < m_maxLinesTask ) ) {
82 QString desc = (*it).summary();
83 if( desc.isEmpty() ) {
84 desc = (*it).description();
85 }
86 tmpout += "<font color=#e00000><b>-" + desc.mid(0, m_maxCharClip) + "</b></font><br>";
87 ammount++;
88 }
89 }
90
91 // get total number of still open todos
92 QValueList<ToDoEvent> openTodo = todo->rawToDos();
93 qBubbleSort( openTodo );
94 for ( QValueList<ToDoEvent>::Iterator it=openTodo.begin();
95 it!=openTodo.end(); ++it ) {
96 if ( !(*it).isCompleted() ){
97 count +=1;
98 // not the overdues, we allready got them, and not if we are
99 // over the maxlines
100 if ( !(*it).isOverdue() && ( ammount < m_maxLinesTask ) ) {
101 QString desc = (*it).summary();
102 if( desc.isEmpty() ) {
103 desc = (*it).description();
104 }
105 tmpout += "<b>-</b>" + desc.mid(0, m_maxCharClip) + "<br>";
106 ammount++;
107 }
108 }
109 }
110
111
112 if ( count > 0 ) {
113 if( count == 1 ) {
114 output += QObject::tr( "There is <b> 1</b> active task: <br>" );
115 } else {
116 output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg(count);
117 }
118 output += tmpout;
119 } else {
120 output = QObject::tr( "No active tasks" );
121 }
122 todoLabel->setText( output );
123 layoutTodo->addWidget( todoLabel );
124}
125
126/**
127 * start the todolist
128 */
129void TodolistPluginWidget::startTodolist() {
130 QCopEnvelope e("QPE/System", "execute(QString)");
131 e << QString("todolist");
132}
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h
new file mode 100644
index 0000000..ccc312a
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginwidget.h
@@ -0,0 +1,47 @@
1/*
2 * todopluginwidget.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef TODOLIST_PLUGIN_WIDGET_H
18#define TODOLIST_PLUGIN_WIDGET_H
19
20#include <qstring.h>
21#include <qwidget.h>
22
23#include <opie/tododb.h>
24#include <opie/oclickablelabel.h>
25
26
27class TodolistPluginWidget : public QWidget {
28
29 Q_OBJECT
30
31public:
32 TodolistPluginWidget( QWidget *parent, const char *name );
33 ~TodolistPluginWidget();
34
35protected slots:
36 void startTodolist();
37
38private:
39 OClickableLabel *todoLabel;
40 ToDoDB *todo;
41 void readConfig();
42 void getTodo();
43 int m_maxLinesTask;
44 int m_maxCharClip;
45};
46
47#endif