123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- From 36ede44fc7bef479e94f76121309a900bee2b29f Mon Sep 17 00:00:00 2001
- From: Christoph Cullmann <cullmann@kde.org>
- Date: Mon, 16 May 2022 19:49:02 +0200
- Subject: [PATCH] Revert "Create filebrowser on demand"
- This reverts commit 7caed2681d18d9ea08c35f160e88fb44a2e52769.
- BUG: 453795
- revert full lazy loading, doesn't work this way
- ---
- addons/filebrowser/katefilebrowser.cpp | 2 -
- addons/filebrowser/katefilebrowserplugin.cpp | 41 ++++++--------------
- addons/filebrowser/katefilebrowserplugin.h | 14 +++----
- 3 files changed, 18 insertions(+), 39 deletions(-)
- diff --git a/addons/filebrowser/katefilebrowser.cpp b/addons/filebrowser/katefilebrowser.cpp
- index 54c1fa1fb..a1e5e4eba 100644
- --- a/addons/filebrowser/katefilebrowser.cpp
- +++ b/addons/filebrowser/katefilebrowser.cpp
- @@ -115,8 +115,6 @@ KateFileBrowser::KateFileBrowser(KTextEditor::MainWindow *mainWindow, QWidget *p
- connect(m_mainWindow, &KTextEditor::MainWindow::viewChanged, this, &KateFileBrowser::autoSyncFolder);
-
- connect(m_dirOperator, &KDirOperator::contextMenuAboutToShow, this, &KateFileBrowser::contextMenuAboutToShow);
- -
- - autoSyncFolder();
- }
-
- KateFileBrowser::~KateFileBrowser()
- diff --git a/addons/filebrowser/katefilebrowserplugin.cpp b/addons/filebrowser/katefilebrowserplugin.cpp
- index f03c78698..3e415b025 100644
- --- a/addons/filebrowser/katefilebrowserplugin.cpp
- +++ b/addons/filebrowser/katefilebrowserplugin.cpp
- @@ -52,10 +52,7 @@ KTextEditor::ConfigPage *KateFileBrowserPlugin::configPage(int number, QWidget *
- if (number != 0) {
- return nullptr;
- }
- - if (!m_views[0]->m_fileBrowser) {
- - m_views[0]->createFileBrowser(true);
- - }
- - return new KateFileBrowserConfigPage(parent, m_views[0]->m_fileBrowser.get());
- + return new KateFileBrowserConfigPage(parent, m_views[0]->m_fileBrowser);
- }
- // END KateFileBrowserPlugin
-
- @@ -67,50 +64,34 @@ KateFileBrowserPluginView::KateFileBrowserPluginView(KTextEditor::Plugin *plugin
- KTextEditor::MainWindow::Left,
- QIcon::fromTheme(QStringLiteral("document-open")),
- i18n("Filesystem")))
- + , m_fileBrowser(new KateFileBrowser(mainWindow, m_toolView))
- , m_mainWindow(mainWindow)
- {
- m_toolView->installEventFilter(this);
- - connect(m_toolView.get(), SIGNAL(toolVisibleChanged(bool)), this, SLOT(createFileBrowser(bool)));
- }
-
- -void KateFileBrowserPluginView::readSessionConfig(const KConfigGroup &config)
- +KateFileBrowserPluginView::~KateFileBrowserPluginView()
- {
- - if (m_fileBrowser) {
- - m_fileBrowser->readSessionConfig(config);
- - } else {
- - cg.reset(new KConfigGroup(config));
- - }
- + // cleanup, kill toolview + console
- + delete m_fileBrowser->parentWidget();
- }
-
- -void KateFileBrowserPluginView::writeSessionConfig(KConfigGroup &config)
- +void KateFileBrowserPluginView::readSessionConfig(const KConfigGroup &config)
- {
- - if (m_fileBrowser) {
- - m_fileBrowser->writeSessionConfig(config);
- - }
- + m_fileBrowser->readSessionConfig(config);
- }
-
- -void KateFileBrowserPluginView::createFileBrowser(bool visible)
- +void KateFileBrowserPluginView::writeSessionConfig(KConfigGroup &config)
- {
- - if (!visible) {
- - return;
- - }
- -
- - // we must not have a filebrowser
- - Q_ASSERT(!m_fileBrowser);
- -
- - disconnect(m_toolView.get(), SIGNAL(toolVisibleChanged(bool)), this, SLOT(createFileBrowser(bool)));
- - m_fileBrowser = std::make_unique<KateFileBrowser>(m_mainWindow, m_toolView.get());
- - m_fileBrowser->readSessionConfig(*cg);
- - // delete the config now
- - cg.reset();
- + m_fileBrowser->writeSessionConfig(config);
- }
-
- bool KateFileBrowserPluginView::eventFilter(QObject *obj, QEvent *event)
- {
- if (event->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent *>(event);
- - if ((obj == m_toolView.get()) && (ke->key() == Qt::Key_Escape)) {
- - m_mainWindow->hideToolView(m_toolView.get());
- + if ((obj == m_toolView) && (ke->key() == Qt::Key_Escape)) {
- + m_mainWindow->hideToolView(m_toolView);
- event->accept();
- return true;
- }
- diff --git a/addons/filebrowser/katefilebrowserplugin.h b/addons/filebrowser/katefilebrowserplugin.h
- index 2517d3453..9fb6610c4 100644
- --- a/addons/filebrowser/katefilebrowserplugin.h
- +++ b/addons/filebrowser/katefilebrowserplugin.h
- @@ -11,15 +11,12 @@
- #ifndef KATE_FILEBROWSER_PLUGIN_H
- #define KATE_FILEBROWSER_PLUGIN_H
-
- -#include <KConfigGroup>
- #include <KTextEditor/SessionConfigInterface>
- #include <ktexteditor/configpage.h>
- #include <ktexteditor/document.h>
- #include <ktexteditor/mainwindow.h>
- #include <ktexteditor/plugin.h>
-
- -#include <memory>
- -
- class KateFileBrowser;
- class KateFileBrowserPluginView;
-
- @@ -56,16 +53,19 @@ public:
- */
- KateFileBrowserPluginView(KTextEditor::Plugin *plugin, KTextEditor::MainWindow *mainWindow);
-
- + /**
- + * Virtual destructor.
- + */
- + ~KateFileBrowserPluginView() override;
- +
- void readSessionConfig(const KConfigGroup &config) override;
- void writeSessionConfig(KConfigGroup &config) override;
-
- private:
- bool eventFilter(QObject *, QEvent *) override;
- - Q_SLOT void createFileBrowser(bool visible);
-
- - std::unique_ptr<QWidget> m_toolView;
- - std::unique_ptr<KateFileBrowser> m_fileBrowser = nullptr;
- - std::unique_ptr<KConfigGroup> cg;
- + QWidget *m_toolView;
- + KateFileBrowser *m_fileBrowser;
- KTextEditor::MainWindow *m_mainWindow;
- friend class KateFileBrowserPlugin;
- };
- --
- GitLab
|