diff options
Diffstat (limited to 'common/messagequeue.cpp')
-rw-r--r-- | common/messagequeue.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/common/messagequeue.cpp b/common/messagequeue.cpp index 3b5ca2b..2a046d1 100644 --- a/common/messagequeue.cpp +++ b/common/messagequeue.cpp | |||
@@ -44,20 +44,20 @@ MessageQueue::MessageQueue(const QString &storageRoot, const QString &name) | |||
44 | 44 | ||
45 | void MessageQueue::enqueue(void const *msg, size_t size) | 45 | void MessageQueue::enqueue(void const *msg, size_t size) |
46 | { | 46 | { |
47 | enqueue(QByteArray::fromRawData(static_cast<const char*>(msg), size)); | ||
48 | } | ||
49 | |||
50 | void MessageQueue::enqueue(const QByteArray &value) | ||
51 | { | ||
47 | auto transaction = std::move(mStorage.createTransaction(Akonadi2::Storage::ReadWrite)); | 52 | auto transaction = std::move(mStorage.createTransaction(Akonadi2::Storage::ReadWrite)); |
48 | const qint64 revision = Akonadi2::Storage::maxRevision(transaction) + 1; | 53 | const qint64 revision = Akonadi2::Storage::maxRevision(transaction) + 1; |
49 | const QByteArray key = QString("%1").arg(revision).toUtf8(); | 54 | const QByteArray key = QString("%1").arg(revision).toUtf8(); |
50 | transaction.write(key, QByteArray::fromRawData(static_cast<const char*>(msg), size)); | 55 | transaction.write(key, value); |
51 | Akonadi2::Storage::setMaxRevision(transaction, revision); | 56 | Akonadi2::Storage::setMaxRevision(transaction, revision); |
52 | transaction.commit(); | 57 | transaction.commit(); |
53 | emit messageReady(); | 58 | emit messageReady(); |
54 | } | 59 | } |
55 | 60 | ||
56 | void MessageQueue::enqueue(const QByteArray &value) | ||
57 | { | ||
58 | enqueue(value.data(), value.size()); | ||
59 | } | ||
60 | |||
61 | void MessageQueue::dequeue(const std::function<void(void *ptr, int size, std::function<void(bool success)>)> &resultHandler, | 61 | void MessageQueue::dequeue(const std::function<void(void *ptr, int size, std::function<void(bool success)>)> &resultHandler, |
62 | const std::function<void(const Error &error)> &errorHandler) | 62 | const std::function<void(const Error &error)> &errorHandler) |
63 | { | 63 | { |