Akonadi
7#include "tagdeletehandler.h"
9#include "storage/datastore.h"
10#include "storage/selectquerybuilder.h"
11#include "storage/tagqueryhelper.h"
13#include "private/scope_p.h"
14#include "storage/transaction.h"
17using namespace Akonadi::Server;
19TagDeleteHandler::TagDeleteHandler(AkonadiServer &akonadi)
24bool TagDeleteHandler::parseStream()
26 const auto &cmd = Protocol::cmdCast<Protocol::DeleteTagCommand>(m_command);
28 if (!checkScopeConstraints(cmd.tag(), {Scope::Uid})) {
29 return failureResponse(QStringLiteral(
"Only UID-based TAGREMOVE is supported"));
32 SelectQueryBuilder<Tag> tagQuery;
34 if (!tagQuery.
exec()) {
35 return failureResponse(QStringLiteral(
"Failed to obtain tags"));
38 const Tag::List tags = tagQuery.
result();
40 Transaction transaction(storageBackend(), QStringLiteral(
"TagDeleteHandler"));
42 if (!storageBackend()->removeTags(tags)) {
43 return failureResponse(QStringLiteral(
"Failed to remove tags"));
46 if (!transaction.commit()) {
47 return failureResponse(QStringLiteral(
"Failed to commit transaction"));
50 return successResponse<Protocol::DeleteTagResponse>();
The handler interfaces describes an entity capable of handling an AkonadiIMAP command.
bool exec()
Executes the query, returns true on success.
QList< T > result()
Returns the result of this SELECT query.
void scopeToQuery(const Scope &scope, const CommandContext &context, QueryBuilder &qb)
Add conditions to qb for the given item operation scope scope.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:49:57 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.