-rw-r--r-- | core/pim/osearch/doclnksearch.cpp | 4 | ||||
-rw-r--r-- | core/pim/osearch/searchgroup.h | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp index ef0e482..26097a4 100644 --- a/core/pim/osearch/doclnksearch.cpp +++ b/core/pim/osearch/doclnksearch.cpp | |||
@@ -1,93 +1,95 @@ | |||
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 | 13 | ||
14 | #include <qaction.h> | 14 | #include <qaction.h> |
15 | #include <qfile.h> | 15 | #include <qfile.h> |
16 | #include <qiconset.h> | 16 | #include <qiconset.h> |
17 | #include <qpopupmenu.h> | 17 | #include <qpopupmenu.h> |
18 | #include <qtextstream.h> | 18 | #include <qtextstream.h> |
19 | #include <qpe/applnk.h> | 19 | #include <qpe/applnk.h> |
20 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <opie/owait.h> | 23 | #include <opie/owait.h> |
24 | 24 | ||
25 | #include "doclnkitem.h" | 25 | #include "doclnkitem.h" |
26 | #include "doclnksearch.h" | 26 | #include "doclnksearch.h" |
27 | 27 | ||
28 | DocLnkSearch::DocLnkSearch(QListView* parent, QString name) | 28 | DocLnkSearch::DocLnkSearch(QListView* parent, QString name) |
29 | : AppLnkSearch(parent, name), _popupMenu(0) | 29 | : AppLnkSearch(parent, name), _popupMenu(0) |
30 | { | 30 | { |
31 | QIconSet is = Resource::loadIconSet( "osearch/documents" ); | 31 | QIconSet is = Resource::loadIconSet( "osearch/documents" ); |
32 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); | 32 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); |
33 | 33 | ||
34 | actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true ); | 34 | actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true ); |
35 | Config cfg( "osearch", Config::User ); | 35 | Config cfg( "osearch", Config::User ); |
36 | cfg.setGroup( "doclnk_settings" ); | 36 | cfg.setGroup( "doclnk_settings" ); |
37 | actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) ); | 37 | actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) ); |
38 | } | 38 | } |
39 | 39 | ||
40 | 40 | ||
41 | DocLnkSearch::~DocLnkSearch() | 41 | DocLnkSearch::~DocLnkSearch() |
42 | { | 42 | { |
43 | Config cfg( "osearch", Config::User ); | 43 | Config cfg( "osearch", Config::User ); |
44 | cfg.setGroup( "doclnk_settings" ); | 44 | cfg.setGroup( "doclnk_settings" ); |
45 | cfg.writeEntry( "search_content", actionSearchInFiles->isOn() ); | 45 | cfg.writeEntry( "search_content", actionSearchInFiles->isOn() ); |
46 | } | 46 | } |
47 | 47 | ||
48 | void DocLnkSearch::load() | 48 | void DocLnkSearch::load() |
49 | { | 49 | { |
50 | _apps = new DocLnkSet(QPEApplication::documentDir()); | 50 | _apps = new DocLnkSet(QPEApplication::documentDir()); |
51 | } | 51 | } |
52 | 52 | ||
53 | bool DocLnkSearch::searchFile( AppLnk *app ) | 53 | bool DocLnkSearch::searchFile( AppLnk *app ) |
54 | { | 54 | { |
55 | if (!actionSearchInFiles->isOn()) return false; | 55 | if (!actionSearchInFiles->isOn()) return false; |
56 | DocLnk *doc = (DocLnk*)app; | 56 | DocLnk *doc = (DocLnk*)app; |
57 | bool found = false; | 57 | bool found = false; |
58 | if ( doc->type().contains( "text" ) ){ | 58 | if ( doc->type().contains( "text" ) ){ |
59 | #ifdef NEW_OWAIT | 59 | #ifdef NEW_OWAIT |
60 | QString ouput = QObject::tr("searching %1").arg(doc->file()); | 60 | QString ouput = QObject::tr("searching %1").arg(doc->file()); |
61 | OWait( output ); | 61 | OWait( output ); |
62 | #endif | 62 | #endif |
63 | QFile f(doc->file()); | 63 | QFile f(doc->file()); |
64 | if ( f.open(IO_ReadOnly) ) { | 64 | if ( f.open(IO_ReadOnly) ) { |
65 | QTextStream t( &f ); | 65 | QTextStream t( &f ); |
66 | while ( !t.eof() ) | 66 | while ( !t.eof() ) |
67 | if (_search.match( t.readLine()) != -1) { | 67 | if (_search.match( t.readLine()) != -1) { |
68 | found = true; | 68 | found = true; |
69 | break; | 69 | break; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | f.close(); | 72 | f.close(); |
73 | } | 73 | } |
74 | return found; | 74 | return found; |
75 | } | 75 | } |
76 | 76 | ||
77 | void DocLnkSearch::insertItem( void *rec ) | 77 | void DocLnkSearch::insertItem( void *rec ) |
78 | { | 78 | { |
79 | (void)new DocLnkItem( this, (DocLnk*)rec ); | 79 | (void)new DocLnkItem( this, (DocLnk*)rec ); |
80 | _resultCount++; | 80 | _resultCount++; |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | QPopupMenu* DocLnkSearch::popupMenu() | 84 | QPopupMenu* DocLnkSearch::popupMenu() |
85 | { | 85 | { |
86 | if (!_popupMenu){ | 86 | if (!_popupMenu){ |
87 | _popupMenu = new QPopupMenu( 0 ); | 87 | _popupMenu = new QPopupMenu( 0 ); |
88 | actionSearchInFiles->addTo( _popupMenu ); | 88 | actionSearchInFiles->addTo( _popupMenu ); |
89 | } | 89 | } |
90 | return _popupMenu; | 90 | return _popupMenu; |
91 | (void) new DocLnkItem( this, (DocLnk*)rec ); | 91 | //(void) new DocLnkItem( this, (DocLnk*)rec ); |
92 | // rec is undeclared here | ||
93 | #warning FIXME | ||
92 | _resultCount++; | 94 | _resultCount++; |
93 | } | 95 | } |
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h index 23aa82a..48097ab 100644 --- a/core/pim/osearch/searchgroup.h +++ b/core/pim/osearch/searchgroup.h | |||
@@ -1,49 +1,49 @@ | |||
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 | ||
18 | class QRegExp; | 18 | class QRegExp; |
19 | class QPopupMenu; | 19 | class QPopupMenu; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | @author Patrick S. Vogt | 22 | @author Patrick S. Vogt |
23 | */ | 23 | */ |
24 | class SearchGroup : public OListViewItem | 24 | class SearchGroup : public OListViewItem |
25 | { | 25 | { |
26 | public: | 26 | public: |
27 | SearchGroup(QListView* parent, QString name); | 27 | SearchGroup(QListView* parent, QString name); |
28 | 28 | ||
29 | ~SearchGroup(); | 29 | ~SearchGroup(); |
30 | int _resultCount; | ||
30 | 31 | ||
31 | virtual void expand(); | 32 | virtual void expand(); |
32 | virtual void doSearch(); | 33 | virtual void doSearch(); |
33 | virtual void setSearch(QRegExp); | 34 | virtual void setSearch(QRegExp); |
34 | virtual int rtti() { return Searchgroup;} | 35 | virtual int rtti() { return Searchgroup;} |
35 | 36 | ||
36 | protected: | 37 | protected: |
37 | virtual void load() = 0; | 38 | virtual void load() = 0; |
38 | virtual int search() = 0; | 39 | virtual int search() = 0; |
39 | virtual void insertItem( void* ) = 0; | 40 | virtual void insertItem( void* ) = 0; |
40 | QRegExp _search; | 41 | QRegExp _search; |
41 | QRegExp _lastSearch; | 42 | QRegExp _lastSearch; |
42 | QString _name; | 43 | QString _name; |
43 | private: | 44 | private: |
44 | int realSearch(); | 45 | int realSearch(); |
45 | bool loaded :1; | 46 | bool loaded :1; |
46 | int _resultCount; | ||
47 | }; | 47 | }; |
48 | 48 | ||
49 | #endif | 49 | #endif |