aboutsummaryrefslogtreecommitdiff
path: root/src/core/kauthorized.cpp
AgeCommit message (Collapse)Author
2021-11-14Avoid some allocations by QString/QByteArray's toLower()Friedrich W. H. Kossebau
NO_CHANGELOG
2021-10-13Enforce KAuthorized enums being not 0Alexander Lohnau
This will output a warning if an invalid value is requested. The goal is to avoid implicit conversion which might result in a zero-int value.
2021-10-13Create enum to to authorize common keysAlexander Lohnau
By using an enum we have a central place to provide docs for the most common actions/restrictions. Also consumers can pass in type-safe enum values instead of potentially undocumented strings that might contain typos. Also it is better documents is a value is supposed to be authorized using KAuthorized::authorize or KAuthorized::authorizeAction, in the case of "shell_access" this was mixed up from time to time. Considering that we do not want the parameter for the methods to become too long I have deliberately decided against using `enum class`. Also we don't have and usecases for the binary operators in combination with the newly added enums. Task: https://phabricator.kde.org/T11948
2021-08-28GIT_SILENT: we can use std::as_const directlyLaurent Montel
2021-03-06Minor code optimisationAhmad Samir
- Use more range-for loops where appropriate - Use auto instead of the usually-long iterator type names - Use cbegin/cend(), to match the std:: containers, less confusion - Use qDeleteAll instead of a for loop - Make a QRE with a long-ish pattern static NO_CHANGELOG
2021-02-22Fix formatting in a couple of places after running clang-formatAhmad Samir
NO_CHANGELOG
2021-02-22Run clang-format on all cpp/h filesAhmad Samir
NO_CHANGELOG
2021-02-06Minor code optimisationsAhmad Samir
- Use a global var for a QString that's used many times - Break up long-all-cap variable names, it makes it harder to read (and I've fixed one typo in one of those ALLCAPS) - Fix some clazy warnings, make global QString objects in unit tests static (so that the compiler doesn't create symbols for them, it doesn't matter in a unit test but KF code acts as a reference sometimes that others copy from, tip from dfaure) - Add TODO note about changing kconfig_compiler to generate C++ code that uses multi-arg QString::arg(QString, QString, QString) instead of QString::arg().arg() - More const; more QString::at() instead of operator[] where appropriate - Use a ternary where it makes the code more readable (and uses less lines :)) NO_CHANGELOG
2021-01-12Port to QRecursiveMutexNicolas Fella
Using QMutex in recursive mode is deprecated.
2020-05-08Adjust name of internally-exported method as suggested in D29347David Faure
2020-05-03GIT_SILENT add commentDavid Faure
2020-05-03KAuthorized: export method to reload restrictionsDavid Faure
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
2020-03-22KConfig: Convert to SPDX license statementsAndreas Cord-Landwehr
Summary: Convert license headers to SPDX statements and add license files as required by REUSE specification. Reviewers: cgiboudeaux Reviewed By: cgiboudeaux Subscribers: ognarb, cgiboudeaux, kde-frameworks-devel Tags: #frameworks Maniphest Tasks: T11550 Differential Revision: https://phabricator.kde.org/D27601
2020-01-05Port QRegExp to QRegularExpressionAhmad Samir
Summary: Port QRegExp::exactMatch() by using QRegularExpression::anchoredPattern() to match the entire subject string. Remove filenameOnly(), it's been broken for a long time (QStringLiteral("[/\\]") is not a valid QRegExp pattern); besides it's not needed as QFileInfo::fileName() is used to get the filename. Test Plan: make && ctest Reviewers: #frameworks, dfaure, ervin, apol Reviewed By: dfaure, ervin Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D26177
2019-10-18Use ECMGenerateExportHeader to manage deprecated API betterFriedrich W. H. Kossebau
Summary: Allows * projects linking to KConfigCore/Gui to hide deprecated API up to a given version or silence deprecation warnings after a given version, using * -DKCONFIGCORE_DISABLE_DEPRECATED_BEFORE_AND_AT * -DKCONFIGCORE_NO_DEPRECATED * -DKCONFIGCORE_DEPRECATED_WARNINGS_SINCE * -DKCONFIGCORE_NO_DEPRECATED_WARNINGS * -DKCONFIGGUI_DISABLE_DEPRECATED_BEFORE_AND_AT * -DKCONFIGGUI_NO_DEPRECATED * -DKCONFIGGUI_DEPRECATED_WARNINGS_SINCE * -DKCONFIGGUI_NO_DEPRECATED_WARNINGS or * -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT * -DKF_NO_DEPRECATED * -DKF_DEPRECATED_WARNINGS_SINCE * -DKF_NO_DEPRECATED_WARNINGS * to build KConfigCore/Gui optionally with deprecated API excluded from the build, using "EXCLUDE_DEPRECATED_BEFORE_AND_AT" cmake argument. Test Plan: Builds with EXCLUDE_DEPRECATED_BEFORE_AND_AT set to 0, 4.0.0, 5.0.0, 5.11.0, 5.24.0, 5.39.0, 5.42.0, CURRENT. Reviewers: #frameworks, mlaurent Reviewed By: mlaurent Subscribers: mlaurent, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D24496
2019-08-25String code optimization: use s.remove(0. x) instead of s = s.mid(x)Friedrich W. H. Kossebau
GIT_SILENT
2019-08-25String code optimization: use s.chop(x) instead of s.truncate(s.size()-x)Friedrich W. H. Kossebau
GIT_SILENT
2019-03-03[Kconfig] Compile without foreachLaurent Montel
Summary: compile without foreach Test Plan: Unittest Ok as previously Reviewers: dfaure Reviewed By: dfaure Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D19326
2018-03-11Remove not necessary QtCore and coLaurent Montel
2016-07-02Deprecate authorizeKAction() in favor of authorizeAction()Elvis Angelaccio
REVIEW: 128023
2016-01-02Qt 5.3 is required, remove code for < 5.3David Faure
2015-10-05Minor optimizationsAlbert Astals Cid
Ran the clazy tool (http://www.kdab.com/use-static-analysis-improve-performance/) Mostly QStringLiteral/QLatin1String additions A few const & additions to non public methods Compiles, test pass REVIEW: 125106
2014-04-11Rewrite kiosk documentationAlex Merry
A lot of kiosk stuff is actually in other frameworks, from the point of view of applications, but KConfig provides the core functionality. Make the docs here describe KConfig's role, rather than KIO's or KXMLGui's. REVIEW: 117486
2013-12-18Code reformatted using kde-dev-scripts/astyle-kdelibs.David Faure
Use git blame -w 867e7a5 to show authorship as it was before this commit.
2013-12-18Move kconfig code to the root directory.Jenkins CI