Diffstat (limited to 'core/pim/osearch/todosearch.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/osearch/todosearch.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp index 5c1d7a5..8de875e 100644 --- a/core/pim/osearch/todosearch.cpp +++ b/core/pim/osearch/todosearch.cpp | |||
@@ -1,80 +1,80 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Implementation: $MODULE$ | 3 | // C++ Implementation: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #include "todosearch.h" | 13 | #include "todosearch.h" |
14 | 14 | ||
15 | #include <opie/otodoaccess.h> | 15 | #include <opie/otodoaccess.h> |
16 | #include <opie/otodo.h> | 16 | #include <opie/otodo.h> |
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qiconset.h> | 19 | #include <qiconset.h> |
20 | #include <qaction.h> | 20 | #include <qaction.h> |
21 | #include <qpopupmenu.h> | 21 | #include <qpopupmenu.h> |
22 | #include "todoitem.h" | 22 | #include "todoitem.h" |
23 | 23 | ||
24 | TodoSearch::TodoSearch(QListView* parent, QString name) | 24 | TodoSearch::TodoSearch(QListView* parent, QString name) |
25 | : SearchGroup(parent, name), _todos(0), _popupMenu(0) | 25 | : SearchGroup(parent, name), _todos(0), _popupMenu(0) |
26 | { | 26 | { |
27 | //AppLnkSet als(QPEApplication::qpeDir()); | 27 | //AppLnkSet als(QPEApplication::qpeDir()); |
28 | //setPixmap( 0, als.findExec("todolist")->pixmap() ); | 28 | //setPixmap( 0, als.findExec("todolist")->pixmap() ); |
29 | QIconSet is = Resource::loadIconSet( "todo/TodoList" ); | 29 | QIconSet is = Resource::loadIconSet( "todo/TodoListSmall" ); |
30 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); | 30 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); |
31 | actionShowCompleted = new QAction( QObject::tr("show completed tasks"),QString::null, 0, 0, 0, true ); | 31 | actionShowCompleted = new QAction( QObject::tr("show completed tasks"),QString::null, 0, 0, 0, true ); |
32 | Config cfg( "osearch", Config::User ); | 32 | Config cfg( "osearch", Config::User ); |
33 | cfg.setGroup( "todo_settings" ); | 33 | cfg.setGroup( "todo_settings" ); |
34 | actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) ); | 34 | actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) ); |
35 | 35 | ||
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | TodoSearch::~TodoSearch() | 39 | TodoSearch::~TodoSearch() |
40 | { | 40 | { |
41 | Config cfg( "osearch", Config::User ); | 41 | Config cfg( "osearch", Config::User ); |
42 | cfg.setGroup( "todo_settings" ); | 42 | cfg.setGroup( "todo_settings" ); |
43 | cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() ); | 43 | cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() ); |
44 | delete _popupMenu; | 44 | delete _popupMenu; |
45 | delete actionShowCompleted; | 45 | delete actionShowCompleted; |
46 | delete _todos; | 46 | delete _todos; |
47 | } | 47 | } |
48 | 48 | ||
49 | 49 | ||
50 | void TodoSearch::load() | 50 | void TodoSearch::load() |
51 | { | 51 | { |
52 | _todos = new OTodoAccess(); | 52 | _todos = new OTodoAccess(); |
53 | _todos->load(); | 53 | _todos->load(); |
54 | } | 54 | } |
55 | 55 | ||
56 | int TodoSearch::search() | 56 | int TodoSearch::search() |
57 | { | 57 | { |
58 | ORecordList<OTodo> results = _todos->matchRegexp(_search); | 58 | ORecordList<OTodo> results = _todos->matchRegexp(_search); |
59 | for (uint i = 0; i < results.count(); i++) | 59 | for (uint i = 0; i < results.count(); i++) |
60 | insertItem( new OTodo( results[i] )); | 60 | insertItem( new OTodo( results[i] )); |
61 | return _resultCount; | 61 | return _resultCount; |
62 | } | 62 | } |
63 | 63 | ||
64 | void TodoSearch::insertItem( void *rec ) | 64 | void TodoSearch::insertItem( void *rec ) |
65 | { | 65 | { |
66 | OTodo *todo = (OTodo*)rec; | 66 | OTodo *todo = (OTodo*)rec; |
67 | if (!actionShowCompleted->isOn() && | 67 | if (!actionShowCompleted->isOn() && |
68 | todo->isCompleted() ) return; | 68 | todo->isCompleted() ) return; |
69 | (void)new TodoItem( this, todo ); | 69 | (void)new TodoItem( this, todo ); |
70 | _resultCount++; | 70 | _resultCount++; |
71 | } | 71 | } |
72 | 72 | ||
73 | QPopupMenu* TodoSearch::popupMenu() | 73 | QPopupMenu* TodoSearch::popupMenu() |
74 | { | 74 | { |
75 | if (!_popupMenu){ | 75 | if (!_popupMenu){ |
76 | _popupMenu = new QPopupMenu( 0 ); | 76 | _popupMenu = new QPopupMenu( 0 ); |
77 | actionShowCompleted->addTo( _popupMenu ); | 77 | actionShowCompleted->addTo( _popupMenu ); |
78 | } | 78 | } |
79 | return _popupMenu; | 79 | return _popupMenu; |
80 | } | 80 | } |