author | tille <tille> | 2003-05-15 13:55:07 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-15 13:55:07 (UTC) |
commit | 80e9fd1b08a3a7173ecf443b2830df4ca6e83ce6 (patch) (unidiff) | |
tree | 4245ef4caf67784b452b908a9528ae03f988bf4c /core/pim/osearch/searchgroup.cpp | |
parent | ded2a7a5715af1d1f6aab0b79ba90d8a815a9adc (diff) | |
download | opie-80e9fd1b08a3a7173ecf443b2830df4ca6e83ce6.zip opie-80e9fd1b08a3a7173ecf443b2830df4ca6e83ce6.tar.gz opie-80e9fd1b08a3a7173ecf443b2830df4ca6e83ce6.tar.bz2 |
owait and settings for search group:
- hide completed todos
- show only later events
- do not display hits in datebook dated
Diffstat (limited to 'core/pim/osearch/searchgroup.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/osearch/searchgroup.cpp | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp index 490deea..e307696 100644 --- a/core/pim/osearch/searchgroup.cpp +++ b/core/pim/osearch/searchgroup.cpp | |||
@@ -10,17 +10,22 @@ | |||
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 "searchgroup.h" | 13 | #include "searchgroup.h" |
14 | 14 | ||
15 | #include <qregexp.h> | 15 | #include <qregexp.h> |
16 | // #include <qapplication.h> | 16 | #include <qapplication.h> |
17 | // #include <opie/owait.h> | 17 | #include <opie/owait.h> |
18 | 18 | ||
19 | #include "olistviewitem.h" | 19 | #include "olistviewitem.h" |
20 | 20 | ||
21 | //#define NEW_OWAIT | ||
22 | #ifndef NEW_OWAIT | ||
23 | static OWait *wait = 0; | ||
24 | #endif | ||
25 | |||
21 | SearchGroup::SearchGroup(QListView* parent, QString name) | 26 | SearchGroup::SearchGroup(QListView* parent, QString name) |
22 | : OListViewItem(parent, name) | 27 | : OListViewItem(parent, name) |
23 | { | 28 | { |
24 | _name = name; | 29 | _name = name; |
25 | loaded = false; | 30 | loaded = false; |
26 | } | 31 | } |
@@ -46,42 +51,43 @@ void SearchGroup::expand() | |||
46 | } | 51 | } |
47 | 52 | ||
48 | void SearchGroup::doSearch() | 53 | void SearchGroup::doSearch() |
49 | { | 54 | { |
50 | clearList(); | 55 | clearList(); |
51 | if (_search.isEmpty()) return; | 56 | if (_search.isEmpty()) return; |
52 | int res_count = realSearch(); | 57 | _resultCount = realSearch(); |
53 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); | ||
54 | //repaint(); | 58 | //repaint(); |
55 | } | 59 | } |
56 | 60 | ||
57 | void SearchGroup::clearList() | ||
58 | { | ||
59 | QListViewItem *item = firstChild(); | ||
60 | QListViewItem *toDel; | ||
61 | while ( item != 0 ) { | ||
62 | toDel = item; | ||
63 | item = item->nextSibling(); | ||
64 | delete toDel; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | void SearchGroup::setSearch(QRegExp re) | 61 | void SearchGroup::setSearch(QRegExp re) |
69 | { | 62 | { |
63 | if (re == _search) return; | ||
70 | setText(0, _name+" - "+re.pattern() ); | 64 | setText(0, _name+" - "+re.pattern() ); |
71 | _search = re; | 65 | _search = re; |
72 | if (isOpen()) expand(); | 66 | if (isOpen()) expand(); |
73 | else new OListViewItem( this, "searching..."); | 67 | else new OListViewItem( this, "searching..."); |
74 | } | 68 | } |
75 | 69 | ||
76 | int SearchGroup::realSearch() | 70 | int SearchGroup::realSearch() |
77 | { | 71 | { |
78 | //emit isSearching( tr(" Searching for %s in %s" ).arg( _search.pattern().latin1()).arg( _name ) ); | 72 | #ifndef NEW_OWAIT |
79 | /*OWait *wait = new OWait( qApp->mainWidget(), "test" ); | 73 | qDebug("NOT using NEW_OWAIT"); |
80 | wait->show();*/ | 74 | if (!wait) wait = new OWait( qApp->mainWidget(), "osearch" ); |
75 | wait->show(); | ||
76 | qApp->processEvents(); | ||
77 | #else | ||
78 | qDebug("using NEW_OWAIT"); | ||
79 | OWait::start( "osearch" ); | ||
80 | #endif | ||
81 | if (!loaded) load(); | 81 | if (!loaded) load(); |
82 | int count = search(); | 82 | _resultCount = 0; |
83 | /*wait->hide(); | 83 | _resultCount = search(); |
84 | delete wait;*/ | 84 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( _resultCount ) + ")"); |
85 | return count; | 85 | |
86 | #ifndef NEW_OWAIT | ||
87 | wait->hide(); | ||
88 | #else | ||
89 | OWait::stop(); | ||
90 | #endif | ||
91 | return _resultCount; | ||
86 | } | 92 | } |
87 | 93 | ||