aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/kauthorized.cpp9
-rw-r--r--src/core/kauthorized.h32
2 files changed, 39 insertions, 2 deletions
diff --git a/src/core/kauthorized.cpp b/src/core/kauthorized.cpp
index 993a5e86..9c8b1175 100644
--- a/src/core/kauthorized.cpp
+++ b/src/core/kauthorized.cpp
@@ -216,7 +216,7 @@ bool KAuthorized::authorize(const QString &genericAction)
return cg.readEntry(genericAction, true);
}
-bool KAuthorized::authorizeKAction(const QString &action)
+bool KAuthorized::authorizeAction(const QString &action)
{
MY_D
if (d->blockEverything) {
@@ -229,6 +229,13 @@ bool KAuthorized::authorizeKAction(const QString &action)
return authorize(QLatin1String("action/") + action);
}
+#ifndef KDE_NO_DEPRECATED
+bool KAuthorized::authorizeKAction(const QString &action)
+{
+ return authorizeAction(action);
+}
+#endif
+
bool KAuthorized::authorizeControlModule(const QString &menuId)
{
if (menuId.isEmpty() || kde_kiosk_exception) {
diff --git a/src/core/kauthorized.h b/src/core/kauthorized.h
index d0988234..584bac1a 100644
--- a/src/core/kauthorized.h
+++ b/src/core/kauthorized.h
@@ -80,6 +80,33 @@ KCONFIGCORE_EXPORT bool authorize(const QString &action);
@endverbatim
* then
* @code
+ * KAuthorized::authorizeAction("file_new");
+ * @endcode
+ * will return @c false.
+ *
+ * KXMLGui-based applications should not normally need to call this
+ * function, as KActionCollection will do it automatically.
+ *
+ * @param action The name of a QAction action.
+ * @return @c true if the QAction is authorized, @c false
+ * otherwise.
+ * @since 5.24
+ *
+ * @see authorize()
+ */
+KCONFIGCORE_EXPORT bool authorizeAction(const QString &action);
+
+/**
+ * Returns whether the user is permitted to perform a certain action.
+ *
+ * This behaves like authorize(), except that "action/" is prepended to
+ * @p action. So if kdeglobals contains
+ * @verbatim
+ [KDE Action Restrictions][$i]
+ action/file_new=false
+ @endverbatim
+ * then
+ * @code
* KAuthorized::authorizeKAction("file_new");
* @endcode
* will return @c false.
@@ -92,8 +119,11 @@ KCONFIGCORE_EXPORT bool authorize(const QString &action);
* otherwise.
*
* @see authorize()
+ * @deprecated Use authorizeAction() instead.
*/
-KCONFIGCORE_EXPORT bool authorizeKAction(const QString &action);
+#ifndef KDE_NO_DEPRECATED
+KCONFIGCORE_DEPRECATED bool authorizeKAction(const QString &action);
+#endif
/**
* Returns whether the user is permitted to use a certain control