Make the boss happy.
[kdepim.git] / kmail / undostack.h
blobb321ae69e02b8d582c4103d10cd078db67098f6e
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 <akonadi/collection.h>
28 #include <akonadi/item.h>
29 class KJob;
31 namespace KMail {
33 /** A class for storing Undo information. */
34 class UndoInfo
36 public:
37 int id;
38 Akonadi::Item::List items;
39 Akonadi::Collection srcFolder;
40 Akonadi::Collection destFolder;
43 class UndoStack : public QObject
45 Q_OBJECT
47 public:
48 UndoStack(int size);
49 ~UndoStack();
51 void clear();
52 int size() const { return mStack.count(); }
53 int newUndoAction( const Akonadi::Collection& srcFolder, const Akonadi::Collection & destFolder );
54 void addMsgToAction( int undoId, const Akonadi::Item &item );
55 void undo();
57 void pushSingleAction(const Akonadi::Item &item, const Akonadi::Collection&, const Akonadi::Collection& destFolder);
58 void folderDestroyed( const Akonadi::Collection &folder);
60 public slots:
61 void msgDestroyed( const Akonadi::Item &msg);
63 protected slots:
64 void slotMoveResult(KJob*);
66 protected:
67 QList<UndoInfo*> mStack;
68 int mSize;
69 int mLastId;
70 UndoInfo *mCachedInfo;
72 signals:
73 void undoStackChanged();
78 #endif