From 94f841782de88a27c9d053d92aa550113238b0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= Date: Wed, 17 Apr 2024 15:02:31 +0800 Subject: [PATCH] fix version showing "none" on about dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 侯红勋 --- ...-version-showing-none-on-about-dialo.patch | 78 +++++++++++++++++++ kylin-burner.spec | 7 +- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 0001-kylin-burner-fix-version-showing-none-on-about-dialo.patch diff --git a/0001-kylin-burner-fix-version-showing-none-on-about-dialo.patch b/0001-kylin-burner-fix-version-showing-none-on-about-dialo.patch new file mode 100644 index 0000000..674b81f --- /dev/null +++ b/0001-kylin-burner-fix-version-showing-none-on-about-dialo.patch @@ -0,0 +1,78 @@ +From c97c831b5cdc5008436733ffcca8946e666c03c3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= +Date: Wed, 17 Apr 2024 14:40:24 +0800 +Subject: [PATCH] kylin-burner: fix version showing "none" on about dialog +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: 侯红勋 +--- + src/view/kybaboutdialog.cpp | 38 +++++++++++++------------------------ + 1 file changed, 13 insertions(+), 25 deletions(-) + +diff --git a/src/view/kybaboutdialog.cpp b/src/view/kybaboutdialog.cpp +index b8c4201..9e20b7e 100644 +--- a/src/view/kybaboutdialog.cpp ++++ b/src/view/kybaboutdialog.cpp +@@ -31,12 +31,12 @@ + #include + #include + #include ++#include ++#include + + KYBAboutDialog *KYBAboutDialog::m_oInstance = nullptr; + QMutex KYBAboutDialog::m_oMutex; + +-#define VERSION "3.10.3" +- + #include + + KYBAboutDialog::KYBAboutDialog(QWidget *parent) : +@@ -211,31 +211,19 @@ KYBAboutDialog::~KYBAboutDialog() + + QString KYBAboutDialog::getCurrentVersion() + { +- FILE *pp = NULL; +- char *line = NULL; +- size_t len = 0; +- ssize_t read; +- char *q = NULL; +- QString version = tr("none"); +- +- pp = popen("dpkg -l kylin-burner", "r"); +- if(NULL == pp) +- return version; ++ QProcess v_p; ++ v_p.start("rpm", QStringList() << "-q" << "kylin-burner"); + +- while((read = getline(&line, &len, pp)) != -1){ +- q = strrchr(line, '\n'); +- *q = '\0'; ++ if (!v_p.waitForFinished()) ++ return "none"; + +- QString content = line; +- QStringList list = content.split(" "); ++ QByteArray ba = v_p.readAllStandardOutput(); + +- list.removeAll(""); +- +- if (list.size() >= 3) +- version = list.at(2); +- } ++ QRegularExpression qe("-([^-]+)-[^-]+\n$"); + +- free(line); +- pclose(pp); +- return version; ++ QRegularExpressionMatch qem = qe.match(ba); ++ if (qem.hasMatch()) { ++ return qem.captured(1); ++ } ++ return "none"; + } +-- +2.43.0 + diff --git a/kylin-burner.spec b/kylin-burner.spec index 447d799..7b94708 100644 --- a/kylin-burner.spec +++ b/kylin-burner.spec @@ -1,6 +1,6 @@ Name: kylin-burner Version: 3.10.3 -Release: 1 +Release: 2 Summary: CD/DVD burning application for UKUI. License: GPL-3.0-or-later URL: https://github.com/UbuntuKylin/kylin-burner @@ -8,6 +8,7 @@ Source0: %{name}-%{version}.tar.gz Patch01: 0001-Fix-the-problem-of-scrambled-burner.patch Patch02: 0002-Repair-the-user-guide-does-not-work.patch Patch03: 0003-fix-version-of-kylin-burner.patch +Patch04: 0001-kylin-burner-fix-version-showing-none-on-about-dialo.patch BuildRequires: cmake BuildRequires: qt5-qtx11extras-devel @@ -32,6 +33,7 @@ CD/DVD burning application for UKUI. %patch01 -p1 %patch02 -p1 %patch03 -p1 +%patch04 -p1 %build mkdir cmake-build @@ -52,6 +54,9 @@ popd %{_datadir}/locale/zh_CN/LC_MESSAGES/kylin-burner.mo %changelog +* Wed Apr 17 2024 houhongxun - 3.10.3-2 +- fix version showing "none" on about dialog + * Mon May 08 2023 peijiankang - 3.10.3-1 - update upstream version to 3.10.3