1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef nsMsgBaseUndoTxn_h_
7 #define nsMsgBaseUndoTxn_h_
8 
9 #include "mozilla/Attributes.h"
10 #include "nsMsgTxn.h"
11 #include "nsTArray.h"
12 #include "nsCOMPtr.h"
13 #include "MailNewsTypes.h"
14 #include "nsIMsgFolder.h"
15 
16 #define NS_MSGREADSTATETXN_IID                       \
17   { /* 121FCE4A-3EA1-455C-8161-839E1557D0CF */       \
18     0x121FCE4A, 0x3EA1, 0x455C, {                    \
19       0x81, 0x61, 0x83, 0x9E, 0x15, 0x57, 0xD0, 0xCF \
20     }                                                \
21   }
22 
23 //------------------------------------------------------------------------------
24 // A mark-all transaction handler. Helper for redo/undo of message read states.
25 //------------------------------------------------------------------------------
26 class nsMsgReadStateTxn : public nsMsgTxn {
27  public:
28   nsMsgReadStateTxn();
29   virtual ~nsMsgReadStateTxn();
30 
31   nsresult Init(nsIMsgFolder* aParentFolder, uint32_t aNumKeys,
32                 nsMsgKey* aMsgKeyArray);
33   NS_IMETHOD UndoTransaction() override;
34   NS_IMETHOD RedoTransaction() override;
35 
36  protected:
37   NS_IMETHOD MarkMessages(bool aAsRead);
38 
39  private:
40   nsCOMPtr<nsIMsgFolder> mParentFolder;
41   nsTArray<nsMsgKey> mMarkedMessages;
42 };
43 
44 #endif  // nsMsgBaseUndoTxn_h_
45