!23 [sync] PR-20: fix version showing "none"
From: @openeuler-sync-bot Reviewed-by: @peijiankang Signed-off-by: @peijiankang
This commit is contained in:
commit
5d24b1f180
@ -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?= <houhongxun@kylinos.cn>
|
||||||
|
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: 侯红勋 <houhongxun@kylinos.cn>
|
||||||
|
---
|
||||||
|
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 <QStyle>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include <QScrollBar>
|
||||||
|
+#include <QRegularExpression>
|
||||||
|
+#include <QProcess>
|
||||||
|
|
||||||
|
KYBAboutDialog *KYBAboutDialog::m_oInstance = nullptr;
|
||||||
|
QMutex KYBAboutDialog::m_oMutex;
|
||||||
|
|
||||||
|
-#define VERSION "3.10.3"
|
||||||
|
-
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: kylin-burner
|
Name: kylin-burner
|
||||||
Version: 3.10.3
|
Version: 3.10.3
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: CD/DVD burning application for UKUI.
|
Summary: CD/DVD burning application for UKUI.
|
||||||
License: GPL-3.0-or-later
|
License: GPL-3.0-or-later
|
||||||
URL: https://github.com/UbuntuKylin/kylin-burner
|
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
|
Patch01: 0001-Fix-the-problem-of-scrambled-burner.patch
|
||||||
Patch02: 0002-Repair-the-user-guide-does-not-work.patch
|
Patch02: 0002-Repair-the-user-guide-does-not-work.patch
|
||||||
Patch03: 0003-fix-version-of-kylin-burner.patch
|
Patch03: 0003-fix-version-of-kylin-burner.patch
|
||||||
|
Patch04: 0001-kylin-burner-fix-version-showing-none-on-about-dialo.patch
|
||||||
|
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: qt5-qtx11extras-devel
|
BuildRequires: qt5-qtx11extras-devel
|
||||||
@ -32,6 +33,7 @@ CD/DVD burning application for UKUI.
|
|||||||
%patch01 -p1
|
%patch01 -p1
|
||||||
%patch02 -p1
|
%patch02 -p1
|
||||||
%patch03 -p1
|
%patch03 -p1
|
||||||
|
%patch04 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
mkdir cmake-build
|
mkdir cmake-build
|
||||||
@ -52,6 +54,9 @@ popd
|
|||||||
%{_datadir}/locale/zh_CN/LC_MESSAGES/kylin-burner.mo
|
%{_datadir}/locale/zh_CN/LC_MESSAGES/kylin-burner.mo
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Apr 17 2024 houhongxun <houhongxun@kylinos.cn> - 3.10.3-2
|
||||||
|
- fix version showing "none" on about dialog
|
||||||
|
|
||||||
* Mon May 08 2023 peijiankang <peijiankang@kylinos.cn> - 3.10.3-1
|
* Mon May 08 2023 peijiankang <peijiankang@kylinos.cn> - 3.10.3-1
|
||||||
- update upstream version to 3.10.3
|
- update upstream version to 3.10.3
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user