From a59062f073e42998f43ea8d900af49736e7dee8c Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Thu, 20 May 2010 20:37:03 +0000 Subject: [PATCH] suppress sleep mode while applying operations -- untested svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1128978 --- src/core/operationrunner.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/operationrunner.cpp b/src/core/operationrunner.cpp index d1ce93f..6ecdc00 100644 --- a/src/core/operationrunner.cpp +++ b/src/core/operationrunner.cpp @@ -29,6 +29,11 @@ #include #include +#include +#include +#include + +#include /** Constructs an OperationRunner. @param ostack the OperationStack to act on @@ -51,6 +56,9 @@ void OperationRunner::run() bool status = true; + int suppressCookie = Solid::PowerManagement::beginSuppressingSleep(i18nc("@info Reason why sleep mode is suppressed", "%1 is performing operations.", KGlobal::mainComponent().aboutData()->programName())); + kDebug() << suppressCookie; + for (int i = 0; i < numOperations(); i++) { suspendMutex().lock(); @@ -83,6 +91,9 @@ void OperationRunner::run() msleep(5); } + if (suppressCookie != -1) + Solid::PowerManagement::stopSuppressingSleep(suppressCookie); + if (!status) emit error(); else if (isCancelling())