00001 /* 00002 Copyright (C) 2008-2010 Lukas Sommer < SommerLuk at gmail dot com > 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public License as 00006 published by the Free Software Foundation; either version 2 of 00007 the License or (at your option) version 3 or any later version 00008 accepted by the membership of KDE e.V. (or its successor approved 00009 by the membership of KDE e.V.), which shall act as a proxy 00010 defined in Section 14 of version 3 of the license. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #include "streamdirectoryentry.h" 00022 00023 streamDirectoryEntry::streamDirectoryEntry() 00024 { 00025 parentItem = 0; 00026 self = this; 00027 } 00028 00029 streamDirectoryEntry::~streamDirectoryEntry() 00030 { 00031 foreach (streamDirectoryEntry *entry, childItems) { 00032 delete entry; 00033 }; 00034 } 00035 00036 int streamDirectoryEntry::childCount() const 00037 { 00038 return childItems.size(); 00039 } 00040 00041 streamDirectoryEntry *streamDirectoryEntry::child(int row) const 00042 { 00043 if (childItems.size() > row) { 00044 return childItems.value(row); 00045 } else { 00046 return 0; 00047 }; 00048 } 00049 00050 void streamDirectoryEntry::appendChild(streamDirectoryEntry *child) 00051 { 00052 child->parentItem = this; 00053 childItems.append(child); 00054 } 00055 00056 QVariant streamDirectoryEntry::rawData(const int column) const 00057 { 00058 return data(column); 00059 } 00060 00061 int streamDirectoryEntry::row() const 00062 { 00063 if (parentItem) { // this is a child item 00064 return parentItem->childItems.indexOf(self); 00065 } else { // this is a root item 00066 return 0; 00067 }; 00068 } 00069 00070 QVariant streamDirectoryEntry::data(const int) const 00071 { 00072 return QVariant(); 00073 } 00074 00075 streamDirectoryEntry *streamDirectoryEntry::parent() const 00076 { 00077 return parentItem; 00078 } 00079 00080 QString streamDirectoryEntry::name() const 00081 { 00082 return entryName; 00083 } 00084 00085 void streamDirectoryEntry::setName(const QString & name) 00086 { 00087 entryName = name; 00088 } 00089 00090 KUrl streamDirectoryEntry::value() const 00091 { 00092 return entryValue; 00093 } 00094 00095 void streamDirectoryEntry::setValue(const KUrl & value) 00096 { 00097 entryValue = value; 00098 } 00099 00100 bool streamDirectoryEntry::canFetchMore() const 00101 { 00102 return false; 00103 } 00104 00105 void streamDirectoryEntry::fetchMore() 00106 { 00107 }