media-gfx/skanpage: Truncate existing files when overwriting

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
Andreas Sturmlechner
2025-08-11 22:40:53 +02:00
parent 5c0f49b233
commit a7e4ccbae7
2 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
From 19308900da27b46739f2360426b91479e7179a2f Mon Sep 17 00:00:00 2001
From: Jeff Robertson <syntaxaire@gmail.com>
Date: Sat, 19 Jul 2025 11:35:29 -0400
Subject: [PATCH] Truncate existing files when overwriting
WriteOnly mode truncates existing files when overwriting,
but ReadWrite does not.
https://doc.qt.io/qt-6/qiodevicebase.html
BUG: 507174
(cherry picked from commit de3ad2941054a26920e022dc7c4a3dc16c065b5a)
---
src/DocumentSaver.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/DocumentSaver.cpp b/src/DocumentSaver.cpp
index 8311c316..79f45fa6 100644
--- a/src/DocumentSaver.cpp
+++ b/src/DocumentSaver.cpp
@@ -79,7 +79,7 @@ void DocumentSaver::savePDF(const QUrl &fileUrl, const SkanpageUtils::DocumentPa
{
const QString localName = getLocalNameForFile(fileUrl);
QFile file(localName);
- bool ok = file.open(QIODevice::ReadWrite);
+ bool ok = file.open(QIODevice::WriteOnly);
if (!ok) {
Q_EMIT showUserMessage(SkanpageUtils::ErrorMessage, i18nc("%1 is the error message", "An error ocurred while saving: %1.", file.errorString()));
return;
--
GitLab

View File

@@ -0,0 +1,41 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
KDE_ORG_CATEGORY="utilities"
PVCUT=$(ver_cut 1-3)
KFMIN=6.13.0
QTMIN=6.7.2
inherit ecm gear.kde.org xdg
DESCRIPTION="Multi-page scanning application supporting image and pdf files"
HOMEPAGE="https://apps.kde.org/skanpage/"
LICENSE="|| ( GPL-2 GPL-3 ) CC0-1.0"
SLOT="6"
KEYWORDS="~amd64 ~arm64"
IUSE=""
DEPEND="
>=app-text/tesseract-5:=
>=dev-qt/qtbase-${QTMIN}:6[concurrent,gui,network,widgets]
>=dev-qt/qtdeclarative-${QTMIN}:6
>=dev-qt/qtwebengine-${QTMIN}:6[pdfium]
>=kde-frameworks/kconfig-${KFMIN}:6
>=kde-frameworks/kcoreaddons-${KFMIN}:6
>=kde-frameworks/kcrash-${KFMIN}:6
>=kde-frameworks/ki18n-${KFMIN}:6
>=kde-frameworks/kio-${KFMIN}:6
>=kde-frameworks/kirigami-${KFMIN}:6
>=kde-frameworks/kjobwidgets-${KFMIN}:6
>=kde-frameworks/kwidgetsaddons-${KFMIN}:6
>=kde-frameworks/kxmlgui-${KFMIN}:6
>=kde-frameworks/purpose-${KFMIN}:6
media-libs/kquickimageeditor:6
>=media-libs/ksanecore-${PVCUT}:6
media-libs/leptonica:=
"
RDEPEND="${DEPEND}"
PATCHES=( "${FILESDIR}/${P}-truncate-existing-file.patch" )