summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Vrátil <[email protected]>2015-09-04 17:18:14 +0200
committerDan Vrátil <[email protected]>2015-09-04 17:18:14 +0200
commitf3380529dcebedee96052399641af6918c6a2b35 (patch)
treecfe4f2ce317d6220f7519a44a8ac6dcc38129ff8
parent7f2ec709209bf7ce01f98a804523108964c82990 (diff)
Make Akonadi::Tag::List a QVector instead of QList
-rw-r--r--akonadi/CMakeLists.txt2
-rw-r--r--akonadi/autotests/fakeakonadiservercommand.cpp2
-rw-r--r--akonadi/src/core/monitor_p.cpp3
-rw-r--r--akonadi/src/core/tag.h2
-rw-r--r--akonadi/src/core/vectorhelper.h15
5 files changed, 19 insertions, 5 deletions
diff --git a/akonadi/CMakeLists.txt b/akonadi/CMakeLists.txt
index a81beb4..2ab114c 100644
--- a/akonadi/CMakeLists.txt
+++ b/akonadi/CMakeLists.txt
@@ -19,7 +19,7 @@ include(ECMQtDeclareLoggingCategory)
# FIXME: Do we want the same versions in kdepimlibs and kf5?
set(KF5_VERSION "5.12.0")
-set(KDEPIMLIBS_VERSION "5.0.41")
+set(KDEPIMLIBS_VERSION "5.0.42")
set(QT_REQUIRED_VERSION "5.2.0")
# Remove it when we split it
diff --git a/akonadi/autotests/fakeakonadiservercommand.cpp b/akonadi/autotests/fakeakonadiservercommand.cpp
index fe881b4..25ee4bc 100644
--- a/akonadi/autotests/fakeakonadiservercommand.cpp
+++ b/akonadi/autotests/fakeakonadiservercommand.cpp
@@ -110,7 +110,7 @@ void FakeJobResponse::doCommand()
setProperty("FetchCollectionId", m_parentCollection.id());
emit_itemsFetched(Akonadi::valuesToVector(m_items));
} else if (m_type == RespondToTagFetch) {
- emit_tagsFetched(m_tags.values());
+ emit_tagsFetched(Akonadi::valuesToVector(m_tags));
}
}
diff --git a/akonadi/src/core/monitor_p.cpp b/akonadi/src/core/monitor_p.cpp
index f0a192a..70bbb7c 100644
--- a/akonadi/src/core/monitor_p.cpp
+++ b/akonadi/src/core/monitor_p.cpp
@@ -28,6 +28,7 @@
#include "notificationmanagerinterface.h"
#include "session.h"
#include "changemediator_p.h"
+#include "vectorhelper.h"
#include <qdebug.h>
@@ -996,7 +997,7 @@ bool MonitorPrivate::emitItemsNotification(const Protocol::ChangeNotification &m
return handled;
case Protocol::ChangeNotification::ModifyTags:
if (q_ptr->receivers(SIGNAL(itemsTagsChanged(Akonadi::Item::List,QSet<Akonadi::Tag>,QSet<Akonadi::Tag>))) > 0) {
- emit q_ptr->itemsTagsChanged(its, addedTags.toSet(), removedTags.toSet());
+ emit q_ptr->itemsTagsChanged(its, Akonadi::vectorToSet(addedTags), Akonadi::vectorToSet(removedTags));
return true;
}
return false;
diff --git a/akonadi/src/core/tag.h b/akonadi/src/core/tag.h
index 0463281..5ae07ca 100644
--- a/akonadi/src/core/tag.h
+++ b/akonadi/src/core/tag.h
@@ -44,7 +44,7 @@ namespace Akonadi
class AKONADICORE_EXPORT Tag : public AttributeEntity
{
public:
- typedef QList<Tag> List;
+ typedef QVector<Tag> List;
typedef qint64 Id;
/**
diff --git a/akonadi/src/core/vectorhelper.h b/akonadi/src/core/vectorhelper.h
index ea725b1..bd05af6 100644
--- a/akonadi/src/core/vectorhelper.h
+++ b/akonadi/src/core/vectorhelper.h
@@ -19,7 +19,9 @@
#ifndef VECTORHELPER_H
#define VECTORHELPER_H
+
#include <QVector>
+#include <QSet>
namespace Akonadi {
template<typename Key, typename Value, template<typename, typename> class Container>
@@ -27,12 +29,23 @@ QVector<Value> valuesToVector(const Container<Key, Value> &container)
{
QVector<Value> values;
values.reserve(container.size());
- foreach (const Value &value, container) {
+ Q_FOREACH (const Value &value, container) {
values << value;
}
return values;
}
+template<typename T>
+QSet<T> vectorToSet(const QVector<T> &container)
+{
+ QSet<T> set;
+ set.reserve(container.size());
+ Q_FOREACH (const T &value, container) {
+ set.insert(value);
+ }
+ return set;
+}
+
}
#endif // VECTORHELPER_H