summaryrefslogtreecommitdiff
path: root/core/pim/osearch/todosearch.cpp
Unidiff
Diffstat (limited to 'core/pim/osearch/todosearch.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/todosearch.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp
index c9fa61a..08bbe93 100644
--- a/core/pim/osearch/todosearch.cpp
+++ b/core/pim/osearch/todosearch.cpp
@@ -16,4 +16,7 @@
16#include <opie/otodo.h> 16#include <opie/otodo.h>
17#include <qiconset.h>
18#include <qpe/resource.h> 17#include <qpe/resource.h>
18#include <qpe/config.h>
19#include <qiconset.h>
20#include <qaction.h>
21#include <qpopupmenu.h>
19#include "todoitem.h" 22#include "todoitem.h"
@@ -21,5 +24,4 @@
21TodoSearch::TodoSearch(QListView* parent, QString name) 24TodoSearch::TodoSearch(QListView* parent, QString name)
22: SearchGroup(parent, name) 25: SearchGroup(parent, name), _todos(0), _popupMenu(0)
23{ 26{
24 _todos = 0;
25 //AppLnkSet als(QPEApplication::qpeDir()); 27 //AppLnkSet als(QPEApplication::qpeDir());
@@ -28,2 +30,7 @@ TodoSearch::TodoSearch(QListView* parent, QString name)
28 setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); 30 setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
31 actionShowCompleted = new QAction( QObject::tr("show completed tasks"),QString::null, 0, 0, 0, true );
32 Config cfg( "osearch", Config::User );
33 cfg.setGroup( "todo_settings" );
34 actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) );
35
29} 36}
@@ -33,2 +40,7 @@ TodoSearch::~TodoSearch()
33{ 40{
41 Config cfg( "osearch", Config::User );
42 cfg.setGroup( "todo_settings" );
43 cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() );
44 delete _popupMenu;
45 delete actionShowCompleted;
34 delete _todos; 46 delete _todos;
@@ -47,9 +59,22 @@ int TodoSearch::search()
47 for (uint i = 0; i < results.count(); i++) 59 for (uint i = 0; i < results.count(); i++)
48 new TodoItem( this, new OTodo( results[i] )); 60 insertItem( new OTodo( results[i] ));
49 return results.count(); 61 return _resultCount;
50} 62}
51 63
52void TodoSearch::insertItem( void* ) 64void TodoSearch::insertItem( void *rec )
53{ 65{
66 OTodo *todo = (OTodo*)rec;
67 if (!actionShowCompleted->isOn() &&
68 todo->isCompleted() ) return;
69 new TodoItem( this, todo );
70 _resultCount++;
71}
54 72
73QPopupMenu* TodoSearch::popupMenu()
74{
75 if (!_popupMenu){
76 _popupMenu = new QPopupMenu( 0 );
77 actionShowCompleted->addTo( _popupMenu );
78 }
79 return _popupMenu;
55} 80}