summaryrefslogtreecommitdiff
authortille <tille>2003-05-11 19:29:27 (UTC)
committer tille <tille>2003-05-11 19:29:27 (UTC)
commit10de2c93dffa16f6d2f1cf72fa20008757c5ef3a (patch) (unidiff)
tree561f501cf966e1f3ee6c9ce6d76ab9c227e7708a
parent43c18630840a98aed8deb96b454957c40f0a4344 (diff)
downloadopie-10de2c93dffa16f6d2f1cf72fa20008757c5ef3a.zip
opie-10de2c93dffa16f6d2f1cf72fa20008757c5ef3a.tar.gz
opie-10de2c93dffa16f6d2f1cf72fa20008757c5ef3a.tar.bz2
colabse applnkitem in case of new search, since it's far to slow...
... I wonder how slow osearch will be on the pda!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/applnksearch.cpp8
-rw-r--r--core/pim/osearch/applnksearch.h2
-rw-r--r--core/pim/osearch/searchgroup.h1
3 files changed, 9 insertions, 2 deletions
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp
index d5b2930..acf650a 100644
--- a/core/pim/osearch/applnksearch.cpp
+++ b/core/pim/osearch/applnksearch.cpp
@@ -1,55 +1,63 @@
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 "applnksearch.h" 13#include "applnksearch.h"
14 14
15#include <qpe/applnk.h> 15#include <qpe/applnk.h>
16#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17 17
18#include "applnkitem.h" 18#include "applnkitem.h"
19 19
20AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) 20AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
21{ 21{
22 _apps = 0; 22 _apps = 0;
23} 23}
24 24
25 25
26AppLnkSearch::~AppLnkSearch() 26AppLnkSearch::~AppLnkSearch()
27{ 27{
28 delete _apps; 28 delete _apps;
29} 29}
30 30
31 31
32void AppLnkSearch::load() 32void AppLnkSearch::load()
33{ 33{
34 _apps = new AppLnkSet(QPEApplication::qpeDir()); 34 _apps = new AppLnkSet(QPEApplication::qpeDir());
35} 35}
36 36
37int AppLnkSearch::search() 37int AppLnkSearch::search()
38{ 38{
39 int count = 0; 39 int count = 0;
40 QList<AppLnk> appList = _apps->children(); 40 QList<AppLnk> appList = _apps->children();
41 for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ 41 for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){
42 if ( (_search.match( app->name() ) != -1) 42 if ( (_search.match( app->name() ) != -1)
43 || (_search.match(app->comment()) != -1) 43 || (_search.match(app->comment()) != -1)
44 || (_search.match(app->exec()) != -1) ) { 44 || (_search.match(app->exec()) != -1) ) {
45 count++; 45 count++;
46 insertItem( app ); 46 insertItem( app );
47 } 47 }
48 } 48 }
49 return count; 49 return count;
50} 50}
51 51
52void AppLnkSearch::insertItem( void *rec ) 52void AppLnkSearch::insertItem( void *rec )
53{ 53{
54 new AppLnkItem( this, (AppLnk*)rec ); 54 new AppLnkItem( this, (AppLnk*)rec );
55} 55}
56
57void AppLnkSearch::setSearch(QRegExp re)
58{
59 expanded = false;
60 setOpen( false );
61 SearchGroup::setSearch( re );
62}
63
diff --git a/core/pim/osearch/applnksearch.h b/core/pim/osearch/applnksearch.h
index d88a8ce..6bb7486 100644
--- a/core/pim/osearch/applnksearch.h
+++ b/core/pim/osearch/applnksearch.h
@@ -1,38 +1,38 @@
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 APPLNKSEARCH_H 13#ifndef APPLNKSEARCH_H
14#define APPLNKSEARCH_H 14#define APPLNKSEARCH_H
15 15
16#include "searchgroup.h" 16#include "searchgroup.h"
17 17
18class AppLnkSet; 18class AppLnkSet;
19 19
20/** 20/**
21@author Patrick S. Vogt 21@author Patrick S. Vogt
22*/ 22*/
23class AppLnkSearch : public SearchGroup 23class AppLnkSearch : public SearchGroup
24{ 24{
25public: 25public:
26 AppLnkSearch(QListView* parent, QString name); 26 AppLnkSearch(QListView* parent, QString name);
27 27
28 ~AppLnkSearch(); 28 ~AppLnkSearch();
29 29
30protected: 30 virtual void setSearch(QRegExp);
31 virtual void load(); 31 virtual void load();
32 virtual int search(); 32 virtual int search();
33 virtual void insertItem( void* ); 33 virtual void insertItem( void* );
34 34
35 AppLnkSet *_apps; 35 AppLnkSet *_apps;
36}; 36};
37 37
38#endif 38#endif
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h
index ebe1193..35949f0 100644
--- a/core/pim/osearch/searchgroup.h
+++ b/core/pim/osearch/searchgroup.h
@@ -1,49 +1,48 @@
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
18class QRegExp; 18class QRegExp;
19 19
20/** 20/**
21@author Patrick S. Vogt 21@author Patrick S. Vogt
22*/ 22*/
23class SearchGroup : public OListViewItem 23class SearchGroup : public OListViewItem
24{ 24{
25public: 25public:
26 SearchGroup(QListView* parent, QString name); 26 SearchGroup(QListView* parent, QString name);
27 27
28 ~SearchGroup(); 28 ~SearchGroup();
29 29
30 virtual void expand(); 30 virtual void expand();
31 virtual void setSearch(QString); 31 virtual void setSearch(QString);
32 virtual void setSearch(QRegExp); 32 virtual void setSearch(QRegExp);
33 virtual int rtti() { return Searchgroup;} 33 virtual int rtti() { return Searchgroup;}
34 34
35 35
36 36
37protected: 37protected:
38 QRegExp _search; 38 QRegExp _search;
39 virtual void load() = 0; 39 virtual void load() = 0;
40 virtual int search() = 0; 40 virtual int search() = 0;
41 virtual void insertItem( void* ) = 0; 41 virtual void insertItem( void* ) = 0;
42private:
43 void clearList(); 42 void clearList();
44 QString _name; 43 QString _name;
45 bool expanded; 44 bool expanded;
46 bool loaded; 45 bool loaded;
47}; 46};
48 47
49#endif 48#endif