Port plasmapkg from KStandardDirs to QStandardPaths

This commit is contained in:
Sebastian Kügler 2013-03-05 17:38:31 +01:00
parent 3dee256411
commit f35ea4b123

View File

@ -22,12 +22,9 @@
#include <kcmdlineargs.h> #include <kcmdlineargs.h>
#include <kdebug.h> #include <kdebug.h>
//#include <KLocale>
//#include <KPluginInfo>
#include <kservice.h> #include <kservice.h>
#include <kservicetypetrader.h> #include <kservicetypetrader.h>
#include <kshell.h> #include <kshell.h>
#include <kstandarddirs.h>
#include <KSycoca> #include <KSycoca>
#include <klocalizedstring.h> #include <klocalizedstring.h>
@ -42,6 +39,7 @@
#include <QDBusInterface> #include <QDBusInterface>
#include <QFileInfo> #include <QFileInfo>
#include <QMap> #include <QMap>
#include <QStandardPaths>
#include <QStringList> #include <QStringList>
#include <QTimer> #include <QTimer>
@ -390,10 +388,10 @@ QString PlasmaPkg::findPackageRoot(const QString& pluginName, const QString& pre
packageRoot = d->args->getOption("packageroot"); packageRoot = d->args->getOption("packageroot");
qDebug() << "(set via arg) d->packageRoot is: " << d->packageRoot; qDebug() << "(set via arg) d->packageRoot is: " << d->packageRoot;
} else if (d->args->isSet("global")) { } else if (d->args->isSet("global")) {
packageRoot = KStandardDirs::locate("data", d->packageRoot); packageRoot = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, d->packageRoot, QStandardPaths::LocateDirectory).last();
qDebug() << "(set via locate) d->packageRoot is: " << d->packageRoot; qDebug() << "(set via locateAll) d->packageRoot is: " << d->packageRoot;
} else { } else {
packageRoot = KStandardDirs::locateLocal("data", d->packageRoot); packageRoot = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + d->packageRoot;
qDebug() << "(set via locateLocal) d->packageRoot is: " << d->packageRoot; qDebug() << "(set via locateLocal) d->packageRoot is: " << d->packageRoot;
} }
return packageRoot; return packageRoot;
@ -401,7 +399,6 @@ QString PlasmaPkg::findPackageRoot(const QString& pluginName, const QString& pre
void PlasmaPkg::listPackages(const QStringList& types) void PlasmaPkg::listPackages(const QStringList& types)
{ {
qDebug() << "Listign...";
QStringList list = d->packages(types); QStringList list = d->packages(types);
list.sort(); list.sort();
foreach (const QString& package, list) { foreach (const QString& package, list) {
@ -495,7 +492,8 @@ void PlasmaPkgPrivate::listTypes()
renderTypeTable(plugins); renderTypeTable(plugins);
} }
QStringList desktopFiles = KGlobal::dirs()->findAllResources("data", "plasma/packageformats/*rc", KStandardDirs::NoDuplicates); QStringList desktopFiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, "plasma/packageformats/*rc", QStandardPaths::LocateFile);
if (!desktopFiles.isEmpty()) { if (!desktopFiles.isEmpty()) {
coutput(i18n("Provided by .desktop files:")); coutput(i18n("Provided by .desktop files:"));
Plasma::PackageStructure structure; Plasma::PackageStructure structure;