Commit c67cfeb8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Start to fix bug 453969.

If we try to modify too many item it will failed
parent ee49d8f4
Pipeline #190251 failed with stage
in 2 minutes and 41 seconds
......@@ -45,6 +45,8 @@ set(akonadimime_SRCS
movecommand.cpp
movetotrashcommand.cpp
standardmailactionmanager.cpp
markascommandhelper_p.h
markascommandhelper.cpp
messagestatus.h
util_p.h
......
#include "markascommandhelper_p.h"
#include "akonadi_mime_debug.h"
#include <Akonadi/ItemModifyJob>
using namespace Akonadi;
MarkAsCommandHelper::MarkAsCommandHelper(QObject *parent)
: QObject{parent}
{
}
MarkAsCommandHelper::~MarkAsCommandHelper() = default;
void MarkAsCommandHelper::start()
{
if (!mItemsToModify.isEmpty()) {
auto modifyJob = new Akonadi::ItemModifyJob(mItemsToModify, this);
modifyJob->setIgnorePayload(true);
modifyJob->disableRevisionCheck();
connect(modifyJob, &Akonadi::ItemModifyJob::result, this, &MarkAsCommandHelper::slotModifyItemDone);
} else {
emitResult(Akonadi::CommandBase::OK);
deleteLater();
}
}
const Akonadi::Item::List &MarkAsCommandHelper::itemsToModify() const
{
return mItemsToModify;
}
void MarkAsCommandHelper::setItemsToModify(const Akonadi::Item::List &newItemsToModify)
{
mItemsToModify = newItemsToModify;
}
void MarkAsCommandHelper::slotModifyItemDone(KJob *job)
{
if (job && job->error()) {
qCDebug(AKONADIMIME_LOG) << " Error trying to set item status:" << job->errorText();
emitResult(Akonadi::CommandBase::Failed);
} else {
emitResult(Akonadi::CommandBase::OK);
}
deleteLater();
}
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#pragma once
#include "akonadi-mime_export.h"
#include "commandbase.h"
#include <Akonadi/Item>
#include <QObject>
namespace Akonadi
{
class AKONADI_MIME_EXPORT MarkAsCommandHelper : public QObject
{
Q_OBJECT
public:
explicit MarkAsCommandHelper(QObject *parent = nullptr);
~MarkAsCommandHelper() override;
Q_REQUIRED_RESULT const Akonadi::Item::List &itemsToModify() const;
void setItemsToModify(const Akonadi::Item::List &newItemsToModify);
void start();
Q_SIGNALS:
void emitResult(Akonadi::CommandBase::Result result);
private:
void slotModifyItemDone(KJob *job);
Akonadi::Item::List mItemsToModify;
};
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment