mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +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
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue