From 630b7196d93786595546565329160ff26332704b Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 12 Feb 2010 18:09:55 +0000 Subject: Added KDE3 version of kio-locate git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kio-locate@1089224 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/locater.h | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 src/locater.h (limited to 'src/locater.h') diff --git a/src/locater.h b/src/locater.h new file mode 100644 index 0000000..e083d2a --- /dev/null +++ b/src/locater.h @@ -0,0 +1,103 @@ +/*************************************************************************** + * kio-locate: KDE I/O Slave for the locate command * + * * + * Copyright (C) 2005 by Tobi Vollebregt * + * tobivollebregt@gmail.com * + * * + * Thanks to Google's Summer Of Code Program! * + * * + * Copyright (C) 2004 by Armin Straub * + * linux@arminstraub.de * + * * + * 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 * + * michael@schuerig.de * + * * + * * + * 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 +#include + +#include + + +#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 QObject +{ + Q_OBJECT + public: + /** + * Constructor + */ + Locater(QObject *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 QString& 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 QString& binary = "", const QString& additionalArguments = ""); + + void stop(); + + QString 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 QStringList& items); + + /** + * Emitted when the search is finished. + */ + void finished(); + + private slots: + void gotOutput(KProcIO* proc); + void finished(KProcess* proc); + + private: + KProcIO m_process; + QString m_binary; + QString m_additionalArguments; + bool m_binaryExists; +}; + +#endif -- cgit v1.2.1