summaryrefslogtreecommitdiff
path: root/core/pim/osearch/searchgroup.cpp
authortille <tille>2003-05-13 13:46:19 (UTC)
committer tille <tille>2003-05-13 13:46:19 (UTC)
commitba4bb8e673fba43ae7a232942dea14d166991530 (patch) (unidiff)
treee775ad637d5256eb1412e576c1bd5e77ed50406d /core/pim/osearch/searchgroup.cpp
parent1461a41433a732e3a615508e5de23f8acd91de6a (diff)
downloadopie-ba4bb8e673fba43ae7a232942dea14d166991530.zip
opie-ba4bb8e673fba43ae7a232942dea14d166991530.tar.gz
opie-ba4bb8e673fba43ae7a232942dea14d166991530.tar.bz2
icons ;)
Diffstat (limited to 'core/pim/osearch/searchgroup.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/searchgroup.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp
index 3159984..490deea 100644
--- a/core/pim/osearch/searchgroup.cpp
+++ b/core/pim/osearch/searchgroup.cpp
@@ -10,65 +10,78 @@
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>
17// #include <opie/owait.h>
16 18
17#include "olistviewitem.h" 19#include "olistviewitem.h"
18 20
19SearchGroup::SearchGroup(QListView* parent, QString name) 21SearchGroup::SearchGroup(QListView* parent, QString name)
20: OListViewItem(parent, name) 22: OListViewItem(parent, name)
21{ 23{
22 _name = name; 24 _name = name;
23 loaded = false; 25 loaded = false;
24 expanded = false;
25} 26}
26 27
27 28
28SearchGroup::~SearchGroup() 29SearchGroup::~SearchGroup()
29{ 30{
30} 31}
31 32
32 33
33void SearchGroup::expand() 34void SearchGroup::expand()
34{ 35{
36 //expanded = true;
35 clearList(); 37 clearList();
36 if (_search.isEmpty()) return; 38 if (_search.isEmpty()) return;
37 OListViewItem *dummy = new OListViewItem( this, "searching..."); 39 OListViewItem *dummy = new OListViewItem( this, "searching...");
38 setOpen( expanded ); 40 setOpen( true );
39 if (!loaded) load(); 41 repaint();
40 int res_count = search(); 42 int res_count = realSearch();
41 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); 43 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")");
42 delete dummy; 44 delete dummy;
45 repaint();
43} 46}
44 47
45void SearchGroup::doSearch() 48void SearchGroup::doSearch()
46{ 49{
47 clearList(); 50 clearList();
48 if (_search.isEmpty()) return; 51 if (_search.isEmpty()) return;
49 if (!loaded) load(); 52 int res_count = realSearch();
50 int res_count = search();
51 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); 53 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")");
54 //repaint();
52} 55}
53 56
54void SearchGroup::clearList() 57void SearchGroup::clearList()
55{ 58{
56 QListViewItem *item = firstChild(); 59 QListViewItem *item = firstChild();
57 QListViewItem *toDel; 60 QListViewItem *toDel;
58
59 while ( item != 0 ) { 61 while ( item != 0 ) {
60 toDel = item; 62 toDel = item;
61 item = item->nextSibling(); 63 item = item->nextSibling();
62 delete toDel; 64 delete toDel;
63 } 65 }
64 expanded = true;
65} 66}
66 67
67void SearchGroup::setSearch(QRegExp re) 68void SearchGroup::setSearch(QRegExp re)
68{ 69{
69 setText(0, _name+" - "+re.pattern() ); 70 setText(0, _name+" - "+re.pattern() );
70 _search = re; 71 _search = re;
71 if (expanded) expand(); 72 if (isOpen()) expand();
72 else new OListViewItem( this, "searching..."); 73 else new OListViewItem( this, "searching...");
73} 74}
74 75
76int SearchGroup::realSearch()
77{
78 //emit isSearching( tr(" Searching for %s in %s" ).arg( _search.pattern().latin1()).arg( _name ) );
79 /*OWait *wait = new OWait( qApp->mainWidget(), "test" );
80 wait->show();*/
81 if (!loaded) load();
82 int count = search();
83 /*wait->hide();
84 delete wait;*/
85 return count;
86}
87