make webinterface translatable. there are around 20 short strings, all with context...
[kdenetwork.git] / kopete / libkopete / kopeteproperty.h
blob6bd6afed78529414a8a971b33a2a36a92cf80c83
1 /*
2 kopeteproperty.h
4 Kopete::Property class
6 Copyright (c) 2007 by Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
7 Copyright (c) 2004 by Stefan Gehn <metz AT gehn.net>
8 Copyright (c) 2006 by Michaël Larouche <larouche@kde.org>
10 Kopete (c) 2004-2007 by the Kopete developers <kopete-devel@kde.org>
12 *************************************************************************
13 * *
14 * This library is free software; you can redistribute it and/or *
15 * modify it under the terms of the GNU Lesser General Public *
16 * License as published by the Free Software Foundation; either *
17 * version 2 of the License, or (at your option) any later version. *
18 * *
19 *************************************************************************
22 #ifndef _KOPETEPROPERTY_H_
23 #define _KOPETEPROPERTY_H_
25 #include <QtCore/QVariant>
26 #include <QtCore/QFlags>
28 #include "kopete_export.h"
30 namespace Kopete
33 /**
34 * @author Stefan Gehn <metz AT gehn.net>
35 * @author Michaël Larouche <larouche@kde.org>
37 * The template class for registering properties in Kopete
38 * You need to use this if you want to set properties for a
39 * Kopete::Contact
40 **/
41 class KOPETE_EXPORT PropertyTmpl
43 public:
44 enum PropertyOption
46 NoProperty = 0x0,
47 PersistentProperty = 0x1,
48 RichTextProperty = 0x2,
49 PrivateProperty = 0x4
51 Q_DECLARE_FLAGS(PropertyOptions, PropertyOption)
53 /**
54 * Constructor only used for empty PropertyTmpl objects
56 * Note: Only useful for the null object
57 **/
58 PropertyTmpl();
60 /**
61 * Constructor
62 * @param key internal unique key for this template
63 * @param label a label to show for properties based on this template
64 * @param icon name of the icon to show for properties based on this template
65 * @param options set the options for that property. See PropertyOption enum.
66 **/
67 PropertyTmpl( const QString &key,
68 const QString &label,
69 const QString &icon = QString(),
70 PropertyOptions options = NoProperty);
72 /**
73 * Copy constructor
74 **/
75 PropertyTmpl(const PropertyTmpl &other);
77 /** Destructor */
78 ~PropertyTmpl();
80 PropertyTmpl &operator=(const PropertyTmpl &other);
82 bool operator==(const PropertyTmpl &other) const;
83 bool operator!=(const PropertyTmpl &other) const;
85 /**
86 * Getter for the unique key. Properties based on this template will be
87 * stored with this key
88 **/
89 const QString &key() const;
91 /**
92 * Getter for i18ned label
93 **/
94 const QString &label() const;
96 /**
97 * Getter for icon to show aside or instead of @p label()
98 **/
99 const QString &icon() const;
102 * Return the options for that property.
104 PropertyOptions options() const;
107 * Returns true if properties based on this template should
108 * be saved across Kopete sessions, false otherwise.
110 bool persistent() const;
113 * Returns true if properties based on this template are HTML formatted
115 bool isRichText() const;
118 * Returns true if properties based on this template are invisible to the user
120 bool isPrivate() const;
123 * An empty template, check for it using isNull()
125 static PropertyTmpl null;
128 * Returns true if this object is an empty template
130 bool isNull() const;
133 * A Map of QString and PropertyTmpl objects, based on QMap
135 typedef QMap<QString, PropertyTmpl> Map;
137 private:
138 class Private;
139 Private *d;
142 Q_DECLARE_OPERATORS_FOR_FLAGS(PropertyTmpl::PropertyOptions)
145 * @author Stefan Gehn <metz AT gehn.net>
147 * A data container for whatever information Kopete or any of its
148 * plugins want to store for a Kopete::Contact
150 class KOPETE_EXPORT Property
152 public:
154 * Constructor only used for empty Property objects
156 * Note: you cannot set a label or value later on!
158 Property();
161 * @param tmpl The contact property template this property is based on
162 * @param value The value this Property holds
164 Property(const PropertyTmpl &tmpl, const QVariant &value);
167 * Copy constructor
169 Property(const Property &other);
171 /** Destructor **/
172 ~Property();
174 Property &operator=(const Property &other);
177 * Getter for this properties template
179 const PropertyTmpl &tmpl() const;
182 * Getter for this properties value
184 const QVariant &value() const;
187 * The null, i.e. empty, Property
189 static Property null;
192 * Returns true if this object is an empty Property (i.e. it holds no
193 * value), false otherwise.
195 bool isNull() const;
198 * Returns true if this property is HTML formatted
200 bool isRichText() const;
203 * A map of key,Property items
205 typedef QMap<QString, Property> Map;
207 private:
208 class Private;
209 Private *d;
212 } // END namespace Kopete
214 #endif //_KOPETEPROPERTY_H_