suppress sleep mode while applying operations -- untested

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1128978
This commit is contained in:
Volker Lanz 2010-05-20 20:37:03 +00:00
parent 7196b3a37e
commit a59062f073
1 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,11 @@
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kcomponentdata.h>
#include <kaboutdata.h>
#include <solid/powermanagement.h>
/** 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", "<application>%1</application> 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())