• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • kio
  • kio
kfilemetainfoitem.cpp
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2
3 Copyright (c) 2007 Jos van den Oever <jos@vandenoever.info>
4 2010 Sebastian Trueg <trueg@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License (LGPL) as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#include "kfilemetainfoitem.h"
23#include "kfilemetainfoitem_p.h"
24#include <config-nepomuk.h>
25
26KFileMetaInfoItem::KFileMetaInfoItem() : d(new KFileMetaInfoItemPrivate()) {
27}
28
29KFileMetaInfoItem::KFileMetaInfoItem(const KFileMetaInfoItem& item) : d(item.d) {
30}
31KFileMetaInfoItem::KFileMetaInfoItem(const QString& pp,
32 const QVariant& v, KFileWritePlugin* w, bool e)
33 : d(new KFileMetaInfoItemPrivate()) {
34#ifndef KDE_NO_DEPRECATED
35 d->pp = pp;
36#else
37#ifndef KIO_NO_NEPOMUK
38 d->pp = QUrl(pp);
39#endif
40#endif
41 d->value = v;
42 d->writer = w;
43 d->embedded = e;
44 d->modified = false;
45}
46KFileMetaInfoItem::~KFileMetaInfoItem() {
47}
48const KFileMetaInfoItem&
49KFileMetaInfoItem::operator=(const KFileMetaInfoItem& item) {
50 d = item.d;
51 return item;
52}
53const QString&
54KFileMetaInfoItem::name() const {
55#ifndef KDE_NO_DEPRECATED
56 return d->pp.name();
57#else
58 #ifndef KIO_NO_NEPOMUK
59 return d->pp.name();
60 #else
61 return QString::null;
62 #endif
63#endif
64}
65const QVariant&
66KFileMetaInfoItem::value() const {
67 return d->value;
68}
69bool
70KFileMetaInfoItem::setValue(const QVariant& value) {
71 bool changed = d->value != value;
72 d->value = value;
73 d->modified |= changed;
74 return changed;
75}
76bool
77KFileMetaInfoItem::addValue(const QVariant& value) {
78 QVariant& v = d->value;
79 if (v.type() == QVariant::List) {
80 QVariantList vl = v.toList();
81 vl.append(value);
82 d->value = vl;
83 }
84 return false;
85}
86bool
87KFileMetaInfoItem::isModified() const {
88 return d->modified;
89}
90bool
91KFileMetaInfoItem::isRemoved() const {
92 return d->modified && d->value.isNull();
93}
94bool
95KFileMetaInfoItem::isValid() const {
96 return true;
97}
98bool
99KFileMetaInfoItem::isSkipped() const {
100 // ########## TODO implement (vandenoever)
101 return false;
102}
103#ifndef KDE_NO_DEPRECATED
104const PredicateProperties&
105KFileMetaInfoItem::properties() const {
106 return d->pp;
107}
108#endif
109bool
110KFileMetaInfoItem::isEditable() const {
111 return d->writer != 0;
112}
113QString
114KFileMetaInfoItem::suffix() const {
115 // ########## TODO implement (vandenoever)
116 return QString();
117}
118
119QString
120KFileMetaInfoItem::prefix() const {
121 // ########## TODO implement (vandenoever)
122 return QString();
123}
KFileMetaInfoItemPrivate
Definition: kfilemetainfoitem_p.h:40
KFileMetaInfoItem
Definition: kfilemetainfoitem.h:34
KFileMetaInfoItem::suffix
QString suffix() const
This method returns a translated suffix to be displayed after the value.
Definition: kfilemetainfoitem.cpp:114
KFileMetaInfoItem::isEditable
bool isEditable() const
Can this item be edited.
Definition: kfilemetainfoitem.cpp:110
KFileMetaInfoItem::isSkipped
bool isSkipped() const
Has this value been skipped by analyzer due to performance or other considerations.
Definition: kfilemetainfoitem.cpp:99
KFileMetaInfoItem::isValid
bool isValid() const
Is this a valid item.
Definition: kfilemetainfoitem.cpp:95
KFileMetaInfoItem::addValue
bool addValue(const QVariant &)
Append a value to the properties in this file.
Definition: kfilemetainfoitem.cpp:77
KFileMetaInfoItem::isRemoved
bool isRemoved() const
Has this value been removed, e.g with setValue(QVariant())
Definition: kfilemetainfoitem.cpp:91
KFileMetaInfoItem::isModified
bool isModified() const
Can this item be removed.
Definition: kfilemetainfoitem.cpp:87
KFileMetaInfoItem::operator=
const KFileMetaInfoItem & operator=(const KFileMetaInfoItem &item)
Copy operator.
Definition: kfilemetainfoitem.cpp:49
KFileMetaInfoItem::setValue
bool setValue(const QVariant &value)
Set the value of this field.
Definition: kfilemetainfoitem.cpp:70
KFileMetaInfoItem::value
const QVariant & value() const
Retrieve the current value of this item.
Definition: kfilemetainfoitem.cpp:66
KFileMetaInfoItem::~KFileMetaInfoItem
~KFileMetaInfoItem()
Destructor.
Definition: kfilemetainfoitem.cpp:46
KFileMetaInfoItem::KFileMetaInfoItem
KFileMetaInfoItem()
Default constructor.
Definition: kfilemetainfoitem.cpp:26
KFileMetaInfoItem::properties
const PredicateProperties & properties() const
Retrieve the properties of this field type.
Definition: kfilemetainfoitem.cpp:105
KFileMetaInfoItem::name
const QString & name() const
Localized name of the predicate.
Definition: kfilemetainfoitem.cpp:54
KFileMetaInfoItem::prefix
QString prefix() const
This method returns a translated prefix to be displayed before the value.
Definition: kfilemetainfoitem.cpp:120
KFileWritePlugin
Definition: kfilewriteplugin.h:28
PredicateProperties
A predicate is part of the RDF trinity: subject, predicate, object.
Definition: predicateproperties.h:36
QUrl
kfilemetainfoitem.h
kfilemetainfoitem_p.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal