Clazy fix++
[kdepim.git] / kmail / undostack.h
blob5c67785e789b87040d872ea113a30a5641854ef7
1 /*
2 This file is part of KMail
4 Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
5 Copyright (c) 2003 Zack Rusin <zack@kde.org>
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 This software is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this library; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
22 #ifndef UNDOSTACK_H
23 #define UNDOSTACK_H
25 #include <QList>
26 #include <QObject>
27 #include <AkonadiCore/collection.h>
28 #include <AkonadiCore/item.h>
29 class KJob;
31 namespace KMail
34 /** A class for storing Undo information. */
35 class UndoInfo
37 public:
38 UndoInfo()
39 : id(-1),
40 moveToTrash(false)
44 int id;
45 Akonadi::Item::List items;
46 Akonadi::Collection srcFolder;
47 Akonadi::Collection destFolder;
48 bool moveToTrash;
51 class UndoStack : public QObject
53 Q_OBJECT
55 public:
56 explicit UndoStack(int size);
57 ~UndoStack();
59 void clear();
60 int size() const;
61 int newUndoAction(const Akonadi::Collection &srcFolder, const Akonadi::Collection &destFolder);
62 void addMsgToAction(int undoId, const Akonadi::Item &item);
63 bool isEmpty() const;
64 void undo();
66 void pushSingleAction(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &destFolder);
67 void folderDestroyed(const Akonadi::Collection &folder);
69 QString undoInfo() const;
71 protected Q_SLOTS:
72 void slotMoveResult(KJob *);
74 protected:
75 QList<UndoInfo *> mStack;
76 int mSize;
77 int mLastId;
78 UndoInfo *mCachedInfo;
80 Q_SIGNALS:
81 void undoStackChanged();
86 #endif