Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konqueror / src / konqundomanager.h
blobf78851208c710405446404f859bfb8de367d97fe
1 /* This file is part of the KDE project
2 Copyright 2007 David Faure <faure@kde.org>
3 Copyright 2007 Eduardo Robles Elvira <edulix@gmail.com>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #ifndef KONQUNDOMANAGER_H
22 #define KONQUNDOMANAGER_H
24 #include "konqprivate_export.h"
25 #include <QObject>
26 #include <QString>
27 #include <QList>
28 class KonqClosedWindowItem;
29 class KonqClosedTabItem;
30 class KonqClosedItem;
31 class QAction;
33 /**
34 * Note that there is one KonqUndoManager per mainwindow.
35 * It integrates KonqFileUndoManager (undoing file operations)
36 * and undoing the closing of tabs.
38 class KONQ_TESTS_EXPORT KonqUndoManager : public QObject
40 Q_OBJECT
41 public:
42 /**
43 * Constructor
44 * @param parent the parent QObject, also used as the parent widget for KonqFileUndoManager::UiInterface.
46 explicit KonqUndoManager(QWidget* parent);
47 ~KonqUndoManager();
49 bool undoAvailable() const;
50 QString undoText() const;
51 quint64 newCommandSerialNumber();
53 /**
54 * This method is not constant because when calling it the m_closedItemsList
55 * might get filled because of delayed initialization.
57 const QList<KonqClosedItem* >& closedItemsList();
58 void undoClosedItem(int index);
59 void addClosedTabItem(KonqClosedTabItem* closedTabItem);
60 /**
61 * Add current window as a closed window item to other windows
63 void addClosedWindowItem(KonqClosedWindowItem *closedWindowItem);
64 void updateSupportsFileUndo(bool enable);
66 public Q_SLOTS:
67 void undo();
68 void clearClosedItemsList(bool onlyInthisWindow = false);
69 void undoLastClosedItem();
70 /**
71 * Opens in a new tab/window the item the user selected from the closed tabs
72 * menu (by emitting openClosedTab/Window), and takes it from the list.
74 void slotClosedItemsActivated(QAction* action);
75 void slotAddClosedWindowItem(KonqUndoManager *real_sender,
76 KonqClosedWindowItem *closedWindowItem);
78 Q_SIGNALS:
79 void undoAvailable(bool canUndo);
80 void undoTextChanged(const QString& text);
82 /// Emitted when a closed tab should be reopened
83 void openClosedTab(const KonqClosedTabItem&);
84 /// Emitted when a closed window should be reopened
85 void openClosedWindow(const KonqClosedWindowItem&);
86 /// Emitted when closedItemsList() has changed.
87 void closedItemsListChanged();
89 /// Emitted to be received in other window instances, uing the singleton
90 /// communicator
91 void removeWindowInOtherInstances(KonqUndoManager *real_sender, const
92 KonqClosedWindowItem *closedWindowItem);
93 void addWindowInOtherInstances(KonqUndoManager *real_sender,
94 KonqClosedWindowItem *closedWindowItem);
95 private Q_SLOTS:
96 void slotFileUndoAvailable(bool);
97 void slotFileUndoTextChanged(const QString& text);
99 /**
100 * Received from other window instances, removes/adds a reference of a
101 * window from m_closedItemList.
103 void slotRemoveClosedWindowItem(KonqUndoManager *real_sender, const
104 KonqClosedWindowItem *closedWindowItem);
106 private:
107 /// Fill the m_closedItemList with closed windows
108 void populate();
110 QList<KonqClosedItem *> m_closedItemList;
111 bool m_supportsFileUndo;
112 bool m_populated;
115 #endif /* KONQUNDOMANAGER_H */