Commit db45a7da authored by Frederik Gladhorn's avatar Frederik Gladhorn

KAuthorized::authorizeKAction -> authorizeAction

Summary: Fix the deprecation warning.

Reviewers: #krita, rempt

Reviewed By: #krita, rempt

Differential Revision: https://phabricator.kde.org/D3153
parent 89c05098
......@@ -240,6 +240,7 @@ find_package(KF5 ${MIN_FRAMEWORKS_VERSION} REQUIRED COMPONENTS
Archive
Config
WidgetsAddons
Auth
Completion
CoreAddons
GuiAddons
......@@ -249,6 +250,15 @@ find_package(KF5 ${MIN_FRAMEWORKS_VERSION} REQUIRED COMPONENTS
WindowSystem
)
# KAuth deprecated authorizeKAction. In order to be warning free,
# compile with the updated function when the dependency is new enough.
# Remove this (and the uses of the define) when the minimum KF5
# version is >= 5.24.0.
if (${KF5Auth_VERSION} VERSION_LESS "5.24.0" )
message("Old KAuth (< 5.24.0) found.")
add_definitions(-DKAUTH_BEFORE_5_24)
endif()
find_package(Qt5 ${MIN_QT_VERSION}
REQUIRED COMPONENTS
Core
......
......@@ -47,6 +47,10 @@
#include <stdio.h>
#if defined(KAUTH_BEFORE_5_24)
# define authorizeAction authorizeKAction
#endif
class KActionCollectionPrivate
{
public:
......@@ -291,7 +295,7 @@ QAction *KActionCollection::addAction(const QString &name, QAction *action)
return action;
}
if (!KAuthorized::authorizeKAction(indexName)) {
if (!KAuthorized::authorizeAction(indexName)) {
// Disable this action
action->setEnabled(false);
action->setVisible(false);
......
......@@ -32,6 +32,10 @@
#include "kxmlguifactory.h"
#include "kactioncollection.h"
#if defined(KAUTH_BEFORE_5_24)
# define authorizeAction authorizeKAction
#endif
namespace
{
const char actionListName[] = "show_menu_and_toolbar_actionlist";
......@@ -260,7 +264,7 @@ void ToolBarHandler::setupActions()
// We have no XML file associated with our action collection, so load settings from KConfig
actionCollection()->readSettings(); // #233712
if (KAuthorized::authorizeKAction(QStringLiteral("options_show_toolbar"))) {
if (KAuthorized::authorizeAction(QStringLiteral("options_show_toolbar"))) {
plugActionList(QLatin1String(actionListName), d->actions);
}
......
......@@ -40,6 +40,10 @@
#include <kis_icon_utils.h>
#if defined(KAUTH_BEFORE_5_24)
# define authorizeAction authorizeKAction
#endif
using namespace KDEPrivate;
class KXMLGUIBuilderPrivate
......@@ -166,7 +170,7 @@ QWidget *KXMLGUIBuilder::createContainer(QWidget *parent, int index, const QDomE
QString name = element.attribute(d->attrName);
if (!KAuthorized::authorizeKAction(name)) {
if (!KAuthorized::authorizeAction(name)) {
return 0;
}
......
......@@ -40,6 +40,10 @@
#include <assert.h>
#if defined(KAUTH_BEFORE_5_24)
# define authorizeAction authorizeKAction
#endif
class KXMLGUIClientPrivate
{
public:
......@@ -429,7 +433,7 @@ bool KXMLGUIClientPrivate::mergeXML(QDomElement &base, QDomElement &additive, KA
if (equalstr(tag, tagAction)) {
const QString name = e.attribute(attrName);
if (!actionCollection->action(name) ||
!KAuthorized::authorizeKAction(name)) {
!KAuthorized::authorizeAction(name)) {
// remove this child as we aren't using it
base.removeChild(e);
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment