Commit 981a6cf6 authored by Frederik Schwarzer's avatar Frederik Schwarzer

GenericDataLocation + appname == AppDataLocation.

parent 31981acc
......@@ -394,7 +394,7 @@ void KMahjongg::startNewGame(int item)
// Use same layout if restarting game or starting a numbered game.
if (Prefs::randomLayout() && item == -1) {
QStringList availableLayouts;
const QStringList layoutDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kmahjongg/layouts/"), QStandardPaths::LocateDirectory);
const QStringList layoutDirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QStringLiteral("layouts/"), QStandardPaths::LocateDirectory);
Q_FOREACH (const QString& dir, layoutDirs) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.desktop"));
Q_FOREACH (const QString& file, fileNames) {
......
......@@ -66,9 +66,10 @@ KMahjonggLayout::~KMahjonggLayout()
bool KMahjonggLayout::loadDefault()
{
const QString idx = QStringLiteral("default.desktop");
const QString subdir = QStringLiteral("/layouts/");
const QString layoutFileName = QStringLiteral("default.desktop");
const QString layoutPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kmahjongg/layouts/" + idx);
const QString layoutPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, subdir + layoutFileName);
qCDebug(KMAHJONGG_LOG) << "Inside LoadDefault(), located layout at" << layoutPath;
if (layoutPath.isEmpty()) {
return false;
......@@ -100,9 +101,10 @@ bool KMahjonggLayout::load(const QString &file) {
return false;
}
const QString layoutName = group.readEntry("FileName");
const QString subdir = QStringLiteral("/layouts/");
const QString layoutFileName = group.readEntry("FileName");
const QString layoutPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kmahjongg/layouts/" + layoutName);
const QString layoutPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, subdir + layoutFileName);
qCDebug(KMAHJONGG_LOG) << "Using layout at" << layoutPath;
d->filename = layoutPath;
......
......@@ -61,7 +61,7 @@ void KMahjonggLayoutSelector::setupData(KConfigSkeleton * aconfig)
//Now get our tilesets into a list
QStringList tilesAvailable;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kmahjongg/layouts"), QStandardPaths::LocateDirectory);
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QStringLiteral("layouts/"), QStandardPaths::LocateDirectory);
Q_FOREACH (const QString& dir, dirs) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.desktop"));
Q_FOREACH (const QString& file, fileNames) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment