commit:     cb14d193518487ecc9867eb4735538f63ba88dad
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  4 12:14:40 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Apr  4 13:19:42 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cb14d193

kde-apps/dolphin: Don't re-open already-open URLs w/ session-restore

Upstream commit 175538020824355115cd98637ce83ecc53badd44

KDE-bug: https://bugs.kde.org/show_bug.cgi?id=434911
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 kde-apps/dolphin/dolphin-20.12.3-r1.ebuild         | 101 +++++++++++++++++++++
 ...phin-20.12.3-fix-session-restore-w-o-tabs.patch |  70 ++++++++++++++
 2 files changed, 171 insertions(+)

diff --git a/kde-apps/dolphin/dolphin-20.12.3-r1.ebuild 
b/kde-apps/dolphin/dolphin-20.12.3-r1.ebuild
new file mode 100644
index 00000000000..367584e27d2
--- /dev/null
+++ b/kde-apps/dolphin/dolphin-20.12.3-r1.ebuild
@@ -0,0 +1,101 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+ECM_HANDBOOK="forceoptional"
+ECM_TEST="true"
+PVCUT=$(ver_cut 1-3)
+KFMIN=5.75.0
+QTMIN=5.15.2
+VIRTUALX_REQUIRED="test"
+inherit ecm kde.org optfeature
+
+DESCRIPTION="Plasma filemanager focusing on usability"
+HOMEPAGE="https://apps.kde.org/en/dolphin https://userbase.kde.org/Dolphin";
+
+LICENSE="GPL-2" # TODO: CHECK
+SLOT="5"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+IUSE="activities semantic-desktop telemetry"
+
+DEPEND="
+       >=dev-qt/qtconcurrent-${QTMIN}:5
+       >=dev-qt/qtdbus-${QTMIN}:5
+       >=dev-qt/qtgui-${QTMIN}:5
+       >=dev-qt/qtwidgets-${QTMIN}:5
+       >=dev-qt/qtxml-${QTMIN}:5
+       >=kde-frameworks/kbookmarks-${KFMIN}:5
+       >=kde-frameworks/kcmutils-${KFMIN}:5
+       >=kde-frameworks/kcodecs-${KFMIN}:5
+       >=kde-frameworks/kcompletion-${KFMIN}:5
+       >=kde-frameworks/kconfig-${KFMIN}:5
+       >=kde-frameworks/kconfigwidgets-${KFMIN}:5
+       >=kde-frameworks/kcoreaddons-${KFMIN}:5
+       >=kde-frameworks/kcrash-${KFMIN}:5
+       >=kde-frameworks/kdbusaddons-${KFMIN}:5
+       >=kde-frameworks/ki18n-${KFMIN}:5
+       >=kde-frameworks/kiconthemes-${KFMIN}:5
+       >=kde-frameworks/kinit-${KFMIN}:5
+       >=kde-frameworks/kio-${KFMIN}:5=
+       >=kde-frameworks/kitemviews-${KFMIN}:5
+       >=kde-frameworks/kjobwidgets-${KFMIN}:5
+       >=kde-frameworks/knewstuff-${KFMIN}:5
+       >=kde-frameworks/knotifications-${KFMIN}:5
+       >=kde-frameworks/kparts-${KFMIN}:5
+       >=kde-frameworks/kservice-${KFMIN}:5
+       >=kde-frameworks/ktextwidgets-${KFMIN}:5
+       >=kde-frameworks/kwidgetsaddons-${KFMIN}:5
+       >=kde-frameworks/kwindowsystem-${KFMIN}:5
+       >=kde-frameworks/kxmlgui-${KFMIN}:5
+       >=kde-frameworks/solid-${KFMIN}:5
+       >=media-libs/phonon-4.11.0
+       activities? ( >=kde-frameworks/kactivities-${KFMIN}:5 )
+       semantic-desktop? (
+               >=kde-apps/baloo-widgets-${PVCUT}:5
+               >=kde-frameworks/baloo-${KFMIN}:5
+               >=kde-frameworks/kfilemetadata-${KFMIN}:5
+       )
+       telemetry? ( dev-libs/kuserfeedback:5 )
+"
+RDEPEND="${DEPEND}
+       >=kde-apps/kio-extras-${PVCUT}:5
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-fix-session-restore-w-o-tabs.patch" # KDE-bug 434911
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DCMAKE_DISABLE_FIND_PACKAGE_PackageKitQt5=ON
+               $(cmake_use_find_package activities KF5Activities)
+               $(cmake_use_find_package semantic-desktop KF5Baloo)
+               $(cmake_use_find_package semantic-desktop KF5BalooWidgets)
+               $(cmake_use_find_package semantic-desktop KF5FileMetaData)
+               $(cmake_use_find_package telemetry KUserFeedback)
+       )
+       ecm_src_configure
+}
+
+src_test() {
+       local myctestargs=(
+               # servicemenuinstaller requires ruby, no thanks
+               # dolphinmainwindowtest, kitemlistcontrollertest, 
kfileitemlistviewtest, kfileitemmodeltest hang forever
+               # placesitemmodeltest requires DBus
+               -E 
"(servicemenuinstaller|dolphinmainwindowtest|kfileitemlistviewtest|kfileitemmodeltest|kitemlistcontrollertest|placesitemmodeltest)"
+       )
+       ecm_src_test
+}
+
+pkg_postinst() {
+       if [[ -z "${REPLACING_VERSIONS}" ]]; then
+               elog "Optional dependencies:"
+               optfeature "compress/extract and other actions" 
kde-apps/ark:${SLOT}
+               optfeature "crypto actions" kde-apps/kleopatra:${SLOT}
+               optfeature "video file thumbnails" kde-apps/ffmpegthumbs:${SLOT}
+               optfeature "graphics file thumbnails" 
kde-apps/thumbnailers:${SLOT}
+               optfeature "'Share' context menu actions" 
kde-frameworks/purpose:${SLOT}
+       fi
+       ecm_pkg_postinst
+}

