From f066475ea03755a738b78eb1145d772311d8cda5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= Date: Mon, 27 May 2024 14:26:30 +0800 Subject: [PATCH] Fix the version number is "none" in about dialog window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 侯红勋 --- ...version-showing-none-in-about-dialog.patch | 72 +++++++++++++++++++ kylin-calculator.spec | 10 ++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-the-version-showing-none-in-about-dialog.patch diff --git a/0001-Fix-the-version-showing-none-in-about-dialog.patch b/0001-Fix-the-version-showing-none-in-about-dialog.patch new file mode 100644 index 0000000..abe694c --- /dev/null +++ b/0001-Fix-the-version-showing-none-in-about-dialog.patch @@ -0,0 +1,72 @@ +From c16a752694ed5e34382199e0b4175a73c2c6ab5e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= +Date: Mon, 27 May 2024 14:22:23 +0800 +Subject: [PATCH] Fix the version showing "none" in about dialog +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: 侯红勋 +--- + src/menumodule/menumodule.cpp | 31 ++++++++++++------------ + translations/generate_translations_qm.sh | 4 +-- + 2 files changed, 17 insertions(+), 18 deletions(-) + +diff --git a/src/menumodule/menumodule.cpp b/src/menumodule/menumodule.cpp +index 230ad47..765e855 100755 +--- a/src/menumodule/menumodule.cpp ++++ b/src/menumodule/menumodule.cpp +@@ -127,22 +127,21 @@ void menuModule::helpAction() + + QString menuModule::getVersion() + { +- QString version; +- QString command = "dpkg -l kylin-calculator | grep kylin-calculator"; +- QProcess process; +- QStringList args; +- args << "-c" << command; +- process.start("bash", args); +- process.waitForFinished(); +- process.waitForReadyRead(); +- version = process.readAll(); +- QStringList fields = version.split(QRegularExpression("[ \t]+")); +- if (fields.size() >= 3) +- version = fields.at(2); +- else +- version = "none"; +- +- return version; ++ QProcess v_p; ++ v_p.start("rpm", QStringList() << "-q" << "kylin-calculator"); ++ ++ if (!v_p.waitForFinished()) ++ return "none"; ++ ++ QByteArray ba = v_p.readAllStandardOutput(); ++ ++ QRegularExpression qe("-([^-]+)-[^-]+\n$"); ++ ++ QRegularExpressionMatch qem = qe.match(ba); ++ if (qem.hasMatch()) { ++ return qem.captured(1); ++ } ++ return "none"; + } + + void menuModule::keyPressEvent(QKeyEvent *event) +diff --git a/translations/generate_translations_qm.sh b/translations/generate_translations_qm.sh +index 62fa6b5..c162798 100755 +--- a/translations/generate_translations_qm.sh ++++ b/translations/generate_translations_qm.sh +@@ -4,5 +4,5 @@ ts_file_list=(`ls translations/*.ts`) + + for ts in "${ts_file_list[@]}" + do +- lrelease "${ts}" +-done +\ No newline at end of file ++ lrelease-qt5 "${ts}" ++done +-- +2.33.0 + diff --git a/kylin-calculator.spec b/kylin-calculator.spec index 47d2556..a686463 100644 --- a/kylin-calculator.spec +++ b/kylin-calculator.spec @@ -1,11 +1,12 @@ Name: kylin-calculator Version: 1.2.0.0 -Release: 1 +Release: 2 Summary: Calculator tool for UKUI License: LGPL-3.0-or-later and GPL-3.0-or-later URL: http://www.ukui.org Source0: %{name}-%{version}.tar.gz Patch01: 0001-install-schema-files-to-fix-build-error.patch +Patch02: 0001-Fix-the-version-showing-none-in-about-dialog.patch BuildRequires: qt5-qtbase-devel BuildRequires: qtchooser @@ -39,6 +40,7 @@ and other advantages. %prep %setup -q %patch01 -p1 +%patch02 -p1 %build %{qmake_qt5} %{_qt5_qmake_flags} CONFIG+=enable-by-default kylin-calculator.pro @@ -77,6 +79,12 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/kylin-user-guide/data/guide/kylin-calculator/* %changelog +* Mon May 27 2024 houhongxun - 1.2.0.0-2 +- Type:bugfix +- CVE: +- SUG:NA +- DESC: fix the version number is "none" in about dialog window + * Sun Apr 07 2024 houhongxun - 1.2.0.0-1 - Type:update - CVE: -- Gitee