File indexing completed on 2025-01-19 12:45:20
0001 /* This file is part of the KDE libraries 0002 0003 Copyright (c) 2007 Jos van den Oever <jos@vandenoever.info> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License (LGPL) as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 #ifndef PREDICATEPROPERTIES_H 0021 #define PREDICATEPROPERTIES_H 0022 0023 #include <kdelibs4support_export.h> 0024 #include <QSharedData> 0025 #include <QVariant> 0026 class QValidator; 0027 0028 /** 0029 * A predicate is part of the RDF trinity: subject, predicate, object. 0030 * It is identified by URI and it defines the type of the relationship. 0031 * For file metadata, a predicate can be seen as a fieldname. 0032 * It has a data type, a description, a short id, a cardinality 0033 * 0034 * @deprecated use Nepomuk::Types::Property instead 0035 **/ 0036 class KDELIBS4SUPPORT_DEPRECATED_EXPORT PredicateProperties 0037 { 0038 friend class PredicatePropertyProvider; 0039 public: 0040 #ifndef KDELIBS4SUPPORT_NO_DEPRECATED 0041 KDELIBS4SUPPORT_DEPRECATED PredicateProperties(const QString &predicate = QString()); 0042 #endif 0043 PredicateProperties(const PredicateProperties &p); 0044 ~PredicateProperties(); 0045 const PredicateProperties &operator=(const PredicateProperties &p); 0046 /** 0047 * This enum is used to specify some attributes that an item can have, 0048 * which fit neither in the Hint nor in the Unit enum. 0049 */ 0050 enum Attributes { 0051 Addable = 1, ///< The item or group can be added by a user 0052 Removable = 2, ///< It can be removed 0053 Modifiable = 4, ///< The value can be edited (no meaning for a group) 0054 Cumulative = 8, /**< If an application wants to display information 0055 for more than one file, it may add up the values 0056 for this item (e.g. play time of an mp3 file) */ 0057 Averaged = 16, /**< Similar to Cumulative, but the average should 0058 be calculated instead of the sum */ 0059 MultiLine = 32, /**< This attribute says that a string item is likely 0060 to be more than one line long, so for editing, a 0061 widget capable for multline text should be used 0062 */ 0063 SqueezeText = 64 /**< If the text for this item is very long, it 0064 should be squeezed to the size of the widget 0065 where it's displayed 0066 */ 0067 }; 0068 /** 0069 * Get the attributes of this group (see Attributes) 0070 * 0071 * @return the attributes 0072 */ 0073 uint attributes() const; 0074 /** 0075 * Key associated with this value. 0076 **/ 0077 const QString &key() const; 0078 /** 0079 * The type for this field. 0080 **/ 0081 QVariant::Type type() const; 0082 /** 0083 * Localized name of the predicate. 0084 **/ 0085 const QString &name() const; 0086 /** 0087 * Localized description of the predicate. 0088 **/ 0089 const QString &description() const; 0090 QValidator *createValidator() const; 0091 const QStringList &suggestedValues() const; 0092 uint minCardinality() const; 0093 uint maxCardinality() const; 0094 const PredicateProperties &parent() const; 0095 /** 0096 * Return a url that identifies the unit in which this property 0097 * is expressed. 0098 **/ 0099 const QString &unit() const; 0100 bool isValid() const; 0101 private: 0102 class Private; 0103 QSharedDataPointer<Private> d; 0104 }; 0105 0106 #endif