File indexing completed on 2024-04-28 04:38:54
0001 /* 0002 SPDX-FileCopyrightText: 1999-2001 Bernd Gehrmann <bernd@kdevelop.org> 0003 SPDX-FileCopyrightText: 2010 Julien Desgats <julien.desgats@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KDEVPLATFORM_PLUGIN_GREPVIEWPLUGIN_H 0009 #define KDEVPLATFORM_PLUGIN_GREPVIEWPLUGIN_H 0010 0011 #include <interfaces/iplugin.h> 0012 0013 #include <QVector> 0014 #include <QPointer> 0015 #include <QVariant> 0016 0017 class KJob; 0018 class GrepDialog; 0019 class GrepJob; 0020 class GrepOutputViewFactory; 0021 0022 class GrepViewPlugin : public KDevelop::IPlugin 0023 { 0024 Q_OBJECT 0025 Q_CLASSINFO( "D-Bus Interface", "org.kdevelop.GrepViewPlugin" ) 0026 0027 public: 0028 explicit GrepViewPlugin( QObject *parent, const QVariantList & = QVariantList() ); 0029 ~GrepViewPlugin() override; 0030 0031 void unload() override; 0032 0033 void rememberSearchDirectory(QString const & directory); 0034 KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context, QWidget* parent) override; 0035 void showDialog(bool setLastUsed = false, const QString& pattern = QString(), bool show = true); 0036 0037 /** 0038 * Returns a new instance of GrepJob. Since the plugin supports only one job at the same time, 0039 * previous job, if any, is killed before creating a new job. 0040 */ 0041 GrepJob *newGrepJob(); 0042 GrepJob *grepJob(); 0043 GrepOutputViewFactory* toolViewFactory() const; 0044 public Q_SLOTS: 0045 ///@param pattern the pattern to search 0046 ///@param directory the directory, or a semicolon-separated list of files 0047 ///@param show whether the search dialog should be shown. if false, 0048 /// the parameters of the last search will be used. 0049 Q_SCRIPTABLE void startSearch(const QString& pattern, const QString& directory, bool show); 0050 0051 Q_SIGNALS: 0052 void grepJobFinished(bool success); 0053 0054 private Q_SLOTS: 0055 void showDialogFromMenu(); 0056 void showDialogFromProject(); 0057 void jobFinished(KJob *job); 0058 0059 private: 0060 GrepJob *m_currentJob; 0061 QVector<QPointer<GrepDialog>> m_currentDialogs; 0062 QString m_directory; 0063 QString m_contextMenuDirectory; 0064 GrepOutputViewFactory* m_factory; 0065 }; 0066 0067 #endif