From 5e46fb35016c8ae73fbd31cc64a9f1354b304541 Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Mon, 30 May 2022 14:51:29 +0800
Subject: [PATCH] modify version of kylin-scanner is null

---
 src/main.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/main.cpp b/src/main.cpp
index 48ae229..6de4eca 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -140,7 +140,23 @@ static QString getSystemArchitecture()
 
 static QString getAppVersion()
 {
-    QString versionResult = execCmd(QString("dpkg-parsechangelog -l %1 --show-field Version").arg(ChangelogFilePath));
+    QString versionResult;
+    QProcess process;
+    QStringList options;
+    options << "-q" << "kylin-scanner";
+    process.start("rpm", options);
+    process.waitForFinished();
+    QString dpkgInfo = process.readAll();
+    QStringList infoList = dpkgInfo.split("\n");
+    for (int n = 0; n < infoList.size(); n++) {
+        QString strInfoLine = infoList[n];
+	if (strInfoLine.contains("kylin-scanner")) {
+	    QStringList lineInfoList = strInfoLine.split(QRegExp("-"));
+	    if (lineInfoList.size() >= 3) {
+		 versionResult = lineInfoList[2];
+	    }
+	}
+    }
     return versionResult;
 }
 
-- 
2.33.0

