summaryrefslogtreecommitdiff
path: root/core/pim/osearch/searchgroup.cpp
Unidiff
Diffstat (limited to 'core/pim/osearch/searchgroup.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/searchgroup.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp
index e307696..0b58176 100644
--- a/core/pim/osearch/searchgroup.cpp
+++ b/core/pim/osearch/searchgroup.cpp
@@ -1,54 +1,54 @@
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 "searchgroup.h"
14 13
14#include <qobject.h>
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#include "searchgroup.h"
20 21
21//#define NEW_OWAIT
22#ifndef NEW_OWAIT 22#ifndef NEW_OWAIT
23static OWait *wait = 0; 23static OWait *wait = 0;
24#endif 24#endif
25 25
26SearchGroup::SearchGroup(QListView* parent, QString name) 26SearchGroup::SearchGroup(QListView* parent, QString name)
27: OListViewItem(parent, name) 27: OListViewItem(parent, name)
28{ 28{
29 _name = name; 29 _name = name;
30 loaded = false; 30 loaded = false;
31} 31}
32 32
33 33
34SearchGroup::~SearchGroup() 34SearchGroup::~SearchGroup()
35{ 35{
36} 36}
37 37
38 38
39void SearchGroup::expand() 39void SearchGroup::expand()
40{ 40{
41 //expanded = true; 41 //expanded = true;
42 clearList(); 42 if (_lastSearch != _search) clearList();
43 if (_search.isEmpty()) return; 43 if (_search.isEmpty()) return;
44 OListViewItem *dummy = new OListViewItem( this, "searching..."); 44 OListViewItem *dummy = new OListViewItem( this, "searching...");
45 setOpen( true ); 45 setOpen( true );
46 repaint(); 46 repaint();
47 int res_count = realSearch(); 47 int res_count = realSearch();
48 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); 48 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")");
49 delete dummy; 49 delete dummy;
50 repaint(); 50 repaint();
51} 51}
52 52
53void SearchGroup::doSearch() 53void SearchGroup::doSearch()
54{ 54{
@@ -60,34 +60,33 @@ void SearchGroup::doSearch()
60 60
61void SearchGroup::setSearch(QRegExp re) 61void SearchGroup::setSearch(QRegExp re)
62{ 62{
63 if (re == _search) return; 63 if (re == _search) return;
64 setText(0, _name+" - "+re.pattern() ); 64 setText(0, _name+" - "+re.pattern() );
65 _search = re; 65 _search = re;
66 if (isOpen()) expand(); 66 if (isOpen()) expand();
67 else new OListViewItem( this, "searching..."); 67 else new OListViewItem( this, "searching...");
68} 68}
69 69
70int SearchGroup::realSearch() 70int SearchGroup::realSearch()
71{ 71{
72 if (_lastSearch == _search) return _resultCount;
72#ifndef NEW_OWAIT 73#ifndef NEW_OWAIT
73 qDebug("NOT using NEW_OWAIT");
74 if (!wait) wait = new OWait( qApp->mainWidget(), "osearch" ); 74 if (!wait) wait = new OWait( qApp->mainWidget(), "osearch" );
75 wait->show(); 75 wait->show();
76 qApp->processEvents(); 76 qApp->processEvents();
77#else 77#else
78 qDebug("using NEW_OWAIT"); 78 qDebug("********** NEW_OWAIT *************");
79 OWait::start( "osearch" ); 79 OWait( "searching" );
80#endif 80#endif
81 if (!loaded) load(); 81 if (!loaded) load();
82 _resultCount = 0; 82 _resultCount = 0;
83 _resultCount = search(); 83 _resultCount = search();
84 _lastSearch = _search;
84 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( _resultCount ) + ")"); 85 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( _resultCount ) + ")");
85 86
86#ifndef NEW_OWAIT 87#ifndef NEW_OWAIT
87 wait->hide(); 88 wait->hide();
88#else
89 OWait::stop();
90#endif 89#endif
91 return _resultCount; 90 return _resultCount;
92} 91}
93 92