public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/kxmlgui/, kde-frameworks/kxmlgui/files/
Date: Tue,  3 Oct 2023 15:29:52 +0000 (UTC)	[thread overview]
Message-ID: <1696346982.84f85d1105409ac7cd5119e9ff7a47b91c2cb172.sam@gentoo> (raw)

commit:     84f85d1105409ac7cd5119e9ff7a47b91c2cb172
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 15:28:54 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 15:29:42 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84f85d11

kde-frameworks/kxmlgui: fix XML merging (shortcut scheme handling)

KDE-bug: https://bugs.kde.org/show_bug.cgi?id=475016
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/kxmlgui-5.111.0-fix-xml-merging.patch    | 156 +++++++++++++++++++++
 kde-frameworks/kxmlgui/kxmlgui-5.110.0-r1.ebuild   |  49 +++++++
 2 files changed, 205 insertions(+)

diff --git a/kde-frameworks/kxmlgui/files/kxmlgui-5.111.0-fix-xml-merging.patch b/kde-frameworks/kxmlgui/files/kxmlgui-5.111.0-fix-xml-merging.patch
new file mode 100644
index 000000000000..013fbab9d1c7
--- /dev/null
+++ b/kde-frameworks/kxmlgui/files/kxmlgui-5.111.0-fix-xml-merging.patch
@@ -0,0 +1,156 @@
+https://invent.kde.org/frameworks/kxmlgui/-/merge_requests/190
+https://bugs.kde.org/show_bug.cgi?id=475016
+
+From f015fa6006d2e2eea2d2aac11c18219b255722ef Mon Sep 17 00:00:00 2001
+From: Mladen Milinkovic <maxrd2@smoothware.net>
+Date: Fri, 29 Sep 2023 20:01:49 +0200
+Subject: [PATCH] Fix merging of XMLs with multiple ActionProperties tags
+
+BUG: 475016
+--- a/autotests/kxmlgui_unittest.cpp
++++ b/autotests/kxmlgui_unittest.cpp
+@@ -88,6 +88,26 @@ static void createXmlFile(QFile &file, int version, int flags, const QByteArray
+     file.write("</" + toplevelTag + ">\n");
+ }
+ 
++class ShortcutSchemeHandler
++{
++public:
++    ShortcutSchemeHandler(const QString &scheme)
++        : cgScheme(KSharedConfig::openConfig(), "Shortcut Schemes")
++        , prevScheme(cgScheme.readEntry("Current Scheme", QStringLiteral("Default")))
++    {
++        cgScheme.writeEntry("Current Scheme", scheme);
++    }
++
++    ~ShortcutSchemeHandler()
++    {
++        cgScheme.writeEntry("Current Scheme", prevScheme);
++    }
++
++private:
++    KConfigGroup cgScheme;
++    const QString prevScheme;
++};
++
+ static void clickApply(KEditToolBar *dialog)
+ {
+     QDialogButtonBox *box = dialog->findChild<QDialogButtonBox *>();
+@@ -106,6 +126,15 @@ void KXmlGui_UnitTest::initTestCase()
+         QFile::remove(configFile);
+         KSharedConfig::openConfig()->reparseConfiguration();
+     }
++
++    // Create "Test" shortcut scheme to eliminate the KF warning
++    QFile testScheme = QFile(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
++        + QLatin1String("/%1/shortcuts/%2").arg(QCoreApplication::applicationName(), QStringLiteral("Test")));
++    if (!testScheme.exists()) {
++        QVERIFY(QFileInfo(testScheme).dir().mkpath(QStringLiteral(".")));
++        QVERIFY(testScheme.open(QIODevice::WriteOnly));
++        testScheme.write(QByteArray("<gui><ActionProperties/></gui>"));
++    }
+ }
+ 
+ void KXmlGui_UnitTest::testFindVersionNumber_data()
+@@ -457,6 +486,56 @@ void KXmlGui_UnitTest::testPartMerging()
+     factory.removeClient(&hostClient);
+ }
+ 
++void KXmlGui_UnitTest::testShortcutSchemeMerging()
++{
++    TestGuiClient client;
++
++    ShortcutSchemeHandler sss(QStringLiteral("Test"));
++
++    KActionCollection *ac = client.actionCollection();
++
++    QAction *a = ac->addAction(QStringLiteral("test_action"));
++    ac->setDefaultShortcut(a, QKeySequence(QStringLiteral("Ctrl+A")));
++
++    const QByteArray appXml = R"(<?xml version = "1.0"?>
++<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
++<kpartgui name="foo" version="5">
++<MenuBar>
++  <Menu name="file"><text>&amp;File</text>
++    <Action name="test_action" />
++  </Menu>
++</MenuBar></kpartgui>
++)";
++    client.createGUI(appXml, false);
++
++    const QByteArray settingsXml = R"(<!DOCTYPE kpartgui SYSTEM 'kpartgui.dtd'>
++<kpartgui name="foo" version="1">
++ <MenuBar>
++  <Menu name="file">
++   <text>&amp;File</text>
++   <Action name="test_action" />
++  </Menu>
++ </MenuBar>
++ <ActionProperties scheme="Default">
++  <Action name="test_action" shortcut="Ctrl+B"/>
++ </ActionProperties>
++ <ActionProperties scheme="Test">
++  <Action name="test_action" shortcut="Ctrl+C"/>
++ </ActionProperties>
++</kpartgui>
++)";
++    client.mergeXML(settingsXml);
++
++    KMainWindow mainWindow;
++    KXMLGUIBuilder builder(&mainWindow);
++    KXMLGUIFactory factory(&builder);
++    factory.addClient(&client);
++
++    QCOMPARE(a->shortcut(), QKeySequence(QStringLiteral("Ctrl+C")));
++
++    factory.removeClient(&client);
++}
++
+ void KXmlGui_UnitTest::testPartMergingSettings() // #252911
+ {
+     const QByteArray hostXml =
+--- a/autotests/kxmlgui_unittest.h
++++ b/autotests/kxmlgui_unittest.h
+@@ -23,6 +23,7 @@ private Q_SLOTS:
+     void testVersionHandlerNewVersionUserChanges();
+     void testPartMerging();
+     void testPartMergingSettings();
++    void testShortcutSchemeMerging();
+     void testUiStandardsMerging_data();
+     void testUiStandardsMerging();
+     void testActionListAndSeparator();
+--- a/autotests/testguiclient.h
++++ b/autotests/testguiclient.h
+@@ -42,6 +42,10 @@ public:
+ 
+         setXML(QString::fromLatin1(xml), true);
+     }
++    void mergeXML(const QByteArray &xml)
++    {
++        setXML(QString::fromLatin1(xml), true);
++    }
+     void createActions(const QStringList &actionNames)
+     {
+         KActionCollection *coll = actionCollection();
+--- a/src/kxmlguiclient.cpp
++++ b/src/kxmlguiclient.cpp
+@@ -587,6 +587,8 @@ bool KXMLGUIClientPrivate::isEmptyContainer(const QDomElement &base, KActionColl
+ 
+ QDomElement KXMLGUIClientPrivate::findMatchingElement(const QDomElement &base, const QDomElement &additive)
+ {
++    const QString idAttribute(base.tagName() == QLatin1String("ActionProperties") ? QStringLiteral("scheme") : QStringLiteral("name"));
++
+     QDomNode n = additive.firstChild();
+     while (!n.isNull()) {
+         QDomElement e = n.toElement();
+@@ -604,7 +606,7 @@ QDomElement KXMLGUIClientPrivate::findMatchingElement(const QDomElement &base, c
+ 
+         // now see if our tags are equivalent
+         if (equalstr(tag, base.tagName()) //
+-            && e.attribute(QStringLiteral("name")) == base.attribute(QStringLiteral("name"))) {
++            && e.attribute(idAttribute) == base.attribute(idAttribute)) {
+             return e;
+         }
+     }
+-- 
+GitLab

diff --git a/kde-frameworks/kxmlgui/kxmlgui-5.110.0-r1.ebuild b/kde-frameworks/kxmlgui/kxmlgui-5.110.0-r1.ebuild
new file mode 100644
index 000000000000..e891a27f3694
--- /dev/null
+++ b/kde-frameworks/kxmlgui/kxmlgui-5.110.0-r1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_DESIGNERPLUGIN="true"
+PVCUT=$(ver_cut 1-2)
+QTMIN=5.15.9
+inherit ecm frameworks.kde.org
+
+DESCRIPTION="Framework for managing menu and toolbar actions in an abstract way"
+
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
+LICENSE="LGPL-2+"
+IUSE=""
+
+# slot op: includes QtCore/private/qlocale_p.h
+DEPEND="
+	>=dev-qt/qtcore-${QTMIN}:5=
+	>=dev-qt/qtdbus-${QTMIN}:5
+	>=dev-qt/qtgui-${QTMIN}:5
+	>=dev-qt/qtnetwork-${QTMIN}:5[ssl]
+	>=dev-qt/qtprintsupport-${QTMIN}:5
+	>=dev-qt/qtwidgets-${QTMIN}:5
+	>=dev-qt/qtxml-${QTMIN}:5
+	=kde-frameworks/kconfig-${PVCUT}*:5
+	=kde-frameworks/kconfigwidgets-${PVCUT}*:5
+	=kde-frameworks/kcoreaddons-${PVCUT}*:5
+	=kde-frameworks/kglobalaccel-${PVCUT}*:5
+	=kde-frameworks/kguiaddons-${PVCUT}*:5
+	=kde-frameworks/ki18n-${PVCUT}*:5
+	=kde-frameworks/kiconthemes-${PVCUT}*:5
+	=kde-frameworks/kitemviews-${PVCUT}*:5
+	=kde-frameworks/kwidgetsaddons-${PVCUT}*:5
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-5.111.0-fix-xml-merging.patch
+)
+
+src_test() {
+	# Files are missing; whatever. Bugs 650290, 668198, 808216
+	local myctestargs=(
+		-E "(ktoolbar_unittest|kxmlgui_unittest|ktooltiphelper_unittest)"
+	)
+
+	ecm_src_test
+}


             reply	other threads:[~2023-10-03 15:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 15:29 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-04-11 14:23 [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/kxmlgui/, kde-frameworks/kxmlgui/files/ Andreas Sturmlechner
2020-09-29 12:49 Andreas Sturmlechner
2018-07-18 18:46 Andreas Sturmlechner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1696346982.84f85d1105409ac7cd5119e9ff7a47b91c2cb172.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox