File indexing completed on 2024-04-21 14:56:00

0001 /* This file is part of the KDE project
0002    Copyright (C) 2006 Peter Simonsson <peter.simonsson@gmail.com>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017    Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KUNDOSTACK_H
0021 #define KUNDOSTACK_H
0022 
0023 #include <kdelibs4support_export.h>
0024 
0025 #include <QUndoStack>
0026 
0027 class KActionCollection;
0028 
0029 /**
0030  * Extends QUndoStack with functions that creates actions with KDE's default icons and shortcuts.
0031  * See QUndoStack for more information.
0032  */
0033 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KUndoStack : public QUndoStack
0034 {
0035     Q_OBJECT
0036 public:
0037     /**
0038      * Constructs a KUndoStack with @p parent as parent
0039      * @param parent parent of the object
0040      */
0041     KUndoStack(QObject *parent = nullptr);
0042 
0043     /**
0044      * Creates an redo action with the default shortcut and icon and adds it to @p actionCollection
0045      * @param actionCollection the KActionCollection that should be the parent of the action
0046      * @param actionName the created action's object name, empty string will set it to the KDE default
0047      * @return the created action.
0048      */
0049     QAction *createRedoAction(KActionCollection *actionCollection, const QString &actionName = QString());
0050     /**
0051      * Creates an undo action with the default KDE shortcut and icon and adds it to @p actionCollection
0052      * @param actionCollection the KActionCollection that should be the parent of the action
0053      * @param actionName the created action's object name, empty string will set it to the KDE default
0054      * @return the created action.
0055      */
0056     QAction *createUndoAction(KActionCollection *actionCollection, const QString &actionName = QString());
0057 };
0058 
0059 #endif