1 /* This file is part of Step.
2    Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
3 
4    Step is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2 of the License, or
7    (at your option) any later version.
8 
9    Step is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with Step; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18 
19 #include "undobrowser.h"
20 
21 #include "worldmodel.h"
22 
23 #include <QIcon>
24 #include <QUndoView>
25 #include <QUrl>
26 
27 #include <KLocalizedString>
28 
UndoBrowser(WorldModel * worldModel,QWidget * parent)29 UndoBrowser::UndoBrowser(WorldModel* worldModel, QWidget* parent)
30     : QDockWidget(i18n("Undo History"), parent), _worldModel(worldModel)
31 {
32     _undoView = new QUndoView(_worldModel->undoStack(), this);
33     setWidget(_undoView);
34 }
35 
setEmptyLabel(const QString & label)36 void UndoBrowser::setEmptyLabel(const QString& label)
37 {
38     _undoView->setEmptyLabel(label);
39 }
40 
setCurrentFileUrl(const QUrl & url)41 void UndoBrowser::setCurrentFileUrl(const QUrl& url)
42 {
43     if (url.isEmpty())
44         _undoView->setCleanIcon(QIcon());
45     else
46         _undoView->setCleanIcon(QIcon::fromTheme(QStringLiteral("document-save")));
47 }
48 
setUndoEnabled(bool enabled)49 void UndoBrowser::setUndoEnabled(bool enabled)
50 {
51     _undoView->setEnabled(enabled);
52 }
53 
54