Projects
home:Eustace:branches:Eulaceura:Factory
kylin-calculator
_service:obs_scm:0001-Fix-the-version-showing-n...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0001-Fix-the-version-showing-none-in-about-dialog.patch of Package kylin-calculator
From c16a752694ed5e34382199e0b4175a73c2c6ab5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= <houhongxun@kylinos.cn> 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: 侯红勋 <houhongxun@kylinos.cn> --- 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
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2