KConfig 5.109.0
|
The functions in this namespace provide the core of the Kiosk action restriction system; the KIO and KXMLGui frameworks build on this. More...
Enumerations | |
enum | GenericAction { OPEN_WITH = 1 , EDITFILETYPE , OPTIONS_SHOW_TOOLBAR , SWITCH_APPLICATION_LANGUAGE , BOOKMARKS } |
enum | GenericRestriction { SHELL_ACCESS = 1 , GHNS , LINEEDIT_REVEAL_PASSWORD , LINEEDIT_TEXT_COMPLETION , MOVABLE_TOOLBARS , RUN_DESKTOP_FILES } |
The enum values lower cased represent the action that is authorized For example the SHELL_ACCESS value is converted to the "shell_access" string. More... | |
Functions | |
bool | authorize (const QString &action) |
Returns whether the user is permitted to perform a certain action. | |
bool | authorize (GenericRestriction action) |
Returns whether the user is permitted to perform a common action. | |
bool | authorizeAction (const QString &action) |
Returns whether the user is permitted to perform a certain action. | |
bool | authorizeAction (GenericAction action) |
Overload to authorize common actions. | |
bool | authorizeControlModule (const QString &menuId) |
Returns whether the user is permitted to use a certain control module. | |
QStringList | authorizeControlModules (const QStringList &menuIds) |
Determines which control modules from a list the user is permitted to use. | |
bool | authorizeKAction (const QString &action) |
Returns whether the user is permitted to perform a certain action. | |
The functions in this namespace provide the core of the Kiosk action restriction system; the KIO and KXMLGui frameworks build on this.
The relevant settings are read from the application's KSharedConfig instance, so actions can be disabled on a per-application or global basis (by using the kdeglobals file).
The enum values lower cased represent the action that is authorized For example the SHELL_ACCESS value is converted to the "shell_access" string.
bool KAuthorized::authorize | ( | const QString & | action | ) |
Returns whether the user is permitted to perform a certain action.
All settings are read from the "[KDE Action Restrictions]" group. For example, if kdeglobals contains
[KDE Action Restrictions][$i] shell_access=false
then
will return false
.
This method is intended for actions that do not necessarily have a one-to-one correspondence with a menu or toolbar item (ie: a QAction in a KXMLGui application). "shell_access" is an example of such a "generic" action.
The convention for actions like "File->New" is to prepend the action name with "action/", for example "action/file_new". This is what authorizeAction() does.
action | The name of the action. |
true
if the action is authorized, false
otherwise.bool KAuthorized::authorize | ( | GenericRestriction | action | ) |
Returns whether the user is permitted to perform a common action.
The enum values lower cased represent the action that is passed in to authorize(QString)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool KAuthorized::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 action
. So if kdeglobals contains
[KDE Action Restrictions][$i] action/file_new=false
then
will return false
.
KXMLGui-based applications should not normally need to call this function, as KActionCollection will do it automatically.
action | The name of a QAction action. |
true
if the QAction is authorized, false
otherwise. bool KAuthorized::authorizeAction | ( | GenericAction | action | ) |
Overload to authorize common actions.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool KAuthorized::authorizeControlModule | ( | const QString & | menuId | ) |
Returns whether the user is permitted to use a certain control module.
All settings are read from the "[KDE Control Module Restrictions]" group. For example, if kdeglobals contains
[KDE Control Module Restrictions][$i] desktop-settings.desktop=false
then
will return false
.
menuId | The desktop menu ID for the control module. |
true
if access to the module is authorized, false
otherwise.QStringList KAuthorized::authorizeControlModules | ( | const QStringList & | menuIds | ) |
Determines which control modules from a list the user is permitted to use.
menuIds | A list of desktop menu IDs for control modules. |
menuIds
for which authorizeControlModule() returns true
.bool KAuthorized::authorizeKAction | ( | const QString & | action | ) |
Returns whether the user is permitted to perform a certain action.
This behaves like authorize(), except that "action/" is prepended to action
. So if kdeglobals contains
[KDE Action Restrictions][$i] action/file_new=false
then
will return false
.
KXMLGui-based applications should not normally need to call this function, as KActionCollection will do it automatically.
action | The name of a KAction action. |
true
if the KAction is authorized, false
otherwise.