Commit e33e807e authored by Eric Armbruster's avatar Eric Armbruster 🍁
Browse files

Hide openFolderButton if the plugin is not loaded

parent 39d545c6
Pipeline #234539 passed with stage
in 41 minutes and 48 seconds
......@@ -1502,20 +1502,6 @@ void KateViewManager::showWelcomeView()
return;
auto welcomeView = new WelcomeView(this);
connect(welcomeView, &WelcomeView::openDocumentClicked, this, &KateViewManager::slotDocumentOpen);
connect(welcomeView, &WelcomeView::newDocumentClicked, this, &KateViewManager::slotDocumentNew);
connect(welcomeView, &WelcomeView::recentItemClicked, this, [this](const QUrl &url) {
openUrl(url);
});
connect(welcomeView, &WelcomeView::forgetRecentItem, this, &KateViewManager::forgetRecentItem);
QObject *project = mainWindow()->pluginView(QStringLiteral("kateprojectplugin"));
if (project) {
connect(welcomeView, &WelcomeView::openFolderClicked, this, [this, project]() {
QMetaObject::invokeMethod(project, "openDirectoryOrProject");
});
}
auto recentFilesAction = mainWindow()->recentFilesAction();
connect(recentFilesAction, &KRecentFilesAction::recentListCleared, this, &KateViewManager::refreshRecentsOnWelcomeView);
connect(welcomeView, &WelcomeView::forgetAllRecents, recentFilesAction, &KRecentFilesAction::clear);
......
......@@ -24,6 +24,7 @@
#include <klocalizedstring.h>
#include "kateapp.h"
#include "kateviewmanager.h"
#include "kateviewspace.h"
#include "recentitemsmodel.h"
......@@ -130,9 +131,23 @@ WelcomeView::WelcomeView(QWidget *parent)
welcomeLabel->setText(KateApp::isKate() ? i18n("Welcome to Kate") : i18n("Welcome to KWrite"));
appIcon->setPixmap(qApp->windowIcon().pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous));
connect(openDocumentButton, &QPushButton::clicked, this, &WelcomeView::openDocumentClicked);
connect(openFolderButton, &QPushButton::clicked, this, &WelcomeView::openFolderClicked);
connect(newDocumentButton, &QPushButton::clicked, this, &WelcomeView::newDocumentClicked);
auto viewManager = qobject_cast<KateViewManager *>(parent);
connect(this, &WelcomeView::recentItemClicked, viewManager, [viewManager](const QUrl &url) {
viewManager->openUrl(url);
});
connect(this, &WelcomeView::forgetRecentItem, viewManager, &KateViewManager::forgetRecentItem);
connect(openDocumentButton, &QPushButton::clicked, viewManager, &KateViewManager::slotDocumentOpen);
connect(newDocumentButton, &QPushButton::clicked, viewManager, &KateViewManager::slotDocumentNew);
QObject *project = viewManager->mainWindow()->pluginView(QStringLiteral("kateprojectplugin"));
if (project) {
connect(openFolderButton, &QPushButton::clicked, viewManager, [project]() {
QMetaObject::invokeMethod(project, "openDirectoryOrProject");
});
} else {
openFolderButton->setVisible(false);
}
recentsListView->setContextMenuPolicy(Qt::DefaultContextMenu);
recentsListView->setModel(m_recentsModel);
......
......@@ -37,9 +37,6 @@ public Q_SLOTS:
}
Q_SIGNALS:
void openDocumentClicked();
void openFolderClicked();
void newDocumentClicked();
void recentItemClicked(QUrl const &url);
void forgetAllRecents();
void forgetRecentItem(QUrl const &url);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment