summaryrefslogtreecommitdiffstats
path: root/common/resourceconfig.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-22 16:35:09 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-22 16:35:09 +0100
commite8ab53258c044969146be385629a80afe801dee5 (patch)
tree170ded5835b8a60ef813964530aff7c79e52f4a0 /common/resourceconfig.cpp
parent50069f3c28b4130a9a81c25746d2c9d97c0356f5 (diff)
downloadsink-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.cpp9
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
36QByteArray 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
37void ResourceConfig::addResource(const QByteArray &identifier, const QByteArray &type) 46void ResourceConfig::addResource(const QByteArray &identifier, const QByteArray &type)
38{ 47{