Konsole
ViewProperties.cpp
Go to the documentation of this file.00001 /* 00002 Copyright 2007-2008 by Robert Knight <robertknight@gmail.com> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301 USA. 00018 */ 00019 00020 // Own 00021 #include "ViewProperties.h" 00022 00023 // Qt 00024 00025 using namespace Konsole; 00026 00027 QHash<int,ViewProperties*> ViewProperties::_viewProperties; 00028 QString ViewProperties::_mimeType = "application/x-konsole-view-id"; 00029 00030 ViewProperties::ViewProperties(QObject* parent) 00031 : QObject(parent) 00032 , _id(0) 00033 //, _flags(0) 00034 { 00035 } 00036 ViewProperties::~ViewProperties() 00037 { 00038 _viewProperties.remove(_id); 00039 } 00040 ViewProperties* ViewProperties::propertiesById(int id) 00041 { 00042 return _viewProperties[id]; 00043 } 00044 KUrl ViewProperties::url() const 00045 { 00046 return KUrl(); 00047 } 00048 QString ViewProperties::currentDir() const 00049 { 00050 return QString(); 00051 } 00052 void ViewProperties::fireActivity() 00053 { 00054 emit activity(this); 00055 } 00056 00057 void ViewProperties::rename() 00058 { 00059 } 00060 00061 void ViewProperties::setTitle(const QString& title) 00062 { 00063 if ( title != _title ) 00064 { 00065 _title = title; 00066 emit titleChanged(this); 00067 } 00068 } 00069 void ViewProperties::setIcon(const QIcon& icon) 00070 { 00071 // the icon's cache key is used to determine whether this icon is the same 00072 // as the old one. if so no signal is emitted. 00073 00074 if ( icon.cacheKey() != _icon.cacheKey() ) 00075 { 00076 _icon = icon; 00077 emit iconChanged(this); 00078 } 00079 } 00080 void ViewProperties::setIdentifier(int id) 00081 { 00082 if (_viewProperties.contains(_id)) 00083 _viewProperties.remove(_id); 00084 00085 _id = id; 00086 00087 _viewProperties.insert(id,this); 00088 } 00089 QString ViewProperties::title() const 00090 { 00091 return _title; 00092 } 00093 QIcon ViewProperties::icon() const 00094 { 00095 return _icon; 00096 } 00097 int ViewProperties::identifier() const 00098 { 00099 return _id; 00100 } 00101 #include "ViewProperties.moc"