File indexing completed on 2024-11-10 04:50:08

0001 /*
0002  * SPDX-FileCopyrightText: 1996-1998 Stefan Taferner <taferner@kde.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  *
0006  */
0007 
0008 #include "itemcontext.h"
0009 
0010 using namespace MailCommon;
0011 
0012 ItemContext::ItemContext(const Akonadi::Item &item, bool needsFullPayload)
0013     : mItem(item)
0014     , mItemContextAction(needsFullPayload ? FullPayload : None)
0015 {
0016 }
0017 
0018 Akonadi::Item &ItemContext::item()
0019 {
0020     return mItem;
0021 }
0022 
0023 void ItemContext::setMoveTargetCollection(const Akonadi::Collection &collection)
0024 {
0025     mMoveTargetCollection = collection;
0026 }
0027 
0028 Akonadi::Collection ItemContext::moveTargetCollection() const
0029 {
0030     return mMoveTargetCollection;
0031 }
0032 
0033 void ItemContext::setNeedsPayloadStore()
0034 {
0035     mItemContextAction |= PlayloadStore;
0036 }
0037 
0038 bool ItemContext::needsPayloadStore() const
0039 {
0040     return mItemContextAction & PlayloadStore;
0041 }
0042 
0043 void ItemContext::setNeedsFlagStore()
0044 {
0045     mItemContextAction |= FlagStore;
0046 }
0047 
0048 bool ItemContext::needsFlagStore() const
0049 {
0050     return mItemContextAction & FlagStore;
0051 }
0052 
0053 void ItemContext::setDeleteItem()
0054 {
0055     mItemContextAction |= DeleteItem;
0056 }
0057 
0058 bool ItemContext::deleteItem() const
0059 {
0060     return mItemContextAction & DeleteItem;
0061 }
0062 
0063 bool ItemContext::needsFullPayload() const
0064 {
0065     return mItemContextAction & FullPayload;
0066 }