1/* This file is part of the KDE libraries
2
3 Copyright (c) 2007 Jos van den Oever <jos@vandenoever.info>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License (LGPL) as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20#ifndef PREDICATEPROPERTIES_H
21#define PREDICATEPROPERTIES_H
22
23#include <kio/kio_export.h>
24#include <QtCore/QSharedData>
25#include <QtCore/QVariant>
26class QValidator;
27
28/**
29 * A predicate is part of the RDF trinity: subject, predicate, object.
30 * It is identified by URI and it defines the type of the relationship.
31 * For file metadata, a predicate can be seen as a fieldname.
32 * It has a data type, a description, a short id, a cardinality
33 *
34 * @deprecated use Nepomuk::Types::Property instead
35 **/
36class KIO_EXPORT PredicateProperties {
37friend class PredicatePropertyProvider;
38public:
39#ifndef KDE_NO_DEPRECATED
40 KDE_DEPRECATED PredicateProperties(const QString& predicate = QString());
41#endif
42 PredicateProperties(const PredicateProperties& p);
43 ~PredicateProperties();
44 const PredicateProperties& operator=(const PredicateProperties& p);
45 /**
46 * This enum is used to specify some attributes that an item can have,
47 * which fit neither in the Hint nor in the Unit enum.
48 */
49 enum Attributes
50 {
51 Addable = 1, ///< The item or group can be added by a user
52 Removable = 2, ///< It can be removed
53 Modifiable = 4, ///< The value can be edited (no meaning for a group)
54 Cumulative = 8, /**< If an application wants to display information
55 for more than one file, it may add up the values
56 for this item (e.g. play time of an mp3 file) */
57 Averaged = 16, /**< Similar to Cumulative, but the average should
58 be calculated instead of the sum */
59 MultiLine = 32, /**< This attribute says that a string item is likely
60 to be more than one line long, so for editing, a
61 widget capable for multline text should be used
62 */
63 SqueezeText = 64 /**< If the text for this item is very long, it
64 should be squeezed to the size of the widget
65 where it's displayed
66 */
67 };
68 /**
69 * Get the attributes of this group (see Attributes)
70 *
71 * @return the attributes
72 */
73 uint attributes() const;
74 /**
75 * Key associated with this value.
76 **/
77 const QString& key() const;
78 /**
79 * The type for this field.
80 **/
81 QVariant::Type type() const;
82 /**
83 * Localized name of the predicate.
84 **/
85 const QString& name() const;
86 /**
87 * Localized description of the predicate.
88 **/
89 const QString& description() const;
90 QValidator* createValidator() const;
91 const QStringList& suggestedValues() const;
92 uint minCardinality() const;
93 uint maxCardinality() const;
94 const PredicateProperties& parent() const;
95 /**
96 * Return a url that identifies the unit in which this property
97 * is expressed.
98 **/
99 const QString& unit() const;
100 bool isValid() const;
101private:
102 class Private;
103 QSharedDataPointer<Private> d;
104};
105
106#endif
107