void ComboboxFieldWizard::loadField(const int fieldId, const int collectionId)
{
    AbstractFieldWizard::loadField(fieldId, collectionId);

    MetadataEngine *meta = &MetadataEngine::getInstance();

    //display properties
    QString displayProperties = meta->getFieldProperties(meta->DisplayProperty,
                                                         fieldId, collectionId);
    MetadataPropertiesParser displayParser(displayProperties);
    if (displayParser.getValue("markEmpty") == "1")
        ui->requiredFieldCheckBox->setChecked(true);
    //get items
    if (displayProperties.size()) {
        QStringList items = displayParser.getValue("items")
                .split(',', QString::SkipEmptyParts);
        foreach (QString s, items) {
            //replace some escape codes
            s.replace("\\comma", ",");
            s.replace("\\colon", ":");
            s.replace("\\semicolon", ";");
            QListWidgetItem *item = new QListWidgetItem(s,
                                                        ui->itemsListWidget);
            item->setFlags(item->flags() | Qt::ItemIsEditable);
        }
void NumberFieldWizard::loadField(const int fieldId, const int collectionId)
{
    AbstractFieldWizard::loadField(fieldId, collectionId);

    MetadataEngine *meta = &MetadataEngine::getInstance();

    //display properties
    QString displayProperties = meta->getFieldProperties(meta->DisplayProperty,
                                                      fieldId, collectionId);
    MetadataPropertiesParser displayParser(displayProperties);
    if (displayParser.size()) {
        if (displayParser.getValue("markNegative") == "1")
            ui->markNegativeCheckBox->setChecked(true);
        ui->precisionSpinBox->setValue(displayParser.getValue("precision").toInt());

        //display mode
        QString m = displayParser.getValue("displayMode");
        if (m == QString("auto"))
            ui->notationComboBox->setCurrentIndex(0);
        else if (m == QString("decimal"))
            ui->notationComboBox->setCurrentIndex(1);
        else if (m == QString("scientific"))
            ui->notationComboBox->setCurrentIndex(2);
    }

    //edit properties
    QString editProperties = meta->getFieldProperties(meta->EditProperty,
                                                      fieldId, collectionId);
    MetadataPropertiesParser editParser(editProperties);
    if (editParser.size()) {
        if (editParser.getValue("noEmpty") == "1")
            ui->requiredFieldCheckBox->setChecked(true);
    }
}
void CreationDateFieldWizard::loadField(const int fieldId, const int collectionId)
{
    AbstractFieldWizard::loadField(fieldId, collectionId);

    MetadataEngine *meta = &MetadataEngine::getInstance();

    //display properties
    QString displayProperties = meta->getFieldProperties(meta->DisplayProperty,
                                                         fieldId, collectionId);
    MetadataPropertiesParser displayParser(displayProperties);
    if (displayParser.size()) {
        //date format
        int f = displayParser.getValue("dateFormat").toInt();
        if (f)
            ui->dateFormatBox->setCurrentIndex(f-1);
    }
}