Buteo Synchronization Framework
ProfileField.h
1/*
2 * This file is part of buteo-syncfw package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef PROFILEFIELD_H
25#define PROFILEFIELD_H
26
27#include <QString>
28#include <QStringList>
29
30class QDomDocument;
31class QDomElement;
32
33namespace Buteo {
34
35class ProfileFieldPrivate;
36
49{
50public:
51
53 static const QString VISIBLE_ALWAYS;
54
56 static const QString VISIBLE_NEVER;
57
59 // been pre-defined in the sub-profiles loaded by the main profile.
60 static const QString VISIBLE_USER;
61
63 static const QString TYPE_BOOLEAN;
64
69 explicit ProfileField(const QDomElement &aRoot);
70
75 ProfileField(const ProfileField &aSource);
76
80
85 QString name() const;
86
91 QString type() const;
92
97 QString defaultValue() const;
98
103 QStringList options() const;
104
111 QString label() const;
112
119 bool validate(const QString &aValue) const;
120
128 QDomElement toXml(QDomDocument &aDoc) const;
129
135 QString visible() const;
136
142 bool isReadOnly() const;
143
144private:
145 ProfileField &operator=(const ProfileField &aRhs);
146 ProfileFieldPrivate *d_ptr;
147};
148
149}
150
151#endif // PROFILEFIELD_H
This class represents a profile field.
Definition: ProfileField.h:49
QString visible() const
Gets the visibility of the field.
Definition: ProfileField.cpp:200
QStringList options() const
Gets the allowed values for the field.
Definition: ProfileField.cpp:151
QString name() const
Gets the field name.
Definition: ProfileField.cpp:136
bool isReadOnly() const
Checks if the field is read only.
Definition: ProfileField.cpp:209
QDomElement toXml(QDomDocument &aDoc) const
Exports the field to XML.
Definition: ProfileField.cpp:173
static const QString VISIBLE_NEVER
Field should never be visible in UI.
Definition: ProfileField.h:56
static const QString VISIBLE_ALWAYS
Field should be always visible in UI.
Definition: ProfileField.h:53
static const QString VISIBLE_USER
Field should be visible in UI if a value for the field has not.
Definition: ProfileField.h:60
QString type() const
Get the field type.
Definition: ProfileField.cpp:141
bool validate(const QString &aValue) const
Checks if the given value is in the list of allowed values.
Definition: ProfileField.cpp:161
~ProfileField()
Destructor.
Definition: ProfileField.cpp:130
QString defaultValue() const
Gets the field default value.
Definition: ProfileField.cpp:146
QString label() const
Gets the field label.
Definition: ProfileField.cpp:156
static const QString TYPE_BOOLEAN
Field type for boolean fields.
Definition: ProfileField.h:63