From 64c9221cad333aeba6dbd5c371513f75d5a6831e Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Thu, 21 Aug 2025 14:39:35 +0300
Subject: trinity-apps/gwenview: several fixes

* fix FTBFS on a system with minimal-ish config
* add missing dependencies
* add optional features for cmake-converted versions

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
 ...4.1.4-Fix-FTBFS-because-of-missing-header.patch | 30 ++++++++++++++++++++++
 trinity-apps/gwenview/gwenview-14.1.1.ebuild       |  6 ++++-
 trinity-apps/gwenview/gwenview-14.1.2.ebuild       |  6 ++++-
 trinity-apps/gwenview/gwenview-9999.ebuild         | 27 ++++++++++++++++---
 trinity-apps/gwenview/metadata.xml                 |  4 +++
 5 files changed, 68 insertions(+), 5 deletions(-)
 create mode 100644 trinity-apps/gwenview/files/gwenview-14.1.4-Fix-FTBFS-because-of-missing-header.patch

diff --git a/trinity-apps/gwenview/files/gwenview-14.1.4-Fix-FTBFS-because-of-missing-header.patch b/trinity-apps/gwenview/files/gwenview-14.1.4-Fix-FTBFS-because-of-missing-header.patch
new file mode 100644
index 00000000..91e098f8
--- /dev/null
+++ b/trinity-apps/gwenview/files/gwenview-14.1.4-Fix-FTBFS-because-of-missing-header.patch
@@ -0,0 +1,30 @@
+From 222ece3a1c8867fc59f74ba3d45514dd13e84b4c Mon Sep 17 00:00:00 2001
+From: Alexander Golubev <fatzer2@gmail.com>
+Date: Tue, 19 Aug 2025 09:11:57 +0300
+Subject: [PATCH] Fix FTBFS because of missing header
+
+The FTBFS happens on a system with minimal-ish config of tdelibs and tqt
+i.e. no threading, no ssl etc. I didn't checked which one of the options
+triggers the FTBFS specifically, though it hardly matters.
+
+Origin: Extracted from upstream git
+Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
+---
+ src/app/bookmarkdialogbase.ui | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/app/bookmarkdialogbase.ui b/src/app/bookmarkdialogbase.ui
+index d2bee5f..42c58ba 100644
+--- a/src/app/bookmarkdialogbase.ui
++++ b/src/app/bookmarkdialogbase.ui
+@@ -101,6 +101,7 @@
+ </customwidgets>
+ <layoutdefaults spacing="6" margin="11"/>
+ <includes>
++    <include location="global" impldecl="in implementation">kicondialog.h</include>
+     <include location="global" impldecl="in implementation">klineedit.h</include>
+     <include location="global" impldecl="in implementation">kpushbutton.h</include>
+     <include location="global" impldecl="in implementation">kurlrequester.h</include>
+-- 
+2.49.1
+
diff --git a/trinity-apps/gwenview/gwenview-14.1.1.ebuild b/trinity-apps/gwenview/gwenview-14.1.1.ebuild
index 37b5f524..8e142412 100644
--- a/trinity-apps/gwenview/gwenview-14.1.1.ebuild
+++ b/trinity-apps/gwenview/gwenview-14.1.1.ebuild
@@ -1,5 +1,5 @@
 # Copyright 1999-2023 Gentoo Authors
-# Copyright 2020-2023 The Trinity Desktop Project
+# Copyright 2020-2025 The Trinity Desktop Project
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="8"
@@ -23,3 +23,7 @@ DEPEND="
 	~trinity-base/tdelibs-${PV}
 "
 RDEPEND="${DEPEND}"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-14.1.4-Fix-FTBFS-because-of-missing-header.patch"
+)
diff --git a/trinity-apps/gwenview/gwenview-14.1.2.ebuild b/trinity-apps/gwenview/gwenview-14.1.2.ebuild
index fe2f8612..57d16fe9 100644
--- a/trinity-apps/gwenview/gwenview-14.1.2.ebuild
+++ b/trinity-apps/gwenview/gwenview-14.1.2.ebuild
@@ -1,5 +1,5 @@
 # Copyright 1999-2024 Gentoo Authors
-# Copyright 2020-2024 The Trinity Desktop Project
+# Copyright 2020-2025 The Trinity Desktop Project
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="8"
@@ -23,3 +23,7 @@ DEPEND="
 	~trinity-base/tdelibs-${PV}
 "
 RDEPEND="${DEPEND}"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-14.1.4-Fix-FTBFS-because-of-missing-header.patch"
+)
diff --git a/trinity-apps/gwenview/gwenview-9999.ebuild b/trinity-apps/gwenview/gwenview-9999.ebuild
index fc4a2dfa..8a52e940 100644
--- a/trinity-apps/gwenview/gwenview-9999.ebuild
+++ b/trinity-apps/gwenview/gwenview-9999.ebuild
@@ -1,9 +1,12 @@
 # Copyright 1999-2020 Gentoo Authors
-# Copyright 2020 The Trinity Desktop Project
+# Copyright 2020-2025 The Trinity Desktop Project
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="8"
 
+TRINITY_EXTRAGEAR_PACKAGING="yes"
+TRINITY_HANDBOOK="optional"
+
 TRINITY_MODULE_TYPE="applications/graphics"
 inherit trinity-base-2
 
@@ -15,10 +18,28 @@ SLOT="14"
 if [[ ${PV} != *9999* ]] ; then
 	KEYWORDS="~amd64 ~arm64 ~x86"
 fi
+IUSE="mng xcursor"
 
 DEPEND="
 	media-gfx/exiv2
+	media-libs/libjpeg-turbo
+	media-libs/libpng
+	mng? ( media-libs/libmng )
+	xcursor? ( x11-libs/libXcursor )
+"
+RDEPEND="${DEPEND}
 	~trinity-apps/gwenview-i18n-${PV}
-	~trinity-base/tdelibs-${PV}
 "
-RDEPEND="${DEPEND}"
+# missing USE=kipi:
+# - DEPEND:  kipi? ( ~trinity-apps/libkipi-${PV} )
+# - RDEPEND: kipi? ( ~trinity-apps/kipi-plugins-${PV} ) not packaged
+# - mycmakeargs: -DWITH_KIPI="$(usex kipi)"
+
+src_configure() {
+	local mycmakeargs=(
+		-DWITH_MNG="$(usex mng)"
+		-DWITH_XCURSOR="$(usex xcursor)"
+	)
+
+	trinity-base-2_src_configure
+}
diff --git a/trinity-apps/gwenview/metadata.xml b/trinity-apps/gwenview/metadata.xml
index ef7d5590..570aeba6 100644
--- a/trinity-apps/gwenview/metadata.xml
+++ b/trinity-apps/gwenview/metadata.xml
@@ -5,4 +5,8 @@
 		<email>team-gentoo@trinitydesktop.org</email>
 		<name>Trinity Gentoo ebuilds project</name>
 	</maintainer>
+	<use>
+	<!-- <flag name='kipi'>Support for plugins for image mainipulation from <pkg>trinity-apps/libkipi</pkg>.</flag> -->
+		<flag name='xcursor'>Support for showing xcursor files via <pkg>x11-libs/libXcursor</pkg>.</flag>
+	</use>
 </pkgmetadata>
-- 
cgit v1.2.3

