summaryrefslogtreecommitdiff
path: root/core/pim/osearch/searchgroup.cpp
Unidiff
Diffstat (limited to 'core/pim/osearch/searchgroup.cpp') (more/less context) (show 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
@@ -7,21 +7,21 @@
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)
@@ -36,13 +36,13 @@ SearchGroup::~SearchGroup()
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 ) + ")");
@@ -66,28 +66,27 @@ void SearchGroup::setSearch(QRegExp 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