KDE3Support
k3filetreeviewitem.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDEproject 00002 Copyright (C) 2000 David Faure <faure@kde.org> 00003 2000 Carsten Pfeiffer <pfeiffer@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library 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 GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "k3filetreeviewitem.h" 00021 00022 #include <kdebug.h> 00023 #include <kfileitem.h> 00024 #include <kicontheme.h> 00025 00026 /* --- K3FileTreeViewItem --- */ 00027 /* 00028 */ 00029 K3FileTreeViewItem::K3FileTreeViewItem( K3FileTreeViewItem *parent, 00030 const KFileItem &item, 00031 KFileTreeBranch *brnch ) 00032 : K3ListViewItem( parent ), 00033 m_kfileitem( item ), 00034 m_branch( brnch ), 00035 m_wasListed(false) 00036 { 00037 setPixmap(0, item.pixmap( KIconLoader::SizeSmall )); 00038 setText( 0, item.text()); 00039 00040 m_kfileitem.setExtraData( m_branch, this ); 00041 } 00042 00043 K3FileTreeViewItem::K3FileTreeViewItem( K3FileTreeView* parent, 00044 const KFileItem &item, 00045 KFileTreeBranch *brnch ) 00046 :K3ListViewItem( (Q3ListView*)parent ), 00047 m_kfileitem(item ), 00048 m_branch( brnch ), 00049 m_wasListed(false) 00050 { 00051 setPixmap(0, item.pixmap( KIconLoader::SizeSmall )); 00052 setText( 0, item.text()); 00053 00054 m_kfileitem.setExtraData( m_branch, this ); 00055 } 00056 00057 K3FileTreeViewItem::~K3FileTreeViewItem() 00058 { 00059 if ( !m_kfileitem.isNull() ) 00060 m_kfileitem.removeExtraData( m_branch ); 00061 } 00062 00063 bool K3FileTreeViewItem::alreadyListed() const 00064 { 00065 return m_wasListed; 00066 } 00067 00068 void K3FileTreeViewItem::setListed( bool wasListed ) 00069 { 00070 m_wasListed = wasListed; 00071 } 00072 00073 KUrl K3FileTreeViewItem::url() const 00074 { 00075 return !m_kfileitem.isNull() ? m_kfileitem.url() : KUrl(); 00076 } 00077 00078 QString K3FileTreeViewItem::path() const 00079 { 00080 return !m_kfileitem.isNull() ? m_kfileitem.url().path() : QString(); 00081 } 00082 00083 bool K3FileTreeViewItem::isDir() const 00084 { 00085 return !m_kfileitem.isNull() ? m_kfileitem.isDir() : false; 00086 }
KDE 4.6 API Reference