Porting kwin scripting to Qt5/KF5: QStandardPaths
REVIEW: 111974
This commit is contained in:
parent
a9c346ad83
commit
d97069590a
4 changed files with 7 additions and 8 deletions
|
@ -1,7 +1,6 @@
|
||||||
set(kcm_kwin4_genericscripted_SRCS genericscriptedconfig.cpp)
|
set(kcm_kwin4_genericscripted_SRCS genericscriptedconfig.cpp)
|
||||||
kde4_add_plugin( kcm_kwin4_genericscripted ${kcm_kwin4_genericscripted_SRCS} )
|
kde4_add_plugin( kcm_kwin4_genericscripted ${kcm_kwin4_genericscripted_SRCS} )
|
||||||
target_link_libraries( kcm_kwin4_genericscripted
|
target_link_libraries( kcm_kwin4_genericscripted
|
||||||
${KDE4Support_LIBRARIES} # KStandardDirs
|
|
||||||
KF5::KConfigWidgets #KCModule
|
KF5::KConfigWidgets #KCModule
|
||||||
KF5::KService
|
KF5::KService
|
||||||
KF5::plasma
|
KF5::plasma
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "genericscriptedconfig.h"
|
#include "genericscriptedconfig.h"
|
||||||
#include "config-kwin.h"
|
#include "config-kwin.h"
|
||||||
#include <KDE/KAboutData>
|
#include <KDE/KAboutData>
|
||||||
#include <KDE/KStandardDirs>
|
|
||||||
#include <KDE/KLocalizedString>
|
#include <KDE/KLocalizedString>
|
||||||
#include <Plasma/ConfigLoader>
|
#include <Plasma/ConfigLoader>
|
||||||
|
|
||||||
|
@ -31,6 +30,7 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QUiLoader>
|
#include <QUiLoader>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
namespace KWin {
|
namespace KWin {
|
||||||
|
|
||||||
|
@ -64,14 +64,14 @@ void GenericScriptedConfig::createUi()
|
||||||
{
|
{
|
||||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
const QString kconfigXTFile = KStandardDirs::locate("data",
|
const QString kconfigXTFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||||
QStringLiteral(KWIN_NAME) +
|
QStringLiteral(KWIN_NAME) +
|
||||||
QStringLiteral("/") +
|
QStringLiteral("/") +
|
||||||
typeName() +
|
typeName() +
|
||||||
QStringLiteral("/") +
|
QStringLiteral("/") +
|
||||||
m_packageName +
|
m_packageName +
|
||||||
QStringLiteral("/contents/config/main.xml"));
|
QStringLiteral("/contents/config/main.xml"));
|
||||||
const QString uiPath = KStandardDirs::locate("data",
|
const QString uiPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||||
QStringLiteral(KWIN_NAME) +
|
QStringLiteral(KWIN_NAME) +
|
||||||
QStringLiteral("/") +
|
QStringLiteral("/") +
|
||||||
typeName() +
|
typeName() +
|
||||||
|
|
|
@ -28,12 +28,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// KDE
|
// KDE
|
||||||
#include <KDE/KConfigGroup>
|
#include <KDE/KConfigGroup>
|
||||||
#include <KDE/KDebug>
|
#include <KDE/KDebug>
|
||||||
#include <KDE/KStandardDirs>
|
|
||||||
#include <Plasma/ConfigLoader>
|
#include <Plasma/ConfigLoader>
|
||||||
// Qt
|
// Qt
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
#include <QtScript/QScriptValueIterator>
|
#include <QtScript/QScriptValueIterator>
|
||||||
|
#include <QtCore/QStandardPaths>
|
||||||
|
|
||||||
typedef KWin::EffectWindow* KEffectWindowRef;
|
typedef KWin::EffectWindow* KEffectWindowRef;
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ bool ScriptedEffect::init(const QString &effectName, const QString &pathToScript
|
||||||
m_scriptFile = pathToScript;
|
m_scriptFile = pathToScript;
|
||||||
|
|
||||||
// does the effect contain an KConfigXT file?
|
// 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()) {
|
if (!kconfigXTFile.isNull()) {
|
||||||
KConfigGroup cg = effects->effectConfig(m_effectName);
|
KConfigGroup cg = effects->effectConfig(m_effectName);
|
||||||
QFile xmlFile(kconfigXTFile);
|
QFile xmlFile(kconfigXTFile);
|
||||||
|
|
|
@ -32,7 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "../options.h"
|
#include "../options.h"
|
||||||
#include "../workspace.h"
|
#include "../workspace.h"
|
||||||
// KDE
|
// KDE
|
||||||
#include <kstandarddirs.h>
|
|
||||||
#include <KDE/KConfigGroup>
|
#include <KDE/KConfigGroup>
|
||||||
#include <KDE/KDebug>
|
#include <KDE/KDebug>
|
||||||
#include <KDE/KGlobal>
|
#include <KDE/KGlobal>
|
||||||
|
@ -51,6 +50,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
#include <QtScript/QScriptValue>
|
#include <QtScript/QScriptValue>
|
||||||
|
#include <QtCore/QStandardPaths>
|
||||||
|
|
||||||
QScriptValue kwinScriptPrint(QScriptContext *context, QScriptEngine *engine)
|
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 pluginName = service->property(QStringLiteral("X-KDE-PluginInfo-Name")).toString();
|
||||||
const QString scriptName = service->property(QStringLiteral("X-Plasma-MainScript")).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()) {
|
if (file.isNull()) {
|
||||||
kDebug(1212) << "Could not find script file for " << pluginName;
|
kDebug(1212) << "Could not find script file for " << pluginName;
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue