D29347: KAuthorized: export method to reload restrictions
Matthew Dawson
noreply at phabricator.kde.org
Sun May 3 22:41:22 BST 2020
mdawson added a comment.
One suggestion for this change:
Instead of exporting a method that takes no parameters and always loads from configuration file, why not make a new method with the implementation that takes in a given KConfigGroup. That way unit tests can pass in a KConfigGroup setup appropriately without having to create a normal configuration file in the user's home folder (ie use a temporary file). They can also configure the KConfig to not cascade/use the global configuration so they are isolated from the environment.
initUrlActionRestrictions can then remain the same, and pass in the KConfigGroup that would have been used previously.
It would look something like:
KCONFIGCORE_EXPORT void loadUrlActionRestrictions(KConfigGroup cg)
{
// Code as before, without creating the KConfigGroup
}
void initUrlActionRestrictions()
{
KConfigGroup cg(KSharedConfig::openConfig(), "KDE URL Restrictions");
loadUrlActionRestrictions(cg);
}
REPOSITORY
R237 KConfig
REVISION DETAIL
https://phabricator.kde.org/D29347
To: dfaure, aacid, apol, mdawson
Cc: kossebau, kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200503/76285c7f/attachment.html>
More information about the Kde-frameworks-devel
mailing list