Commit 6c43ad3a authored by Volker Krause's avatar Volker Krause

Rename basePath and use it in more places

parent 63c50a6f
......@@ -60,12 +60,12 @@ bool ReservationManager::hasReservation(const QString &id) const
return true;
}
return QFile::exists(basePath() + id + QLatin1String(".jsonld"));
return QFile::exists(reservationsBasePath() + id + QLatin1String(".jsonld"));
}
QVector<QString> ReservationManager::reservations() const
{
const auto base = basePath();
const auto base = reservationsBasePath();
QDir::root().mkpath(base);
QVector<QString> resIds;
......@@ -88,7 +88,7 @@ QVariant ReservationManager::reservation(const QString& id) const
return it.value();
}
const QString resPath = basePath() + id + QLatin1String(".jsonld");
const QString resPath = reservationsBasePath() + id + QLatin1String(".jsonld");
QFile f(resPath);
if (!f.open(QFile::ReadOnly)) {
qCWarning(Log) << "Failed to open JSON-LD reservation data file:" << resPath << f.errorString();
......@@ -120,7 +120,7 @@ QVariant ReservationManager::reservation(const QString& id) const
return res;
}
QString ReservationManager::basePath()
QString ReservationManager::reservationsBasePath()
{
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1String("/reservations/");
}
......@@ -186,7 +186,7 @@ void ReservationManager::importReservations(const QVector<QVariant> &resData)
void ReservationManager::addReservation(const QVariant &res)
{
QString resId = QUuid::createUuid().toString();
const QString basePath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/reservations/");
const QString basePath = reservationsBasePath();
QDir::root().mkpath(basePath);
const QString path = basePath + resId + QLatin1String(".jsonld");
QFile f(path);
......@@ -201,7 +201,7 @@ void ReservationManager::addReservation(const QVariant &res)
void ReservationManager::updateReservation(const QString &resId, const QVariant &res)
{
const QString basePath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/reservations/");
const QString basePath = reservationsBasePath();
QDir::root().mkpath(basePath);
const QString path = basePath + resId + QLatin1String(".jsonld");
QFile f(path);
......
......@@ -54,7 +54,7 @@ Q_SIGNALS:
void reservationRemoved(const QString &id);
private:
static QString basePath();
static QString reservationsBasePath();
void passAdded(const QString &passId);
void passUpdated(const QString &passId);
......
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