From 4efdcbfa9ae55ba42b10b5003c9e524b2e1f0eef Mon Sep 17 00:00:00 2001 From: harlekin Date: Tue, 05 Nov 2002 00:43:46 +0000 Subject: transition to new opie pim api, no finished yet, but should allready close bug #1 cvs upcvs up --- (limited to 'core') 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,7 +1,6 @@ TEMPLATE = lib -#TEMPLATE = app CONFIG -= moc -CONFIG += qt debug +CONFIG += qt release # Input HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \ 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 @@ -32,7 +32,7 @@ QString TodolistPlugin::pluginName() const { } double TodolistPlugin::versionNumber() const { - return 0.7; + return 0.8; } QString TodolistPlugin::pixmapNameWidget() const { 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 @@ -36,7 +36,9 @@ TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) if ( todo ) { delete todo; } - todo = new ToDoDB(); + + todo = new OTodoAccess(); + todo->load(); readConfig(); getTodo(); @@ -67,7 +69,6 @@ void TodolistPluginWidget::getTodo() { } todoLabel = new OClickableLabel( this ); - todoLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); QString output; @@ -76,14 +77,13 @@ void TodolistPluginWidget::getTodo() { int ammount = 0; // get overdue todos first - QValueList overDueList = todo->overDue(); - qBubbleSort( overDueList ); - for ( QValueList::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 += "-" + desc.mid( 0, m_maxCharClip ) + "
"; ammount++; @@ -91,26 +91,22 @@ void TodolistPluginWidget::getTodo() { } // get total number of still open todos - QValueList openTodo = todo->rawToDos(); - qBubbleSort( openTodo ); - for ( QValueList::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 += "-" + desc.mid( 0, m_maxCharClip ) + "
"; - 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 += "-" + desc.mid( 0, m_maxCharClip ) + "
"; + ammount++; } } - if ( count > 0 ) { if( count == 1 ) { output += QObject::tr( "There is 1 active task:
" ); 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 @@ -20,7 +20,8 @@ #include #include -#include +#include +#include #include @@ -37,7 +38,10 @@ protected slots: private: OClickableLabel *todoLabel; - ToDoDB *todo; + + OTodoAccess *todo; + OTodoAccess::List m_list; + OTodoAccess::List::Iterator m_it; void readConfig(); void getTodo(); -- cgit v0.9.0.2