ukui-control-center/0014-modify-the-error-of-ukui-control-center-open.patch

65 lines
2.2 KiB
Diff
Raw Normal View History

From cd42ab432e63ec38e0339c9d075499b2b628db7b Mon Sep 17 00:00:00 2001
From: pei-jiankang <peijiankang@kylinos.cn>
Date: Fri, 15 Oct 2021 14:10:28 +0800
Subject: [PATCH] modify the error of ukui-control-center open
---
plugins/messages-task/about/about.cpp | 5 +++--
plugins/messages-task/about/cpuinfo.cpp | 5 +++--
plugins/messages-task/about/memoryentry.cpp | 2 +-
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/plugins/messages-task/about/about.cpp b/plugins/messages-task/about/about.cpp
index a2dc766..77f99da 100755
--- a/plugins/messages-task/about/about.cpp
+++ b/plugins/messages-task/about/about.cpp
@@ -106,8 +106,9 @@ void About::setupKernelCompenent() {
MemoryEntry memoryInfo;
QStringList memory = memoryInfo.totalMemory();
- memorySize = memory.at(0) + "(" + memory.at(1) + tr(" available") + ")";
-
+ if(memory.size() >=2) {
+ memorySize = memory.at(0) + "(" + memory.at(1) + tr(" available") + ")";
+ }
ui->kernalContent->setText(kernal);
ui->memoryContent->setText(memorySize);
diff --git a/plugins/messages-task/about/cpuinfo.cpp b/plugins/messages-task/about/cpuinfo.cpp
index d208453..0fb1461 100644
--- a/plugins/messages-task/about/cpuinfo.cpp
+++ b/plugins/messages-task/about/cpuinfo.cpp
@@ -20,14 +20,15 @@ QString cpuinfo::getCpuName()
for (QString str : outputlist) {
if (str.contains("型号名称")){
- name = QString(str).right(str.length() - 28);
+ name = QString(str).right(str.length() - (str.indexOf("") + 1));
break;
}
else if(str.contains("Model name")) {
- name = QString(str).right(str.length() - 33);
+ name = QString(str).right(str.length() - (str.indexOf(":") + 1));
break;
}
}
+ name.remove(QRegExp("^ +\\s*"));
#elif defined(Q_OS_FREEBSD)
#endif
diff --git a/plugins/messages-task/about/memoryentry.cpp b/plugins/messages-task/about/memoryentry.cpp
index f1b1bef..b48b9b7 100755
--- a/plugins/messages-task/about/memoryentry.cpp
+++ b/plugins/messages-task/about/memoryentry.cpp
@@ -76,6 +76,6 @@ QStringList MemoryEntry::totalMemory()
res << total << available;
return res;
}
-
+ res << "N/A" << "N/A";
return res;
}
--
2.27.0