From d97069590a9347b06a122afb967e996992b7c243 Mon Sep 17 00:00:00 2001 From: "Anselmo L. S. Melo" Date: Sat, 3 Aug 2013 17:34:24 -0300 Subject: [PATCH] Porting kwin scripting to Qt5/KF5: QStandardPaths REVIEW: 111974 --- scripting/CMakeLists.txt | 1 - scripting/genericscriptedconfig.cpp | 6 +++--- scripting/scriptedeffect.cpp | 4 ++-- scripting/scripting.cpp | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scripting/CMakeLists.txt b/scripting/CMakeLists.txt index 54b10385d6..6330f38ff5 100644 --- a/scripting/CMakeLists.txt +++ b/scripting/CMakeLists.txt @@ -1,7 +1,6 @@ set(kcm_kwin4_genericscripted_SRCS genericscriptedconfig.cpp) kde4_add_plugin( kcm_kwin4_genericscripted ${kcm_kwin4_genericscripted_SRCS} ) target_link_libraries( kcm_kwin4_genericscripted - ${KDE4Support_LIBRARIES} # KStandardDirs KF5::KConfigWidgets #KCModule KF5::KService KF5::plasma diff --git a/scripting/genericscriptedconfig.cpp b/scripting/genericscriptedconfig.cpp index 12d3c602fb..cf90e681d1 100644 --- a/scripting/genericscriptedconfig.cpp +++ b/scripting/genericscriptedconfig.cpp @@ -21,7 +21,6 @@ #include "genericscriptedconfig.h" #include "config-kwin.h" #include -#include #include #include @@ -31,6 +30,7 @@ #include #include #include +#include namespace KWin { @@ -64,14 +64,14 @@ void GenericScriptedConfig::createUi() { QVBoxLayout* layout = new QVBoxLayout(this); - const QString kconfigXTFile = KStandardDirs::locate("data", + const QString kconfigXTFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(KWIN_NAME) + QStringLiteral("/") + typeName() + QStringLiteral("/") + m_packageName + QStringLiteral("/contents/config/main.xml")); - const QString uiPath = KStandardDirs::locate("data", + const QString uiPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(KWIN_NAME) + QStringLiteral("/") + typeName() + diff --git a/scripting/scriptedeffect.cpp b/scripting/scriptedeffect.cpp index 2fc8ce7af3..2451d3fae3 100644 --- a/scripting/scriptedeffect.cpp +++ b/scripting/scriptedeffect.cpp @@ -28,12 +28,12 @@ along with this program. If not, see . // KDE #include #include -#include #include // Qt #include #include #include +#include typedef KWin::EffectWindow* KEffectWindowRef; @@ -400,7 +400,7 @@ bool ScriptedEffect::init(const QString &effectName, const QString &pathToScript m_scriptFile = pathToScript; // does the effect contain an KConfigXT file? - const QString kconfigXTFile = KStandardDirs::locate("data", QStringLiteral(KWIN_NAME) + QStringLiteral("/effects/") + m_effectName + QStringLiteral("/contents/config/main.xml")); + const QString kconfigXTFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(KWIN_NAME) + QStringLiteral("/effects/") + m_effectName + QStringLiteral("/contents/config/main.xml")); if (!kconfigXTFile.isNull()) { KConfigGroup cg = effects->effectConfig(m_effectName); QFile xmlFile(kconfigXTFile); diff --git a/scripting/scripting.cpp b/scripting/scripting.cpp index 2fc528a648..078fed9b16 100644 --- a/scripting/scripting.cpp +++ b/scripting/scripting.cpp @@ -32,7 +32,6 @@ along with this program. If not, see . #include "../options.h" #include "../workspace.h" // KDE -#include #include #include #include @@ -51,6 +50,7 @@ along with this program. If not, see . #include #include #include +#include QScriptValue kwinScriptPrint(QScriptContext *context, QScriptEngine *engine) { @@ -671,7 +671,7 @@ LoadScriptList KWin::Scripting::queryScriptsToLoad() } const QString pluginName = service->property(QStringLiteral("X-KDE-PluginInfo-Name")).toString(); const QString scriptName = service->property(QStringLiteral("X-Plasma-MainScript")).toString(); - const QString file = KStandardDirs::locate("data", QStringLiteral(KWIN_NAME) + QStringLiteral("/scripts/") + pluginName + QStringLiteral("/contents/") + scriptName); + const QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(KWIN_NAME) + QStringLiteral("/scripts/") + pluginName + QStringLiteral("/contents/") + scriptName); if (file.isNull()) { kDebug(1212) << "Could not find script file for " << pluginName; continue;