aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/kauthorized.cpp9
-rw-r--r--src/core/kauthorized.h4
2 files changed, 9 insertions, 4 deletions
diff --git a/src/core/kauthorized.cpp b/src/core/kauthorized.cpp
index 0c8beef9..aad23949 100644
--- a/src/core/kauthorized.cpp
+++ b/src/core/kauthorized.cpp
@@ -7,10 +7,12 @@
#include "kauthorized.h"
+#include <QDebug>
#include <QDir>
#include <QList>
#include <QUrl>
+#include "kconfig_core_log_settings.h"
#include <QCoreApplication>
#include <ksharedconfig.h>
#include <stdlib.h> // srand(), rand()
@@ -221,9 +223,11 @@ bool KAuthorized::authorize(const QString &genericAction)
bool KAuthorized::authorize(KAuthorized::GenericRestriction action)
{
const QMetaEnum metaEnum = QMetaEnum::fromType<KAuthorized::GenericRestriction>();
- if (metaEnum.isValid()) {
+
+ if (metaEnum.isValid() && action != 0) {
return KAuthorized::authorize(QString::fromLatin1(metaEnum.valueToKey(action)).toLower());
}
+ qCWarning(KCONFIG_CORE_LOG) << "Invalid GenericRestriction requested" << action;
return false;
}
@@ -243,9 +247,10 @@ bool KAuthorized::authorizeAction(const QString &action)
bool KAuthorized::authorizeAction(KAuthorized::GenericAction action)
{
const QMetaEnum metaEnum = QMetaEnum::fromType<KAuthorized::GenericAction>();
- if (metaEnum.isValid()) {
+ if (metaEnum.isValid() && action != 0) {
return KAuthorized::authorizeAction(QString::fromLatin1(metaEnum.valueToKey(action)).toLower());
}
+ qCWarning(KCONFIG_CORE_LOG) << "Invalid GenericAction requested" << action;
return false;
}
diff --git a/src/core/kauthorized.h b/src/core/kauthorized.h
index b7fa4c97..071e0cb2 100644
--- a/src/core/kauthorized.h
+++ b/src/core/kauthorized.h
@@ -37,7 +37,7 @@ Q_NAMESPACE_EXPORT(KCONFIGCORE_EXPORT);
* @since 5.88
*/
enum GenericRestriction {
- SHELL_ACCESS, // if the user is authorized to open a shell or execute shell commands
+ SHELL_ACCESS = 1, // if the user is authorized to open a shell or execute shell commands
GHNS, /// if the collaborative data sharing framework KNewStuff is authorized
// GUI behavior
LINEEDIT_REVEAL_PASSWORD, /// if typed characters in password fields can be made visible
@@ -52,7 +52,7 @@ Q_ENUM_NS(GenericRestriction)
* @since 5.88
*/
enum GenericAction {
- OPEN_WITH, /// if the open-with menu should be shown for files etc.
+ OPEN_WITH = 1, /// if the open-with menu should be shown for files etc.
EDITFILETYPE, /// if mime-type accociations are allowed to be configured
OPTIONS_SHOW_TOOLBAR, /// if the toolbar should be displayed in apps