diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 16:35:09 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 16:35:09 +0100 |
commit | e8ab53258c044969146be385629a80afe801dee5 (patch) | |
tree | 170ded5835b8a60ef813964530aff7c79e52f4a0 /common/resourceconfig.cpp | |
parent | 50069f3c28b4130a9a81c25746d2c9d97c0356f5 (diff) | |
download | sink-e8ab53258c044969146be385629a80afe801dee5.tar.gz sink-e8ab53258c044969146be385629a80afe801dee5.zip |
Turn operations of resources into a special case.
Resources don't live inside a resource context, and as such inherently
are a special case. By also removing the option to manually specify the
identifier, the commandline is a lot easier to use.
Diffstat (limited to 'common/resourceconfig.cpp')
-rw-r--r-- | common/resourceconfig.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/resourceconfig.cpp b/common/resourceconfig.cpp index 3554b76..a0f39a8 100644 --- a/common/resourceconfig.cpp +++ b/common/resourceconfig.cpp | |||
@@ -33,6 +33,15 @@ static QSharedPointer<QSettings> getResourceConfig(const QByteArray &identifier) | |||
33 | return QSharedPointer<QSettings>::create(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/akonadi2/" + identifier, QSettings::IniFormat); | 33 | return QSharedPointer<QSettings>::create(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/akonadi2/" + identifier, QSettings::IniFormat); |
34 | } | 34 | } |
35 | 35 | ||
36 | QByteArray ResourceConfig::newIdentifier(const QByteArray &type) | ||
37 | { | ||
38 | auto settings = getSettings(); | ||
39 | const auto counter = settings->value("instanceCounter", 0).toInt() + 1; | ||
40 | const QByteArray identifier = type + ".instance" + QByteArray::number(counter); | ||
41 | settings->setValue("instanceCounter", counter); | ||
42 | settings->sync(); | ||
43 | return identifier; | ||
44 | } | ||
36 | 45 | ||
37 | void ResourceConfig::addResource(const QByteArray &identifier, const QByteArray &type) | 46 | void ResourceConfig::addResource(const QByteArray &identifier, const QByteArray &type) |
38 | { | 47 | { |