script-ported with kde-dev-scripts/kf5/convert-kstandarddirs.pl

This commit is contained in:
David Faure 2013-10-05 12:49:18 +02:00
parent 0a0f0114ec
commit f432b46fbd
9 changed files with 25 additions and 19 deletions

View File

@ -93,14 +93,14 @@ void PlasmaKPart::setThemeDefaults()
Plasma::Theme::defaultTheme()->setUseGlobalSettings(false); Plasma::Theme::defaultTheme()->setUseGlobalSettings(false);
Plasma::Theme::defaultTheme()->setThemeName(themeName); Plasma::Theme::defaultTheme()->setThemeName(themeName);
cg = KConfigGroup(KGlobal::config(), "General"); cg = KConfigGroup(KSharedConfig::openConfig(), "General");
Plasma::Theme::defaultTheme()->setFont(cg.readEntry("desktopFont", QFont("Sans") )); Plasma::Theme::defaultTheme()->setFont(cg.readEntry("desktopFont", QFont("Sans") ));
} }
void PlasmaKPart::syncConfig() void PlasmaKPart::syncConfig()
{ {
KGlobal::config()->sync(); KSharedConfig::openConfig()->sync();
} }
void PlasmaKPart::initCorona() void PlasmaKPart::initCorona()

View File

@ -32,6 +32,7 @@
#include <Plasma/Corona> #include <Plasma/Corona>
#include <Plasma/Package> #include <Plasma/Package>
#include <Plasma/Theme> #include <Plasma/Theme>
#include <qstandardpaths.h>
#include "widget.h" #include "widget.h"
#include "layouttemplatepackagestructure.h" #include "layouttemplatepackagestructure.h"
@ -231,7 +232,7 @@ QStringList ScriptEngine::pendingUpdateScripts()
return scriptPaths; return scriptPaths;
} }
KConfigGroup cg(KGlobal::config(), "Updates"); KConfigGroup cg(KSharedConfig::openConfig(), "Updates");
QStringList performed = cg.readEntry("performed", QStringList()); QStringList performed = cg.readEntry("performed", QStringList());
const QString localDir = KGlobal::dirs()->localkdedir(); const QString localDir = KGlobal::dirs()->localkdedir();
const QString localXdgDir = KGlobal::dirs()->localxdgdatadir(); const QString localXdgDir = KGlobal::dirs()->localxdgdatadir();
@ -251,7 +252,7 @@ QStringList ScriptEngine::pendingUpdateScripts()
} }
cg.writeEntry("performed", performed); cg.writeEntry("performed", performed);
KGlobal::config()->sync(); KSharedConfig::openConfig()->sync();
return scriptPaths; return scriptPaths;
} }

View File

