summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2015-12-25 18:27:28 +0100
committerAaron Seigo <aseigo@kde.org>2015-12-25 18:27:28 +0100
commita90342d5fb92092e1d1715eae7f66f33d5b4a66c (patch)
tree170d3b7db2e7c8c3598f84ef46190ab99e525d66
parentc1eb4d6f95962c36e5e3994a0e6578cbff03cf49 (diff)
downloadsink-a90342d5fb92092e1d1715eae7f66f33d5b4a66c.tar.gz
sink-a90342d5fb92092e1d1715eae7f66f33d5b4a66c.zip
key/value map maker
straight from akonadi2_client .. needs improving
-rw-r--r--akonadish/akonadish_utils.cpp12
-rw-r--r--akonadish/akonadish_utils.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/akonadish/akonadish_utils.cpp b/akonadish/akonadish_utils.cpp
index bfb72ca..ffbdcb3 100644
--- a/akonadish/akonadish_utils.cpp
+++ b/akonadish/akonadish_utils.cpp
@@ -70,5 +70,17 @@ QSharedPointer<QAbstractItemModel> loadModel(const QString &type, Akonadi2::Quer
70 return model; 70 return model;
71} 71}
72 72
73QMap<QString, QString> keyValueMapFromArgs(const QStringList &args)
74{
75 //TODO: this is not the most clever of algorithms. preserved during the port of commands
76 // from akonadi2_client ... we can probably do better, however ;)
77 QMap<QString, QString> map;
78 for (int i = 0; i + 2 <= args.size(); i += 2) {
79 map.insert(args.at(i), args.at(i + 1));
80 }
81
82 return map;
83}
84
73} 85}
74 86
diff --git a/akonadish/akonadish_utils.h b/akonadish/akonadish_utils.h
index c15162f..17b8ec7 100644
--- a/akonadish/akonadish_utils.h
+++ b/akonadish/akonadish_utils.h
@@ -34,6 +34,7 @@ class StoreBase;
34bool isValidStoreType(const QString &type); 34bool isValidStoreType(const QString &type);
35StoreBase &getStore(const QString &type); 35StoreBase &getStore(const QString &type);
36QSharedPointer<QAbstractItemModel> loadModel(const QString &type, Akonadi2::Query query); 36QSharedPointer<QAbstractItemModel> loadModel(const QString &type, Akonadi2::Query query);
37QMap<QString, QString> keyValueMapFromArgs(const QStringList &args);
37 38
38/** 39/**
39 * A small abstraction layer to use the akonadi store with the type available as string. 40 * A small abstraction layer to use the akonadi store with the type available as string.