File indexing completed on 2024-06-23 05:07:03

0001 /*
0002     SPDX-FileCopyrightText: 2014 Daniel Vrátil <dvratil@redhat.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QSqlQuery>
0010 
0011 #include "private/protocol_p.h"
0012 #include "private/scope_p.h"
0013 
0014 namespace Akonadi
0015 {
0016 namespace Server
0017 {
0018 class Connection;
0019 
0020 class TagFetchHelper
0021 {
0022 public:
0023     TagFetchHelper(Connection *connection, const Scope &scope, const Protocol::TagFetchScope &fetchScope);
0024     ~TagFetchHelper() = default;
0025 
0026     bool fetchTags();
0027 
0028     static QMap<QByteArray, QByteArray> fetchTagAttributes(qint64 tagId, const Protocol::TagFetchScope &fetchScope);
0029 
0030 private:
0031     QSqlQuery buildTagQuery();
0032     QSqlQuery buildAttributeQuery() const;
0033     static QSqlQuery buildAttributeQuery(qint64 id, const Protocol::TagFetchScope &fetchScope);
0034 
0035 private:
0036     Connection *mConnection = nullptr;
0037     Scope mScope;
0038     Protocol::TagFetchScope mFetchScope;
0039 };
0040 
0041 } // namespace Server
0042 } // namespace Akonadi