File indexing completed on 2024-05-05 05:51:24
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2001 Christoph Cullmann <cullmann@kde.org> 0003 SPDX-FileCopyrightText: 2001 Joseph Wenninger <jowenn@kde.org> 0004 SPDX-FileCopyrightText: 2001 Anders Lund <anders.lund@lund.tdcadsl.dk> 0005 SPDX-FileCopyrightText: 2007 Mirko Stocker <me@misto.ch> 0006 SPDX-FileCopyrightText: 2009 Dominik Haumann <dhaumann kde org> 0007 0008 SPDX-License-Identifier: LGPL-2.0-only 0009 */ 0010 0011 #pragma once 0012 0013 #include <KTextEditor/SessionConfigInterface> 0014 #include <ktexteditor/configpage.h> 0015 #include <ktexteditor/document.h> 0016 #include <ktexteditor/mainwindow.h> 0017 #include <ktexteditor/plugin.h> 0018 0019 class KateFileBrowser; 0020 class KateFileBrowserPluginView; 0021 0022 class KateFileBrowserPlugin : public KTextEditor::Plugin 0023 { 0024 Q_OBJECT 0025 0026 public: 0027 explicit KateFileBrowserPlugin(QObject *parent = nullptr, const QVariantList & = QVariantList()); 0028 ~KateFileBrowserPlugin() override 0029 { 0030 } 0031 0032 QObject *createView(KTextEditor::MainWindow *mainWindow) override; 0033 0034 int configPages() const override; 0035 KTextEditor::ConfigPage *configPage(int number = 0, QWidget *parent = nullptr) override; 0036 0037 public Q_SLOTS: 0038 void viewDestroyed(QObject *view); 0039 0040 private: 0041 QList<KateFileBrowserPluginView *> m_views; 0042 }; 0043 0044 class KateFileBrowserPluginView : public QObject, public KTextEditor::SessionConfigInterface 0045 { 0046 Q_OBJECT 0047 Q_INTERFACES(KTextEditor::SessionConfigInterface) 0048 0049 public: 0050 /** 0051 * Constructor. 0052 */ 0053 KateFileBrowserPluginView(KTextEditor::Plugin *plugin, KTextEditor::MainWindow *mainWindow); 0054 0055 /** 0056 * Virtual destructor. 0057 */ 0058 ~KateFileBrowserPluginView() override; 0059 0060 void readSessionConfig(const KConfigGroup &config) override; 0061 void writeSessionConfig(KConfigGroup &config) override; 0062 0063 private: 0064 bool eventFilter(QObject *, QEvent *) override; 0065 0066 QWidget *m_toolView; 0067 KateFileBrowser *m_fileBrowser; 0068 KTextEditor::MainWindow *m_mainWindow; 0069 friend class KateFileBrowserPlugin; 0070 };