Buteo Synchronization Framework
|
This class represents a profile field. More...
#include <ProfileField.h>
Public Member Functions | |
ProfileField (const QDomElement &aRoot) | |
Constructs a ProfileField from XML. More... | |
ProfileField (const ProfileField &aSource) | |
Copy constructor. More... | |
~ProfileField () | |
Destructor. | |
QString | name () const |
Gets the field name. More... | |
QString | type () const |
Get the field type. More... | |
QString | defaultValue () const |
Gets the field default value. More... | |
QStringList | options () const |
Gets the allowed values for the field. More... | |
QString | label () const |
Gets the field label. More... | |
bool | validate (const QString &aValue) const |
Checks if the given value is in the list of allowed values. More... | |
QDomElement | toXml (QDomDocument &aDoc) const |
Exports the field to XML. More... | |
QString | visible () const |
Gets the visibility of the field. More... | |
bool | isReadOnly () const |
Checks if the field is read only. More... | |
Static Public Attributes | |
static const QString | VISIBLE_ALWAYS = "always" |
Field should be always visible in UI. More... | |
static const QString | VISIBLE_NEVER = "never" |
Field should never be visible in UI. More... | |
static const QString | VISIBLE_USER = "user" |
Field should be visible in UI if a value for the field has not. More... | |
static const QString | TYPE_BOOLEAN = "boolean" |
Field type for boolean fields. More... | |
This class represents a profile field.
Profile field is a bunch of information about a setting whose value must be defined as a separate key/value pair in some profile. The key name must be same as the profile field name. The class includes functions for accessing the name, type, description and possible values of the setting. Only the name is a mandatory field. The class also has a function for validating a given value against the possible values defined by the field. A ProfileField can be constructed from XML and exported to XML.
|
explicit |
Constructs a ProfileField from XML.
aRoot | Root element of the field XML. |
ProfileField::ProfileField | ( | const ProfileField & | aSource | ) |
Copy constructor.
aSource | Copy source. |
QString ProfileField::defaultValue | ( | ) | const |
Gets the field default value.
bool ProfileField::isReadOnly | ( | ) | const |
Checks if the field is read only.
UI should not allow modifying the value of a read only field.
QString ProfileField::label | ( | ) | const |
Gets the field label.
The label can be for example displayed in the UI that asks for the field value.
QString ProfileField::name | ( | ) | const |
Gets the field name.
QStringList ProfileField::options | ( | ) | const |
Gets the allowed values for the field.
QDomElement ProfileField::toXml | ( | QDomDocument & | aDoc | ) | const |
Exports the field to XML.
aDoc | Parent document for the created XML elements. The created elements are not inserted to the document by this function, but the document is still required for creating the elements. |
QString ProfileField::type | ( | ) | const |
Get the field type.
bool ProfileField::validate | ( | const QString & | aValue | ) | const |
Checks if the given value is in the list of allowed values.
If allowed values have not been defined, any value is accepted.
aValue | The value to validate. |
QString ProfileField::visible | ( | ) | const |
Gets the visibility of the field.
|
static |
Field type for boolean fields.
ProfileField Visbility Const string for boolean.
|
static |
Field should be always visible in UI.
ProfileField Visbility Const string for always.
|
static |
Field should never be visible in UI.
ProfileField Visbility Const string for never.
|
static |
Field should be visible in UI if a value for the field has not.
ProfileField Visbility Const string for user.