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 2010 Sebastian Trueg <trueg@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License (LGPL) as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #include "kfilemetainfoitem.h" 00023 #include "kfilemetainfoitem_p.h" 00024 #include <config-nepomuk.h> 00025 00026 KFileMetaInfoItem::KFileMetaInfoItem() : d(new KFileMetaInfoItemPrivate()) { 00027 } 00028 00029 KFileMetaInfoItem::KFileMetaInfoItem(const KFileMetaInfoItem& item) : d(item.d) { 00030 } 00031 KFileMetaInfoItem::KFileMetaInfoItem(const QString& pp, 00032 const QVariant& v, KFileWritePlugin* w, bool e) 00033 : d(new KFileMetaInfoItemPrivate()) { 00034 #ifndef KDE_NO_DEPRECATED 00035 d->pp = pp; 00036 #else 00037 #ifndef KIO_NO_NEPOMUK 00038 d->pp = QUrl(pp); 00039 #endif 00040 #endif 00041 d->value = v; 00042 d->writer = w; 00043 d->embedded = e; 00044 d->modified = false; 00045 } 00046 KFileMetaInfoItem::~KFileMetaInfoItem() { 00047 } 00048 const KFileMetaInfoItem& 00049 KFileMetaInfoItem::operator=(const KFileMetaInfoItem& item) { 00050 d = item.d; 00051 return item; 00052 } 00053 const QString& 00054 KFileMetaInfoItem::name() const { 00055 #ifndef KDE_NO_DEPRECATED 00056 return d->pp.name(); 00057 #else 00058 #ifndef KIO_NO_NEPOMUK 00059 return d->pp.name(); 00060 #else 00061 return QString::null; 00062 #endif 00063 #endif 00064 } 00065 const QVariant& 00066 KFileMetaInfoItem::value() const { 00067 return d->value; 00068 } 00069 bool 00070 KFileMetaInfoItem::setValue(const QVariant& value) { 00071 bool changed = d->value != value; 00072 d->value = value; 00073 d->modified |= changed; 00074 return changed; 00075 } 00076 bool 00077 KFileMetaInfoItem::addValue(const QVariant& value) { 00078 QVariant& v = d->value; 00079 if (v.type() == QVariant::List) { 00080 QVariantList vl = v.toList(); 00081 vl.append(value); 00082 d->value = vl; 00083 } 00084 return false; 00085 } 00086 bool 00087 KFileMetaInfoItem::isModified() const { 00088 return d->modified; 00089 } 00090 bool 00091 KFileMetaInfoItem::isRemoved() const { 00092 return d->modified && d->value.isNull(); 00093 } 00094 bool 00095 KFileMetaInfoItem::isValid() const { 00096 return true; 00097 } 00098 bool 00099 KFileMetaInfoItem::isSkipped() const { 00100 // ########## TODO implement (vandenoever) 00101 return false; 00102 } 00103 #ifndef KDE_NO_DEPRECATED 00104 const PredicateProperties& 00105 KFileMetaInfoItem::properties() const { 00106 return d->pp; 00107 } 00108 #endif 00109 bool 00110 KFileMetaInfoItem::isEditable() const { 00111 return d->writer != 0; 00112 } 00113 QString 00114 KFileMetaInfoItem::suffix() const { 00115 // ########## TODO implement (vandenoever) 00116 return QString(); 00117 } 00118 00119 QString 00120 KFileMetaInfoItem::prefix() const { 00121 // ########## TODO implement (vandenoever) 00122 return QString(); 00123 }
KDE 4.6 API Reference