blob: 229f3f2ee9b97085b1b276b460b0726bd22667f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/***************************************************************************
* tdeio-locate: KDE I/O Slave for the locate command *
* *
* Copyright (C) 2005 by Tobi Vollebregt *
* [email protected] *
* *
* Thanks to Google's Summer Of Code Program! *
* *
* Copyright (C) 2004 by Armin Straub *
* [email protected] *
* *
* This program was initially written by Michael Schuerig. *
* Although I have completely rewritten it, most ideas are adopted *
* from his original work. *
* *
* Copyright (C) 2002 by Michael Schuerig *
* [email protected] *
* *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef LOCATER_H
#define LOCATER_H
#include <tqobject.h>
#include <tqstringlist.h>
#include <kprocio.h>
#define DEBUGSTR kdDebug(7199)
/**
* Interface to the locate command.
*
* Usage is very simple:
* - Calling locate searches for the given pattern.
* - You can then collect the found files by connecting to the signal
* found.
* - When finished the signal finished is emitted.
*/
class Locater : public TQObject
{
Q_OBJECT
public:
/**
* Constructor
*/
Locater(TQObject *parent = 0, const char *name = 0);
virtual ~Locater();
/**
* Starts the search.
* @param pattern the pattern to search for
* @param ignoreCase whether to ignore case or not
* @param regExp whether to treat pattern as a regular expression or not
* @return true if locate could be started
*/
bool locate(const TQString& pattern, bool ignoreCase = false, bool regExp = false);
/**
* Set parameters for using locate.
* @param binary the binary to use (default: automatically chosen from
* slocate, rlocate and locate)
* @param additionalArguments additional arguments to use
*/
void setupLocate(const TQString& binary = "", const TQString& additionalArguments = "");
void stop();
TQString binary() { return m_binary; }
bool binaryExists() { return m_binaryExists; }
signals:
/**
* Emitted whenever some new files are found.
* @param items a list of the new filenames
*/
void found(const TQStringList& items);
/**
* Emitted when the search is finished.
*/
void finished();
private slots:
void gotOutput(KProcIO* proc);
void finished(TDEProcess* proc);
private:
KProcIO m_process;
TQString m_binary;
TQString m_additionalArguments;
bool m_binaryExists;
};
#endif
|