Changeset View
Changeset View
Standalone View
Standalone View
addons/openselection/plugin_kateopenselection.h
- This file was added.
1 | /* This file is part of the KDE project | ||||
---|---|---|---|---|---|
2 | Copyright (C) 2019 Arnaud Ruiz | ||||
3 | | ||||
4 | Created from large parts of: | ||||
5 | - openheader plugin | ||||
6 | Copyright (C) 2001 Joseph Wenninger | ||||
7 | Copyright (C) 2009 Erlend Hamberg <ehamberg@gmail.com> | ||||
8 | - search plugin | ||||
9 | Copyright (C) 2011-2013 by Kåre Särs <kare.sars@iki.fi> | ||||
10 | | ||||
11 | This library is free software; you can redistribute it and/or | ||||
12 | modify it under the terms of the GNU Library General Public | ||||
13 | License version 2 as published by the Free Software Foundation. | ||||
14 | | ||||
15 | This library is distributed in the hope that it will be useful, | ||||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
18 | Library General Public License for more details. | ||||
19 | | ||||
20 | You should have received a copy of the GNU Library General Public License | ||||
21 | along with this library; see the file COPYING.LIB. If not, write to | ||||
22 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
23 | Boston, MA 02110-1301, USA. | ||||
24 | */ | ||||
25 | | ||||
26 | | ||||
27 | #ifndef PLUGIN_KATEOPENSELECTION_H | ||||
28 | #define PLUGIN_KATEOPENSELECTION_H | ||||
29 | | ||||
30 | #include <ktexteditor/plugin.h> | ||||
31 | #include <ktexteditor/mainwindow.h> | ||||
32 | #include <KTextEditor/Command> | ||||
33 | #include <KXMLGUIClient> | ||||
34 | #include <kpluginfactory.h> | ||||
35 | #include <QObject> | ||||
36 | #include <QUrl> | ||||
37 | | ||||
38 | class PluginKateOpenSelection : public KTextEditor::Plugin | ||||
39 | { | ||||
40 | Q_OBJECT | ||||
41 | | ||||
42 | public: | ||||
43 | explicit PluginKateOpenSelection( QObject* parent = nullptr, const QList<QVariant>& = QList<QVariant>() ); | ||||
44 | ~PluginKateOpenSelection() override; | ||||
45 | | ||||
46 | QObject *createView (KTextEditor::MainWindow *mainWindow) override; | ||||
47 | | ||||
48 | public Q_SLOTS: | ||||
49 | void slotOpenSelection(); | ||||
50 | | ||||
51 | private: | ||||
52 | bool fileExists(const QUrl &url); | ||||
53 | }; | ||||
54 | | ||||
55 | class PluginViewKateOpenSelection | ||||
56 | : public KTextEditor::Command | ||||
57 | , public KXMLGUIClient | ||||
58 | { | ||||
59 | Q_OBJECT | ||||
60 | public: | ||||
61 | PluginViewKateOpenSelection(PluginKateOpenSelection* plugin, KTextEditor::MainWindow *mainwindow); | ||||
62 | ~PluginViewKateOpenSelection() override; | ||||
63 | | ||||
64 | bool exec (KTextEditor::View *view, const QString &cmd, QString &msg, const KTextEditor::Range &range = KTextEditor::Range::invalid()) override; | ||||
65 | bool help (KTextEditor::View *view, const QString &cmd, QString &msg) override; | ||||
66 | | ||||
67 | private: | ||||
68 | PluginKateOpenSelection* m_plugin; | ||||
69 | KTextEditor::MainWindow *m_mainWindow; | ||||
70 | }; | ||||
71 | | ||||
72 | #endif // PLUGIN_KATEOPENSELECTION_H |