mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
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.
This commit is contained in:
parent
9fde9035a8
commit
4683c03be6
1 changed files with 4 additions and 4 deletions
|
@ -260,9 +260,9 @@ QPushButton *DolphinNavigatorsWidgetAction::newNetworkFolderButton(const Dolphin
|
||||||
auto networkFolderButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-add")),
|
auto networkFolderButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-add")),
|
||||||
i18nc("@action:button", "Add Network Folder"), parent);
|
i18nc("@action:button", "Add Network Folder"), parent);
|
||||||
networkFolderButton->setFlat(true);
|
networkFolderButton->setFlat(true);
|
||||||
connect(networkFolderButton, &QPushButton::clicked,
|
|
||||||
this, [networkFolderButton]() {
|
|
||||||
KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("org.kde.knetattach"));
|
KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("org.kde.knetattach"));
|
||||||
|
connect(networkFolderButton, &QPushButton::clicked,
|
||||||
|
this, [networkFolderButton, service]() {
|
||||||
auto *job = new KIO::ApplicationLauncherJob(service, networkFolderButton);
|
auto *job = new KIO::ApplicationLauncherJob(service, networkFolderButton);
|
||||||
auto *delegate = new KNotificationJobUiDelegate;
|
auto *delegate = new KNotificationJobUiDelegate;
|
||||||
delegate->setAutoErrorHandlingEnabled(true);
|
delegate->setAutoErrorHandlingEnabled(true);
|
||||||
|
@ -270,8 +270,8 @@ QPushButton *DolphinNavigatorsWidgetAction::newNetworkFolderButton(const Dolphin
|
||||||
job->start();
|
job->start();
|
||||||
});
|
});
|
||||||
networkFolderButton->hide();
|
networkFolderButton->hide();
|
||||||
connect(urlNavigator, &KUrlNavigator::urlChanged, this, [networkFolderButton, urlNavigator]() {
|
connect(urlNavigator, &KUrlNavigator::urlChanged, this, [networkFolderButton, urlNavigator, service]() {
|
||||||
networkFolderButton->setVisible(urlNavigator->locationUrl().scheme() == QLatin1String("remote"));
|
networkFolderButton->setVisible(service && urlNavigator->locationUrl().scheme() == QLatin1String("remote"));
|
||||||
});
|
});
|
||||||
return networkFolderButton;
|
return networkFolderButton;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue