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()->setThemeName(themeName);
cg = KConfigGroup(KGlobal::config(), "General");
cg = KConfigGroup(KSharedConfig::openConfig(), "General");
Plasma::Theme::defaultTheme()->setFont(cg.readEntry("desktopFont", QFont("Sans") ));
}
void PlasmaKPart::syncConfig()
{
KGlobal::config()->sync();
KSharedConfig::openConfig()->sync();
}
void PlasmaKPart::initCorona()

View File

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

View File

@ -39,12 +39,13 @@
#include <kdirwatch.h>
#include <QDebug>
#include <kstandarddirs.h>
#include <kprocess.h>
#include <kuser.h>
#include <cstdio> // FILE
#include <qstandardpaths.h>
namespace Plasma
{
@ -81,7 +82,7 @@ SigningPrivate::SigningPrivate(Signing *auth, const QString &keystorePath = 0)
m_keystoreDir->startScan(true);
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);
// 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);
return;
}
QString path(KStandardDirs::locate("appdata", "plasmakeys/"));
QString path(QStandardPaths::locate(QStandardPaths::DataLocation, "plasmakeys"), QStandardPaths::LocateDirectory);
QDir dir(path);
if (!dir.exists() || path.isEmpty() || path.isNull()) {
// qDebug() << "Directory with KDE keys not found: aborting";

View File

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

View File

@ -37,6 +37,7 @@
#include <KRun>
#include <Plasma/Package>
#include <qstandardpaths.h>
#ifdef USEGUI
#include "simplebindings/filedialogproxy.h"
@ -335,7 +336,7 @@ QScriptValue ScriptEnv::loadAddon(QScriptContext *context, QScriptEngine *engine
Plasma::PackageStructure::Ptr structure(new JavascriptAddonPackageStructure);
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);
QFile file(package.filePath("mainscript"));

View File

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

View File

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

View File

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