diff options
author | David Faure <faure@kde.org> | 2020-05-01 20:41:13 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2020-05-03 13:24:47 +0200 |
commit | 2789bb2c7b263803b2708d021c8e47ea9f5207dc (patch) | |
tree | 400055ff323cb1cef1899fb16fefae4cdae81198 | |
parent | 1c8da80c5f10a25c2c6ba23981e6050d0555423d (diff) | |
download | kconfig-2789bb2c7b263803b2708d021c8e47ea9f5207dc.tar.gz kconfig-2789bb2c7b263803b2708d021c8e47ea9f5207dc.tar.bz2 |
KAuthorized: export method to reload restrictions
Summary:
This is useful for unittests. Example:
```
KCONFIGCORE_EXPORT void reloadUrlActionRestrictions();
void someTestMethod()
{
KConfigGroup cg(KSharedConfig::openConfig(), "KDE URL Restrictions");
cg.writeEntry("rule_count", 1);
cg.writeEntry("rule_1", QStringList{"open", {}, {}, {}, "file", "", "", "false"});
cg.sync();
reloadUrlActionRestrictions();
// Some test for code that uses KUrlAuthorized
cg.deleteEntry("rule_1");
cg.deleteEntry("rule_count");
cg.sync();
reloadUrlActionRestrictions();
}
```
This is consistent with the fact that other functions used by
KUrlAuthorized are defined here and exported internally.
Test Plan: Used this in a KIO unittest I'm writing for the future OpenUrlJob
Reviewers: aacid, apol, mdawson
Reviewed By: aacid
Subscribers: kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D29347
-rw-r--r-- | src/core/kauthorized.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/kauthorized.cpp b/src/core/kauthorized.cpp index fd79930e..ca98bffa 100644 --- a/src/core/kauthorized.cpp +++ b/src/core/kauthorized.cpp @@ -244,7 +244,7 @@ QStringList KAuthorized::authorizeControlModules(const QStringList &menuIds) return result; } -static void initUrlActionRestrictions() +KCONFIGCORE_EXPORT void reloadUrlActionRestrictions() { MY_D const QString Any; @@ -368,7 +368,7 @@ KCONFIGCORE_EXPORT bool authorizeUrlActionInternal(const QString &action, const bool result = false; if (d->urlActionRestrictions.isEmpty()) { - initUrlActionRestrictions(); + reloadUrlActionRestrictions(); } QUrl baseURL(_baseURL); |