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)
|
||||
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
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "genericscriptedconfig.h"
|
||||
#include "config-kwin.h"
|
||||
#include <KDE/KAboutData>
|
||||
#include <KDE/KStandardDirs>
|
||||
#include <KDE/KLocalizedString>
|
||||
#include <Plasma/ConfigLoader>
|
||||
|
||||
|
@ -31,6 +30,7 @@
|
|||
#include <QLabel>
|
||||
#include <QUiLoader>
|
||||
#include <QVBoxLayout>
|
||||
#include <QStandardPaths>
|
||||
|
||||
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() +
|
||||
|
|
|
@ -28,12 +28,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// KDE
|
||||
#include <KDE/KConfigGroup>
|
||||
#include <KDE/KDebug>
|
||||
#include <KDE/KStandardDirs>
|
||||
#include <Plasma/ConfigLoader>
|
||||
// Qt
|
||||
#include <QFile>
|
||||
#include <QtScript/QScriptEngine>
|
||||
#include <QtScript/QScriptValueIterator>
|
||||
#include <QtCore/QStandardPaths>
|
||||
|
||||
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);
|
||||
|
|
|
@ -32,7 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../options.h"
|
||||
#include "../workspace.h"
|
||||
// KDE
|
||||
#include <kstandarddirs.h>
|
||||
#include <KDE/KConfigGroup>
|
||||
#include <KDE/KDebug>
|
||||
#include <KDE/KGlobal>
|
||||
|
@ -51,6 +50,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QQmlEngine>
|
||||
#include <QtScript/QScriptEngine>
|
||||
#include <QtScript/QScriptValue>
|
||||
#include <QtCore/QStandardPaths>
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue