LeechCraft 0.6.70-17335-ge406ffdcaf
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
screensaverprohibitor.cpp
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
10#include <QUuid>
12#include "util.h"
13
14namespace LC::Util
15{
17 : IEM_ { iem }
18 , ContextID_ { QUuid::createUuid ().toString () }
19 {
20 }
21
26
28 {
29 if (Prohibited_ == prohibited)
30 return;
31
32 Prohibited_ = prohibited;
33
34 if (Enabled_)
35 SendEntity (Prohibited_);
36 }
37
39 {
40 if (Enabled_ == enabled)
41 return;
42
43 Enabled_ = enabled;
44
45 if (Prohibited_)
46 SendEntity (Enabled_);
47 }
48
49 void ScreensaverProhibitor::SendEntity (bool prohibit)
50 {
51 auto e = MakeEntity ("ScreensaverProhibition", {}, {}, QStringLiteral ("x-leechcraft/power-management"));
52 e.Additional_ = {
53 { QStringLiteral ("Enable"), prohibit },
54 { QStringLiteral ("ContextID"), ContextID_ }
55 };
56 IEM_->HandleEntity (e);
57 }
58}
Proxy to core entity manager.
char * toString(const char *name, const T &t)
Definition common.h:55
Entity MakeEntity(const QVariant &entity, const QString &location, TaskParameters tp, const QString &mime)
Definition util.cpp:82
QMap< QString, QVariant > Additional_
Additional parameters.
Definition structures.h:164