Warning, file /utilities/kate/addons/filetree/katefiletreeplugin.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2010 Thomas Fjellstrom <thomas@fjellstrom.ca> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QTimer> 0010 0011 #include <KTextEditor/Plugin> 0012 #include <ktexteditor/document.h> 0013 #include <ktexteditor/editor.h> 0014 #include <ktexteditor/mainwindow.h> 0015 #include <ktexteditor/sessionconfiginterface.h> 0016 0017 #include "katefiletreepluginsettings.h" 0018 0019 #include <KXMLGUIClient> 0020 0021 class QToolBar; 0022 0023 class KateFileTree; 0024 class KateFileTreeModel; 0025 class KateFileTreeProxyModel; 0026 class KateFileTreeConfigPage; 0027 class KateFileTreePluginView; 0028 0029 class QLineEdit; 0030 0031 class KateFileTreePlugin : public KTextEditor::Plugin 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 explicit KateFileTreePlugin(QObject *parent = nullptr, const QVariantList & = QVariantList()); 0037 ~KateFileTreePlugin() override; 0038 0039 QObject *createView(KTextEditor::MainWindow *mainWindow) override; 0040 0041 int configPages() const override; 0042 KTextEditor::ConfigPage *configPage(int number = 0, QWidget *parent = nullptr) override; 0043 0044 const KateFileTreePluginSettings &settings(); 0045 0046 void applyConfig(bool shadingEnabled, 0047 const QColor &viewShade, 0048 const QColor &editShade, 0049 bool listMode, 0050 int sortRole, 0051 bool showFullPath, 0052 bool showToolbar, 0053 bool closeButton); 0054 0055 public Q_SLOTS: 0056 void viewDestroyed(QObject *view); 0057 0058 private: 0059 QList<KateFileTreePluginView *> m_views; 0060 KateFileTreePluginSettings m_settings; 0061 }; 0062 0063 class KateFileTreePluginView : public QObject, public KXMLGUIClient, public KTextEditor::SessionConfigInterface 0064 { 0065 Q_OBJECT 0066 0067 Q_INTERFACES(KTextEditor::SessionConfigInterface) 0068 0069 public: 0070 /** 0071 * Constructor. 0072 */ 0073 KateFileTreePluginView(KTextEditor::MainWindow *mainWindow, KateFileTreePlugin *plug); 0074 0075 /** 0076 * Virtual destructor. 0077 */ 0078 ~KateFileTreePluginView() override; 0079 0080 void readSessionConfig(const KConfigGroup &config) override; 0081 void writeSessionConfig(KConfigGroup &config) override; 0082 0083 /** 0084 * The file tree model. 0085 * @return the file tree model 0086 */ 0087 KateFileTreeModel *model() const; 0088 /** 0089 * The file tree proxy model. 0090 * @return the file tree proxy model 0091 */ 0092 KateFileTreeProxyModel *proxy() const; 0093 /** 0094 * The file tree. 0095 * @return the file tree 0096 */ 0097 KateFileTree *tree() const; 0098 0099 void setToolbarVisible(bool); 0100 void setListMode(bool listMode); 0101 0102 bool hasLocalPrefs() const; 0103 void setHasLocalPrefs(bool); 0104 0105 KTextEditor::MainWindow *mainWindow() const 0106 { 0107 return m_mainWindow; 0108 } 0109 0110 protected: 0111 void setupActions(); 0112 0113 private: 0114 QWidget *m_toolView; 0115 QToolBar *m_toolbar; 0116 KateFileTree *m_fileTree; 0117 KateFileTreeProxyModel *m_proxyModel; 0118 QLineEdit *m_filter; 0119 KateFileTreeModel *m_documentModel; 0120 bool m_hasLocalPrefs = false; 0121 KateFileTreePlugin *m_plug; 0122 KTextEditor::MainWindow *m_mainWindow; 0123 QTimer m_documentsCreatedTimer; 0124 QList<KTextEditor::Document *> m_documentsCreated; 0125 0126 private Q_SLOTS: 0127 void showToolView(); 0128 void hideToolView(); 0129 void showActiveDocument(); 0130 void activateDocument(KTextEditor::Document *); 0131 void viewChanged(KTextEditor::View * = nullptr); 0132 void documentOpened(KTextEditor::Document *); 0133 void documentClosed(KTextEditor::Document *); 0134 void viewModeChanged(bool); 0135 void sortRoleChanged(int); 0136 void slotDocumentsCreated(); 0137 void slotDocumentSave() const; 0138 void slotDocumentSaveAs() const; 0139 0140 void slotWidgetCreated(QWidget *); 0141 void slotWidgetRemoved(QWidget *); 0142 };