|
|
@ -18,6 +18,7 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "tderootsystemdevice.h"
|
|
|
|
#include "tderootsystemdevice.h"
|
|
|
|
|
|
|
|
#include "tdestoragedevice.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
|
@ -27,6 +28,7 @@
|
|
|
|
#include "tdeglobal.h"
|
|
|
|
#include "tdeglobal.h"
|
|
|
|
#include "tdeconfig.h"
|
|
|
|
#include "tdeconfig.h"
|
|
|
|
#include "tdeapplication.h"
|
|
|
|
#include "tdeapplication.h"
|
|
|
|
|
|
|
|
#include "kstandarddirs.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
|
@ -38,6 +40,16 @@
|
|
|
|
#include <tqdbusconnection.h>
|
|
|
|
#include <tqdbusconnection.h>
|
|
|
|
#endif // defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER) || defined(WITH_HAL) || defined(WITH_CONSOLEKIT)
|
|
|
|
#endif // defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER) || defined(WITH_HAL) || defined(WITH_CONSOLEKIT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isNetworkFileSystem(TQString fileSystemType) {
|
|
|
|
|
|
|
|
if ((fileSystemType.startsWith("nfs"))
|
|
|
|
|
|
|
|
|| (fileSystemType == "cifs")
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TDERootSystemDevice::TDERootSystemDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) {
|
|
|
|
TDERootSystemDevice::TDERootSystemDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) {
|
|
|
|
m_hibernationSpace = -1;
|
|
|
|
m_hibernationSpace = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -97,6 +109,12 @@ bool TDERootSystemDevice::canSetHibernationMethod() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool TDERootSystemDevice::canStandby() {
|
|
|
|
bool TDERootSystemDevice::canStandby() {
|
|
|
|
|
|
|
|
// Network file systems mounted on $HOME typically cause nasty suspend/resume failures
|
|
|
|
|
|
|
|
// See Bug 1615 for details
|
|
|
|
|
|
|
|
if (isNetworkFileSystem(TDEStorageDevice::determineFileSystemType(TDEGlobal::dirs()->localtdedir()))) {
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString statenode = "/sys/power/state";
|
|
|
|
TQString statenode = "/sys/power/state";
|
|
|
|
int rval = access (statenode.ascii(), W_OK);
|
|
|
|
int rval = access (statenode.ascii(), W_OK);
|
|
|
|
if (rval == 0) {
|
|
|
|
if (rval == 0) {
|
|
|
@ -125,9 +143,17 @@ bool TDERootSystemDevice::canStandby() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // WITH_TDEHWLIB_DAEMONS
|
|
|
|
#endif // WITH_TDEHWLIB_DAEMONS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool TDERootSystemDevice::canSuspend() {
|
|
|
|
bool TDERootSystemDevice::canSuspend() {
|
|
|
|
|
|
|
|
// Network file systems mounted on $HOME typically cause nasty suspend/resume failures
|
|
|
|
|
|
|
|
// See Bug 1615 for details
|
|
|
|
|
|
|
|
if (isNetworkFileSystem(TDEStorageDevice::determineFileSystemType(TDEGlobal::dirs()->localtdedir()))) {
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString statenode = "/sys/power/state";
|
|
|
|
TQString statenode = "/sys/power/state";
|
|
|
|
int rval = access (statenode.ascii(), W_OK);
|
|
|
|
int rval = access (statenode.ascii(), W_OK);
|
|
|
|
if (rval == 0) {
|
|
|
|
if (rval == 0) {
|
|
|
@ -223,6 +249,12 @@ bool TDERootSystemDevice::canSuspend() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool TDERootSystemDevice::canHibernate() {
|
|
|
|
bool TDERootSystemDevice::canHibernate() {
|
|
|
|
|
|
|
|
// Network file systems mounted on $HOME typically cause nasty suspend/resume failures
|
|
|
|
|
|
|
|
// See Bug 1615 for details
|
|
|
|
|
|
|
|
if (isNetworkFileSystem(TDEStorageDevice::determineFileSystemType(TDEGlobal::dirs()->localtdedir()))) {
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString statenode = "/sys/power/state";
|
|
|
|
TQString statenode = "/sys/power/state";
|
|
|
|
int rval = access (statenode.ascii(), W_OK);
|
|
|
|
int rval = access (statenode.ascii(), W_OK);
|
|
|
|
if (rval == 0) {
|
|
|
|
if (rval == 0) {
|
|
|
|