diff --git 
a/kde-apps/dolphin/files/dolphin-20.12.3-fix-session-restore-w-o-tabs.patch 
b/kde-apps/dolphin/files/dolphin-20.12.3-fix-session-restore-w-o-tabs.patch
new file mode 100644
index 00000000000..9605bead03c
--- /dev/null
+++ b/kde-apps/dolphin/files/dolphin-20.12.3-fix-session-restore-w-o-tabs.patch
@@ -0,0 +1,70 @@
+From 175538020824355115cd98637ce83ecc53badd44 Mon Sep 17 00:00:00 2001
+From: Nate Graham <n...@kde.org>
+Date: Thu, 18 Mar 2021 13:42:59 -0600
+Subject: [PATCH] Don't re-open already-open URLs when using session-restore
+ feature
+
+If Dolphin would be asked to open a location that is already open, don't
+open it again in a new tab; instead switch to that view. Supports tabs
+and split view.
+
+BUG: 434911
+FIXED-IN: 21.04
+---
+ src/dolphintabwidget.cpp | 24 ++++++++++++++++++------
+ 1 file changed, 18 insertions(+), 6 deletions(-)
+
+diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp
+index d61a9f74f..17fa0ff4e 100644
+--- a/src/dolphintabwidget.cpp
++++ b/src/dolphintabwidget.cpp
+@@ -186,14 +186,20 @@ void DolphinTabWidget::openDirectories(const 
QList<QUrl>& dirs, bool splitView)
+ {
+     Q_ASSERT(dirs.size() > 0);
+ 
++    bool somethingWasAlreadyOpen = false;
++
+     QList<QUrl>::const_iterator it = dirs.constBegin();
+     while (it != dirs.constEnd()) {
+         const QUrl& primaryUrl = *(it++);
+         const QPair<int, bool> indexInfo = indexByUrl(primaryUrl);
+         const int index = indexInfo.first;
+         const bool isInPrimaryView = indexInfo.second;
++
++        // When the user asks for a URL that's already open, activate it 
instead
++        // of opening a second copy
+         if (index >= 0) {
+-            setCurrentIndex(index);
++            somethingWasAlreadyOpen = true;
++            activateTab(index);
+             const auto tabPage = tabPageAt(index);
+             if (isInPrimaryView) {
+                 tabPage->primaryViewContainer()->setActive(true);
+@@ -204,13 +210,19 @@ void DolphinTabWidget::openDirectories(const 
QList<QUrl>& dirs, bool splitView)
+             // Required for updateViewState() call in openFiles() to work as 
expected
+             // If there is a selection, updateViewState() calls are 
effectively a no-op
+             tabPage->activeViewContainer()->view()->clearSelection();
+-            continue;
+-        }
+-        if (splitView && (it != dirs.constEnd())) {
++        } else if (splitView) {
+             const QUrl& secondaryUrl = *(it++);
+-            openNewActivatedTab(primaryUrl, secondaryUrl);
++            if (somethingWasAlreadyOpen) {
++                openNewTab(primaryUrl, secondaryUrl);
++            } else {
++                openNewActivatedTab(primaryUrl, secondaryUrl);
++            }
+         } else {
+-            openNewActivatedTab(primaryUrl);
++            if (somethingWasAlreadyOpen) {
++                openNewTab(primaryUrl);
++            } else {
++                openNewActivatedTab(primaryUrl);
++            }
+         }
+     }
+ }
+-- 
+GitLab
+

Reply via email to