File indexing completed on 2024-04-21 05:50:19

0001 /* This file is part of the KDE project
0002    Copyright (C) 2000, 2009 David Faure <faure@kde.org>
0003    Copyright (C) 2002-2003 Alexander Kellett <lypanov@kde.org>
0004 
0005    This program is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU General Public License as
0007    published by the Free Software Foundation; either version 2 of
0008    the License, or (at your option) version 3.
0009 
0010    This program is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013    GNU General Public License for more details.
0014 
0015    You should have received a copy of the GNU General Public License
0016    along with this program.  If not, see <http://www.gnu.org/licenses/>
0017 */
0018 
0019 #ifndef COMMANDHISTORY_H
0020 #define COMMANDHISTORY_H
0021 
0022 #include "kbookmarkmodel_export.h"
0023 #include <QObject>
0024 class KBookmarkGroup;
0025 class KBookmarkManager;
0026 class QUndoCommand;
0027 class KActionCollection;
0028 
0029 // TODO namespacing
0030 class KBOOKMARKMODEL_EXPORT CommandHistory : public QObject
0031 {
0032     Q_OBJECT
0033 public:
0034     explicit CommandHistory(QObject *parent = nullptr);
0035     ~CommandHistory() override;
0036 
0037     // Call this before putting any commands into the history!
0038     void setBookmarkManager(KBookmarkManager *manager);
0039     KBookmarkManager *bookmarkManager();
0040 
0041     void createActions(KActionCollection *collection);
0042 
0043     void notifyDocSaved();
0044 
0045     void clearHistory();
0046     void addCommand(QUndoCommand *);
0047 
0048 Q_SIGNALS:
0049     void notifyCommandExecuted(const KBookmarkGroup &);
0050 
0051 public Q_SLOTS:
0052     void undo();
0053     void redo();
0054 
0055 private:
0056     void commandExecuted(const QUndoCommand *k);
0057 
0058 private:
0059     class Private;
0060     Private *const d;
0061 };
0062 
0063 #endif /* COMMANDHISTORY_H */