File indexing completed on 2024-12-22 04:56:51
0001 /* 0002 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <Akonadi/TransactionSequence> 0010 0011 #include <Akonadi/Item> 0012 #include <QString> 0013 /** 0014 * This class stores the result of a StoreResultJob in an item. 0015 * First, it removes the 'queued' flag. 0016 * After that, if the result was success, it stores the 'sent' flag. 0017 * If the result was failure, it stores the 'error' flag and an ErrorAttribute. 0018 */ 0019 class StoreResultJob : public Akonadi::TransactionSequence 0020 { 0021 Q_OBJECT 0022 0023 public: 0024 /** 0025 * Creates a new store result job. 0026 * 0027 * @param item The item to store. 0028 * @param success Whether the mail could be dispatched or not. 0029 * @param message An error message in case the mail could not be dispatched. 0030 * @param parent The parent object. 0031 */ 0032 explicit StoreResultJob(const Akonadi::Item &item, bool success, const QString &message, QObject *parent = nullptr); 0033 0034 /** 0035 * Destroys the store result job. 0036 */ 0037 ~StoreResultJob() override; 0038 0039 [[nodiscard]] bool success() const; 0040 [[nodiscard]] QString message() const; 0041 0042 protected: 0043 // reimpl from TransactionSequence 0044 void doStart() override; 0045 0046 private: 0047 // Q_SLOTS: 0048 void fetchDone(KJob *job); 0049 void modifyDone(KJob *job); 0050 0051 Akonadi::Item mItem; 0052 bool mSuccess = false; 0053 QString mMessage; 0054 };