aboutsummaryrefslogtreecommitdiff
path: root/libLumina
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-09-09 12:12:50 -0400
committerKen Moore <moorekou@gmail.com>2015-09-09 12:12:50 -0400
commit049a94d791e84a065eec0ca27e1f40a338b5db52 (patch)
tree25b8ec5d9b8c02c246e979f2e61c02307f898b4a /libLumina
parentMake sure that drag events only happen with left/right mouse clicks, and clea... (diff)
downloadlumina-049a94d791e84a065eec0ca27e1f40a338b5db52.tar.gz
lumina-049a94d791e84a065eec0ca27e1f40a338b5db52.tar.bz2
lumina-049a94d791e84a065eec0ca27e1f40a338b5db52.zip
Add a new function to LuminaOS: systemPerformingUpdates()
This returns true if the system is in the middle of applying updates and cannot be powered off at the present time.
Diffstat (limited to 'libLumina')
-rw-r--r--libLumina/LuminaOS-Debian.cpp5
-rw-r--r--libLumina/LuminaOS-DragonFly.cpp5
-rw-r--r--libLumina/LuminaOS-FreeBSD.cpp11
-rw-r--r--libLumina/LuminaOS-Linux.cpp5
-rw-r--r--libLumina/LuminaOS-OpenBSD.cpp5
-rw-r--r--libLumina/LuminaOS-kFreeBSD.cpp5
-rw-r--r--libLumina/LuminaOS-template.cpp7
-rw-r--r--libLumina/LuminaOS.h1
8 files changed, 37 insertions, 7 deletions
diff --git a/libLumina/LuminaOS-Debian.cpp b/libLumina/LuminaOS-Debian.cpp
index 85dd657e..593e3d24 100644
--- a/libLumina/LuminaOS-Debian.cpp
+++ b/libLumina/LuminaOS-Debian.cpp
@@ -144,6 +144,11 @@ bool LOS::userHasShutdownAccess(){
/org/freedesktop/login1 org.freedesktop.login1.Manager.CanPowerOff");
}
+//Check for whether the system is safe to power off (no updates being perfomed)
+bool LOS::systemPerformingUpdates(){
+ return false; //Not implemented yet
+}
+
//System Shutdown
void LOS::systemShutdown(){ //start poweroff sequence
QProcess::startDetached("dbus-send --system --print-reply \
diff --git a/libLumina/LuminaOS-DragonFly.cpp b/libLumina/LuminaOS-DragonFly.cpp
index e44db402..35ff49ae 100644
--- a/libLumina/LuminaOS-DragonFly.cpp
+++ b/libLumina/LuminaOS-DragonFly.cpp
@@ -216,6 +216,11 @@ bool LOS::userHasShutdownAccess(){
return true; //not implemented yet
}
+//Check for whether the system is safe to power off (no updates being perfomed)
+bool LOS::systemPerformingUpdates(){
+ return false; //Not implemented yet
+}
+
//System Shutdown
void LOS::systemShutdown(){ //start poweroff sequence
QProcess::startDetached("shutdown -p now");
diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp
index fd117079..7ca6c876 100644
--- a/libLumina/LuminaOS-FreeBSD.cpp
+++ b/libLumina/LuminaOS-FreeBSD.cpp
@@ -181,12 +181,11 @@ void LOS::startMixerUtility(){
bool LOS::userHasShutdownAccess(){
//User needs to be a part of the operator group to be able to run the shutdown command
QStringList groups = LUtils::getCmdOutput("id -Gn").join(" ").split(" ");
- bool ok = groups.contains("operator"); //not implemented yet
- if(ok){
- //If a PC-BSD system, also disable the shutdown/restart options if the system is in the middle of upgrading
- ok = (QProcess::execute("pgrep -F /tmp/.updateInProgress")!=0); //this is 0 if updating right now
- }
- return ok;
+ return groups.contains("operator");
+}
+
+bool LOS::systemPerformingUpdates(){
+ return (QProcess::execute("pgrep -F /tmp/.updateInProgress")!=0); //this is 0 if updating right now
}
//System Shutdown
diff --git a/libLumina/LuminaOS-Linux.cpp b/libLumina/LuminaOS-Linux.cpp
index ebf49a08..1fc98489 100644
--- a/libLumina/LuminaOS-Linux.cpp
+++ b/libLumina/LuminaOS-Linux.cpp
@@ -139,6 +139,11 @@ bool LOS::userHasShutdownAccess(){
return true; //not implemented yet
}
+//Check for whether the system is safe to power off (no updates being perfomed)
+bool LOS::systemPerformingUpdates(){
+ return false; //Not implemented yet
+}
+
//System Shutdown
void LOS::systemShutdown(){ //start poweroff sequence
QProcess::startDetached("shutdown -P -h now");
diff --git a/libLumina/LuminaOS-OpenBSD.cpp b/libLumina/LuminaOS-OpenBSD.cpp
index f33fed97..33159454 100644
--- a/libLumina/LuminaOS-OpenBSD.cpp
+++ b/libLumina/LuminaOS-OpenBSD.cpp
@@ -156,6 +156,11 @@ bool LOS::userHasShutdownAccess(){
return groups.contains("operator");
}
+//Check for whether the system is safe to power off (no updates being perfomed)
+bool LOS::systemPerformingUpdates(){
+ return false; //Not implemented yet
+}
+
//System Shutdown
void LOS::systemShutdown(){ //start poweroff sequence
QProcess::startDetached("shutdown -p now");
diff --git a/libLumina/LuminaOS-kFreeBSD.cpp b/libLumina/LuminaOS-kFreeBSD.cpp
index 91de843c..d651de4d 100644
--- a/libLumina/LuminaOS-kFreeBSD.cpp
+++ b/libLumina/LuminaOS-kFreeBSD.cpp
@@ -123,6 +123,11 @@ bool LOS::userHasShutdownAccess(){
return true; //not implemented yet
}
+//Check for whether the system is safe to power off (no updates being perfomed)
+bool LOS::systemPerformingUpdates(){
+ return false; //Not implemented yet
+}
+
//System Shutdown
void LOS::systemShutdown(){ //start poweroff sequence
QProcess::startDetached("shutdown -h now");
diff --git a/libLumina/LuminaOS-template.cpp b/libLumina/LuminaOS-template.cpp
index 298f9ddd..ec547d1d 100644
--- a/libLumina/LuminaOS-template.cpp
+++ b/libLumina/LuminaOS-template.cpp
@@ -70,7 +70,12 @@ void LOS::startMixerUtility(){
bool LOS::userHasShutdownAccess(){
return false; //not implemented yet
}
-
+
+//Check for whether the system is safe to power off (no updates being perfomed)
+bool LOS::systemPerformingUpdates(){
+ return false; //Not implemented yet
+}
+
//System Shutdown
void LOS::systemShutdown(){ //start poweroff sequence
QProcess::startDetached("shutdown -p now");
diff --git a/libLumina/LuminaOS.h b/libLumina/LuminaOS.h
index 2780c80c..5672454b 100644
--- a/libLumina/LuminaOS.h
+++ b/libLumina/LuminaOS.h
@@ -67,6 +67,7 @@ public:
//Check for user system permission (shutdown/restart)
static bool userHasShutdownAccess();
+ static bool systemPerformingUpdates();
//System Shutdown
static void systemShutdown(); //start poweroff sequence
//System Restart
bgstack15