Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konsole / src / ViewProperties.cpp
blob4c47ff4dbf98b7ff772e6953a6e00bbda516069a
1 /*
2 Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
4 This program 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.
9 This program 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.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301 USA.
20 // Own
21 #include "ViewProperties.h"
23 // Qt
25 using namespace Konsole;
27 QHash<int,ViewProperties*> ViewProperties::_viewProperties;
28 QString ViewProperties::_mimeType = "application/x-konsole-view-id";
30 ViewProperties::ViewProperties(QObject* parent)
31 : QObject(parent)
32 , _id(0)
33 //, _flags(0)
36 ViewProperties::~ViewProperties()
38 _viewProperties.remove(_id);
40 ViewProperties* ViewProperties::propertiesById(int id)
42 return _viewProperties[id];
44 KUrl ViewProperties::url() const
46 return KUrl();
48 QString ViewProperties::currentDir() const
50 return QString();
52 void ViewProperties::fireActivity()
54 emit activity(this);
57 void ViewProperties::rename()
61 void ViewProperties::setTitle(const QString& title)
63 if ( title != _title )
65 _title = title;
66 emit titleChanged(this);
69 void ViewProperties::setIcon(const QIcon& icon)
71 // the icon's cache key is used to determine whether this icon is the same
72 // as the old one. if so no signal is emitted.
74 if ( icon.cacheKey() != _icon.cacheKey() )
76 _icon = icon;
77 emit iconChanged(this);
80 void ViewProperties::setIdentifier(int id)
82 if (_viewProperties.contains(_id))
83 _viewProperties.remove(_id);
85 _id = id;
87 _viewProperties.insert(id,this);
89 QString ViewProperties::title() const
91 return _title;
93 QIcon ViewProperties::icon() const
95 return _icon;
97 int ViewProperties::identifier() const
99 return _id;
101 #include "ViewProperties.moc"