diff --git a/0001-fix-poweroff.patch b/0001-fix-poweroff.patch new file mode 100644 index 0000000..f6d5df8 --- /dev/null +++ b/0001-fix-poweroff.patch @@ -0,0 +1,65 @@ +From 6e6f2d46c03b255062c8fdb6f64f0e587445a6ef Mon Sep 17 00:00:00 2001 +From: myshow <296570182@qq.com> +Date: Thu, 3 Dec 2020 11:05:51 +0800 +Subject: [PATCH] fix-poweroff + +--- + ukui-session/sessiondbusadaptor.h | 27 +++++++++++++++++++++++---- + 1 file changed, 23 insertions(+), 4 deletions(-) + +diff --git a/ukui-session/sessiondbusadaptor.h b/ukui-session/sessiondbusadaptor.h +index c005702..4da2b55 100644 +--- a/ukui-session/sessiondbusadaptor.h ++++ b/ukui-session/sessiondbusadaptor.h +@@ -21,6 +21,7 @@ + #define SESSIONDBUSADAPTOR_H + + #include ++#include + #include "../tools/ukuipower.h" + #include "modulemanager.h" + +@@ -54,7 +55,16 @@ public slots: + + bool canPowerOff() + { +- return mPower->canAction(UkuiPower::PowerShutdown); ++ QProcess p; ++ p.start("bash", QStringList() <<"-c" << "who | wc -l"); ++ p.waitForFinished(); ++ QString ret = p.readAllStandardOutput(); ++ int user = ret.toInt(); ++ if (user > 1) ++ return false; ++ else ++ return true; ++ // return mPower->canAction(UkuiPower::PowerShutdown); + } + + Q_NOREPLY void logout() +@@ -74,10 +84,19 @@ public slots: + Q_NOREPLY void powerOff() + { + if(mPower->canAction(UkuiPower::PowerShutdown)){ +- mManager->logout(false); +- mPower->doAction(UkuiPower::PowerShutdown); ++ // mManager->logout(false); ++ // mPower->doAction(UkuiPower::PowerShutdown); ++ QProcess::execute("shutdown -h now"); ++ // QProcess::execute("poweroff"); ++ } ++ else { ++ //弹框提示无法生效? ++ QMessageBox msg; ++ msg.setWindowTitle(tr("Error")); ++ msg.setText(tr("The computer could not be shut down!")); ++ msg.addButton(tr("Ok"), QMessageBox::AcceptRole); ++ msg.exec(); + } +- //QCoreApplication::exit(0); + } + + // QDBusVariant listModules() +-- +2.29.2.windows.2 + diff --git a/ukui-session-manager.spec b/ukui-session-manager.spec index ad168e7..4bbf137 100644 --- a/ukui-session-manager.spec +++ b/ukui-session-manager.spec @@ -2,7 +2,7 @@ Name: ukui-session-manager Version: 3.0.2 -Release: 1 +Release: 2 Summary: Session manager of the UKUI desktop environment License: LGPL-2.1+ GPL-3+ URL: http://www.ukui.org @@ -22,17 +22,17 @@ Recommends: ukui-settings-daemon Provides: x-session-manager -#patch0: delay-other-program.patch +patch0: 0001-fix-poweroff.patch + %description This package contains a session that can be started from a display manager such as lightdm. It will load all necessary applications for a full-featured user session. - . This package contain the session manager component. %prep %setup -q -#%%patch0 -p2 +%patch0 -p1 %build mkdir cmake-build @@ -49,7 +49,7 @@ popd #install -m644 debian/99ukui-environment %{buildroot}/etc/X11/Xsession.d/99ukui-environment install -d %{buildroot}/usr/share/man/man1/ %{buildroot}/etc/polkit-1/localauthority/50-local.d/ install -m644 data/com.ubuntu.enable-hibernate.pkla %{buildroot}/etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla -gzip -c man/ukui-session.1 > %{buildroot}/usr/share/man/man1/ukui-session.1.gz +gzip -c man/ukui-session.1 > %{buildroot}/usr/share/man/man1/ukui-session.1.gz gzip -c man/ukui-session-tools.1 > %{buildroot}/usr/share/man/man1/ukui-session-tools.1.gz %clean @@ -62,10 +62,13 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/* %{_prefix}/bin/ukui-session %{_prefix}/bin/ukui-session-tools -#%%{_datadir}/man/man1/ukui-session.1.gz +#%%{_datadir}/man/man1/ukui-session.1.gz #%%{_datadir}/man/man1/ukui-session-tools.1.gz %changelog +* Thu Dec 3 2020 lvhan - 3.0.2-2 +- fix poweroff + * Mon Oct 26 2020 douyan - 3.0.2-1 - update to upstream version 3.0.1