summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/todolist/todolist.pro3
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.cpp2
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.cpp46
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.h8
4 files changed, 29 insertions, 30 deletions
diff --git a/core/pim/today/plugins/todolist/todolist.pro b/core/pim/today/plugins/todolist/todolist.pro
index 1f9c61c..38db406 100644
--- a/core/pim/today/plugins/todolist/todolist.pro
+++ b/core/pim/today/plugins/todolist/todolist.pro
@@ -1,20 +1,19 @@
TEMPLATE = lib
-#TEMPLATE = app
CONFIG -= moc
-CONFIG += qt debug
+CONFIG += qt release
# 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
index e10b414..b5abbd3 100644
--- a/core/pim/today/plugins/todolist/todoplugin.cpp
+++ b/core/pim/today/plugins/todolist/todoplugin.cpp
@@ -1,61 +1,61 @@
/*
* 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 QObject::tr( "Todolist plugin" );
}
double TodolistPlugin::versionNumber() const {
- return 0.7;
+ return 0.8;
}
QString TodolistPlugin::pixmapNameWidget() const {
return "TodoList";
}
QWidget* TodolistPlugin::widget( QWidget *wid ) {
return new TodolistPluginWidget( wid, "Todolist" );
}
QString TodolistPlugin::pixmapNameConfig() const {
return "TodoList";
}
TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) {
return new TodolistPluginConfig( wid , "Todolist" );
}
QString TodolistPlugin::appName() const {
return "todolist";
}
bool TodolistPlugin::excludeFromRefresh() const {
return false;
}
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp
index 320969e..773e5cf 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.cpp
+++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp
@@ -1,134 +1,130 @@
/*
* 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();
+
+ todo = new OTodoAccess();
+ todo->load();
readConfig();
getTodo();
}
TodolistPluginWidget::~TodolistPluginWidget() {
delete todo;
}
void TodolistPluginWidget::readConfig() {
Config cfg( "todaytodoplugin" );
cfg.setGroup( "config" );
m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
}
/**
* 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();
+ m_list = todo->overDue();
+
+ for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
+ if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) {
+ QString desc = (*m_it).summary();
if( desc.isEmpty() ) {
- desc = (*it).description();
+ desc = (*m_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++;
+ m_list = todo->sorted( true, 1, 4, 1);
+
+ for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
+ count +=1;
+ // not the overdues, we allready got them, and not if we are
+ // over the maxlines
+ if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) {
+ QString desc = (*m_it).summary();
+ if( desc.isEmpty() ) {
+ desc = (*m_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
index 970f430..37b0ee1 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.h
+++ b/core/pim/today/plugins/todolist/todopluginwidget.h
@@ -1,48 +1,52 @@
/*
* 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/otodo.h>
+#include <opie/otodoaccess.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;
+
+ OTodoAccess *todo;
+ OTodoAccess::List m_list;
+ OTodoAccess::List::Iterator m_it;
void readConfig();
void getTodo();
int m_maxLinesTask;
int m_maxCharClip;
};
#endif