@ -39,12 +39,13 @@
#include <kdirwatch.h> #include <kdirwatch.h>
#include <QDebug> #include <QDebug>
#include <kstandarddirs.h>
#include <kprocess.h> #include <kprocess.h>
#include <kuser.h> #include <kuser.h>
#include <cstdio> // FILE #include <cstdio> // FILE
#include <qstandardpaths.h>
namespace Plasma namespace Plasma
{ {
@ -81,7 +82,7 @@ SigningPrivate::SigningPrivate(Signing *auth, const QString &keystorePath = 0)
m_keystoreDir->startScan(true); m_keystoreDir->startScan(true);
m_KdeKeysDir = new KDirWatch(); m_KdeKeysDir = new KDirWatch();
m_KdeKeysDir->addDir(KStandardDirs::locate("appdata", "plasmakeys/")); m_KdeKeysDir->addDir(QStandardPaths::locate(QStandardPaths::DataLocation, "plasmakeys"), QStandardPaths::LocateDirectory);
m_KdeKeysDir->startScan(true); m_KdeKeysDir->startScan(true);
// Start watching the keystore and the dir with the kde keys, and notify for changed // Start watching the keystore and the dir with the kde keys, and notify for changed
@ -103,7 +104,7 @@ void SigningPrivate::importKdeKeysToKeystore()
keys.insert(UltimatelyTrusted, tmp); keys.insert(UltimatelyTrusted, tmp);
return; return;
} }
QString path(KStandardDirs::locate("appdata", "plasmakeys/")); QString path(QStandardPaths::locate(QStandardPaths::DataLocation, "plasmakeys"), QStandardPaths::LocateDirectory);
QDir dir(path); QDir dir(path);
if (!dir.exists() || path.isEmpty() || path.isNull()) { if (!dir.exists() || path.isEmpty() || path.isNull()) {
// qDebug() << "Directory with KDE keys not found: aborting"; // qDebug() << "Directory with KDE keys not found: aborting";

View File

@ -7,6 +7,7 @@
#include <QDebug> #include <QDebug>
#include <kdirwatch.h> #include <kdirwatch.h>
#include <kpluginfactory.h> #include <kpluginfactory.h>
#include <qstandardpaths.h>
#include "platformstatusadaptor.h" #include "platformstatusadaptor.h"

View File

@ -40,7 +40,7 @@ QScriptValue ScriptEnv::runApplication(QScriptContext *context, QScriptEngine *e
const QString app = context->argument(0).toString(); const QString app = context->argument(0).toString();
const QString exec = KGlobal::dirs()->findExe(app); const QString exec = KStandardDirs::findExe(app);
if (!exec.isEmpty()) { if (!exec.isEmpty()) {
return KRun::run(exec, urls, 0); return KRun::run(exec, urls, 0);
} }
@ -61,7 +61,7 @@ QScriptValue ScriptEnv::runCommand(QScriptContext *context, QScriptEngine *engin
return false; return false;
} }
const QString exec = KGlobal::dirs()->findExe(context->argument(0).toString()); const QString exec = KStandardDirs::findExe(context->argument(0).toString());
if (!exec.isEmpty()) { if (!exec.isEmpty()) {
QString args; QString args;
if (context->argumentCount() > 1) { if (context->argumentCount() > 1) {
@ -148,7 +148,7 @@ QScriptValue ScriptEnv::defaultApplication(QScriptContext *context, QScriptEngin
if (!command.isEmpty()) { if (!command.isEmpty()) {
if (settings.getSetting(KEMailSettings::ClientTerminal) == "true") { if (settings.getSetting(KEMailSettings::ClientTerminal) == "true") {
KConfigGroup confGroup(KGlobal::config(), "General"); KConfigGroup confGroup(KSharedConfig::openConfig(), "General");
const QString preferredTerminal = confGroup.readPathEntry("TerminalApplication", const QString preferredTerminal = confGroup.readPathEntry("TerminalApplication",
QString::fromLatin1("konsole")); QString::fromLatin1("konsole"));
command = preferredTerminal + QString::fromLatin1(" -e ") + command; command = preferredTerminal + QString::fromLatin1(" -e ") + command;
@ -157,7 +157,7 @@ QScriptValue ScriptEnv::defaultApplication(QScriptContext *context, QScriptEngin
return command; return command;
} }
} else if (application.compare("browser", Qt::CaseInsensitive) == 0) { } else if (application.compare("browser", Qt::CaseInsensitive) == 0) {
KConfigGroup config(KGlobal::config(), "General"); KConfigGroup config(KSharedConfig::openConfig(), "General");
QString browserApp = config.readPathEntry("BrowserApplication", QString()); QString browserApp = config.readPathEntry("BrowserApplication", QString());
if (browserApp.isEmpty()) { if (browserApp.isEmpty()) {
const KService::Ptr htmlApp = KMimeTypeTrader::self()->preferredService(QLatin1String("text/html")); const KService::Ptr htmlApp = KMimeTypeTrader::self()->preferredService(QLatin1String("text/html"));
@ -170,7 +170,7 @@ QScriptValue ScriptEnv::defaultApplication(QScriptContext *context, QScriptEngin
return browserApp; return browserApp;
} else if (application.compare("terminal", Qt::CaseInsensitive) == 0) { } else if (application.compare("terminal", Qt::CaseInsensitive) == 0) {
KConfigGroup confGroup(KGlobal::config(), "General"); KConfigGroup confGroup(KSharedConfig::openConfig(), "General");
return confGroup.readPathEntry("TerminalApplication", QString::fromLatin1("konsole")); return confGroup.readPathEntry("TerminalApplication", QString::fromLatin1("konsole"));
} else if (application.compare("filemanager", Qt::CaseInsensitive) == 0) { } else if (application.compare("filemanager", Qt::CaseInsensitive) == 0) {
KService::Ptr service = KMimeTypeTrader::self()->preferredService("inode/directory"); KService::Ptr service = KMimeTypeTrader::self()->preferredService("inode/directory");

View File

@ -37,6 +37,7 @@
#include <KRun> #include <KRun>
#include <Plasma/Package> #include <Plasma/Package>
#include <qstandardpaths.h>
#ifdef USEGUI #ifdef USEGUI
#include "simplebindings/filedialogproxy.h" #include "simplebindings/filedialogproxy.h"
@ -335,7 +336,7 @@ QScriptValue ScriptEnv::loadAddon(QScriptContext *context, QScriptEngine *engine
Plasma::PackageStructure::Ptr structure(new JavascriptAddonPackageStructure); Plasma::PackageStructure::Ptr structure(new JavascriptAddonPackageStructure);
const QString subPath = structure->defaultPackageRoot() + '/' + plugin + '/'; const QString subPath = structure->defaultPackageRoot() + '/' + plugin + '/';
const QString path = KStandardDirs::locate("data", subPath); const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, subPath);
Plasma::Package package(path, structure); Plasma::Package package(path, structure);
QFile file(package.filePath("mainscript")); QFile file(package.filePath("mainscript"));

View File

@ -34,6 +34,7 @@
#include <Plasma/Corona> #include <Plasma/Corona>
#include <Plasma/ContainmentActions> #include <Plasma/ContainmentActions>
#include <Plasma/PluginLoader> #include <Plasma/PluginLoader>
#include <qstandardpaths.h>
//////////////////////////////ContainmentConfigView //////////////////////////////ContainmentConfigView
ContainmentConfigView::ContainmentConfigView(Plasma::Containment *cont, QWindow *parent) ContainmentConfigView::ContainmentConfigView(Plasma::Containment *cont, QWindow *parent)

View File

@ -396,7 +396,7 @@ QScriptValue ScriptEngine::defaultApplication(QScriptContext *context, QScriptEn
if (!command.isEmpty()) { if (!command.isEmpty()) {
//if (settings.getSetting(KEMailSettings::ClientTerminal) == "true") { //if (settings.getSetting(KEMailSettings::ClientTerminal) == "true") {
if (false) { if (false) {
KConfigGroup confGroup(KGlobal::config(), "General"); KConfigGroup confGroup(KSharedConfig::openConfig(), "General");
const QString preferredTerminal = confGroup.readPathEntry("TerminalApplication", QString::fromLatin1("konsole")); const QString preferredTerminal = confGroup.readPathEntry("TerminalApplication", QString::fromLatin1("konsole"));
command = preferredTerminal + QString::fromLatin1(" -e ") + command; command = preferredTerminal + QString::fromLatin1(" -e ") + command;
} }
@ -404,7 +404,7 @@ QScriptValue ScriptEngine::defaultApplication(QScriptContext *context, QScriptEn
return command; return command;
} }
} else if (application.compare("browser", Qt::CaseInsensitive) == 0) { } else if (application.compare("browser", Qt::CaseInsensitive) == 0) {
KConfigGroup config(KGlobal::config(), "General"); KConfigGroup config(KSharedConfig::openConfig(), "General");
QString browserApp = config.readPathEntry("BrowserApplication", QString()); QString browserApp = config.readPathEntry("BrowserApplication", QString());
if (browserApp.isEmpty()) { if (browserApp.isEmpty()) {
const KService::Ptr htmlApp = KMimeTypeTrader::self()->preferredService(QLatin1String("text/html")); const KService::Ptr htmlApp = KMimeTypeTrader::self()->preferredService(QLatin1String("text/html"));
@ -417,7 +417,7 @@ QScriptValue ScriptEngine::defaultApplication(QScriptContext *context, QScriptEn
return onlyExec(browserApp); return onlyExec(browserApp);
} else if (application.compare("terminal", Qt::CaseInsensitive) == 0) { } else if (application.compare("terminal", Qt::CaseInsensitive) == 0) {
KConfigGroup confGroup(KGlobal::config(), "General"); KConfigGroup confGroup(KSharedConfig::openConfig(), "General");
return onlyExec(confGroup.readPathEntry("TerminalApplication", QString::fromLatin1("konsole"))); return onlyExec(confGroup.readPathEntry("TerminalApplication", QString::fromLatin1("konsole")));
} else if (application.compare("filemanager", Qt::CaseInsensitive) == 0) { } else if (application.compare("filemanager", Qt::CaseInsensitive) == 0) {
KService::Ptr service = KMimeTypeTrader::self()->preferredService("inode/directory"); KService::Ptr service = KMimeTypeTrader::self()->preferredService("inode/directory");
@ -703,7 +703,7 @@ QStringList ScriptEngine::pendingUpdateScripts(Plasma::Corona *corona)
return scriptPaths; return scriptPaths;
} }
KConfigGroup cg(KGlobal::config(), "Updates"); KConfigGroup cg(KSharedConfig::openConfig(), "Updates");
QStringList performed = cg.readEntry("performed", QStringList()); QStringList performed = cg.readEntry("performed", QStringList());
const QString localXdgDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); const QString localXdgDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
@ -722,7 +722,7 @@ QStringList ScriptEngine::pendingUpdateScripts(Plasma::Corona *corona)
} }
cg.writeEntry("performed", performed); cg.writeEntry("performed", performed);
KGlobal::config()->sync(); KSharedConfig::openConfig()->sync();
return scriptPaths; return scriptPaths;
} }

View File

@ -29,6 +29,7 @@
#include <Plasma/Containment> #include <Plasma/Containment>
#include <Plasma/Package> #include <Plasma/Package>
#include <Plasma/PackageStructure> #include <Plasma/PackageStructure>
#include <qstandardpaths.h>
#include "kcategorizeditemsviewmodels_p.h" #include "kcategorizeditemsviewmodels_p.h"
#include "plasmaappletitemmodel_p.h" #include "plasmaappletitemmodel_p.h"
@ -587,7 +588,7 @@ void WidgetExplorer::uninstall(const QString &pluginName)
Plasma::PackageStructure installer; Plasma::PackageStructure installer;
qWarning() << "FIXME: uninstall needs reimplementation"; qWarning() << "FIXME: uninstall needs reimplementation";
//installer.uninstallPackage(pluginName, //installer.uninstallPackage(pluginName,
// KStandardDirs::locateLocal("data", "plasma/plasmoids/")); // QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + "plasma/plasmoids/");
//FIXME: moreefficient way rather a linear scan? //FIXME: moreefficient way rather a linear scan?
for (int i = 0; i < d->itemModel.rowCount(); ++i) { for (int i = 0; i < d->itemModel.rowCount(); ++i) {