From 2789bb2c7b263803b2708d021c8e47ea9f5207dc Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 1 May 2020 20:41:13 +0200 Subject: 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 --- src/core/kauthorized.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/kauthorized.cpp') 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); -- cgit v1.2.1