kmail
undostack.h
Go to the documentation of this file.00001 /* 00002 This file is part of KMail 00003 00004 Copyright (C) 1999 Waldo Bastian (bastian@kde.org) 00005 Copyright (c) 2003 Zack Rusin <zack@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 version 2 as published by the Free Software Foundation. 00010 00011 This software is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this library; see the file COPYING. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef UNDOSTACK_H 00023 #define UNDOSTACK_H 00024 00025 #include <qptrlist.h> 00026 #include <qstring.h> 00027 #include <qobject.h> 00028 00029 class KMFolder; 00030 class KMMsgBase; 00031 00032 namespace KMail { 00033 00035 class UndoInfo 00036 { 00037 public: 00038 int id; 00039 QValueList<ulong> serNums; 00040 KMFolder *srcFolder; 00041 KMFolder *destFolder; 00042 }; 00043 00044 class UndoStack : public QObject 00045 { 00046 Q_OBJECT 00047 00048 public: 00049 UndoStack(int size); 00050 00051 void clear(); 00052 int size() const { return mStack.count(); } 00053 int newUndoAction( KMFolder* srcFolder, KMFolder* destFolder ); 00054 void addMsgToAction( int undoId, ulong serNum ); 00055 void undo(); 00056 00057 void pushSingleAction(ulong serNum, KMFolder *folder, KMFolder* destFolder); 00058 void msgDestroyed( KMMsgBase *msg); 00059 void folderDestroyed( KMFolder *folder); 00060 protected: 00061 QPtrList<UndoInfo> mStack; 00062 int mSize; 00063 int mLastId; 00064 UndoInfo *mCachedInfo; 00065 00066 signals: 00067 void undoStackChanged(); 00068 }; 00069 00070 } 00071 00072 #endif