!10 fix-system-overview-failed and fix-autologin-nopasswdlogin-failed
From: @myshow2258 Reviewed-by: @dou33 Signed-off-by: @dou33
This commit is contained in:
commit
471a1377cb
257
0001-fix-system-overview-failed.patch
Normal file
257
0001-fix-system-overview-failed.patch
Normal file
@ -0,0 +1,257 @@
|
||||
From e64005deb039312a914ce8dcb9f93f1f4ac6cf7c Mon Sep 17 00:00:00 2001
|
||||
From: myshow <296570182@qq.com>
|
||||
Date: Wed, 25 Nov 2020 17:34:20 +0800
|
||||
Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E4=BA=8E?=
|
||||
=?UTF-8?q?=E7=95=8C=E9=9D=A2=20=E5=86=85=E6=A0=B8=20cpu=20=E5=86=85?=
|
||||
=?UTF-8?q?=E5=AD=98=20=E7=A1=AC=E7=9B=98=20=E4=BF=A1=E6=81=AF=E6=98=BE?=
|
||||
=?UTF-8?q?=E7=A4=BA=E7=A9=BA=E7=99=BD=E7=9A=84=E9=97=AE=E9=A2=98?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
plugins/messages-task/about/about.cpp | 53 +++++----------------
|
||||
plugins/messages-task/about/about.pro | 8 ++--
|
||||
plugins/messages-task/about/cpuinfo.cpp | 34 +++++++++++++
|
||||
plugins/messages-task/about/cpuinfo.h | 15 ++++++
|
||||
plugins/messages-task/about/memoryentry.cpp | 32 ++++++++++---
|
||||
plugins/messages-task/about/memoryentry.h | 1 +
|
||||
6 files changed, 92 insertions(+), 51 deletions(-)
|
||||
create mode 100644 plugins/messages-task/about/cpuinfo.cpp
|
||||
create mode 100644 plugins/messages-task/about/cpuinfo.h
|
||||
|
||||
diff --git a/plugins/messages-task/about/about.cpp b/plugins/messages-task/about/about.cpp
|
||||
index 9e8c290..a2dc766 100644
|
||||
--- a/plugins/messages-task/about/about.cpp
|
||||
+++ b/plugins/messages-task/about/about.cpp
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "about.h"
|
||||
#include "ui_about.h"
|
||||
#include "memoryentry.h"
|
||||
+#include "cpuinfo.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QFile>
|
||||
@@ -99,54 +100,22 @@ void About::setupDesktopComponent() {
|
||||
|
||||
void About::setupKernelCompenent() {
|
||||
QString kernal = QSysInfo::kernelType() + " " + QSysInfo::kernelVersion();
|
||||
- QString diskSize;
|
||||
- QString memorySize;
|
||||
- QString cpuType;
|
||||
-
|
||||
- //ubuntukylin youker DBus interface
|
||||
- QDBusInterface *youkerInterface;
|
||||
- for (int i = 0; i < 2; i++) {
|
||||
- youkerInterface = new QDBusInterface("com.kylin.assistant.systemdaemon",
|
||||
- "/com/kylin/assistant/systemdaemon",
|
||||
- "com.kylin.assistant.systemdaemon",
|
||||
- QDBusConnection::systemBus(), this);
|
||||
- }
|
||||
- if (!youkerInterface->isValid()) {
|
||||
- qCritical() << "Create youker Interface Failed When Get Computer info: " << QDBusConnection::systemBus().lastError();
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- QDBusReply<QMap<QString, QVariant>> diskinfo;
|
||||
- diskinfo = youkerInterface ->call("get_harddisk_info");
|
||||
- if (!diskinfo.isValid()) {
|
||||
- qDebug() << "diskinfo is invalid" << endl;
|
||||
- } else {
|
||||
- QMap<QString, QVariant> res = diskinfo.value();
|
||||
- diskSize = res["DiskCapacity"].toString();
|
||||
- if (diskSize.contains("<1_1>")) {
|
||||
- int index = diskSize.indexOf("<1_1>");
|
||||
- QString disk1 = diskSize.left(index);
|
||||
- diskSize = tr("Disk:") + disk1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- QDBusReply<QMap<QString, QVariant>> cpuinfo;
|
||||
- cpuinfo = youkerInterface ->call("get_cpu_info");
|
||||
- if (!diskinfo.isValid()) {
|
||||
- qDebug() << "cpuinfo is invalid" << endl;
|
||||
- } else {
|
||||
- QMap<QString, QVariant> res = cpuinfo.value();
|
||||
- cpuType = res["CpuVersion"].toString();
|
||||
- }
|
||||
+ QString memorySize = "N/A";
|
||||
+ QString cpuType = "N/A";
|
||||
+ QString diskSize = "N/A";
|
||||
|
||||
MemoryEntry memoryInfo;
|
||||
QStringList memory = memoryInfo.totalMemory();
|
||||
- memorySize = memorySize + memory.at(0) + "(" + memory.at(1) + tr(" available") + ")";
|
||||
+ memorySize = memory.at(0) + "(" + memory.at(1) + tr(" available") + ")";
|
||||
|
||||
- ui->cpuContent->setText(cpuType);
|
||||
- ui->diskContent->setText(diskSize);
|
||||
ui->kernalContent->setText(kernal);
|
||||
ui->memoryContent->setText(memorySize);
|
||||
+
|
||||
+ ui->cpuContent->setText(cpuinfo::getCpuName());
|
||||
+
|
||||
+ QStorageInfo storage = QStorageInfo::root();
|
||||
+ diskSize = QString("%1").arg(storage.bytesTotal()/1024.0f/1024/1024, 0, 'f', 1) + " GB";
|
||||
+ ui->diskContent->setText(diskSize);
|
||||
}
|
||||
|
||||
void About::setupVersionCompenent() {
|
||||
diff --git a/plugins/messages-task/about/about.pro b/plugins/messages-task/about/about.pro
|
||||
index b9898f6..cd789e1 100644
|
||||
--- a/plugins/messages-task/about/about.pro
|
||||
+++ b/plugins/messages-task/about/about.pro
|
||||
@@ -17,12 +17,14 @@ INCLUDEPATH += \
|
||||
HEADERS += \
|
||||
about.h \
|
||||
entry.h \
|
||||
- memoryentry.h
|
||||
+ memoryentry.h \
|
||||
+ cpuinfo.h
|
||||
|
||||
SOURCES += \
|
||||
about.cpp \
|
||||
entry.cpp \
|
||||
- memoryentry.cpp
|
||||
+ memoryentry.cpp \
|
||||
+ cpuinfo.cpp
|
||||
|
||||
FORMS += \
|
||||
about.ui
|
||||
@@ -30,4 +32,4 @@ FORMS += \
|
||||
RESOURCES += \
|
||||
res/img.qrc
|
||||
|
||||
-INSTALLS += target
|
||||
\ No newline at end of file
|
||||
+INSTALLS += target
|
||||
diff --git a/plugins/messages-task/about/cpuinfo.cpp b/plugins/messages-task/about/cpuinfo.cpp
|
||||
new file mode 100644
|
||||
index 0000000..ee24a95
|
||||
--- /dev/null
|
||||
+++ b/plugins/messages-task/about/cpuinfo.cpp
|
||||
@@ -0,0 +1,34 @@
|
||||
+#include <QFile>
|
||||
+#include <QDebug>
|
||||
+
|
||||
+#include "cpuinfo.h"
|
||||
+
|
||||
+cpuinfo::cpuinfo(QObject *parent) : QObject(parent)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+QString cpuinfo::getCpuName()
|
||||
+{
|
||||
+ QString name = "";
|
||||
+#ifdef Q_OS_LINUX
|
||||
+ QFile file("/proc/cpuinfo");
|
||||
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
+ return "no cpuinfo";
|
||||
+
|
||||
+ QString line = "N/A";
|
||||
+ QTextStream in(&file);
|
||||
+ line = in.readLine();
|
||||
+ while (!in.atEnd()) {
|
||||
+ line = in.readLine();
|
||||
+ if (line.contains("model name"))
|
||||
+ break;
|
||||
+ }
|
||||
+ //openEuler /proc/cpuinfo
|
||||
+ //model name : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
|
||||
+ name = QString(line).right(line.length() - (line.indexOf(":") + 2));
|
||||
+#elif defined(Q_OS_FREEBSD)
|
||||
+
|
||||
+#endif
|
||||
+ return name;
|
||||
+}
|
||||
diff --git a/plugins/messages-task/about/cpuinfo.h b/plugins/messages-task/about/cpuinfo.h
|
||||
new file mode 100644
|
||||
index 0000000..2253ea6
|
||||
--- /dev/null
|
||||
+++ b/plugins/messages-task/about/cpuinfo.h
|
||||
@@ -0,0 +1,15 @@
|
||||
+#ifndef CPUINFO_H
|
||||
+#define CPUINFO_H
|
||||
+
|
||||
+#include <QObject>
|
||||
+
|
||||
+class cpuinfo : public QObject
|
||||
+{
|
||||
+ Q_OBJECT
|
||||
+public:
|
||||
+ explicit cpuinfo(QObject *parent = nullptr);
|
||||
+
|
||||
+ static QString getCpuName();
|
||||
+};
|
||||
+
|
||||
+#endif // CPUINFO_H
|
||||
diff --git a/plugins/messages-task/about/memoryentry.cpp b/plugins/messages-task/about/memoryentry.cpp
|
||||
index 4d93a3b..f1b1bef 100644
|
||||
--- a/plugins/messages-task/about/memoryentry.cpp
|
||||
+++ b/plugins/messages-task/about/memoryentry.cpp
|
||||
@@ -22,6 +22,27 @@ MemoryEntry::MemoryEntry() : Entry(ki18n("Memory:"), totalMemory().at(1))
|
||||
}
|
||||
|
||||
qlonglong MemoryEntry::calculateTotalRam()
|
||||
+{
|
||||
+ qlonglong ret = -1;
|
||||
+#ifdef Q_OS_LINUX
|
||||
+ struct sysinfo info;
|
||||
+ if (sysinfo(&info) == 0)
|
||||
+ // manpage "sizes are given as multiples of mem_unit bytes"
|
||||
+ ret = qlonglong(info.totalswap) * info.mem_unit;
|
||||
+#elif defined(Q_OS_FREEBSD)
|
||||
+ /* Stuff for sysctl */
|
||||
+ size_t len;
|
||||
+
|
||||
+ unsigned long memory;
|
||||
+ len = sizeof(memory);
|
||||
+ sysctlbyname("hw.physmem", &memory, &len, NULL, 0);
|
||||
+
|
||||
+ ret = memory;
|
||||
+#endif
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+qlonglong MemoryEntry::calculateavAilableRam()
|
||||
{
|
||||
qlonglong ret = -1;
|
||||
#ifdef Q_OS_LINUX
|
||||
@@ -46,16 +67,15 @@ QStringList MemoryEntry::totalMemory()
|
||||
{
|
||||
QStringList res;
|
||||
const qlonglong totalRam = calculateTotalRam();
|
||||
+ const qlonglong availableRam = calculateavAilableRam();
|
||||
|
||||
if (totalRam > 0) {
|
||||
- QString total = KFormat().formatByteSize(totalRam, 0);
|
||||
- QString available = KFormat().formatByteSize(totalRam, 1);
|
||||
- if (total.toDouble() > available.toDouble()) {
|
||||
- qSwap(total, available);
|
||||
- }
|
||||
+ QString total = KFormat().formatByteSize(totalRam);
|
||||
+ QString available = KFormat().formatByteSize(availableRam);
|
||||
+
|
||||
res << total << available;
|
||||
return res;
|
||||
}
|
||||
-// return ki18n("Unknown amount of RAM", "Unknown");
|
||||
+
|
||||
return res;
|
||||
}
|
||||
diff --git a/plugins/messages-task/about/memoryentry.h b/plugins/messages-task/about/memoryentry.h
|
||||
index d992a30..3ef792a 100644
|
||||
--- a/plugins/messages-task/about/memoryentry.h
|
||||
+++ b/plugins/messages-task/about/memoryentry.h
|
||||
@@ -15,6 +15,7 @@ class MemoryEntry : public Entry
|
||||
public:
|
||||
MemoryEntry();
|
||||
static qlonglong calculateTotalRam();
|
||||
+ static qlonglong calculateavAilableRam();
|
||||
static QStringList totalMemory();
|
||||
};
|
||||
|
||||
--
|
||||
2.29.2.windows.2
|
||||
|
||||
89
0002-fix-autologin-nopasswdlogin-failed.patch
Normal file
89
0002-fix-autologin-nopasswdlogin-failed.patch
Normal file
@ -0,0 +1,89 @@
|
||||
From 024f7bebf163348518ebbdf443c185dc66595a53 Mon Sep 17 00:00:00 2001
|
||||
From: myshow <296570182@qq.com>
|
||||
Date: Fri, 27 Nov 2020 17:34:23 +0800
|
||||
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=8A=A8?=
|
||||
=?UTF-8?q?=E7=99=BB=E5=BD=95=E4=B8=8E=E5=85=8D=E5=AF=86=E7=99=BB=E5=BD=95?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
plugins/account/userinfo/userinfo.cpp | 3 ++-
|
||||
plugins/account/userinfo/userinfo.ui | 2 +-
|
||||
registeredQDbus/main.cpp | 2 +-
|
||||
registeredQDbus/sysdbusregister.cpp | 9 ++++++---
|
||||
4 files changed, 10 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/plugins/account/userinfo/userinfo.cpp b/plugins/account/userinfo/userinfo.cpp
|
||||
index 49744f6..09183a4 100644
|
||||
--- a/plugins/account/userinfo/userinfo.cpp
|
||||
+++ b/plugins/account/userinfo/userinfo.cpp
|
||||
@@ -355,8 +355,9 @@ void UserInfo::initComponent(){
|
||||
if (!getuid()){
|
||||
ui->changeTypeBtn->setEnabled(false);
|
||||
ui->changeGroupBtn->setEnabled(false);
|
||||
+ ui->changeValidBtn->setEnabled(false);
|
||||
ui->autoLoginFrame->setVisible(false);
|
||||
- ui->autoLoginFrame_2->setVisible(false);
|
||||
+ ui->noPasswdFrame->setVisible(false);
|
||||
}
|
||||
//样式表
|
||||
// pluginWidget->setStyleSheet("background: #ffffff;");
|
||||
diff --git a/plugins/account/userinfo/userinfo.ui b/plugins/account/userinfo/userinfo.ui
|
||||
index 4793f7b..c6d0da8 100644
|
||||
--- a/plugins/account/userinfo/userinfo.ui
|
||||
+++ b/plugins/account/userinfo/userinfo.ui
|
||||
@@ -471,7 +471,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
- <widget class="QFrame" name="autoLoginFrame_2">
|
||||
+ <widget class="QFrame" name="noPasswdFrame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>550</width>
|
||||
diff --git a/registeredQDbus/main.cpp b/registeredQDbus/main.cpp
|
||||
index e6b1340..c2db36e 100644
|
||||
--- a/registeredQDbus/main.cpp
|
||||
+++ b/registeredQDbus/main.cpp
|
||||
@@ -29,7 +29,7 @@ int main(int argc, char *argv[]){
|
||||
|
||||
QCoreApplication app(argc, argv);
|
||||
app.setOrganizationName("Kylin Team");
|
||||
- app.setApplicationName("ukcc-service");
|
||||
+ app.setApplicationName("ukui-service");
|
||||
|
||||
|
||||
QDBusConnection systemBus = QDBusConnection::systemBus();
|
||||
diff --git a/registeredQDbus/sysdbusregister.cpp b/registeredQDbus/sysdbusregister.cpp
|
||||
index 2985c57..670e5e5 100644
|
||||
--- a/registeredQDbus/sysdbusregister.cpp
|
||||
+++ b/registeredQDbus/sysdbusregister.cpp
|
||||
@@ -87,7 +87,7 @@ QString SysdbusRegister::getNoPwdLoginStatus(){
|
||||
|
||||
//设置免密登录状态
|
||||
void SysdbusRegister::setNoPwdLoginStatus(bool status,QString username){
|
||||
-
|
||||
+ systemRun("groupadd -r nopasswdlogin");
|
||||
QString cmd;
|
||||
if(true == status){
|
||||
cmd = QString("gpasswd -a %1 nopasswdlogin").arg(username);
|
||||
@@ -102,10 +102,13 @@ void SysdbusRegister::setAutoLoginStatus(QString username)
|
||||
{
|
||||
QString filename = "/etc/lightdm/lightdm.conf";
|
||||
QSharedPointer<QSettings> autoSettings = QSharedPointer<QSettings>(new QSettings(filename, QSettings::IniFormat));
|
||||
- autoSettings->beginGroup("SeatDefaults");
|
||||
- autoSettings->clear();
|
||||
|
||||
+ autoSettings->beginGroup("SeatDefaults");
|
||||
autoSettings->setValue("autologin-user", username);
|
||||
+ autoSettings->setValue("autologin-session", "ukui");
|
||||
autoSettings->endGroup();
|
||||
autoSettings->sync();
|
||||
+
|
||||
+ systemRun("groupadd -r autologin");
|
||||
+ systemRun(QString("gpasswd -a %1 autologin").arg(username));
|
||||
}
|
||||
--
|
||||
2.29.2.windows.2
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
%define debug_package %{nil}
|
||||
Name: ukui-control-center
|
||||
Version: 3.0.1
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: utilities to configure the UKUI desktop
|
||||
License: GPL-2+
|
||||
URL: http://www.ukui.org
|
||||
@ -23,7 +23,7 @@ BuildRequires: kf5-ki18n-devel
|
||||
BuildRequires: libkscreen-qt5-devel
|
||||
BuildRequires: qt5-qtdeclarative-devel
|
||||
BuildRequires: dconf-devel
|
||||
BuildRequires: edid-decode
|
||||
BuildRequires: edid-decode
|
||||
BuildRequires: redshift
|
||||
BuildRequires: libmatemixer-devel
|
||||
BuildRequires: libqtxdg-devel
|
||||
@ -58,7 +58,7 @@ Requires: kf5-ki18n-devel
|
||||
Requires: libkscreen-qt5-devel
|
||||
Requires: qt5-qtdeclarative-devel
|
||||
Requires: dconf-devel
|
||||
Requires: edid-decode
|
||||
Requires: edid-decode
|
||||
Requires: redshift
|
||||
Requires: libmatemixer-devel
|
||||
Requires: libqtxdg-devel
|
||||
@ -69,6 +69,9 @@ Requires: libcanberra-devel
|
||||
Requires: qt5-qtgraphicaleffects
|
||||
Requires: qt5-qtquickcontrols
|
||||
|
||||
patch0: 0001-fix-system-overview-failed.patch
|
||||
patch1: 0002-fix-autologin-nopasswdlogin-failed.patch
|
||||
|
||||
Recommends: qt5-qtquickcontrols
|
||||
|
||||
Suggests: gsettings-desktop-schemas
|
||||
@ -88,9 +91,11 @@ Suggests: ukui-settings-daemon
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
qmake-qt5
|
||||
qmake-qt5
|
||||
make
|
||||
|
||||
%install
|
||||
@ -113,7 +118,7 @@ chmod u+s /usr/bin/checkuserpwd
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%files
|
||||
%{_sysconfdir}/dbus-1/system.d/*
|
||||
%{_bindir}/launchSysDbus
|
||||
%{_bindir}/ukui-control-center
|
||||
@ -131,6 +136,10 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/polkit-1/actions/org.ukui.groupmanager.policy
|
||||
|
||||
%changelog
|
||||
* Mon Nov 30 2020 lvhan <lvhan@kylinos.cn> - 3.0.1-2
|
||||
- fix autologin nopasswdlogin failed
|
||||
- fix system overview failed
|
||||
|
||||
* Thu Jul 9 2020 douyan <douyan@kylinos.cn> - 3.0.1-1
|
||||
- update to upstream version 3.0.0-1+1031
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user