Plasma
Go to the documentation of this file.
24 #include "private/authorizationmanager_p.h"
25 #include "private/authorizationrule_p.h"
27 #include <QtCore/QObject>
28 #include <QtCore/QTimer>
31 #include <klocalizedstring.h>
36 AuthorizationRulePrivate::AuthorizationRulePrivate(
const QString &serviceName,
const QString &credentialID,
37 AuthorizationRule *rule)
39 serviceName(serviceName),
40 credentialID(credentialID),
41 policy(AuthorizationRule::Deny),
42 targets(AuthorizationRule::Default),
43 persistence(AuthorizationRule::Transient)
47 AuthorizationRulePrivate::~AuthorizationRulePrivate()
51 bool AuthorizationRulePrivate::matches(
const QString &name,
const QString &
id)
const
53 if (serviceName == name && (credentialID ==
id)) {
68 void AuthorizationRulePrivate::scheduleChangedSignal()
70 QTimer::singleShot(0, q, SLOT(fireChangedSignal()));
73 void AuthorizationRulePrivate::fireChangedSignal()
83 AuthorizationRule::AuthorizationRule(
const QString &serviceName,
const QString &credentialID)
84 :
QObject(AuthorizationManager::self()),
85 d(new AuthorizationRulePrivate(serviceName, credentialID, this))
98 return i18n(
"Allow everybody access to %1.", d->serviceName);
99 }
else if (d->targets.testFlag(
AllUsers) && d->policy ==
Deny) {
100 return i18n(
"Deny everybody access to %1", d->serviceName);
102 return i18n(
"Allow %1 access to all services.",
credentials().name());
104 return i18n(
"Deny %1 access to all services.",
credentials().name());
105 }
else if (d->policy ==
Allow) {
106 return i18n(
"Allow access to %1, by %2.", d->serviceName,
credentials().name());
107 }
else if (d->policy ==
Deny) {
108 return i18n(
"Deny access to %1, by %2.", d->serviceName,
credentials().name());
110 return i18n(
"Allow access to %1, by %2?", d->serviceName,
credentials().name());
118 d->scheduleChangedSignal();
129 d->scheduleChangedSignal();
140 d->scheduleChangedSignal();
145 return d->persistence;
151 d->scheduleChangedSignal();
166 return d->serviceName;
171 #include "authorizationrule.moc"
Credentials credentials() const
Namespace for everything in libplasma.
@ AllUsers
specify that this rule is valid for all users
static AuthorizationManager * self()
Singleton pattern accessor.
QString description() const
@ AllServices
specify that this rule is valid for all services
void setPin(const QString &pin)
@ Allow
access for messages matching this rule is allowed.
QString serviceName() const
@ Deny
access for messages matching this rule is denied.
void setTargets(Targets targets)
@ PinRequired
specify that the user will need to enter a pin at both sides
Persistence persistence()
void setPolicy(Policy policy)
void setPersistence(Persistence persistence)
@ Persistent
specify that this rule will be saved between sessions.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jan 30 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.