Buteo Synchronization Framework: Buteo::ProfileField Class Reference

Buteo Synchronization Framework

Public Member Functions | Static Public Attributes | List of all members
Buteo::ProfileField Class Reference

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...

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ ProfileField() [1/2]

ProfileField::ProfileField | ( | const QDomElement & | aRoot | ) |
| explicit

Constructs a ProfileField from XML.

Parameters

  aRoot | Root element of the field XML.

## ◆ ProfileField() [2/2]

ProfileField::ProfileField | ( | const ProfileField & | aSource | ) |

Copy constructor.

Parameters

  aSource | Copy source.

## Member Function Documentation

## ◆ defaultValue()

QString ProfileField::defaultValue | ( |  | ) | const

Gets the field default value.

Returns
  Field default value.

## ◆ isReadOnly()

bool ProfileField::isReadOnly | ( |  | ) | const

Checks if the field is read only.

UI should not allow modifying the value of a read only field.

Returns
  True if readonly.

## ◆ label()

QString ProfileField::label | ( |  | ) | const

Gets the field label.

The label can be for example displayed in the UI that asks for the field value.

Returns
  Field label.

## ◆ name()

QString ProfileField::name | ( |  | ) | const

Gets the field name.

Returns
  Field name.

## ◆ options()

QStringList ProfileField::options | ( |  | ) | const

Gets the allowed values for the field.

Returns
  List of valid values.

## ◆ toXml()

QDomElement ProfileField::toXml | ( | QDomDocument & | aDoc | ) | const

Exports the field to XML.

Parameters

  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.

Returns
  The root element of the created XML node tree.

## ◆ type()

QString ProfileField::type | ( |  | ) | const

Get the field type.

Returns
  Field type.

## ◆ validate()

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.

Parameters

  aValue | The value to validate.

Returns
  Is the given value in the list of allowed values (options).

## ◆ visible()

QString ProfileField::visible | ( |  | ) | const

Gets the visibility of the field.

Returns
  String defining the visibility. See VISIBLE_ constants for predefined values.

## Member Data Documentation

## ◆ TYPE_BOOLEAN

const QString Buteo::ProfileField::TYPE_BOOLEAN = "boolean"
| static

Field type for boolean fields.

ProfileField Visbility Const string for boolean.

## ◆ VISIBLE_ALWAYS

const QString Buteo::ProfileField::VISIBLE_ALWAYS = "always"
| static

Field should be always visible in UI.

ProfileField Visbility Const string for always.

## ◆ VISIBLE_NEVER

const QString Buteo::ProfileField::VISIBLE_NEVER = "never"
| static

Field should never be visible in UI.

ProfileField Visbility Const string for never.

## ◆ VISIBLE_USER

const QString Buteo::ProfileField::VISIBLE_USER = "user"
| static

Field should be visible in UI if a value for the field has not.

ProfileField Visbility Const string for user.

The documentation for this class was generated from the following files:

- ProfileField.h
- ProfileField.cpp