KIO
kfilemetainfoitem.cpp
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 00003 Copyright (c) 2007 Jos van den Oever <jos@vandenoever.info> 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 (LGPL) as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "kfilemetainfo_p.h" 00022 #include <QDebug> 00023 00024 const QVariant KFileMetaInfoItemPrivate::null; 00025 00026 KFileMetaInfoItem::KFileMetaInfoItem() :p(new KFileMetaInfoItemPrivate()) { 00027 } 00028 00029 KFileMetaInfoItem::KFileMetaInfoItem(const KFileMetaInfoItem& item) :p(item.p) { 00030 } 00031 KFileMetaInfoItem::KFileMetaInfoItem(const PredicateProperties& pp, 00032 const QVariant& v, KFileWritePlugin* w, bool e) 00033 :p(new KFileMetaInfoItemPrivate()) { 00034 p->pp = pp; 00035 p->value = v; 00036 p->writer = w; 00037 p->embedded = e; 00038 p->modified = false; 00039 } 00040 KFileMetaInfoItem::~KFileMetaInfoItem() { 00041 } 00042 const KFileMetaInfoItem& 00043 KFileMetaInfoItem::operator=(const KFileMetaInfoItem& item) { 00044 p = item.p; 00045 return item; 00046 } 00047 const QString& 00048 KFileMetaInfoItem::name() const { 00049 return p->pp.name(); 00050 } 00051 const QVariant& 00052 KFileMetaInfoItem::value() const { 00053 return p->value; 00054 } 00055 bool 00056 KFileMetaInfoItem::setValue(const QVariant& value) { 00057 bool changed = p->value != value; 00058 p->value = value; 00059 p->modified |= changed; 00060 return changed; 00061 } 00062 bool 00063 KFileMetaInfoItem::addValue(const QVariant& value) { 00064 QVariant& v = p->value; 00065 if (v.type() == QVariant::List) { 00066 QVariantList vl = v.toList(); 00067 vl.append(value); 00068 p->value = vl; 00069 } 00070 return false; 00071 } 00072 bool 00073 KFileMetaInfoItem::isModified() const { 00074 return p->modified; 00075 } 00076 bool 00077 KFileMetaInfoItem::isRemoved() const { 00078 return p->modified && p->value.isNull(); 00079 } 00080 bool 00081 KFileMetaInfoItem::isValid() const { 00082 return true; 00083 } 00084 bool 00085 KFileMetaInfoItem::isSkipped() const { 00086 // ########## TODO implement (vandenoever) 00087 return false; 00088 } 00089 const PredicateProperties& 00090 KFileMetaInfoItem::properties() const { 00091 return p->pp; 00092 } 00093 bool 00094 KFileMetaInfoItem::isEditable() const { 00095 return p->writer != NULL; 00096 } 00097 QString 00098 KFileMetaInfoItem::suffix() const { 00099 // ########## TODO implement (vandenoever) 00100 return QString(); 00101 } 00102 00103 QString 00104 KFileMetaInfoItem::prefix() const { 00105 // ########## TODO implement (vandenoever) 00106 return QString(); 00107 }