Some KStandardDirs->QStandardPaths porting

This commit is contained in:
David Faure 2013-08-09 22:11:42 +02:00
parent 8ff1ace31c
commit 83cc2a25f4

View File

@ -46,6 +46,7 @@
#include <Plasma/Corona> #include <Plasma/Corona>
#include <Plasma/Package> #include <Plasma/Package>
#include <Plasma/PluginLoader> #include <Plasma/PluginLoader>
#include <qstandardpaths.h>
#include "appinterface.h" #include "appinterface.h"
#include "containment.h" #include "containment.h"
@ -277,7 +278,7 @@ QScriptValue ScriptEngine::loadTemplate(QScriptContext *context, QScriptEngine *
LayoutTemplatePackageStructure structure; LayoutTemplatePackageStructure structure;
Plasma::Package package(&structure); Plasma::Package package(&structure);
KPluginInfo info(offers.first()); KPluginInfo info(offers.first());
const QString path = KStandardDirs::locate("data", package.defaultPackageRoot() + '/' + info.pluginName() + '/'); const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, package.defaultPackageRoot() + '/' + info.pluginName() + '/');
if (path.isEmpty()) { if (path.isEmpty()) {
// qDebug() << "script path is empty"; // qDebug() << "script path is empty";
return false; return false;
@ -477,7 +478,7 @@ QScriptValue ScriptEngine::applicationPath(QScriptContext *context, QScriptEngin
} }
if (KService::Ptr service = KService::serviceByStorageId(application)) { if (KService::Ptr service = KService::serviceByStorageId(application)) {
return KStandardDirs::locate("apps", service->entryPath()); return QStandardPaths::locate(QStandardPaths::ApplicationsLocation, service->entryPath());
} }
if (application.contains("'")) { if (application.contains("'")) {
@ -494,7 +495,7 @@ QScriptValue ScriptEngine::applicationPath(QScriptContext *context, QScriptEngin
if (!offers.isEmpty()) { if (!offers.isEmpty()) {
KService::Ptr offer = offers.first(); KService::Ptr offer = offers.first();
return KStandardDirs::locate("apps", offer->entryPath()); return QStandardPaths::locate(QStandardPaths::ApplicationsLocation, offer->entryPath());
} }
return QString(); return QString();
@ -692,15 +693,14 @@ QStringList ScriptEngine::pendingUpdateScripts(Plasma::Corona *corona)
KConfigGroup cg(KGlobal::config(), "Updates"); KConfigGroup cg(KGlobal::config(), "Updates");
QStringList performed = cg.readEntry("performed", QStringList()); QStringList performed = cg.readEntry("performed", QStringList());
const QString localDir = KGlobal::dirs()->localkdedir(); const QString localXdgDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
const QString localXdgDir = KGlobal::dirs()->localxdgdatadir();
foreach (const QString &script, scripts) { foreach (const QString &script, scripts) {
if (performed.contains(script)) { if (performed.contains(script)) {
continue; continue;
} }
if (script.startsWith(localDir) || script.startsWith(localXdgDir)) { if (script.startsWith(localXdgDir)) {
// qDebug() << "skipping user local script: " << script; // qDebug() << "skipping user local script: " << script;
continue; continue;
} }