Commit 4683c03b authored by Antonio Rojas's avatar Antonio Rojas
Browse files

Don't show "Add network folder" button if knetattach is not available

knetattach is part of plasma-desktop, so it doesn't necessarily have to be installed.
In that case, instead of showing a button that doesn't do anything, don't show it at all.
parent 9fde9035
Pipeline #47819 passed with stage
in 6 minutes and 52 seconds
......@@ -260,9 +260,9 @@ QPushButton *DolphinNavigatorsWidgetAction::newNetworkFolderButton(const Dolphin
auto networkFolderButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-add")),
i18nc("@action:button", "Add Network Folder"), parent);
networkFolderButton->setFlat(true);
KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("org.kde.knetattach"));
connect(networkFolderButton, &QPushButton::clicked,
this, [networkFolderButton]() {
KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("org.kde.knetattach"));
this, [networkFolderButton, service]() {
auto *job = new KIO::ApplicationLauncherJob(service, networkFolderButton);
auto *delegate = new KNotificationJobUiDelegate;
delegate->setAutoErrorHandlingEnabled(true);
......@@ -270,8 +270,8 @@ QPushButton *DolphinNavigatorsWidgetAction::newNetworkFolderButton(const Dolphin
job->start();
});
networkFolderButton->hide();
connect(urlNavigator, &KUrlNavigator::urlChanged, this, [networkFolderButton, urlNavigator]() {
networkFolderButton->setVisible(urlNavigator->locationUrl().scheme() == QLatin1String("remote"));
connect(urlNavigator, &KUrlNavigator::urlChanged, this, [networkFolderButton, urlNavigator, service]() {
networkFolderButton->setVisible(service && urlNavigator->locationUrl().scheme() == QLatin1String("remote"));
});
return networkFolderButton;
}
......
Markdown is supported
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