public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: kde-misc/krename/files/, kde-misc/krename/
@ 2018-12-25 21:23 Andreas Sturmlechner
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Sturmlechner @ 2018-12-25 21:23 UTC (permalink / raw
  To: gentoo-commits

commit:     6c9ac5f10af7c87b21d9eb1276cb4692cb4d4932
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 25 15:12:11 2018 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Dec 25 21:23:19 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c9ac5f1

kde-misc/krename: Backport >=exiv-0.27 support from master

Instead of adding FindLibExiv2.cmake through the patch we will just
bump minimum depend to FRAMEWORKS_MINIMAL=5.53.0.

Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../krename/files/krename-5.0.0-exiv2-0.27.patch   | 188 +++++++++++++++++++++
 kde-misc/krename/krename-5.0.0-r1.ebuild           |  55 ++++++
 2 files changed, 243 insertions(+)

diff --git a/kde-misc/krename/files/krename-5.0.0-exiv2-0.27.patch b/kde-misc/krename/files/krename-5.0.0-exiv2-0.27.patch
new file mode 100644
index 00000000000..fdc13a1815e
--- /dev/null
+++ b/kde-misc/krename/files/krename-5.0.0-exiv2-0.27.patch
@@ -0,0 +1,188 @@
+From ec90823494f5ec9bb2e8098f44209f383ef8c22a Mon Sep 17 00:00:00 2001
+From: Heiko Becker <heirecka@exherbo.org>
+Date: Tue, 20 Nov 2018 18:24:29 +0100
+Subject: Use #cmakedefine01 instead of macro_bool_to_01
+
+---
+ CMakeLists.txt                    | 13 +++++--------
+ config-krename.h.cmake            | 10 +++++-----
+ 3 files changed, 10 insertions(+), 33 deletions(-)
+ delete mode 100644 cmake/modules/MacroBoolTo01.cmake
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -80,13 +80,10 @@ set_package_properties(Freetype PROPERTIES
+ 
+ feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
+ 
+-
+-# Update configuration
+-include(MacroBoolTo01)
+-macro_bool_to_01(TAGLIB_FOUND HAVE_TAGLIB)
+-macro_bool_to_01(EXIV2_FOUND HAVE_EXIV2)
+-macro_bool_to_01(PoDoFo_FOUND HAVE_PODOFO)
+-macro_bool_to_01(FREETYPE_FOUND HAVE_FREETYPE)
++set(HAVE_TAGLIB ${TAGLIB_FOUND})
++set(HAVE_EXIV2 ${LibExiv2_FOUND})
++set(HAVE_PODOFO ${PoDoFo_FOUND})
++set(HAVE_FREETYPE ${FREETYPE_FOUND})
+ configure_file(config-krename.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-krename.h)
+ 
+ # Directories
+--- a/config-krename.h.cmake
++++ b/config-krename.h.cmake
+@@ -1,15 +1,15 @@
+ /* config.h. Generated by cmake from config.h.cmake */
+ 
+ /* have TagLib */
+-#define HAVE_TAGLIB ${HAVE_TAGLIB}
++#cmakedefine01 HAVE_TAGLIB
+ 
+ /* have Exiv2 */
+-#define HAVE_EXIV2 ${HAVE_EXIV2}
++#cmakedefine01 HAVE_EXIV2
+ 
+ /* have PoDoFo */
+-#define HAVE_PODOFO ${HAVE_PODOFO}
++#cmakedefine01 HAVE_PODOFO
+ 
+ /* have Freetype */
+-#define HAVE_FREETYPE ${HAVE_FREETYPE}
++#cmakedefine01 HAVE_FREETYPE
+ 
+-#define VERSION "${KRENAME_VERSION}"
++#define VERSION "${krename_VERSION}"
+-- 
+cgit v1.1
+
+From b22de9135ba2a5abdbd2b275a60933a50f074010 Mon Sep 17 00:00:00 2001
+From: Heiko Becker <heirecka@exherbo.org>
+Date: Tue, 20 Nov 2018 18:26:47 +0100
+Subject: Fix building against exiv2-0.27
+
+One neeeded part is to copy over the new FindLibExiv2 module from
+ECM which has not appeared in a release yet (it will with 5.53.0).
+I'll probably add that version as a requirement and remove the copy
+again in the near future.
+The other part includes raising the cmake version requirement to
+3.7.0, which was released over 2 years ago. (The version comparison
+could be easily solved differently and less elegantly, but let's see
+if people with ancient cmakes complain).
+---
+ CMakeLists.txt                   |  15 ++---
+ config-krename.h.cmake           |   3 +
+ src/CMakeLists.txt               |   8 +--
+ src/exiv2plugin.cpp              |   8 ++-
+ 6 files changed, 137 insertions(+), 91 deletions(-)
+ delete mode 100644 cmake/modules/FindExiv2.cmake
+ create mode 100644 cmake/modules/FindLibExiv2.cmake
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,4 +1,5 @@
+-project(krename)
+ 
+-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
++cmake_minimum_required(VERSION 3.7)
++
++project(krename VERSION "5.0.0")
+ 
+@@ -39,10 +40,6 @@ add_definitions(
+     -DQT_STRICT_ITERATORS
+ )
+ 
+-set(KRENAME_VERSION "5.0.0")
+-
+-include(FindGettext)
+-
+ # Find taglib
+ set(TAGLIB_MIN_VERSION "1.5")
+ find_package(Taglib ${TAGLIB_MIN_VERSION})
+@@ -58,11 +55,12 @@ set_package_properties(Taglib PROPERTIES
+     TYPE OPTIONAL)
+ 
+ # Find exiv2
+-find_package(Exiv2 0.13) # AccessMode was added in 0.13
+-set_package_properties(Exiv2 PROPERTIES
+-    DESCRIPTION "A library to access image metadata"
+-    URL "http://www.exiv2.org"
+-    TYPE OPTIONAL)
++find_package(LibExiv2 0.13) # AccessMode was added in 0.13
++set_package_properties(LibExiv2 PROPERTIES TYPE OPTIONAL)
++
++if (LibExiv2_VERSION VERSION_GREATER_EQUAL "0.27")
++    set(HAVE_LIBEXIV2_0_27 TRUE)
++endif()
+ 
+ # Find podofo
+ find_package(PoDoFo)
+--- a/config-krename.h.cmake
++++ b/config-krename.h.cmake
+@@ -6,6 +6,9 @@
+ /* have Exiv2 */
+ #cmakedefine01 HAVE_EXIV2
+ 
++/* Defined if we have libexiv2 >= 0.27 */
++#cmakedefine HAVE_LIBEXIV2_0_27
++
+ /* have PoDoFo */
+ #cmakedefine01 HAVE_PODOFO
+ 
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -23,7 +23,7 @@ if(FREETYPE_FOUND)
+     include_directories(${FREETYPE_INCLUDE_DIRS})
+ endif()
+ 
+-add_definitions(${TAGLIB_CFLAGS} ${EXIV2_CFLAGS})
++add_definitions(${TAGLIB_CFLAGS})
+ # Exiv2 needs exceptions
+ kde_enable_exceptions()
+ 
+@@ -67,7 +67,7 @@ set(krename_SRCS
+     snumplugin.cpp
+ )
+ 
+-if(EXIV2_FOUND)
++if(LibExiv2_FOUND)
+     set(krename_SRCS ${krename_SRCS}
+         exiv2plugin.cpp
+     )
+@@ -137,9 +137,9 @@ if(TAGLIB_FOUND)
+         ${TAGLIB_LIBRARIES}
+     )
+ endif()
+-if(EXIV2_FOUND)
++if(LibExiv2_FOUND)
+     target_link_libraries(krename
+-        ${EXIV2_LIBRARIES}
++        LibExiv2::LibExiv2
+     )
+ endif()
+ if(PoDoFo_FOUND)
+--- a/src/exiv2plugin.cpp
++++ b/src/exiv2plugin.cpp
+@@ -17,13 +17,19 @@
+ 
+ #include "exiv2plugin.h"
+ 
++#include "../config-krename.h"
++
+ #include <KLocalizedString>
+ 
+ #include <exiv2/error.hpp>
+ #include <exiv2/exif.hpp>
+ #include <exiv2/image.hpp>
+ #include <exiv2/iptc.hpp>
+-#include <exiv2/xmp.hpp>
++#ifdef HAVE_LIBEXIV2_0_27
++    #include <exiv2/xmp_exiv2.hpp>
++#else
++    #include <exiv2/xmp.hpp>
++#endif
+ #include <exiv2/tags.hpp>
+ 
+ #include "batchrenamer.h"
+-- 
+cgit v1.1

diff --git a/kde-misc/krename/krename-5.0.0-r1.ebuild b/kde-misc/krename/krename-5.0.0-r1.ebuild
new file mode 100644
index 00000000000..b0d09e4cb5c
--- /dev/null
+++ b/kde-misc/krename/krename-5.0.0-r1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+FRAMEWORKS_MINIMAL="5.53.0"
+KDE_TEST="true"
+inherit kde5
+
+DESCRIPTION="Powerful batch file renamer"
+HOMEPAGE="http://www.krename.net/"
+SRC_URI="mirror://kde/stable/${PN}/${PV}/src/${P}.tar.xz"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+IUSE="exif pdf taglib truetype"
+
+DEPEND="
+	$(add_frameworks_dep kcompletion)
+	$(add_frameworks_dep kconfig)
+	$(add_frameworks_dep kcoreaddons)
+	$(add_frameworks_dep kcrash)
+	$(add_frameworks_dep ki18n)
+	$(add_frameworks_dep kiconthemes)
+	$(add_frameworks_dep kio)
+	$(add_frameworks_dep kitemviews)
+	$(add_frameworks_dep kjobwidgets)
+	$(add_frameworks_dep kjs)
+	$(add_frameworks_dep kservice)
+	$(add_frameworks_dep kwidgetsaddons)
+	$(add_frameworks_dep kxmlgui)
+	$(add_qt_dep qtgui)
+	$(add_qt_dep qtwidgets)
+	$(add_qt_dep qtxml)
+	exif? ( media-gfx/exiv2:= )
+	pdf? ( app-text/podofo )
+	taglib? ( media-libs/taglib )
+	truetype? ( media-libs/freetype:2 )
+"
+RDEPEND="${DEPEND}
+	!kde-misc/krename:4
+"
+
+PATCHES=( "${FILESDIR}/${P}-exiv2-0.27.patch" )
+
+src_configure() {
+	local mycmakeargs=(
+		$(cmake-utils_use_find_package exif LibExiv2)
+		$(cmake-utils_use_find_package taglib Taglib)
+		$(cmake-utils_use_find_package pdf PoDoFo)
+		$(cmake-utils_use_find_package truetype Freetype)
+	)
+
+	kde5_src_configure
+}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: kde-misc/krename/files/, kde-misc/krename/
@ 2020-12-18 13:44 Andreas Sturmlechner
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Sturmlechner @ 2020-12-18 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     1ae704f776b6fa2a67376a920bdaf6635ec971b6
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 18 12:25:59 2020 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Fri Dec 18 13:43:56 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ae704f7

kde-misc/krename: Backport upstream patch dropping kde-frameworks/kjs

Upstream commit e0a93830d0ea0c71ab649b7e68af0238bd48eb10

Closes: https://bugs.gentoo.org/760543
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 kde-misc/krename/files/krename-5.0.1-no-kjs.patch | 519 ++++++++++++++++++++++
 kde-misc/krename/krename-5.0.1-r1.ebuild          |  58 +++
 2 files changed, 577 insertions(+)

diff --git a/kde-misc/krename/files/krename-5.0.1-no-kjs.patch b/kde-misc/krename/files/krename-5.0.1-no-kjs.patch
new file mode 100644
index 00000000000..f4b7eb78689
--- /dev/null
+++ b/kde-misc/krename/files/krename-5.0.1-no-kjs.patch
@@ -0,0 +1,519 @@
+From 407b612a93128b9f935a686d5ff82c7ee06087f5 Mon Sep 17 00:00:00 2001
+From: Harald Sitter <sitter@kde.org>
+Date: Thu, 17 Dec 2020 13:19:56 +0100
+Subject: [PATCH 1/5] reduce nesting
+
+easier on the eyes
+---
+ src/scriptplugin.cpp | 63 +++++++++++++++++++++++---------------------
+ 1 file changed, 33 insertions(+), 30 deletions(-)
+
+diff --git a/src/scriptplugin.cpp b/src/scriptplugin.cpp
+index 0790fd4..8f4b11e 100644
+--- a/src/scriptplugin.cpp
++++ b/src/scriptplugin.cpp
+@@ -175,36 +175,39 @@ void ScriptPlugin::initKRenameVars(const KRenameFile &file, int index)
+             file.srcDirectory());
+ 
+     // User definitions, set them only on first file
+-    if (index == 0) {
+-        for (int i = 0; i < m_widget->listVariables->topLevelItemCount(); i++) {
+-            // TODO, we have to know the type of the variable!
+-            QTreeWidgetItem *item = m_widget->listVariables->topLevelItem(i);
+-            if (item) {
+-                EVarType eVarType = static_cast<EVarType>(item->data(1, Qt::UserRole).toInt());
+-                const QString &name  = item->text(0);
+-                const QString &value = item->text(1);
+-                switch (eVarType) {
+-                default:
+-                case eVarType_String:
+-                    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-                            name, value.toUtf8().data());
+-                    break;
+-                case eVarType_Int:
+-                    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-                            name, value.toInt());
+-                    break;
+-                case eVarType_Double:
+-                    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-                            name, value.toDouble());
+-                    break;
+-                case eVarType_Bool:
+-                    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-                            name,
+-                            (value.toLower() == "true" ? true : false));
+-                    break;
+-
+-                }
+-            }
++    if (index != 0) {
++        return;
++    }
++
++    for (int i = 0; i < m_widget->listVariables->topLevelItemCount(); i++) {
++        // TODO, we have to know the type of the variable!
++        QTreeWidgetItem *item = m_widget->listVariables->topLevelItem(i);
++        if (!item) {
++            continue;
++        }
++
++        EVarType eVarType = static_cast<EVarType>(item->data(1, Qt::UserRole).toInt());
++        const QString &name  = item->text(0);
++        const QString &value = item->text(1);
++        switch (eVarType) {
++        default:
++        case eVarType_String:
++            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
++                    name, value.toUtf8().data());
++            break;
++        case eVarType_Int:
++            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
++                    name, value.toInt());
++            break;
++        case eVarType_Double:
++            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
++                    name, value.toDouble());
++            break;
++        case eVarType_Bool:
++            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
++                    name,
++                    (value.toLower() == "true" ? true : false));
++            break;
+         }
+     }
+ }
+-- 
+2.29.2
+
+
+From f80de4b81846da45c4cc16c585a159872dcc2c29 Mon Sep 17 00:00:00 2001
+From: Harald Sitter <sitter@kde.org>
+Date: Thu, 17 Dec 2020 13:24:37 +0100
+Subject: [PATCH 2/5] don't needlessly use qpointer
+
+for one it has no value, scopedpointer might. we don't need a pointer
+at all though, simply put qdialog on the stack and let the compiler
+take care of it
+---
+ src/scriptplugin.cpp | 44 ++++++++++++++++++++++----------------------
+ 1 file changed, 22 insertions(+), 22 deletions(-)
+
+diff --git a/src/scriptplugin.cpp b/src/scriptplugin.cpp
+index 8f4b11e..fec61e7 100644
+--- a/src/scriptplugin.cpp
++++ b/src/scriptplugin.cpp
+@@ -28,7 +28,6 @@
+ #include <QTemporaryFile>
+ #include <QFile>
+ #include <QMenu>
+-#include <QPointer>
+ #include <QTextStream>
+ #include <QVariant>
+ #include <QFileDialog>
+@@ -228,7 +227,7 @@ void ScriptPlugin::slotEnableControls()
+ 
+ void ScriptPlugin::slotAdd()
+ {
+-    QPointer<QDialog> dialog = new QDialog();
++    QDialog dialog;
+     Ui::ScriptPluginDialog dlg;
+ 
+     QStringList types;
+@@ -238,32 +237,33 @@ void ScriptPlugin::slotAdd()
+     types << i18n("Double");
+     types << i18n("Boolean");
+ 
+-    dlg.setupUi(dialog);
++    dlg.setupUi(&dialog);
+     dlg.comboType->addItems(types);
+ 
+-    if (dialog->exec() == QDialog::Accepted) {
+-        QString name  = dlg.lineName->text();
+-        QString value = dlg.lineValue->text();
++    if (dialog.exec() != QDialog::Accepted) {
++        return;
++    }
+ 
+-        // Build a Java script statement
+-        QString script = name + " = " + value + ';';
++    QString name  = dlg.lineName->text();
++    QString value = dlg.lineValue->text();
+ 
+-        KJSInterpreter interpreter;
+-        KJSResult result = m_interpreter->evaluate(script, nullptr);
+-        if (result.isException()) {
+-            KMessageBox::error(m_parent,
+-                               i18n("A JavaScript error has occurred: ") +
+-                               result.errorMessage(), this->name());
+-        } else {
+-            QTreeWidgetItem *item = new QTreeWidgetItem();
+-            item->setText(0, name);
+-            item->setText(1, value);
+-            item->setData(1, Qt::UserRole, QVariant(dlg.comboType->currentIndex()));
++    // Build a Java script statement
++    QString script = name + " = " + value + ';';
+ 
+-            m_widget->listVariables->addTopLevelItem(item);
+-        }
++    KJSInterpreter interpreter;
++    KJSResult result = m_interpreter->evaluate(script, nullptr);
++    if (result.isException()) {
++        KMessageBox::error(m_parent,
++                            i18n("A JavaScript error has occurred: ") +
++                            result.errorMessage(), this->name());
++    } else {
++        QTreeWidgetItem *item = new QTreeWidgetItem();
++        item->setText(0, name);
++        item->setText(1, value);
++        item->setData(1, Qt::UserRole, QVariant(dlg.comboType->currentIndex()));
++
++        m_widget->listVariables->addTopLevelItem(item);
+     }
+-    delete dialog;
+ }
+ 
+ void ScriptPlugin::slotRemove()
+-- 
+2.29.2
+
+
+From 5979b30da5b385008894ff5577da917dd888959e Mon Sep 17 00:00:00 2001
+From: Harald Sitter <sitter@kde.org>
+Date: Thu, 17 Dec 2020 13:32:41 +0100
+Subject: [PATCH 3/5] fix dangerously implicit int->int->enum mapping
+
+the type order in the qstringlist was implicitly the int values of the
+type enum. incredibly scary. instead push the items into the combobox
+along with their enum value as Qt::UserRole and then pass that along.
+this ensures (kind of) that the int we cast back to enum in
+initKRenameVars will be an actual enum value
+---
+ src/scriptplugin.cpp | 15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/src/scriptplugin.cpp b/src/scriptplugin.cpp
+index fec61e7..1933bc6 100644
+--- a/src/scriptplugin.cpp
++++ b/src/scriptplugin.cpp
+@@ -4,6 +4,7 @@
+     begin                : Fri Nov 9 2007
+     copyright            : (C) 2007 by Dominik Seichter
+     email                : domseichter@web.de
++    copyright            : (C) 2020 by Harald Sitter <sitter@kde.org>
+  ***************************************************************************/
+ 
+ /***************************************************************************
+@@ -230,15 +231,11 @@ void ScriptPlugin::slotAdd()
+     QDialog dialog;
+     Ui::ScriptPluginDialog dlg;
+ 
+-    QStringList types;
+-
+-    types << i18n("String");
+-    types << i18n("Int");
+-    types << i18n("Double");
+-    types << i18n("Boolean");
+-
+     dlg.setupUi(&dialog);
+-    dlg.comboType->addItems(types);
++    dlg.comboType->addItem(i18n("String"), eVarType_String);
++    dlg.comboType->addItem(i18n("Int"), eVarType_Int);
++    dlg.comboType->addItem(i18n("Double"), eVarType_Double);
++    dlg.comboType->addItem(i18n("Boolean"), eVarType_Bool);
+ 
+     if (dialog.exec() != QDialog::Accepted) {
+         return;
+@@ -260,7 +257,7 @@ void ScriptPlugin::slotAdd()
+         QTreeWidgetItem *item = new QTreeWidgetItem();
+         item->setText(0, name);
+         item->setText(1, value);
+-        item->setData(1, Qt::UserRole, QVariant(dlg.comboType->currentIndex()));
++        item->setData(1, Qt::UserRole, dlg.comboType->currentData());
+ 
+         m_widget->listVariables->addTopLevelItem(item);
+     }
+-- 
+2.29.2
+
+
+From 82161c323b7b0d4b77602551923118f304c5c536 Mon Sep 17 00:00:00 2001
+From: Harald Sitter <sitter@kde.org>
+Date: Thu, 17 Dec 2020 15:05:49 +0100
+Subject: [PATCH 4/5] port away from stringy QMenu::addAction to functor based
+ API
+
+was introdcued in 5.6 so is fine to use and loads safer
+---
+ src/previewlist.cpp    |  8 ++++----
+ src/progressdialog.cpp |  8 ++++----
+ src/scriptplugin.cpp   | 10 +++++-----
+ 3 files changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/src/previewlist.cpp b/src/previewlist.cpp
+index df8097b..0d3ccb6 100644
+--- a/src/previewlist.cpp
++++ b/src/previewlist.cpp
+@@ -28,12 +28,12 @@ PreviewList::PreviewList(QWidget *parent)
+     : QTreeView(parent), m_model(nullptr)
+ {
+     m_menu = new QMenu("KRename", this);   // we need any text here so that we have a title
+-    m_menu->addAction(i18n("&Change filename manually..."), this, SLOT(slotManually()), QKeySequence("F2"));
++    m_menu->addAction(i18n("&Change filename manually..."), this, &PreviewList::slotManually, QKeySequence("F2"));
+     m_menu->addSeparator();
+-    m_menu->addAction(i18n("&Open"), this, SLOT(slotOpen()));
++    m_menu->addAction(i18n("&Open"), this, &PreviewList::slotOpen);
+     m_menu->addSeparator();
+-    m_menu->addAction(i18n("&Add..."), this, SIGNAL(addFiles()));
+-    m_menu->addAction(i18n("&Remove"), this, SLOT(slotRemove()));
++    m_menu->addAction(i18n("&Add..."), this, &PreviewList::addFiles);
++    m_menu->addAction(i18n("&Remove"), this, &PreviewList::slotRemove);
+ 
+     connect(this, &PreviewList::activated, this, &PreviewList::slotManually);
+ }
+diff --git a/src/progressdialog.cpp b/src/progressdialog.cpp
+index 4eaaf1a..d217614 100644
+--- a/src/progressdialog.cpp
++++ b/src/progressdialog.cpp
+@@ -49,11 +49,11 @@ ProgressDialog::ProgressDialog(ESplitMode eSplitMode, unsigned int dot, QWidget
+             qApp, &QApplication::quit, Qt::QueuedConnection);
+ 
+     QMenu *menu = new QMenu(this);
+-    menu->addAction(i18n("Restart &KRename..."), this, SLOT(slotRestartKRename()));
++    menu->addAction(i18n("Restart &KRename..."), this, &ProgressDialog::slotRestartKRename);
+     menu->addSeparator();
+-    m_actProcessed   = menu->addAction(i18n("Rename Processed Files &Again..."),    this, SLOT(slotRenameProcessedAgain()));
+-    m_actUnprocessed = menu->addAction(i18n("Rename &Unprocessed Files Again..."), this, SLOT(slotRenameUnprocessedAgain()));
+-    menu->addAction(i18n("&Rename All Files Again..."),          this, SLOT(slotRenameAllAgain()));
++    m_actProcessed = menu->addAction(i18n("Rename Processed Files &Again..."), this, &ProgressDialog::slotRenameProcessedAgain);
++    m_actUnprocessed = menu->addAction(i18n("Rename &Unprocessed Files Again..."), this, &ProgressDialog::slotRenameUnprocessedAgain);
++    menu->addAction(i18n("&Rename All Files Again..."), this, &ProgressDialog::slotRenameAllAgain);
+ 
+     m_buttonMore->setMenu(menu);
+ }
+diff --git a/src/scriptplugin.cpp b/src/scriptplugin.cpp
+index 1933bc6..46b27ca 100644
+--- a/src/scriptplugin.cpp
++++ b/src/scriptplugin.cpp
+@@ -68,11 +68,11 @@ ScriptPlugin::ScriptPlugin(PluginLoader *loader)
+ 
+     m_help.append("[js;4+5];;" + i18n("Insert a snippet of JavaScript code (4+5 in this case)"));
+ 
+-    m_menu->addAction(i18n("Index of the current file"),     this, SLOT(slotInsertIndex()));
+-    m_menu->addAction(i18n("URL of the current file"),       this, SLOT(slotInsertUrl()));
+-    m_menu->addAction(i18n("Filename of the current file"),  this, SLOT(slotInsertFilename()));
+-    m_menu->addAction(i18n("Extension of the current file"), this, SLOT(slotInsertExtension()));
+-    m_menu->addAction(i18n("Directory of the current file"), this, SLOT(slotInsertDirectory()));
++    m_menu->addAction(i18n("Index of the current file"), this, &ScriptPlugin::slotInsertIndex);
++    m_menu->addAction(i18n("URL of the current file"), this, &ScriptPlugin::slotInsertUrl);
++    m_menu->addAction(i18n("Filename of the current file"), this, &ScriptPlugin::slotInsertFilename);
++    m_menu->addAction(i18n("Extension of the current file"), this, &ScriptPlugin::slotInsertExtension);
++    m_menu->addAction(i18n("Directory of the current file"), this, &ScriptPlugin::slotInsertDirectory);
+ }
+ 
+ ScriptPlugin::~ScriptPlugin()
+-- 
+2.29.2
+
+
+From e0a93830d0ea0c71ab649b7e68af0238bd48eb10 Mon Sep 17 00:00:00 2001
+From: Harald Sitter <sitter@kde.org>
+Date: Thu, 17 Dec 2020 13:45:07 +0100
+Subject: [PATCH 5/5] port from deprecated kjs to qjsengine
+
+for kf6 todo https://phabricator.kde.org/T11604
+
+kjs is deprecated and we want to move away from it. this ports to
+qjsengine which does what we need for krename just fine and is also
+supported in qt6 still
+
+all use cases of the js plugin still seem to work fine. variable
+definition, function definition and using either in the replacement.
+same for the implicit global variables.
+---
+ CMakeLists.txt       |  2 +-
+ src/CMakeLists.txt   |  2 +-
+ src/scriptplugin.cpp | 55 ++++++++++++++------------------------------
+ src/scriptplugin.h   |  6 +++--
+ 4 files changed, 23 insertions(+), 42 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2b39e18..e1673e1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -17,7 +17,7 @@ include(FeatureSummary)
+ include(KDECompilerSettings NO_POLICY_SCOPE)
+ include(FeatureSummary)
+ 
+-find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
++find_package(Qt5 REQUIRED COMPONENTS Core Qml Widgets)
+ find_package(KF5 REQUIRED COMPONENTS
+     Completion
+     Config
+@@ -27,7 +27,6 @@ find_package(KF5 REQUIRED COMPONENTS
+     IconThemes
+     ItemViews
+     JobWidgets
+-    JS
+     KIO
+     Service
+     WidgetsAddons
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 3f262b3..bee7378 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -128,9 +128,9 @@ target_link_libraries(krename
+     KF5::KIOCore
+     KF5::KIOFileWidgets
+     KF5::I18n
+-    KF5::JSApi
+     KF5::IconThemes
+     Qt5::Widgets
++    Qt5::Qml
+ )
+ if(TAGLIB_FOUND)
+     target_link_libraries(krename
+diff --git a/src/scriptplugin.cpp b/src/scriptplugin.cpp
+index d7f7125..651e656 100644
+--- a/src/scriptplugin.cpp
++++ b/src/scriptplugin.cpp
+@@ -18,8 +18,7 @@
+ #include <QTextStream>
+ #include <QVariant>
+ #include <QFileDialog>
+-
+-#include <kjs/kjsinterpreter.h>
++#include <QDebug>
+ 
+ #include "ui_scriptplugindialog.h"
+ #include "ui_scriptpluginwidget.h"
+@@ -46,7 +45,6 @@ ScriptPlugin::ScriptPlugin(PluginLoader *loader)
+ {
+     m_name = i18n("JavaScript Plugin");
+     m_icon = "applications-development";
+-    m_interpreter = new KJSInterpreter();
+     m_menu   = new QMenu();
+     m_widget = new Ui::ScriptPluginWidget();
+ 
+@@ -65,7 +63,6 @@ ScriptPlugin::~ScriptPlugin()
+ {
+     delete m_widget;
+     delete m_menu;
+-    delete m_interpreter;
+ }
+ 
+ QString ScriptPlugin::processFile(BatchRenamer *b, int index,
+@@ -90,13 +87,13 @@ QString ScriptPlugin::processFile(BatchRenamer *b, int index,
+         // Make sure definitions are executed first
+         script = definitions + '\n' + script;
+ 
+-        KJSResult result = m_interpreter->evaluate(script, nullptr);
+-        if (result.isException()) {
+-            qDebug("JavaScript Error: %s", result.errorMessage().toUtf8().data());
++        const QJSValue result = m_engine.evaluate(script);
++        if (result.isError()) {
++            qDebug() << "JavaScript Error:" << result.toString();
+             return QString();
+         }
+ 
+-        return result.value().toString(m_interpreter->globalContext());
++        return result.toString();
+     }
+ 
+     return QString();
+@@ -144,21 +141,11 @@ void ScriptPlugin::createUI(QWidget *parent) const
+ void ScriptPlugin::initKRenameVars(const KRenameFile &file, int index)
+ {
+     // KRename definitions
+-    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-            ScriptPlugin::s_pszVarNameIndex,
+-            index);
+-    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-            ScriptPlugin::s_pszVarNameUrl,
+-            file.srcUrl().url());
+-    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-            ScriptPlugin::s_pszVarNameFilename,
+-            file.srcFilename());
+-    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-            ScriptPlugin::s_pszVarNameExtension,
+-            file.srcExtension());
+-    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-            ScriptPlugin::s_pszVarNameDirectory,
+-            file.srcDirectory());
++    m_engine.globalObject().setProperty(ScriptPlugin::s_pszVarNameIndex, index);
++    m_engine.globalObject().setProperty(ScriptPlugin::s_pszVarNameUrl, file.srcUrl().url());
++    m_engine.globalObject().setProperty(ScriptPlugin::s_pszVarNameFilename, file.srcFilename());
++    m_engine.globalObject().setProperty(ScriptPlugin::s_pszVarNameExtension, file.srcExtension());
++    m_engine.globalObject().setProperty(ScriptPlugin::s_pszVarNameDirectory, file.srcDirectory());
+ 
+     // User definitions, set them only on first file
+     if (index != 0) {
+@@ -178,21 +165,16 @@ void ScriptPlugin::initKRenameVars(const KRenameFile &file, int index)
+         switch (eVarType) {
+         default:
+         case eVarType_String:
+-            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-                    name, value.toUtf8().data());
++            m_engine.globalObject().setProperty(name, value);
+             break;
+         case eVarType_Int:
+-            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-                    name, value.toInt());
++            m_engine.globalObject().setProperty(name, value.toInt());
+             break;
+         case eVarType_Double:
+-            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-                    name, value.toDouble());
++            m_engine.globalObject().setProperty(name, value.toDouble());
+             break;
+         case eVarType_Bool:
+-            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
+-                    name,
+-                    (value.toLower() == "true" ? true : false));
++            m_engine.globalObject().setProperty(name, (value.toLower() == "true" ? true : false));
+             break;
+         }
+     }
+@@ -233,12 +215,9 @@ void ScriptPlugin::slotAdd()
+     // Build a Java script statement
+     QString script = name + " = " + value + ';';
+ 
+-    KJSInterpreter interpreter;
+-    KJSResult result = m_interpreter->evaluate(script, nullptr);
+-    if (result.isException()) {
+-        KMessageBox::error(m_parent,
+-                            i18n("A JavaScript error has occurred: ") +
+-                            result.errorMessage(), this->name());
++    const QJSValue result = m_engine.evaluate(script);
++    if (result.isError()) {
++        KMessageBox::error(m_parent, i18n("A JavaScript error has occurred: ") + result.toString(), this->name());
+     } else {
+         QTreeWidgetItem *item = new QTreeWidgetItem();
+         item->setText(0, name);
+diff --git a/src/scriptplugin.h b/src/scriptplugin.h
+index 367310b..f91e79b 100644
+--- a/src/scriptplugin.h
++++ b/src/scriptplugin.h
+@@ -3,9 +3,10 @@
+ 
+ #include "plugin.h"
+ 
++#include <QJSEngine>
++
+ class QMenu;
+ 
+-class KJSInterpreter;
+ class KRenameFile;
+ 
+ namespace Ui
+@@ -171,7 +173,7 @@ private:
+ 
+     QStringList         m_keys;
+     QStringList         m_help;
+-    KJSInterpreter     *m_interpreter;
++    QJSEngine           m_engine;
+     QWidget            *m_parent;
+     QMenu              *m_menu;
+ 
+-- 
+2.29.2
+

diff --git a/kde-misc/krename/krename-5.0.1-r1.ebuild b/kde-misc/krename/krename-5.0.1-r1.ebuild
new file mode 100644
index 00000000000..168940d1e28
--- /dev/null
+++ b/kde-misc/krename/krename-5.0.1-r1.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+ECM_TEST="true"
+KFMIN=5.70.0
+QTMIN=5.14.2
+inherit ecm kde.org
+
+DESCRIPTION="Powerful batch file renamer"
+HOMEPAGE="https://apps.kde.org/en/krename https://userbase.kde.org/KRename"
+
+if [[ ${KDE_BUILD_TYPE} != live ]]; then
+	SRC_URI="mirror://kde/stable/${PN}/${PV}/src/${P}.tar.xz"
+	KEYWORDS="~amd64 ~arm64 ~x86"
+fi
+
+LICENSE="GPL-2"
+SLOT="5"
+IUSE="exif pdf taglib truetype"
+
+BDEPEND="sys-devel/gettext"
+DEPEND="
+	>=dev-qt/qtdeclarative-${QTMIN}:5
+	>=dev-qt/qtgui-${QTMIN}:5
+	>=dev-qt/qtwidgets-${QTMIN}:5
+	>=dev-qt/qtxml-${QTMIN}:5
+	>=kde-frameworks/kcompletion-${KFMIN}:5
+	>=kde-frameworks/kconfig-${KFMIN}:5
+	>=kde-frameworks/kcoreaddons-${KFMIN}:5
+	>=kde-frameworks/kcrash-${KFMIN}:5
+	>=kde-frameworks/ki18n-${KFMIN}:5
+	>=kde-frameworks/kiconthemes-${KFMIN}:5
+	>=kde-frameworks/kio-${KFMIN}:5
+	>=kde-frameworks/kitemviews-${KFMIN}:5
+	>=kde-frameworks/kjobwidgets-${KFMIN}:5
+	>=kde-frameworks/kservice-${KFMIN}:5
+	>=kde-frameworks/kwidgetsaddons-${KFMIN}:5
+	>=kde-frameworks/kxmlgui-${KFMIN}:5
+	exif? ( media-gfx/exiv2:= )
+	pdf? ( app-text/podofo:= )
+	taglib? ( media-libs/taglib )
+	truetype? ( media-libs/freetype:2 )
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}/${P}-no-kjs.patch" )
+
+src_configure() {
+	local mycmakeargs=(
+		$(cmake_use_find_package exif LibExiv2)
+		$(cmake_use_find_package pdf PoDoFo)
+		$(cmake_use_find_package taglib Taglib)
+		$(cmake_use_find_package truetype Freetype)
+	)
+	ecm_src_configure
+}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: kde-misc/krename/files/, kde-misc/krename/
@ 2023-05-28 12:44 Andreas Sturmlechner
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Sturmlechner @ 2023-05-28 12:44 UTC (permalink / raw
  To: gentoo-commits

commit:     50d9a0b2d140eb64e955826acd7b30c31959d014
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun May 28 12:02:03 2023 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun May 28 12:44:06 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50d9a0b2

kde-misc/krename: Fix build with >=exiv2-0.28

5.0.2-r0: Switch to patchset and cleanup slightly oversize patch.

Closes: https://bugs.gentoo.org/906471
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 kde-misc/krename/Manifest                          |   1 +
 kde-misc/krename/files/krename-5.0.1-no-kjs.patch  | 519 ---------------------
 ...rename-5.0.2.ebuild => krename-5.0.2-r1.ebuild} |   9 +-
 kde-misc/krename/krename-5.0.2.ebuild              |   7 +-
 4 files changed, 10 insertions(+), 526 deletions(-)

diff --git a/kde-misc/krename/Manifest b/kde-misc/krename/Manifest
index e7d89374b2cd..7df8124fb483 100644
--- a/kde-misc/krename/Manifest
+++ b/kde-misc/krename/Manifest
@@ -1 +1,2 @@
+DIST krename-5.0.2-patchset-1.tar.xz 6360 BLAKE2B 69e8b046885be27c77d5d315e994e8b2a31e76ed76f4ea6d030679b83133725cb0577d818841b1f41e566e757f4cbd4e08c1f479bc1d572a8391db47c4a26e8c SHA512 2de0ee19d29dadb50995b0d02e486e8efdbff3d3fda0a3a6ec69f4b5858b4c376b3d33d2018da0cf2333309fe8b4ea58f4de21f6d2864c2c22b60830b5ac9bcf
 DIST krename-5.0.2.tar.xz 337908 BLAKE2B 2fb7a96ca3f3f3b193d0924dd1131a7442b32149c1f62387734c47680077b6f77e3cf32b940b85d6f688d24f24af08ac39a8ccc86f10f5ec1d65b53fc9631108 SHA512 c065d6de90c43e5297db2773d8569279535b007d3b00b99a252329e78c90dc949678ecd2f2ecaa74e72394fa0e848b8774f6f387d4a7f367b367b1dd38405545

diff --git a/kde-misc/krename/files/krename-5.0.1-no-kjs.patch b/kde-misc/krename/files/krename-5.0.1-no-kjs.patch
deleted file mode 100644
index f4b7eb786890..000000000000
--- a/kde-misc/krename/files/krename-5.0.1-no-kjs.patch
+++ /dev/null
@@ -1,519 +0,0 @@
-From 407b612a93128b9f935a686d5ff82c7ee06087f5 Mon Sep 17 00:00:00 2001
-From: Harald Sitter <sitter@kde.org>
-Date: Thu, 17 Dec 2020 13:19:56 +0100
-Subject: [PATCH 1/5] reduce nesting
-
-easier on the eyes
----
- src/scriptplugin.cpp | 63 +++++++++++++++++++++++---------------------
- 1 file changed, 33 insertions(+), 30 deletions(-)
-
-diff --git a/src/scriptplugin.cpp b/src/scriptplugin.cpp
-index 0790fd4..8f4b11e 100644
---- a/src/scriptplugin.cpp
-+++ b/src/scriptplugin.cpp
-@@ -175,36 +175,39 @@ void ScriptPlugin::initKRenameVars(const KRenameFile &file, int index)
-             file.srcDirectory());
- 
-     // User definitions, set them only on first file
--    if (index == 0) {
--        for (int i = 0; i < m_widget->listVariables->topLevelItemCount(); i++) {
--            // TODO, we have to know the type of the variable!
--            QTreeWidgetItem *item = m_widget->listVariables->topLevelItem(i);
--            if (item) {
--                EVarType eVarType = static_cast<EVarType>(item->data(1, Qt::UserRole).toInt());
--                const QString &name  = item->text(0);
--                const QString &value = item->text(1);
--                switch (eVarType) {
--                default:
--                case eVarType_String:
--                    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--                            name, value.toUtf8().data());
--                    break;
--                case eVarType_Int:
--                    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--                            name, value.toInt());
--                    break;
--                case eVarType_Double:
--                    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--                            name, value.toDouble());
--                    break;
--                case eVarType_Bool:
--                    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--                            name,
--                            (value.toLower() == "true" ? true : false));
--                    break;
--
--                }
--            }
-+    if (index != 0) {
-+        return;
-+    }
-+
-+    for (int i = 0; i < m_widget->listVariables->topLevelItemCount(); i++) {
-+        // TODO, we have to know the type of the variable!
-+        QTreeWidgetItem *item = m_widget->listVariables->topLevelItem(i);
-+        if (!item) {
-+            continue;
-+        }
-+
-+        EVarType eVarType = static_cast<EVarType>(item->data(1, Qt::UserRole).toInt());
-+        const QString &name  = item->text(0);
-+        const QString &value = item->text(1);
-+        switch (eVarType) {
-+        default:
-+        case eVarType_String:
-+            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
-+                    name, value.toUtf8().data());
-+            break;
-+        case eVarType_Int:
-+            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
-+                    name, value.toInt());
-+            break;
-+        case eVarType_Double:
-+            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
-+                    name, value.toDouble());
-+            break;
-+        case eVarType_Bool:
-+            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
-+                    name,
-+                    (value.toLower() == "true" ? true : false));
-+            break;
-         }
-     }
- }
--- 
-2.29.2
-
-
-From f80de4b81846da45c4cc16c585a159872dcc2c29 Mon Sep 17 00:00:00 2001
-From: Harald Sitter <sitter@kde.org>
-Date: Thu, 17 Dec 2020 13:24:37 +0100
-Subject: [PATCH 2/5] don't needlessly use qpointer
-
-for one it has no value, scopedpointer might. we don't need a pointer
-at all though, simply put qdialog on the stack and let the compiler
-take care of it
----
- src/scriptplugin.cpp | 44 ++++++++++++++++++++++----------------------
- 1 file changed, 22 insertions(+), 22 deletions(-)
-
-diff --git a/src/scriptplugin.cpp b/src/scriptplugin.cpp
-index 8f4b11e..fec61e7 100644
---- a/src/scriptplugin.cpp
-+++ b/src/scriptplugin.cpp
-@@ -28,7 +28,6 @@
- #include <QTemporaryFile>
- #include <QFile>
- #include <QMenu>
--#include <QPointer>
- #include <QTextStream>
- #include <QVariant>
- #include <QFileDialog>
-@@ -228,7 +227,7 @@ void ScriptPlugin::slotEnableControls()
- 
- void ScriptPlugin::slotAdd()
- {
--    QPointer<QDialog> dialog = new QDialog();
-+    QDialog dialog;
-     Ui::ScriptPluginDialog dlg;
- 
-     QStringList types;
-@@ -238,32 +237,33 @@ void ScriptPlugin::slotAdd()
-     types << i18n("Double");
-     types << i18n("Boolean");
- 
--    dlg.setupUi(dialog);
-+    dlg.setupUi(&dialog);
-     dlg.comboType->addItems(types);
- 
--    if (dialog->exec() == QDialog::Accepted) {
--        QString name  = dlg.lineName->text();
--        QString value = dlg.lineValue->text();
-+    if (dialog.exec() != QDialog::Accepted) {
-+        return;
-+    }
- 
--        // Build a Java script statement
--        QString script = name + " = " + value + ';';
-+    QString name  = dlg.lineName->text();
-+    QString value = dlg.lineValue->text();
- 
--        KJSInterpreter interpreter;
--        KJSResult result = m_interpreter->evaluate(script, nullptr);
--        if (result.isException()) {
--            KMessageBox::error(m_parent,
--                               i18n("A JavaScript error has occurred: ") +
--                               result.errorMessage(), this->name());
--        } else {
--            QTreeWidgetItem *item = new QTreeWidgetItem();
--            item->setText(0, name);
--            item->setText(1, value);
--            item->setData(1, Qt::UserRole, QVariant(dlg.comboType->currentIndex()));
-+    // Build a Java script statement
-+    QString script = name + " = " + value + ';';
- 
--            m_widget->listVariables->addTopLevelItem(item);
--        }
-+    KJSInterpreter interpreter;
-+    KJSResult result = m_interpreter->evaluate(script, nullptr);
-+    if (result.isException()) {
-+        KMessageBox::error(m_parent,
-+                            i18n("A JavaScript error has occurred: ") +
-+                            result.errorMessage(), this->name());
-+    } else {
-+        QTreeWidgetItem *item = new QTreeWidgetItem();
-+        item->setText(0, name);
-+        item->setText(1, value);
-+        item->setData(1, Qt::UserRole, QVariant(dlg.comboType->currentIndex()));
-+
-+        m_widget->listVariables->addTopLevelItem(item);
-     }
--    delete dialog;
- }
- 
- void ScriptPlugin::slotRemove()
--- 
-2.29.2
-
-
-From 5979b30da5b385008894ff5577da917dd888959e Mon Sep 17 00:00:00 2001
-From: Harald Sitter <sitter@kde.org>
-Date: Thu, 17 Dec 2020 13:32:41 +0100
-Subject: [PATCH 3/5] fix dangerously implicit int->int->enum mapping
-
-the type order in the qstringlist was implicitly the int values of the
-type enum. incredibly scary. instead push the items into the combobox
-along with their enum value as Qt::UserRole and then pass that along.
-this ensures (kind of) that the int we cast back to enum in
-initKRenameVars will be an actual enum value
----
- src/scriptplugin.cpp | 15 ++++++---------
- 1 file changed, 6 insertions(+), 9 deletions(-)
-
-diff --git a/src/scriptplugin.cpp b/src/scriptplugin.cpp
-index fec61e7..1933bc6 100644
---- a/src/scriptplugin.cpp
-+++ b/src/scriptplugin.cpp
-@@ -4,6 +4,7 @@
-     begin                : Fri Nov 9 2007
-     copyright            : (C) 2007 by Dominik Seichter
-     email                : domseichter@web.de
-+    copyright            : (C) 2020 by Harald Sitter <sitter@kde.org>
-  ***************************************************************************/
- 
- /***************************************************************************
-@@ -230,15 +231,11 @@ void ScriptPlugin::slotAdd()
-     QDialog dialog;
-     Ui::ScriptPluginDialog dlg;
- 
--    QStringList types;
--
--    types << i18n("String");
--    types << i18n("Int");
--    types << i18n("Double");
--    types << i18n("Boolean");
--
-     dlg.setupUi(&dialog);
--    dlg.comboType->addItems(types);
-+    dlg.comboType->addItem(i18n("String"), eVarType_String);
-+    dlg.comboType->addItem(i18n("Int"), eVarType_Int);
-+    dlg.comboType->addItem(i18n("Double"), eVarType_Double);
-+    dlg.comboType->addItem(i18n("Boolean"), eVarType_Bool);
- 
-     if (dialog.exec() != QDialog::Accepted) {
-         return;
-@@ -260,7 +257,7 @@ void ScriptPlugin::slotAdd()
-         QTreeWidgetItem *item = new QTreeWidgetItem();
-         item->setText(0, name);
-         item->setText(1, value);
--        item->setData(1, Qt::UserRole, QVariant(dlg.comboType->currentIndex()));
-+        item->setData(1, Qt::UserRole, dlg.comboType->currentData());
- 
-         m_widget->listVariables->addTopLevelItem(item);
-     }
--- 
-2.29.2
-
-
-From 82161c323b7b0d4b77602551923118f304c5c536 Mon Sep 17 00:00:00 2001
-From: Harald Sitter <sitter@kde.org>
-Date: Thu, 17 Dec 2020 15:05:49 +0100
-Subject: [PATCH 4/5] port away from stringy QMenu::addAction to functor based
- API
-
-was introdcued in 5.6 so is fine to use and loads safer
----
- src/previewlist.cpp    |  8 ++++----
- src/progressdialog.cpp |  8 ++++----
- src/scriptplugin.cpp   | 10 +++++-----
- 3 files changed, 13 insertions(+), 13 deletions(-)
-
-diff --git a/src/previewlist.cpp b/src/previewlist.cpp
-index df8097b..0d3ccb6 100644
---- a/src/previewlist.cpp
-+++ b/src/previewlist.cpp
-@@ -28,12 +28,12 @@ PreviewList::PreviewList(QWidget *parent)
-     : QTreeView(parent), m_model(nullptr)
- {
-     m_menu = new QMenu("KRename", this);   // we need any text here so that we have a title
--    m_menu->addAction(i18n("&Change filename manually..."), this, SLOT(slotManually()), QKeySequence("F2"));
-+    m_menu->addAction(i18n("&Change filename manually..."), this, &PreviewList::slotManually, QKeySequence("F2"));
-     m_menu->addSeparator();
--    m_menu->addAction(i18n("&Open"), this, SLOT(slotOpen()));
-+    m_menu->addAction(i18n("&Open"), this, &PreviewList::slotOpen);
-     m_menu->addSeparator();
--    m_menu->addAction(i18n("&Add..."), this, SIGNAL(addFiles()));
--    m_menu->addAction(i18n("&Remove"), this, SLOT(slotRemove()));
-+    m_menu->addAction(i18n("&Add..."), this, &PreviewList::addFiles);
-+    m_menu->addAction(i18n("&Remove"), this, &PreviewList::slotRemove);
- 
-     connect(this, &PreviewList::activated, this, &PreviewList::slotManually);
- }
-diff --git a/src/progressdialog.cpp b/src/progressdialog.cpp
-index 4eaaf1a..d217614 100644
---- a/src/progressdialog.cpp
-+++ b/src/progressdialog.cpp
-@@ -49,11 +49,11 @@ ProgressDialog::ProgressDialog(ESplitMode eSplitMode, unsigned int dot, QWidget
-             qApp, &QApplication::quit, Qt::QueuedConnection);
- 
-     QMenu *menu = new QMenu(this);
--    menu->addAction(i18n("Restart &KRename..."), this, SLOT(slotRestartKRename()));
-+    menu->addAction(i18n("Restart &KRename..."), this, &ProgressDialog::slotRestartKRename);
-     menu->addSeparator();
--    m_actProcessed   = menu->addAction(i18n("Rename Processed Files &Again..."),    this, SLOT(slotRenameProcessedAgain()));
--    m_actUnprocessed = menu->addAction(i18n("Rename &Unprocessed Files Again..."), this, SLOT(slotRenameUnprocessedAgain()));
--    menu->addAction(i18n("&Rename All Files Again..."),          this, SLOT(slotRenameAllAgain()));
-+    m_actProcessed = menu->addAction(i18n("Rename Processed Files &Again..."), this, &ProgressDialog::slotRenameProcessedAgain);
-+    m_actUnprocessed = menu->addAction(i18n("Rename &Unprocessed Files Again..."), this, &ProgressDialog::slotRenameUnprocessedAgain);
-+    menu->addAction(i18n("&Rename All Files Again..."), this, &ProgressDialog::slotRenameAllAgain);
- 
-     m_buttonMore->setMenu(menu);
- }
-diff --git a/src/scriptplugin.cpp b/src/scriptplugin.cpp
-index 1933bc6..46b27ca 100644
---- a/src/scriptplugin.cpp
-+++ b/src/scriptplugin.cpp
-@@ -68,11 +68,11 @@ ScriptPlugin::ScriptPlugin(PluginLoader *loader)
- 
-     m_help.append("[js;4+5];;" + i18n("Insert a snippet of JavaScript code (4+5 in this case)"));
- 
--    m_menu->addAction(i18n("Index of the current file"),     this, SLOT(slotInsertIndex()));
--    m_menu->addAction(i18n("URL of the current file"),       this, SLOT(slotInsertUrl()));
--    m_menu->addAction(i18n("Filename of the current file"),  this, SLOT(slotInsertFilename()));
--    m_menu->addAction(i18n("Extension of the current file"), this, SLOT(slotInsertExtension()));
--    m_menu->addAction(i18n("Directory of the current file"), this, SLOT(slotInsertDirectory()));
-+    m_menu->addAction(i18n("Index of the current file"), this, &ScriptPlugin::slotInsertIndex);
-+    m_menu->addAction(i18n("URL of the current file"), this, &ScriptPlugin::slotInsertUrl);
-+    m_menu->addAction(i18n("Filename of the current file"), this, &ScriptPlugin::slotInsertFilename);
-+    m_menu->addAction(i18n("Extension of the current file"), this, &ScriptPlugin::slotInsertExtension);
-+    m_menu->addAction(i18n("Directory of the current file"), this, &ScriptPlugin::slotInsertDirectory);
- }
- 
- ScriptPlugin::~ScriptPlugin()
--- 
-2.29.2
-
-
-From e0a93830d0ea0c71ab649b7e68af0238bd48eb10 Mon Sep 17 00:00:00 2001
-From: Harald Sitter <sitter@kde.org>
-Date: Thu, 17 Dec 2020 13:45:07 +0100
-Subject: [PATCH 5/5] port from deprecated kjs to qjsengine
-
-for kf6 todo https://phabricator.kde.org/T11604
-
-kjs is deprecated and we want to move away from it. this ports to
-qjsengine which does what we need for krename just fine and is also
-supported in qt6 still
-
-all use cases of the js plugin still seem to work fine. variable
-definition, function definition and using either in the replacement.
-same for the implicit global variables.
----
- CMakeLists.txt       |  2 +-
- src/CMakeLists.txt   |  2 +-
- src/scriptplugin.cpp | 55 ++++++++++++++------------------------------
- src/scriptplugin.h   |  6 +++--
- 4 files changed, 23 insertions(+), 42 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 2b39e18..e1673e1 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -17,7 +17,7 @@ include(FeatureSummary)
- include(KDECompilerSettings NO_POLICY_SCOPE)
- include(FeatureSummary)
- 
--find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
-+find_package(Qt5 REQUIRED COMPONENTS Core Qml Widgets)
- find_package(KF5 REQUIRED COMPONENTS
-     Completion
-     Config
-@@ -27,7 +27,6 @@ find_package(KF5 REQUIRED COMPONENTS
-     IconThemes
-     ItemViews
-     JobWidgets
--    JS
-     KIO
-     Service
-     WidgetsAddons
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 3f262b3..bee7378 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -128,9 +128,9 @@ target_link_libraries(krename
-     KF5::KIOCore
-     KF5::KIOFileWidgets
-     KF5::I18n
--    KF5::JSApi
-     KF5::IconThemes
-     Qt5::Widgets
-+    Qt5::Qml
- )
- if(TAGLIB_FOUND)
-     target_link_libraries(krename
-diff --git a/src/scriptplugin.cpp b/src/scriptplugin.cpp
-index d7f7125..651e656 100644
---- a/src/scriptplugin.cpp
-+++ b/src/scriptplugin.cpp
-@@ -18,8 +18,7 @@
- #include <QTextStream>
- #include <QVariant>
- #include <QFileDialog>
--
--#include <kjs/kjsinterpreter.h>
-+#include <QDebug>
- 
- #include "ui_scriptplugindialog.h"
- #include "ui_scriptpluginwidget.h"
-@@ -46,7 +45,6 @@ ScriptPlugin::ScriptPlugin(PluginLoader *loader)
- {
-     m_name = i18n("JavaScript Plugin");
-     m_icon = "applications-development";
--    m_interpreter = new KJSInterpreter();
-     m_menu   = new QMenu();
-     m_widget = new Ui::ScriptPluginWidget();
- 
-@@ -65,7 +63,6 @@ ScriptPlugin::~ScriptPlugin()
- {
-     delete m_widget;
-     delete m_menu;
--    delete m_interpreter;
- }
- 
- QString ScriptPlugin::processFile(BatchRenamer *b, int index,
-@@ -90,13 +87,13 @@ QString ScriptPlugin::processFile(BatchRenamer *b, int index,
-         // Make sure definitions are executed first
-         script = definitions + '\n' + script;
- 
--        KJSResult result = m_interpreter->evaluate(script, nullptr);
--        if (result.isException()) {
--            qDebug("JavaScript Error: %s", result.errorMessage().toUtf8().data());
-+        const QJSValue result = m_engine.evaluate(script);
-+        if (result.isError()) {
-+            qDebug() << "JavaScript Error:" << result.toString();
-             return QString();
-         }
- 
--        return result.value().toString(m_interpreter->globalContext());
-+        return result.toString();
-     }
- 
-     return QString();
-@@ -144,21 +141,11 @@ void ScriptPlugin::createUI(QWidget *parent) const
- void ScriptPlugin::initKRenameVars(const KRenameFile &file, int index)
- {
-     // KRename definitions
--    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--            ScriptPlugin::s_pszVarNameIndex,
--            index);
--    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--            ScriptPlugin::s_pszVarNameUrl,
--            file.srcUrl().url());
--    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--            ScriptPlugin::s_pszVarNameFilename,
--            file.srcFilename());
--    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--            ScriptPlugin::s_pszVarNameExtension,
--            file.srcExtension());
--    m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--            ScriptPlugin::s_pszVarNameDirectory,
--            file.srcDirectory());
-+    m_engine.globalObject().setProperty(ScriptPlugin::s_pszVarNameIndex, index);
-+    m_engine.globalObject().setProperty(ScriptPlugin::s_pszVarNameUrl, file.srcUrl().url());
-+    m_engine.globalObject().setProperty(ScriptPlugin::s_pszVarNameFilename, file.srcFilename());
-+    m_engine.globalObject().setProperty(ScriptPlugin::s_pszVarNameExtension, file.srcExtension());
-+    m_engine.globalObject().setProperty(ScriptPlugin::s_pszVarNameDirectory, file.srcDirectory());
- 
-     // User definitions, set them only on first file
-     if (index != 0) {
-@@ -178,21 +165,16 @@ void ScriptPlugin::initKRenameVars(const KRenameFile &file, int index)
-         switch (eVarType) {
-         default:
-         case eVarType_String:
--            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--                    name, value.toUtf8().data());
-+            m_engine.globalObject().setProperty(name, value);
-             break;
-         case eVarType_Int:
--            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--                    name, value.toInt());
-+            m_engine.globalObject().setProperty(name, value.toInt());
-             break;
-         case eVarType_Double:
--            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--                    name, value.toDouble());
-+            m_engine.globalObject().setProperty(name, value.toDouble());
-             break;
-         case eVarType_Bool:
--            m_interpreter->globalObject().setProperty(m_interpreter->globalContext(),
--                    name,
--                    (value.toLower() == "true" ? true : false));
-+            m_engine.globalObject().setProperty(name, (value.toLower() == "true" ? true : false));
-             break;
-         }
-     }
-@@ -233,12 +215,9 @@ void ScriptPlugin::slotAdd()
-     // Build a Java script statement
-     QString script = name + " = " + value + ';';
- 
--    KJSInterpreter interpreter;
--    KJSResult result = m_interpreter->evaluate(script, nullptr);
--    if (result.isException()) {
--        KMessageBox::error(m_parent,
--                            i18n("A JavaScript error has occurred: ") +
--                            result.errorMessage(), this->name());
-+    const QJSValue result = m_engine.evaluate(script);
-+    if (result.isError()) {
-+        KMessageBox::error(m_parent, i18n("A JavaScript error has occurred: ") + result.toString(), this->name());
-     } else {
-         QTreeWidgetItem *item = new QTreeWidgetItem();
-         item->setText(0, name);
-diff --git a/src/scriptplugin.h b/src/scriptplugin.h
-index 367310b..f91e79b 100644
---- a/src/scriptplugin.h
-+++ b/src/scriptplugin.h
-@@ -3,9 +3,10 @@
- 
- #include "plugin.h"
- 
-+#include <QJSEngine>
-+
- class QMenu;
- 
--class KJSInterpreter;
- class KRenameFile;
- 
- namespace Ui
-@@ -171,7 +173,7 @@ private:
- 
-     QStringList         m_keys;
-     QStringList         m_help;
--    KJSInterpreter     *m_interpreter;
-+    QJSEngine           m_engine;
-     QWidget            *m_parent;
-     QMenu              *m_menu;
- 
--- 
-2.29.2
-

diff --git a/kde-misc/krename/krename-5.0.2.ebuild b/kde-misc/krename/krename-5.0.2-r1.ebuild
similarity index 84%
copy from kde-misc/krename/krename-5.0.2.ebuild
copy to kde-misc/krename/krename-5.0.2-r1.ebuild
index 632cc5cb2f25..5b56a51b4fe9 100644
--- a/kde-misc/krename/krename-5.0.2.ebuild
+++ b/kde-misc/krename/krename-5.0.2-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -12,8 +12,9 @@ DESCRIPTION="Powerful batch file renamer"
 HOMEPAGE="https://apps.kde.org/krename/ https://userbase.kde.org/KRename"
 
 if [[ ${KDE_BUILD_TYPE} != live ]]; then
-	SRC_URI="mirror://kde/stable/${PN}/${PV}/src/${P}.tar.xz"
-	KEYWORDS="amd64 ~arm64 x86"
+	SRC_URI="mirror://kde/stable/${PN}/${PV}/src/${P}.tar.xz
+		https://dev.gentoo.org/~asturm/distfiles/${P}-patchset-1.tar.xz"
+	KEYWORDS="~amd64 ~arm64 ~x86"
 fi
 
 LICENSE="GPL-2"
@@ -45,7 +46,7 @@ DEPEND="
 RDEPEND="${DEPEND}"
 BDEPEND="sys-devel/gettext"
 
-PATCHES=( "${FILESDIR}/${PN}-5.0.1-no-kjs.patch" )
+PATCHES=( "${WORKDIR}/${P}-patchset-1" ) # upstream, git master
 
 src_configure() {
 	local mycmakeargs=(

diff --git a/kde-misc/krename/krename-5.0.2.ebuild b/kde-misc/krename/krename-5.0.2.ebuild
index 632cc5cb2f25..8f13ce26b5db 100644
--- a/kde-misc/krename/krename-5.0.2.ebuild
+++ b/kde-misc/krename/krename-5.0.2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -12,7 +12,8 @@ DESCRIPTION="Powerful batch file renamer"
 HOMEPAGE="https://apps.kde.org/krename/ https://userbase.kde.org/KRename"
 
 if [[ ${KDE_BUILD_TYPE} != live ]]; then
-	SRC_URI="mirror://kde/stable/${PN}/${PV}/src/${P}.tar.xz"
+	SRC_URI="mirror://kde/stable/${PN}/${PV}/src/${P}.tar.xz
+		https://dev.gentoo.org/~asturm/distfiles/${P}-patchset-1.tar.xz"
 	KEYWORDS="amd64 ~arm64 x86"
 fi
 
@@ -45,7 +46,7 @@ DEPEND="
 RDEPEND="${DEPEND}"
 BDEPEND="sys-devel/gettext"
 
-PATCHES=( "${FILESDIR}/${PN}-5.0.1-no-kjs.patch" )
+PATCHES=( "${WORKDIR}/${PN}-5.0.2-patchset-1/${PN}-5.0.1-no-kjs.patch" )
 
 src_configure() {
 	local mycmakeargs=(


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: kde-misc/krename/files/, kde-misc/krename/
@ 2023-09-21 18:42 Andreas Sturmlechner
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Sturmlechner @ 2023-09-21 18:42 UTC (permalink / raw
  To: gentoo-commits

commit:     ec7cf9f84477ba75203a7182ad5d720259d90874
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 21 18:38:09 2023 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Sep 21 18:42:32 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec7cf9f8

kde-misc/krename: Fix configure with >=app-text/podofo-0.10

Closes: https://bugs.gentoo.org/914497
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../krename/files/krename-5.0.2-podofo-0.10.patch  | 319 +++++++++++++++++++++
 kde-misc/krename/krename-5.0.2-r1.ebuild           |   5 +-
 2 files changed, 323 insertions(+), 1 deletion(-)

diff --git a/kde-misc/krename/files/krename-5.0.2-podofo-0.10.patch b/kde-misc/krename/files/krename-5.0.2-podofo-0.10.patch
new file mode 100644
index 000000000000..3410e3f20c2d
--- /dev/null
+++ b/kde-misc/krename/files/krename-5.0.2-podofo-0.10.patch
@@ -0,0 +1,319 @@
+From 0528606297a82aae46cb5e44a2bb406cbc033615 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Mon, 17 Jul 2023 20:29:37 +0000
+Subject: [PATCH 1/2] Support podofo 0.10
+
+Version 0.10 of podofo is a complete rewrite. krename's use of it is minimal, so porting is easy.
+
+Switch the cmake module to use pkgconfig, which is available since 0.9.5 (release in 2017).
+
+Unfortunately, the hack to find the version number is still needed, since the pc file is buggy and ships an empty "Version" field.
+---
+ cmake/modules/FindPoDoFo.cmake | 31 +++++++++++++++----------------
+ src/podofoplugin.cpp           | 20 ++++++++++++++++++++
+ 2 files changed, 35 insertions(+), 16 deletions(-)
+
+diff --git a/cmake/modules/FindPoDoFo.cmake b/cmake/modules/FindPoDoFo.cmake
+index 3d044f0..c771149 100644
+--- a/cmake/modules/FindPoDoFo.cmake
++++ b/cmake/modules/FindPoDoFo.cmake
+@@ -36,15 +36,8 @@
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-find_path(PoDoFo_INCLUDE_DIRS
+-  NAMES podofo/podofo.h
+-)
+-find_library(PoDoFo_LIBRARIES
+-  NAMES libpodofo podofo
+-)
+-
+-include(FindPackageHandleStandardArgs)
+-find_package_handle_standard_args(PoDoFo DEFAULT_MSG PoDoFo_LIBRARIES PoDoFo_INCLUDE_DIRS)
++include(FindPkgConfig)
++pkg_search_module(PoDoFo libpodofo libpodofo-0)
+ 
+ set(PoDoFo_DEFINITIONS)
+ if(PoDoFo_FOUND)
+@@ -61,17 +54,19 @@ if(PoDoFo_FOUND)
+     endif()
+   endif()
+ 
+-  # PoDoFo-0.9.5 unconditionally includes openssl/opensslconf.h in a public
+-  # header. The fix is in https://sourceforge.net/p/podofo/code/1830/ and will
+-  # hopefully be released soon with 0.9.6. Note that krename doesn't use
+-  # OpenSSL in any way.
+-  file(STRINGS "${PoDoFo_INCLUDE_DIRS}/podofo/base/podofo_config.h" PoDoFo_MAJOR_VER_LINE REGEX "^#define[ \t]+PODOFO_VERSION_MAJOR[ \t]+[0-9]+$")
+-  file(STRINGS "${PoDoFo_INCLUDE_DIRS}/podofo/base/podofo_config.h" PoDoFo_MINOR_VER_LINE REGEX "^#define[ \t]+PODOFO_VERSION_MINOR[ \t]+[0-9]+$")
+-  file(STRINGS "${PoDoFo_INCLUDE_DIRS}/podofo/base/podofo_config.h" PoDoFo_PATCH_VER_LINE REGEX "^#define[ \t]+PODOFO_VERSION_PATCH[ \t]+[0-9]+$")
++  find_file(PoDoFo_CONFIG podofo_config.h PATHS ${PoDoFo_INCLUDE_DIRS} PATH_SUFFIXES auxiliary base)
++  file(STRINGS "${PoDoFo_CONFIG}" PoDoFo_MAJOR_VER_LINE REGEX "^#define[ \t]+PODOFO_VERSION_MAJOR[ \t]+[0-9]+$")
++  file(STRINGS "${PoDoFo_CONFIG}" PoDoFo_MINOR_VER_LINE REGEX "^#define[ \t]+PODOFO_VERSION_MINOR[ \t]+[0-9]+$")
++  file(STRINGS "${PoDoFo_CONFIG}" PoDoFo_PATCH_VER_LINE REGEX "^#define[ \t]+PODOFO_VERSION_PATCH[ \t]+[0-9]+$")
+   string(REGEX REPLACE "^#define[ \t]+PODOFO_VERSION_MAJOR[ \t]+([0-9]+)$" "\\1" PoDoFo_MAJOR_VER "${PoDoFo_MAJOR_VER_LINE}")
+   string(REGEX REPLACE "^#define[ \t]+PODOFO_VERSION_MINOR[ \t]+([0-9]+)$" "\\1" PoDoFo_MINOR_VER "${PoDoFo_MINOR_VER_LINE}")
+   string(REGEX REPLACE "^#define[ \t]+PODOFO_VERSION_PATCH[ \t]+([0-9]+)$" "\\1" PoDoFo_PATCH_VER "${PoDoFo_PATCH_VER_LINE}")
+   set(PoDoFo_VERSION "${PoDoFo_MAJOR_VER}.${PoDoFo_MINOR_VER}.${PoDoFo_PATCH_VER}")
++
++  # PoDoFo-0.9.5 unconditionally includes openssl/opensslconf.h in a public
++  # header. The fix is in https://sourceforge.net/p/podofo/code/1830/ and will
++  # hopefully be released soon with 0.9.6. Note that krename doesn't use
++  # OpenSSL in any way.
+   if(PoDoFo_VERSION VERSION_EQUAL "0.9.5")
+     find_package(OpenSSL)
+     if (OpenSSL_FOUND)
+@@ -84,4 +79,8 @@ if(PoDoFo_FOUND)
+   endif()
+ endif()
+ 
++if(PoDoFo_VERSION VERSION_GREATER_EQUAL 0.10.0)
++  set(CMAKE_CXX_STANDARD 17)
++endif()
++
+ mark_as_advanced(PoDoFo_INCLUDE_DIRS PoDoFo_LIBRARIES PoDoFo_DEFINITIONS)
+diff --git a/src/podofoplugin.cpp b/src/podofoplugin.cpp
+index 9bcce21..79fd735 100644
+--- a/src/podofoplugin.cpp
++++ b/src/podofoplugin.cpp
+@@ -61,6 +61,25 @@ QString PodofoPlugin::processFile(BatchRenamer *b, int index, const QString &fil
+     try {
+         PdfMemDocument doc;
+         doc.Load(filename.toUtf8().data());
++#if (PODOFO_VERSION_MINOR>=10 || PODOFO_VERSION_MAJOR>=1)
++        const PdfInfo *info = doc.GetInfo();
++
++        if (token == "pdfauthor") {
++            return info->GetAuthor().has_value() ? QString::fromUtf8(info->GetAuthor()->GetString().c_str()) : QString();
++        } else if (token == "pdfcreator") {
++            return info->GetCreator().has_value() ? QString::fromUtf8(info->GetCreator()->GetString().c_str()) : QString();
++        } else if (token == "pdfkeywords") {
++            return info->GetKeywords().has_value() ? QString::fromUtf8(info->GetKeywords()->GetString().c_str()) : QString();
++        } else if (token == "pdfsubject") {
++            return info->GetSubject().has_value() ? QString::fromUtf8(info->GetSubject()->GetString().c_str()) : QString();
++        } else if (token == "pdftitle") {
++            return info->GetTitle().has_value() ? QString::fromUtf8(info->GetTitle()->GetString().c_str()) : QString();
++        } else if (token == "pdfproducer") {
++            return info->GetProducer().has_value() ? QString::fromUtf8(info->GetProducer()->GetString().c_str()) : QString();
++        } else if (token == "pdfpages") {
++            return QString::number(doc.GetPages().GetCount());
++        }
++#else
+         PdfInfo *info = doc.GetInfo();
+ 
+         if (token == "pdfauthor") {
+@@ -78,6 +97,7 @@ QString PodofoPlugin::processFile(BatchRenamer *b, int index, const QString &fil
+         } else if (token == "pdfpages") {
+             return QString::number(doc.GetPageCount());
+         }
++#endif
+     } catch (PdfError &error) {
+         return QString::fromUtf8(error.what());
+     }
+-- 
+2.42.0
+
+
+From a054a825521698f1de4b387949ef56a15e78feb6 Mon Sep 17 00:00:00 2001
+From: Heiko Becker <heiko.becker@kde.org>
+Date: Sat, 15 Jul 2023 18:20:06 +0200
+Subject: [PATCH 2/2] cmake: Improve FindPoDoFo
+
+Add some rst based documentation and provide an imported target for
+example.
+I've dropped -DUSING_SHARED_PODOFO, which looks weird nowadays and
+seems to exist because of Windows, which I can't test. So comment it out
+for now, but it'll probably be removed in the future, if nobody turns up
+who cares about Windows and can comment on it.
+---
+ CMakeLists.txt                 |   5 +-
+ cmake/modules/FindPoDoFo.cmake | 121 ++++++++++++++++++++++++---------
+ src/CMakeLists.txt             |   7 +-
+ 3 files changed, 91 insertions(+), 42 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a772b6a..9d736be 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -63,10 +63,7 @@ endif()
+ 
+ # Find podofo
+ find_package(PoDoFo)
+-set_package_properties(PoDoFo PROPERTIES
+-    DESCRIPTION "A library to access PDF metadata"
+-    URL "http://podofo.sourceforge.net/"
+-    TYPE OPTIONAL)
++set_package_properties(PoDoFo PROPERTIES TYPE OPTIONAL)
+ 
+ # Find freetype
+ find_package(Freetype)
+diff --git a/cmake/modules/FindPoDoFo.cmake b/cmake/modules/FindPoDoFo.cmake
+index c771149..dce7473 100644
+--- a/cmake/modules/FindPoDoFo.cmake
++++ b/cmake/modules/FindPoDoFo.cmake
+@@ -1,17 +1,5 @@
+-# - Try to find the PoDoFo library
+-#
+-# Windows users MUST set when building:
+-#
+-# PoDoFo_USE_SHARED - whether use PoDoFo as shared library
+-#
+-# Once done this will define:
+-#
+-# PoDoFo_FOUND - system has the PoDoFo library
+-# PoDoFo_INCLUDE_DIRS - the PoDoFo include directory
+-# PoDoFo_LIBRARIES - the libraries needed to use PoDoFo
+-# PoDoFo_DEFINITIONS - the definitions needed to use PoDoFo
+-#
+ # Copyright 2016 Pino Toscano <pino@kde.org>
++# Copyright 2023 Heiko Becker <heiko.becker@kde.org>
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted provided that the following conditions
+@@ -36,23 +24,63 @@
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+-include(FindPkgConfig)
+-pkg_search_module(PoDoFo libpodofo libpodofo-0)
+-
+-set(PoDoFo_DEFINITIONS)
+-if(PoDoFo_FOUND)
+-  if(WIN32)
+-    if(NOT DEFINED PoDoFo_USE_SHARED)
+-      message(SEND_ERROR "Win32 users MUST set PoDoFo_USE_SHARED")
+-      message(SEND_ERROR "Set -DPoDoFo_USE_SHARED=0 if linking to a static library PoDoFo")
+-      message(SEND_ERROR "or -DPoDoFo_USE_SHARED=1 if linking to a DLL build of PoDoFo")
+-      message(FATAL_ERROR "PoDoFo_USE_SHARED unset on win32 build")
+-    else()
+-      if(PoDoFo_USE_SHARED)
+-        set(PoDoFo_DEFINITIONS "${PoDoFo_DEFINITIONS} -DUSING_SHARED_PODOFO")
+-      endif(PoDoFo_USE_SHARED)
+-    endif()
+-  endif()
++#[=======================================================================[.rst:
++FindPoDoFo
++------------
++
++Try to find PoDoFo, a C++ library to work with the PDF file format
++
++This will define the following variables:
++
++``PoDoFo_FOUND``
++    True if PoDoFo is available
++``PoDoFo_VERSION``
++    The version of PoDoFo
++``PoDoFo_LIBRARIES``
++    The libraries of PoDoFofor use with target_link_libraries()
++``PoDoFo_INCLUDE_DIRS``
++    The include dirs of PoDoFo for use with target_include_directories()
++
++If ``PoDoFo_FOUND`` is TRUE, it will also define the following imported
++target:
++
++``PoDoFo::PoDoFo``
++    The PoDoFo library
++
++In general we recommend using the imported target, as it is easier to use.
++Bear in mind, however, that if the target is in the link interface of an
++exported library, it must be made available by the package config file.
++
++#]=======================================================================]
++
++find_package(PkgConfig QUIET)
++pkg_search_module(PC_PoDoFo QUIET libpodofo libpodofo-0)
++
++find_library(PoDoFo_LIBRARIES
++    NAMES podofo
++    HINTS ${PC_PoDoFo_LIBRARY_DIRS}
++)
++
++find_path(PoDoFo_INCLUDE_DIRS
++    NAMES podofo.h
++    HINTS ${PC_PoDoFo_INCLUDE_DIRS}
++)
++
++if(PoDoFo_INCLUDE_DIRS)
++  # NOTE: I have no idea if that's still needed and no possibility to test on
++  # Windows.
++  #if(WIN32)
++  #  if(NOT DEFINED PoDoFo_USE_SHARED)
++  #    message(SEND_ERROR "Win32 users MUST set PoDoFo_USE_SHARED")
++  #    message(SEND_ERROR "Set -DPoDoFo_USE_SHARED=0 if linking to a static library PoDoFo")
++  #    message(SEND_ERROR "or -DPoDoFo_USE_SHARED=1 if linking to a DLL build of PoDoFo")
++  #    message(FATAL_ERROR "PoDoFo_USE_SHARED unset on win32 build")
++  #  else()
++  #    if(PoDoFo_USE_SHARED)
++  #      set(PoDoFo_DEFINITIONS "${PoDoFo_DEFINITIONS} -DUSING_SHARED_PODOFO")
++  #    endif(PoDoFo_USE_SHARED)
++  #  endif()
++  #endif()
+ 
+   find_file(PoDoFo_CONFIG podofo_config.h PATHS ${PoDoFo_INCLUDE_DIRS} PATH_SUFFIXES auxiliary base)
+   file(STRINGS "${PoDoFo_CONFIG}" PoDoFo_MAJOR_VER_LINE REGEX "^#define[ \t]+PODOFO_VERSION_MAJOR[ \t]+[0-9]+$")
+@@ -80,7 +108,36 @@ if(PoDoFo_FOUND)
+ endif()
+ 
+ if(PoDoFo_VERSION VERSION_GREATER_EQUAL 0.10.0)
+-  set(CMAKE_CXX_STANDARD 17)
++    set(CMAKE_CXX_STANDARD 17)
++endif()
++
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(PoDoFo
++    FOUND_VAR
++        PoDoFo_FOUND
++    REQUIRED_VARS
++        PoDoFo_LIBRARIES
++        PoDoFo_INCLUDE_DIRS
++    VERSION_VAR
++        PoDoFo_VERSION
++)
++
++if(PoDoFo_FOUND AND NOT TARGET PoDoFo::PoDoFo)
++    add_library(PoDoFo::PoDoFo UNKNOWN IMPORTED)
++    set_target_properties(PoDoFo::PoDoFo PROPERTIES
++        IMPORTED_LOCATION "${PoDoFo_LIBRARIES}"
++        INTERFACE_COMPILE_OPTIONS "${PC_PoDoFo_CFLAGS}"
++        INTERFACE_INCLUDE_DIRECTORIES "${PoDoFo_INCLUDE_DIRS}"
++    )
++    if(TARGET PkgConfig::PC_PoDoFo)
++        target_link_libraries(PoDoFo::PoDoFo INTERFACE PkgConfig::PC_PoDoFo)
++    endif()
+ endif()
+ 
+-mark_as_advanced(PoDoFo_INCLUDE_DIRS PoDoFo_LIBRARIES PoDoFo_DEFINITIONS)
++mark_as_advanced(PoDoFo_LIBRARIES PoDoFo_INCLUDE_DIRS PoDoFo_VERSION)
++
++include(FeatureSummary)
++set_package_properties(PoDoFo PROPERTIES
++    DESCRIPTION "A C++ libary to work with the PDF file format"
++    URL "https://github.com/podofo/podofo"
++)
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index e4b00ac..cffe7fb 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -14,11 +14,6 @@ if(EXIV2_FOUND)
+     include_directories(${EXIV2_INCLUDE_DIR})
+ endif()
+ 
+-if(PoDoFo_FOUND)
+-    include_directories(${PoDoFo_INCLUDE_DIRS})
+-    add_definitions(${PoDoFo_DEFINITIONS})
+-endif()
+-
+ if(FREETYPE_FOUND)
+     include_directories(${FREETYPE_INCLUDE_DIRS})
+ endif()
+@@ -138,7 +133,7 @@ if(LibExiv2_FOUND)
+ endif()
+ if(PoDoFo_FOUND)
+     target_link_libraries(krename
+-        ${PoDoFo_LIBRARIES}
++        PoDoFo::PoDoFo
+     )
+ endif()
+ if(FREETYPE_FOUND)
+-- 
+2.42.0
+

diff --git a/kde-misc/krename/krename-5.0.2-r1.ebuild b/kde-misc/krename/krename-5.0.2-r1.ebuild
index 36cabcc29156..fc67232d79aa 100644
--- a/kde-misc/krename/krename-5.0.2-r1.ebuild
+++ b/kde-misc/krename/krename-5.0.2-r1.ebuild
@@ -46,7 +46,10 @@ DEPEND="
 RDEPEND="${DEPEND}"
 BDEPEND="sys-devel/gettext"
 
-PATCHES=( "${WORKDIR}/${P}-patchset-1" ) # upstream, git master
+PATCHES=(
+	"${WORKDIR}/${P}-patchset-1" # upstream, git master
+	"${FILESDIR}/${P}-podofo-0.10.patch" # bug 914497
+)
 
 src_configure() {
 	local mycmakeargs=(


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-21 18:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-25 21:23 [gentoo-commits] repo/gentoo:master commit in: kde-misc/krename/files/, kde-misc/krename/ Andreas Sturmlechner
  -- strict thread matches above, loose matches on Subject: below --
2020-12-18 13:44 Andreas Sturmlechner
2023-05-28 12:44 Andreas Sturmlechner
2023-09-21 18:42 Andreas Sturmlechner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox