summaryrefslogtreecommitdiff
path: root/core/pim/osearch/doclnksearch.cpp
Unidiff
Diffstat (limited to 'core/pim/osearch/doclnksearch.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/osearch/doclnksearch.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp
index c73dcbf..3f0d223 100644
--- a/core/pim/osearch/doclnksearch.cpp
+++ b/core/pim/osearch/doclnksearch.cpp
@@ -1,75 +1,74 @@
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 14
15#include "doclnkitem.h" 15#include "doclnkitem.h"
16#include "doclnksearch.h" 16#include "doclnksearch.h"
17 17
18#include <opie2/owait.h> 18#include <opie2/owait.h>
19 19
20#include <qpe/applnk.h> 20#include <qpe/applnk.h>
21#include <qpe/config.h> 21#include <qpe/config.h>
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24 24
25#include <qaction.h> 25#include <qaction.h>
26#include <qfile.h> 26#include <qfile.h>
27#include <qiconset.h>
28#include <qpopupmenu.h> 27#include <qpopupmenu.h>
29#include <qtextstream.h> 28#include <qtextstream.h>
30 29
31 30
32DocLnkSearch::DocLnkSearch(QListView* parent, QString name) 31DocLnkSearch::DocLnkSearch(QListView* parent, QString name)
33: AppLnkSearch(parent, name), _popupMenu(0) 32: AppLnkSearch(parent, name), _popupMenu(0)
34{ 33{
35 QIconSet is = Resource::loadIconSet( "osearch/documentsSmall" ); 34 QIconSet is = Resource::loadIconSet( "osearch/documentsSmall" );
36 setPixmap( 0, is.pixmap( QIconSet::Automatic, true ) ); 35 setPixmap( 0, is.pixmap( QIconSet::Automatic, true ) );
37 36
38 actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true ); 37 actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true );
39 Config cfg( "osearch", Config::User ); 38 Config cfg( "osearch", Config::User );
40 cfg.setGroup( "doclnk_settings" ); 39 cfg.setGroup( "doclnk_settings" );
41 actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) ); 40 actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) );
42} 41}
43 42
44 43
45DocLnkSearch::~DocLnkSearch() 44DocLnkSearch::~DocLnkSearch()
46{ 45{
47 Config cfg( "osearch", Config::User ); 46 Config cfg( "osearch", Config::User );
48 cfg.setGroup( "doclnk_settings" ); 47 cfg.setGroup( "doclnk_settings" );
49 cfg.writeEntry( "search_content", actionSearchInFiles->isOn() ); 48 cfg.writeEntry( "search_content", actionSearchInFiles->isOn() );
50} 49}
51 50
52void DocLnkSearch::load() 51void DocLnkSearch::load()
53{ 52{
54 _apps = new DocLnkSet(QPEApplication::documentDir()); 53 _apps = new DocLnkSet(QPEApplication::documentDir());
55} 54}
56 55
57bool DocLnkSearch::searchFile( AppLnk *app ) 56bool DocLnkSearch::searchFile( AppLnk *app )
58{ 57{
59 if (!actionSearchInFiles->isOn()) return false; 58 if (!actionSearchInFiles->isOn()) return false;
60 DocLnk *doc = (DocLnk*)app; 59 DocLnk *doc = (DocLnk*)app;
61 bool found = false; 60 bool found = false;
62 if ( doc->type().contains( "text" ) ){ 61 if ( doc->type().contains( "text" ) ){
63#ifdef NEW_OWAIT 62#ifdef NEW_OWAIT
64 QString ouput = QObject::tr("searching %1").arg(doc->file()); 63 QString ouput = QObject::tr("searching %1").arg(doc->file());
65 OWait( output ); 64 OWait( output );
66#endif 65#endif
67 QFile f(doc->file()); 66 QFile f(doc->file());
68 if ( f.open(IO_ReadOnly) ) { 67 if ( f.open(IO_ReadOnly) ) {
69 QTextStream t( &f ); 68 QTextStream t( &f );
70 while ( !t.eof() ) 69 while ( !t.eof() )
71 if (_search.match( t.readLine()) != -1) { 70 if (_search.match( t.readLine()) != -1) {
72 found = true; 71 found = true;
73 break; 72 break;
74 } 73 }
75 } 74 }