Diffstat (limited to 'core/pim/today/plugins/todolist') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/today/plugins/todolist/moc_todoplugin.cpp | 0 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/moc_todoplugin.o | bin | 0 -> 2268 bytes | |||
-rw-r--r-- | core/pim/today/plugins/todolist/opie-today-todolistplugin.control | 8 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todolist.pro | 20 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.cpp | 71 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.h | 47 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginconfig.cpp | 69 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginconfig.h | 55 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginimpl.cpp | 43 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginimpl.h | 40 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginwidget.cpp | 132 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginwidget.h | 47 |
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 Binary files differnew file mode 100644 index 0000000..1e6a22f --- a/dev/null +++ b/core/pim/today/plugins/todolist/moc_todoplugin.o 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 @@ +Files: $OPIEDIR/lib/today/libtodaytodolistplugin.so* +Priority: optional +Section: opie/applications +Maintainer: Maximilian Reiss <harlekin@handhelds.org> +Architecture: arm +Version: $QPE_VERSION-$SUB_VERSION +Depends: qt-embedded (>=$QTE_VERSION) +Description: 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 @@ +TEMPLATE = lib +#TEMPLATE = app +CONFIG -= moc +CONFIG += qt debug + +# Input +HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \ + todopluginwidget.h +SOURCES = todoplugin.cpp todopluginimpl.cpp todopluginconfig.cpp \ + todopluginwidget.cpp + +INCLUDEPATH += $(OPIEDIR)/include \ + ../ ../library +DEPENDPATH += $(OPIEDIR)/include \ + ../ ../library + +LIBS+= -lqpe -lopie + +DESTDIR = $(OPIEDIR)/plugins/today +TARGET = 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 @@ +/* + * todoplugin.cpp + * + * copyright : (c) 2002 by Maximilian Reiß + * email : harlekin@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + + +#include "todoplugin.h" +#include "todopluginconfig.h" +#include "todopluginwidget.h" + + +TodolistPlugin::TodolistPlugin() { +} + +TodolistPlugin::~TodolistPlugin() { +} + +QString TodolistPlugin::pluginName() const { + return "Todolist plugin"; +} + +double TodolistPlugin::versionNumber() const { + return 0.1; +} + +QString TodolistPlugin::pixmapNameWidget() const { + return "TodoList"; +} + +QWidget* TodolistPlugin::widget( QWidget *wid ) { + return new TodolistPluginWidget( wid, "Todolist" ); +} + +QString TodolistPlugin::pixmapNameConfig() const { + return "TodoList"; +} + +ConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { + return new TodolistPluginConfig( wid , "Todolist" ); +} + +QString TodolistPlugin::appName() const { + return "Todolist"; +} + +int TodolistPlugin::minHeight() const { + return 10; +} + +int TodolistPlugin::maxHeight() const { + return 100; +} + + + + + int main() { +} + 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 @@ +/* + * todoplugin.h + * + * copyright : (c) 2002 by Maximilian Reiß + * email : harlekin@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TODOLIST_PLUGIN_H +#define TODOLIST_PLUGIN_H + +#include <qstring.h> +#include <qwidget.h> + +#include <opie/tododb.h> +#include <opie/oclickablelabel.h> + +#include "../../todayplugininterface.h" +#include "../../configwidget.h" + +class TodolistPlugin : public TodayPluginObject { + + +public: + TodolistPlugin(); + ~TodolistPlugin(); + + QString pluginName() const; + double versionNumber() const; + QString pixmapNameWidget() const; + QWidget* widget(QWidget *); + QString pixmapNameConfig() const; + ConfigWidget* configWidget(QWidget *); + QString appName() const; + virtual int minHeight() const; + virtual int maxHeight() const; +}; + +#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 @@ +/* + * todopluginconfig.cpp + * + * copyright : (c) 2002 by Maximilian Reiß + * email : harlekin@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "todopluginconfig.h" + +#include <qpe/config.h> + +#include <qlayout.h> +#include <qtoolbutton.h> +#include <qlabel.h> + + +TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name) + : ConfigWidget(parent, name ) { + + QVBoxLayout * layout = new QVBoxLayout( this ); + + QFrame* Frame9 = new QFrame( this, "Frame9" ); + Frame9->setGeometry( QRect( -5, 0, 230, 310 ) ); + Frame9->setFrameShape( QFrame::StyledPanel ); + Frame9->setFrameShadow( QFrame::Raised ); + + QLabel* TextLabel6 = new QLabel( Frame9, "TextLabel6" ); + TextLabel6->setGeometry( QRect( 20, 10, 100, 60 ) ); + TextLabel6->setText( tr( "How many\n" + "tasks should \n" + "be shown?" ) ); + + SpinBox2 = new QSpinBox( Frame9, "SpinBox2" ); + SpinBox2->setGeometry( QRect( 115, 20, 58, 25 ) ); + SpinBox2->setMaxValue( 20 ); + SpinBox2->setValue( 5 ); + + layout->addWidget( Frame9 ); + + readConfig(); +} + +void TodolistPluginConfig::readConfig() { + Config cfg( "todaydatebookplugin" ); + cfg.setGroup( "config" ); + m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); + SpinBox2->setValue( m_max_lines_task ); +} + + +void TodolistPluginConfig::writeConfig() { + Config cfg( "todaydatebookplugin" ); + cfg.setGroup( "config" ); + cfg.writeEntry( "maxlinestask", m_max_lines_task ); + cfg.write(); +} + + +TodolistPluginConfig::~TodolistPluginConfig() { +} 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 @@ +/* + * todopluginconfig.h + * + * copyright : (c) 2002 by Maximilian Reiß + * email : harlekin@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TODOLIST_PLUGIN_CONFIG_H +#define TODOLIST_PLUGIN_CONFIG_H + +#include <qwidget.h> +#include <qspinbox.h> + +#include "../../configwidget.h" + +class TodolistPluginConfig : public ConfigWidget { + + Q_OBJECT + +public: + + TodolistPluginConfig( QWidget *parent, const char *name ); + ~TodolistPluginConfig(); + +private: + /** + * if changed then save + */ + bool changed(); + void readConfig(); + void writeConfig(); + + QSpinBox* SpinBox2; + + // how many lines should be showed in the todolist section + int m_max_lines_task; + + + +}; + + + + + +#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 @@ +/* + * todopluginimpl.cpp + * + * copyright : (c) 2002 by Maximilian Reiß + * email : harlekin@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "todoplugin.h" +#include "todopluginimpl.h" + +TodolistPluginImpl::TodolistPluginImpl() { + todolistPlugin = new TodolistPlugin(); +} + +TodolistPluginImpl::~TodolistPluginImpl() { +} + + +TodayPluginObject* TodolistPluginImpl::guiPart() { + return todolistPlugin; +} + +QRESULT TodolistPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { + *iface = 0; + if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) { + *iface = this, (*iface)->addRef(); + } + return QS_OK; + +} + +Q_EXPORT_INTERFACE() { + Q_CREATE_INSTANCE( TodolistPluginImpl ); +} 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 @@ +/* + * todopluginimpl.h + * + * copyright : (c) 2002 by Maximilian Reiß + * email : harlekin@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TODOLIST_PLUGIN_IMPL_H +#define TODOLIST_PLUGIN_IMPL_H + +#include "../../todayplugininterface.h" + +class TodolistPlugin; + +class TodolistPluginImpl : public TodayPluginInterface{ + +public: + TodolistPluginImpl(); + virtual ~TodolistPluginImpl(); + + QRESULT queryInterface( const QUuid &, QUnknownInterface** ); + Q_REFCOUNT + + virtual TodayPluginObject *guiPart(); + +private: + TodolistPlugin *todolistPlugin; + ulong ref; +}; + +#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 @@ +/* + * todopluginwidget.cpp + * + * copyright : (c) 2002 by Maximilian Reiß + * email : harlekin@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "todopluginwidget.h" + +#include <qvaluelist.h> +#include <qtl.h> +#include <qstring.h> +#include <qscrollview.h> +#include <qobject.h> +#include <qlayout.h> + +#include <qpe/config.h> +#include <qpe/timestring.h> +#include <qpe/qcopenvelope_qws.h> + +TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name) + : QWidget(parent, name ) { + + todoLabel= 0l; + + todo = 0l; + if ( todo ) { + delete todo; + } + todo = new ToDoDB(); + + readConfig(); + m_maxCharClip = 36; + getTodo(); +} + +TodolistPluginWidget::~TodolistPluginWidget() { + delete todo; +} + +void TodolistPluginWidget::readConfig() { + Config cfg( "todaytodolistplugin" ); + cfg.setGroup( "config" ); + m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); +} + + +/** + * Get the todos + */ +void TodolistPluginWidget::getTodo() { + + QVBoxLayout* layoutTodo = new QVBoxLayout( this ); + + if ( todoLabel ) { + delete todoLabel; + } + + todoLabel = new OClickableLabel( this ); + todoLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); + connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); + QString output; + QString tmpout; + int count = 0; + int ammount = 0; + + // get overdue todos first + QValueList<ToDoEvent> overDueList = todo->overDue(); + qBubbleSort(overDueList); + for ( QValueList<ToDoEvent>::Iterator it = overDueList.begin(); + it!=overDueList.end(); ++it ) { + if (!(*it).isCompleted() && ( ammount < m_maxLinesTask ) ) { + QString desc = (*it).summary(); + if( desc.isEmpty() ) { + desc = (*it).description(); + } + tmpout += "<font color=#e00000><b>-" + desc.mid(0, m_maxCharClip) + "</b></font><br>"; + ammount++; + } + } + + // get total number of still open todos + QValueList<ToDoEvent> openTodo = todo->rawToDos(); + qBubbleSort( openTodo ); + for ( QValueList<ToDoEvent>::Iterator it=openTodo.begin(); + it!=openTodo.end(); ++it ) { + if ( !(*it).isCompleted() ){ + count +=1; + // not the overdues, we allready got them, and not if we are + // over the maxlines + if ( !(*it).isOverdue() && ( ammount < m_maxLinesTask ) ) { + QString desc = (*it).summary(); + if( desc.isEmpty() ) { + desc = (*it).description(); + } + tmpout += "<b>-</b>" + desc.mid(0, m_maxCharClip) + "<br>"; + ammount++; + } + } + } + + + if ( count > 0 ) { + if( count == 1 ) { + output += QObject::tr( "There is <b> 1</b> active task: <br>" ); + } else { + output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg(count); + } + output += tmpout; + } else { + output = QObject::tr( "No active tasks" ); + } + todoLabel->setText( output ); + layoutTodo->addWidget( todoLabel ); +} + +/** + * start the todolist + */ +void TodolistPluginWidget::startTodolist() { + QCopEnvelope e("QPE/System", "execute(QString)"); + e << QString("todolist"); +} 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 @@ +/* + * todopluginwidget.h + * + * copyright : (c) 2002 by Maximilian Reiß + * email : harlekin@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TODOLIST_PLUGIN_WIDGET_H +#define TODOLIST_PLUGIN_WIDGET_H + +#include <qstring.h> +#include <qwidget.h> + +#include <opie/tododb.h> +#include <opie/oclickablelabel.h> + + +class TodolistPluginWidget : public QWidget { + + Q_OBJECT + +public: + TodolistPluginWidget( QWidget *parent, const char *name ); + ~TodolistPluginWidget(); + +protected slots: + void startTodolist(); + +private: + OClickableLabel *todoLabel; + ToDoDB *todo; + void readConfig(); + void getTodo(); + int m_maxLinesTask; + int m_maxCharClip; +}; + +#endif |