File indexing completed on 2024-05-12 15:56:13
0001 /**************************************************************************** 0002 ** 0003 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 0004 ** All rights reserved. 0005 ** Contact: Nokia Corporation (qt-info@nokia.com) 0006 ** 0007 ** This file is part of the QtGui module of the Qt Toolkit. 0008 ** 0009 ** $QT_BEGIN_LICENSE:LGPL$ 0010 ** No Commercial Usage 0011 ** This file contains pre-release code and may not be distributed. 0012 ** You may use this file in accordance with the terms and conditions 0013 ** contained in the Technology Preview License Agreement accompanying 0014 ** this package. 0015 ** 0016 ** GNU Lesser General Public License Usage 0017 ** Alternatively, this file may be used under the terms of the GNU Lesser 0018 ** General Public License version 2.1 as published by the Free Software 0019 ** Foundation and appearing in the file LICENSE.LGPL included in the 0020 ** packaging of this file. Please review the following information to 0021 ** ensure the GNU Lesser General Public License version 2.1 requirements 0022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 0023 ** 0024 ** In addition, as a special exception, Nokia gives you certain additional 0025 ** rights. These rights are described in the Nokia Qt LGPL Exception 0026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 0027 ** 0028 ** If you have questions regarding the use of this file, please contact 0029 ** Nokia at qt-info@nokia.com. 0030 ** 0031 ** 0032 ** 0033 ** 0034 ** 0035 ** 0036 ** 0037 ** 0038 ** $QT_END_LICENSE$ 0039 ** 0040 ****************************************************************************/ 0041 0042 #ifndef KUNDO2GROUP_H 0043 #define KUNDO2GROUP_H 0044 0045 #include <QObject> 0046 #include <QString> 0047 0048 #include "kritacommand_export.h" 0049 0050 class KUndo2GroupPrivate; 0051 class KUndo2QStack; 0052 class QAction; 0053 0054 #ifndef QT_NO_UNDOGROUP 0055 0056 class KRITACOMMAND_EXPORT KUndo2Group : public QObject 0057 { 0058 Q_OBJECT 0059 Q_DECLARE_PRIVATE(KUndo2Group) 0060 0061 public: 0062 explicit KUndo2Group(QObject *parent = 0); 0063 ~KUndo2Group() override; 0064 0065 void addStack(KUndo2QStack *stack); 0066 void removeStack(KUndo2QStack *stack); 0067 QList<KUndo2QStack*> stacks() const; 0068 KUndo2QStack *activeStack() const; 0069 0070 #ifndef QT_NO_ACTION 0071 QAction *createUndoAction(QObject *parent) const; 0072 QAction *createRedoAction(QObject *parent) const; 0073 #endif // QT_NO_ACTION 0074 bool canUndo() const; 0075 bool canRedo() const; 0076 QString undoText() const; 0077 QString redoText() const; 0078 bool isClean() const; 0079 0080 public Q_SLOTS: 0081 void undo(); 0082 void redo(); 0083 void setActiveStack(KUndo2QStack *stack); 0084 0085 Q_SIGNALS: 0086 void activeStackChanged(KUndo2QStack *stack); 0087 void indexChanged(int idx); 0088 void cleanChanged(bool clean); 0089 void canUndoChanged(bool canUndo); 0090 void canRedoChanged(bool canRedo); 0091 void undoTextChanged(const QString &undoActionText); 0092 void redoTextChanged(const QString &redoActionText); 0093 0094 private: 0095 // from QUndoGroupPrivate 0096 KUndo2QStack *m_active; 0097 QList<KUndo2QStack*> m_stack_list; 0098 0099 Q_DISABLE_COPY(KUndo2Group) 0100 }; 0101 0102 #endif // QT_NO_UNDOGROUP 0103 0104 #endif // KUNDO2GROUP_H