epel9
Rex Dieter 4 years ago
parent 8a08ffbaff
commit 9a86fcb325

1
.gitignore vendored

@ -1,2 +1,3 @@
/dolphin-20.08.3.tar.xz /dolphin-20.08.3.tar.xz
/dolphin-20.12.1.tar.xz /dolphin-20.12.1.tar.xz
/dolphin-20.12.2.tar.xz

@ -1,156 +0,0 @@
From b1cadeba939155282a9fadf7d7b025d6529c489e Mon Sep 17 00:00:00 2001
From: Nate Graham <nate@kde.org>
Date: Tue, 15 Dec 2020 23:03:00 -0700
Subject: [PATCH] Show button to open knetattach inline with URL nav on
Remote:// view
In conjunction with
https://invent.kde.org/frameworks/kio/-/merge_requests/260,
the net result is to hide the knetattach launcher in the view, and show
it inline with Dolphin's URL navigator toolbar when viewing the
remote:// view, just like how we add an "Empty Trash" button when
viewing trash://.
CCBUG: 430211
---
src/dolphinnavigatorswidgetaction.cpp | 49 ++++++++++++++++++++++++---
src/dolphinnavigatorswidgetaction.h | 17 +++++++++-
2 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/src/dolphinnavigatorswidgetaction.cpp b/src/dolphinnavigatorswidgetaction.cpp
index ace004f0f..e42e9c3ee 100644
--- a/src/dolphinnavigatorswidgetaction.cpp
+++ b/src/dolphinnavigatorswidgetaction.cpp
@@ -10,9 +10,13 @@
#include "trash/dolphintrash.h"
#include <KLocalizedString>
+#include <KNotificationJobUiDelegate>
+#include <KService>
#include <KXMLGUIFactory>
#include <KXmlGuiWindow>
+#include <KIO/ApplicationLauncherJob>
+
#include <QApplication>
#include <QDomDocument>
#include <QHBoxLayout>
@@ -154,7 +158,9 @@ void DolphinNavigatorsWidgetAction::adjustSpacing()
}
int trailingSpacing = (m_globalXOfSplitter + m_splitter->width())
- (m_globalXOfPrimary + m_widthOfPrimary);
- if (trailingSpacing < 0 || emptyTrashButton(Primary)->isVisible()) {
+ if (trailingSpacing < 0 || emptyTrashButton(Primary)->isVisible()
+ || networkFolderButton(Primary)->isVisible()
+ ) {
trailingSpacing = 0;
}
const int widthLeftForUrlNavigator = m_splitter->widget(0)->width() - leadingSpacing - trailingSpacing;
@@ -181,7 +184,9 @@ void DolphinNavigatorsWidgetAction::adjustSpacing()
trailingSpacing = (m_globalXOfSplitter + m_splitter->width())
- (m_globalXOfSecondary + m_widthOfSecondary);
- if (trailingSpacing < 0 || emptyTrashButton(Secondary)->isVisible()) {
+ if (trailingSpacing < 0 || emptyTrashButton(Secondary)->isVisible()
+ || networkFolderButton(Secondary)->isVisible()
+ ) {
trailingSpacing = 0;
} else {
const int widthLeftForUrlNavigator2 = m_splitter->widget(1)->width() - trailingSpacing;
@@ -212,6 +215,9 @@ QWidget *DolphinNavigatorsWidgetAction::createNavigatorWidget(Side side) const
auto emptyTrashButton = newEmptyTrashButton(urlNavigator, navigatorWidget);
layout->addWidget(emptyTrashButton);
+ auto networkFolderButton = newNetworkFolderButton(urlNavigator, navigatorWidget);
+ layout->addWidget(networkFolderButton);
+
connect(urlNavigator, &KUrlNavigator::urlChanged, this, [this]() {
// We have to wait for DolphinUrlNavigator::sizeHint() to update which
// happens a little bit later than when urlChanged is emitted.
@@ -235,6 +246,36 @@ QPushButton *DolphinNavigatorsWidgetAction::newEmptyTrashButton(const DolphinUrl
return emptyTrashButton;
}
+QPushButton *DolphinNavigatorsWidgetAction::networkFolderButton(DolphinNavigatorsWidgetAction::Side side)
+{
+ int sideIndex = (side == Primary ? 0 : 1);
+ if (side == Primary) {
+ return static_cast<QPushButton *>(m_splitter->widget(sideIndex)->layout()->itemAt(3)->widget());
+ }
+ return static_cast<QPushButton *>(m_splitter->widget(sideIndex)->layout()->itemAt(2)->widget());
+}
+
+QPushButton *DolphinNavigatorsWidgetAction::newNetworkFolderButton(const DolphinUrlNavigator *urlNavigator, QWidget *parent) const
+{
+ auto networkFolderButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-add")),
+ i18nc("@action:button", "Add Network Folder"), parent);
+ networkFolderButton->setFlat(true);
+ connect(networkFolderButton, &QPushButton::clicked,
+ this, [networkFolderButton]() {
+ KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("org.kde.knetattach"));
+ auto *job = new KIO::ApplicationLauncherJob(service, networkFolderButton);
+ auto *delegate = new KNotificationJobUiDelegate;
+ delegate->setAutoErrorHandlingEnabled(true);
+ job->setUiDelegate(delegate);
+ job->start();
+ });
+ networkFolderButton->hide();
+ connect(urlNavigator, &KUrlNavigator::urlChanged, this, [networkFolderButton, urlNavigator]() {
+ networkFolderButton->setVisible(urlNavigator->locationUrl().scheme() == QLatin1String("remote"));
+ });
+ return networkFolderButton;
+}
+
QWidget *DolphinNavigatorsWidgetAction::spacing(Side side, Position position) const
{
int sideIndex = (side == Primary ? 0 : 1);
@@ -243,9 +284,9 @@ QWidget *DolphinNavigatorsWidgetAction::spacing(Side side, Position position) co
return m_splitter->widget(sideIndex)->layout()->itemAt(0)->widget();
}
if (side == Primary) {
- return m_splitter->widget(sideIndex)->layout()->itemAt(3)->widget();
+ return m_splitter->widget(sideIndex)->layout()->itemAt(4)->widget();
}
- return m_splitter->widget(sideIndex)->layout()->itemAt(2)->widget();
+ return m_splitter->widget(sideIndex)->layout()->itemAt(3)->widget();
}
void DolphinNavigatorsWidgetAction::updateText()
diff --git a/src/dolphinnavigatorswidgetaction.h b/src/dolphinnavigatorswidgetaction.h
index 804996532..6f5f8e7af 100644
--- a/src/dolphinnavigatorswidgetaction.h
+++ b/src/dolphinnavigatorswidgetaction.h
@@ -31,7 +31,8 @@ class QPushButton;
* The secondary side only exists for split view and is created by
* createSecondaryUrlNavigator() when necessary.
* - Each side is a QWidget which I call NavigatorWidget with a QHBoxLayout.
- * - Each NavigatorWidget consists an UrlNavigator, an emptyTrashButton and spacing.
+ * - Each NavigatorWidget consists an UrlNavigator, an emptyTrashButton, a
+ * networkFolderButton, and spacing.
* - Only the primary navigatorWidget has leading spacing. Both have trailing spacing.
* The spacing is there to align the UrlNavigator with its DolphinViewContainer.
*/
@@ -127,6 +128,20 @@ private:
*/
QPushButton *newEmptyTrashButton(const DolphinUrlNavigator *urlNavigator, QWidget *parent) const;
+ /**
+ * Used to retrieve the networkFolderButtons for the navigatorWidgets on
+ * both sides.
+ */
+ QPushButton *networkFolderButton(Side side);
+
+ /**
+ * Creates a new add "network folder" button.
+ * @param urlNavigator Only when this UrlNavigator shows the remote directory
+ * will the button be visible.
+ * @param parent The object that should be the button's parent.
+ */
+ QPushButton *newNetworkFolderButton(const DolphinUrlNavigator *urlNavigator, QWidget *parent) const;
+
enum Position {
Leading,
Trailing
--
GitLab

@ -14,8 +14,8 @@
Name: dolphin Name: dolphin
Summary: KDE File Manager Summary: KDE File Manager
Version: 20.12.1 Version: 20.12.2
Release: 4%{?dist} Release: 1%{?dist}
License: GPLv2+ License: GPLv2+
URL: https://invent.kde.org/system/dolphin URL: https://invent.kde.org/system/dolphin
@ -29,8 +29,6 @@ URL: https://invent.kde.org/system/dolphin
Source0: http://download.kde.org/%{stable}/release-service/%{version}/src/%{name}-%{version}.tar.xz Source0: http://download.kde.org/%{stable}/release-service/%{version}/src/%{name}-%{version}.tar.xz
## upstream patches (master) ## upstream patches (master)
# https://bugs.kde.org/show_bug.cgi?id=431626#c11
Patch100: b1cadeba939155282a9fadf7d7b025d6529c489e.patch
# for %%check # for %%check
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
@ -180,6 +178,9 @@ make test ARGS="--output-on-failure --timeout 10" -C %{_target_platform} ||:
%changelog %changelog
* Tue Feb 02 2021 Rex Dieter <rdieter@fedoraproject.org> - 20.12.2-1
- 20.12.2
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 20.12.1-4 * Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 20.12.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

@ -1 +1 @@
SHA512 (dolphin-20.12.1.tar.xz) = a9f04b1dce709afebde3c60e356750ae2e6b32209cf9251845a348594047eeca1c98942de6125d9b4eaa1db596fc598ef9467185072d220c430e1499f5ef56e8 SHA512 (dolphin-20.12.2.tar.xz) = e3c79fc1d5d764a8ed59958d829a5d2ecce3dcb2b661506354ec73aed7dda2ddedd6cbc7f8d77efa7629272915df9f52f614306ed0b4c867ec76e55d115ca356

Loading…
Cancel
Save