-rw-r--r-- | core/pim/osearch/adresssearch.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/datebooksearch.cpp | 1 | ||||
-rw-r--r-- | core/pim/osearch/searchgroup.h | 3 | ||||
-rw-r--r-- | core/pim/osearch/todosearch.cpp | 1 |
4 files changed, 5 insertions, 2 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp index c5b1ae7..0ee8eba 100644 --- a/core/pim/osearch/adresssearch.cpp +++ b/core/pim/osearch/adresssearch.cpp | |||
@@ -1,43 +1,45 @@ | |||
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 "adresssearch.h" | 13 | #include "adresssearch.h" |
14 | 14 | ||
15 | #include <opie/ocontactaccess.h> | 15 | #include <opie/ocontactaccess.h> |
16 | #include <qstring.h> | ||
16 | 17 | ||
17 | #include "contactitem.h" | 18 | #include "contactitem.h" |
18 | //#include <qdir.h> | 19 | //#include <qdir.h> |
19 | 20 | ||
20 | AdressSearch::AdressSearch(QListView* parent, QString name): | 21 | AdressSearch::AdressSearch(QListView* parent, QString name): |
21 | SearchGroup(parent, name) | 22 | SearchGroup(parent, name) |
22 | { | 23 | { |
23 | _contacts = 0; | 24 | _contacts = 0; |
24 | } | 25 | } |
25 | 26 | ||
26 | 27 | ||
27 | AdressSearch::~AdressSearch() | 28 | AdressSearch::~AdressSearch() |
28 | { | 29 | { |
29 | delete _contacts; | 30 | delete _contacts; |
30 | } | 31 | } |
31 | 32 | ||
32 | 33 | ||
33 | void AdressSearch::expand() | 34 | void AdressSearch::expand() |
34 | { | 35 | { |
35 | SearchGroup::expand(); | 36 | SearchGroup::expand(); |
36 | if (_search.isEmpty()) return; | 37 | if (_search.isEmpty()) return; |
37 | if (!_contacts) _contacts = new OContactAccess("osearch"); | 38 | if (!_contacts) _contacts = new OContactAccess("osearch"); |
38 | ORecordList<OContact> results = _contacts->matchRegexp(_search); | 39 | ORecordList<OContact> results = _contacts->matchRegexp(_search); |
40 | setText(0, text(0) + " (" + QString::number( results.count() ) + ")" ); | ||
39 | for (uint i = 0; i < results.count(); i++) { | 41 | for (uint i = 0; i < results.count(); i++) { |
40 | new ContactItem( this, new OContact( results[i] )); | 42 | new ContactItem( this, new OContact( results[i] )); |
41 | } | 43 | } |
42 | } | 44 | } |
43 | 45 | ||
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp index 8f9d472..0590252 100644 --- a/core/pim/osearch/datebooksearch.cpp +++ b/core/pim/osearch/datebooksearch.cpp | |||
@@ -18,45 +18,46 @@ | |||
18 | #include <opie/odatebookaccess.h> | 18 | #include <opie/odatebookaccess.h> |
19 | 19 | ||
20 | DatebookSearch::DatebookSearch(QListView* parent, QString name) | 20 | DatebookSearch::DatebookSearch(QListView* parent, QString name) |
21 | : SearchGroup(parent, name) | 21 | : SearchGroup(parent, name) |
22 | { | 22 | { |
23 | _dates = 0; | 23 | _dates = 0; |
24 | } | 24 | } |
25 | 25 | ||
26 | 26 | ||
27 | DatebookSearch::~DatebookSearch() | 27 | DatebookSearch::~DatebookSearch() |
28 | { | 28 | { |
29 | delete _dates; | 29 | delete _dates; |
30 | } | 30 | } |
31 | 31 | ||
32 | 32 | ||
33 | void DatebookSearch::expand() | 33 | void DatebookSearch::expand() |
34 | { | 34 | { |
35 | SearchGroup::expand(); | 35 | SearchGroup::expand(); |
36 | if (!_dates){ | 36 | if (!_dates){ |
37 | _dates = new ODateBookAccess(); | 37 | _dates = new ODateBookAccess(); |
38 | _dates->load(); | 38 | _dates->load(); |
39 | } | 39 | } |
40 | #ifdef LIPBOPIE_SEARCH | 40 | #ifdef LIPBOPIE_SEARCH |
41 | ORecordList<OEvent> results = _dates->matchRegexp(_search); | 41 | ORecordList<OEvent> results = _dates->matchRegexp(_search); |
42 | setText(0, text(0) + " (" + QString::number( results.count() ) + ")" ); | ||
42 | for (uint i = 0; i < results.count(); i++) { | 43 | for (uint i = 0; i < results.count(); i++) { |
43 | new EventItem( this, new OEvent( results[i] )); | 44 | new EventItem( this, new OEvent( results[i] )); |
44 | } | 45 | } |
45 | #else | 46 | #else |
46 | ORecordList<OEvent> list = _dates->allRecords(); | 47 | ORecordList<OEvent> list = _dates->allRecords(); |
47 | QArray<int> m_currentQuery( list.count() ); | 48 | QArray<int> m_currentQuery( list.count() ); |
48 | for( uint i=0; i<list.count(); i++ ){ | 49 | for( uint i=0; i<list.count(); i++ ){ |
49 | //qDebug("datebook: %s",list[i].description().latin1() ); | 50 | //qDebug("datebook: %s",list[i].description().latin1() ); |
50 | if ( | 51 | if ( |
51 | ( list[i].description().contains( _search ) ) || | 52 | ( list[i].description().contains( _search ) ) || |
52 | ( list[i].note().contains( _search ) ) || | 53 | ( list[i].note().contains( _search ) ) || |
53 | ( list[i].location().contains( _search ) ) | 54 | ( list[i].location().contains( _search ) ) |
54 | ){ | 55 | ){ |
55 | //qDebug("FOUND"); | 56 | //qDebug("FOUND"); |
56 | new EventItem( this, new OEvent( list[i] ) ); | 57 | new EventItem( this, new OEvent( list[i] ) ); |
57 | } | 58 | } |
58 | 59 | ||
59 | } | 60 | } |
60 | #endif | 61 | #endif |
61 | } | 62 | } |
62 | 63 | ||
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h index 6b6bbf5..4195e6f 100644 --- a/core/pim/osearch/searchgroup.h +++ b/core/pim/osearch/searchgroup.h | |||
@@ -1,44 +1,43 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Interface: $MODULE$ | 3 | // C++ Interface: $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 | #ifndef SEARCHGROUP_H | 13 | #ifndef SEARCHGROUP_H |
14 | #define SEARCHGROUP_H | 14 | #define SEARCHGROUP_H |
15 | 15 | ||
16 | #include "olistviewitem.h" | 16 | #include "olistviewitem.h" |
17 | 17 | ||
18 | #include <qregexp.h> | 18 | #include <qregexp.h> |
19 | 19 | #define LIPBOPIE_SEARCH | |
20 | //#define LIPBOPIE_SEARCH | ||
21 | 20 | ||
22 | /** | 21 | /** |
23 | @author Patrick S. Vogt | 22 | @author Patrick S. Vogt |
24 | */ | 23 | */ |
25 | class SearchGroup : public OListViewItem | 24 | class SearchGroup : public OListViewItem |
26 | { | 25 | { |
27 | public: | 26 | public: |
28 | SearchGroup(QListView* parent, QString name); | 27 | SearchGroup(QListView* parent, QString name); |
29 | 28 | ||
30 | ~SearchGroup(); | 29 | ~SearchGroup(); |
31 | 30 | ||
32 | virtual void expand(); | 31 | virtual void expand(); |
33 | virtual void setSearch(QString); | 32 | virtual void setSearch(QString); |
34 | virtual void setSearch(QRegExp); | 33 | virtual void setSearch(QRegExp); |
35 | virtual int rtti() { return Searchgroup;} | 34 | virtual int rtti() { return Searchgroup;} |
36 | 35 | ||
37 | protected: | 36 | protected: |
38 | QRegExp _search; | 37 | QRegExp _search; |
39 | private: | 38 | private: |
40 | QString _name; | 39 | QString _name; |
41 | bool expanded; | 40 | bool expanded; |
42 | }; | 41 | }; |
43 | 42 | ||
44 | #endif | 43 | #endif |
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp index 9a22ee1..fba8aa0 100644 --- a/core/pim/osearch/todosearch.cpp +++ b/core/pim/osearch/todosearch.cpp | |||
@@ -23,43 +23,44 @@ TodoSearch::TodoSearch(QListView* parent, QString name) | |||
23 | { | 23 | { |
24 | //_fileName = QDir::homeDirPath()+"/Applications/todolist/todolist.xml"; | 24 | //_fileName = QDir::homeDirPath()+"/Applications/todolist/todolist.xml"; |
25 | _todos = 0; | 25 | _todos = 0; |
26 | } | 26 | } |
27 | 27 | ||
28 | 28 | ||
29 | TodoSearch::~TodoSearch() | 29 | TodoSearch::~TodoSearch() |
30 | { | 30 | { |
31 | delete _todos; | 31 | delete _todos; |
32 | } | 32 | } |
33 | 33 | ||
34 | 34 | ||
35 | void TodoSearch::expand() | 35 | void TodoSearch::expand() |
36 | { | 36 | { |
37 | SearchGroup::expand(); | 37 | SearchGroup::expand(); |
38 | if (_search.isEmpty()) return; | 38 | if (_search.isEmpty()) return; |
39 | 39 | ||
40 | if (!_todos){ | 40 | if (!_todos){ |
41 | _todos = new OTodoAccess(); | 41 | _todos = new OTodoAccess(); |
42 | _todos->load(); | 42 | _todos->load(); |
43 | } | 43 | } |
44 | 44 | ||
45 | #ifdef LIPBOPIE_SEARCH | 45 | #ifdef LIPBOPIE_SEARCH |
46 | ORecordList<OTodo> results = _todos->matchRegexp(_search); | 46 | ORecordList<OTodo> results = _todos->matchRegexp(_search); |
47 | setText(0, text(0) + " (" + QString::number( results.count() ) + ")"); | ||
47 | for (uint i = 0; i < results.count(); i++) { | 48 | for (uint i = 0; i < results.count(); i++) { |
48 | new TodoItem( this, new OTodo( results[i] )); | 49 | new TodoItem( this, new OTodo( results[i] )); |
49 | } | 50 | } |
50 | #else | 51 | #else |
51 | ORecordList<OTodo> list = _todos->allRecords(); | 52 | ORecordList<OTodo> list = _todos->allRecords(); |
52 | QArray<int> m_currentQuery( list.count() ); | 53 | QArray<int> m_currentQuery( list.count() ); |
53 | for( uint i=0; i<list.count(); i++ ){ | 54 | for( uint i=0; i<list.count(); i++ ){ |
54 | // qDebug("todo: %s",list[i].summary().latin1() ); | 55 | // qDebug("todo: %s",list[i].summary().latin1() ); |
55 | if ( list[i].match( _search ) ){ | 56 | if ( list[i].match( _search ) ){ |
56 | // qDebug("FOUND"); | 57 | // qDebug("FOUND"); |
57 | new TodoItem( this, new OTodo( list[i] ) ); | 58 | new TodoItem( this, new OTodo( list[i] ) ); |
58 | } | 59 | } |
59 | 60 | ||
60 | } | 61 | } |
61 | #endif | 62 | #endif |
62 | 63 | ||
63 | } | 64 | } |
64 | 65 | ||
65 | 66 | ||