File indexing completed on 2025-01-19 03:59:45

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2015-06-16
0007  * Description : Advanced Configuration tab for metadata.
0008  *
0009  * SPDX-FileCopyrightText: 2015 by Veaceslav Munteanu <veaceslav dot munteanu90 at gmail.com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "advancedmetadatatab.h"
0016 
0017 // Qt includes
0018 
0019 #include <QApplication>
0020 #include <QVBoxLayout>
0021 #include <QComboBox>
0022 #include <QHBoxLayout>
0023 #include <QCheckBox>
0024 #include <QPushButton>
0025 #include <QListView>
0026 #include <QStandardPaths>
0027 #include <QStandardItemModel>
0028 #include <QStandardItem>
0029 #include <QLabel>
0030 #include <QUrl>
0031 
0032 // KDE includes
0033 
0034 #include <kconfig.h>
0035 #include <kconfiggroup.h>
0036 #include <klocalizedstring.h>
0037 
0038 // Local includes
0039 
0040 #include "digikam_debug.h"
0041 #include "dmetadatasettings.h"
0042 #include "namespacelistview.h"
0043 #include "namespaceeditdlg.h"
0044 #include "dmessagebox.h"
0045 #include "dfiledialog.h"
0046 
0047 namespace Digikam
0048 {
0049 
0050 class Q_DECL_HIDDEN AdvancedMetadataTab::Private
0051 {
0052 public:
0053 
0054     explicit Private()
0055       : metadataType    (nullptr),
0056         operationType   (nullptr),
0057         addButton       (nullptr),
0058         editButton      (nullptr),
0059         deleteButton    (nullptr),
0060         moveUpButton    (nullptr),
0061         moveDownButton  (nullptr),
0062         revertChanges   (nullptr),
0063         saveProfile     (nullptr),
0064         loadProfile     (nullptr),
0065         resetButton     (nullptr),
0066         unifyReadWrite  (nullptr),
0067         readingAllTags  (nullptr),
0068         namespaceView   (nullptr),
0069         metadataTypeSize(0),
0070         changed         (false)
0071     {
0072     }
0073 
0074     QComboBox*                  metadataType;
0075     QComboBox*                  operationType;
0076     QPushButton*                addButton;
0077     QPushButton*                editButton;
0078     QPushButton*                deleteButton;
0079     QPushButton*                moveUpButton;
0080     QPushButton*                moveDownButton;
0081     QPushButton*                revertChanges;
0082     QPushButton*                saveProfile;
0083     QPushButton*                loadProfile;
0084     QPushButton*                resetButton;
0085     QCheckBox*                  unifyReadWrite;
0086     QCheckBox*                  readingAllTags;
0087     QList<QStandardItemModel*>  models;
0088     NamespaceListView*          namespaceView;
0089     DMetadataSettingsContainer  container;
0090     int                         metadataTypeSize;
0091 
0092     bool                        changed;
0093 };
0094 
0095 AdvancedMetadataTab::AdvancedMetadataTab(QWidget* const parent)
0096     : QWidget(parent),
0097       d      (new Private())
0098 {
0099     // ---------- Advanced Configuration Panel -----------------------------
0100 
0101     d->container = DMetadataSettings::instance()->settings();
0102     setUi();
0103     setModels();
0104     connectButtons();
0105 
0106     d->unifyReadWrite->setChecked(d->container.unifyReadWrite());
0107     d->readingAllTags->setChecked(d->container.readingAllTags());
0108 
0109     connect(d->unifyReadWrite, SIGNAL(toggled(bool)),
0110             this, SLOT(slotUnifyChecked(bool)));
0111 
0112     connect(d->readingAllTags, SIGNAL(toggled(bool)),
0113             this, SLOT(slotAllTagsChecked(bool)));
0114 
0115     connect(d->metadataType, SIGNAL(currentIndexChanged(int)),
0116             this, SLOT(slotIndexChanged()));
0117 
0118     connect(d->operationType, SIGNAL(currentIndexChanged(int)),
0119             this, SLOT(slotIndexChanged()));
0120 
0121     /**
0122      * Connect all actions to slotRevertAvailable, which will enable revert to original
0123      * if an add, edit, delete, or reorder was made
0124      */
0125     connect(d->namespaceView, SIGNAL(signalItemsChanged()),
0126             this, SLOT(slotRevertChangesAvailable()));
0127 
0128     if (d->unifyReadWrite->isChecked())
0129     {
0130         d->operationType->setEnabled(false);
0131     }
0132 }
0133 
0134 AdvancedMetadataTab::~AdvancedMetadataTab()
0135 {
0136     delete d;
0137 }
0138 
0139 void AdvancedMetadataTab::slotSaveProfile()
0140 {
0141     QString metaPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
0142 
0143     QString savePath = DFileDialog::getSaveFileName(qApp->activeWindow(),
0144                                                     i18nc("@title:window", "Save Advanced Metadata Profile"),
0145                                                     metaPath, QLatin1String("*.dkamp"), nullptr,
0146                                                     QFileDialog::DontConfirmOverwrite);
0147 
0148     if (savePath.isEmpty())
0149     {
0150         return;
0151     }
0152 
0153     if (!savePath.endsWith(QLatin1String(".dkamp")))
0154     {
0155         savePath.append(QLatin1String(".dkamp"));
0156     }
0157 
0158     KConfig config(savePath);
0159     KConfigGroup group1 = config.group(QLatin1String("General"));
0160     KConfigGroup group2 = config.group(QLatin1String("Metadata"));
0161     group1.writeEntry(QLatin1String("AMPVersion"), 1);
0162     d->container.writeToConfig(group2);
0163     config.sync();
0164 }
0165 
0166 void AdvancedMetadataTab::slotLoadProfile()
0167 {
0168     QString metaPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
0169                                               QLatin1String("digikam/metadata"),
0170                                               QStandardPaths::LocateDirectory);
0171 
0172     QString loadPath = DFileDialog::getOpenFileName(qApp->activeWindow(),
0173                                                     i18nc("@title:window", "Load Advanced Metadata Profile"),
0174                                                     metaPath, QLatin1String("*.dkamp"));
0175 
0176     if (loadPath.isEmpty())
0177     {
0178         return;
0179     }
0180 
0181     KConfig config(loadPath);
0182     KConfigGroup group1 = config.group(QLatin1String("General"));
0183     KConfigGroup group2 = config.group(QLatin1String("Metadata"));
0184     int version         = group1.readEntry(QLatin1String("AMPVersion"), 0);
0185 
0186     if (version != 1)
0187     {
0188         return;
0189     }
0190 
0191     DMetadataSettingsContainer container;
0192     container.readFromConfig(group2);
0193 
0194     if (container.mappingKeys().size() != 5)
0195     {
0196         return;
0197     }
0198 
0199     d->container = container;
0200 
0201     d->unifyReadWrite->setChecked(d->container.unifyReadWrite());
0202     d->readingAllTags->setChecked(d->container.readingAllTags());
0203 
0204     d->revertChanges->setEnabled(false);
0205     d->changed = false;
0206 
0207     setModels();
0208 }
0209 
0210 void AdvancedMetadataTab::slotResetToDefault()
0211 {
0212     const int result = DMessageBox::showContinueCancel(QMessageBox::Warning,
0213                                                        this,
0214                                                        i18nc("@title:window, reset to default warning dialog", "Warning"),
0215                                                        i18nc("@info", "This option will reset configuration to default\n"
0216                                                                       "All your changes will be lost.\n "
0217                                                                       "Do you want to continue?"));
0218 
0219     if (result != QMessageBox::Yes)
0220     {
0221         return;
0222     }
0223 
0224     d->container.defaultValues();
0225     d->models.at(getModelIndex())->clear();
0226     setModelData(d->models.at(getModelIndex()), getCurrentContainer());
0227 
0228     d->namespaceView->setModel(d->models.at(getModelIndex()));
0229 }
0230 
0231 void AdvancedMetadataTab::slotRevertChanges()
0232 {
0233     d->models.at(getModelIndex())->clear();
0234     setModelData(d->models.at(getModelIndex()), getCurrentContainer());
0235 
0236     d->namespaceView->setModel(d->models.at(getModelIndex()));
0237 
0238     d->changed = false;
0239     d->revertChanges->setEnabled(false);
0240 }
0241 
0242 void AdvancedMetadataTab::slotAddNewNamespace()
0243 {
0244     NamespaceEntry entry;
0245 
0246     // Setting some default parameters;
0247 
0248     if      (d->metadataType->currentData().toString() == NamespaceEntry::DM_TAG_CONTAINER())
0249     {
0250         entry.nsType = NamespaceEntry::TAGS;
0251     }
0252     else if (d->metadataType->currentData().toString() == NamespaceEntry::DM_TITLE_CONTAINER())
0253     {
0254         entry.nsType = NamespaceEntry::TITLE;
0255     }
0256     else if (d->metadataType->currentData().toString() == NamespaceEntry::DM_RATING_CONTAINER())
0257     {
0258         entry.nsType = NamespaceEntry::RATING;
0259     }
0260     else if (d->metadataType->currentData().toString() == NamespaceEntry::DM_COMMENT_CONTAINER())
0261     {
0262         entry.nsType = NamespaceEntry::COMMENT;
0263     }
0264     else if (d->metadataType->currentData().toString() == NamespaceEntry::DM_COLORLABEL_CONTAINER())
0265     {
0266         entry.nsType = NamespaceEntry::COLORLABEL;
0267     }
0268 
0269     entry.isDefault  = false;
0270     entry.subspace   = NamespaceEntry::XMP;
0271 
0272     if (!NamespaceEditDlg::create(qApp->activeWindow(), entry))
0273     {
0274         return;
0275     }
0276 
0277     QStandardItem* const root = d->models.at(getModelIndex())->invisibleRootItem();
0278     QStandardItem* const item = new QStandardItem(entry.namespaceName);
0279     setDataToItem(item, entry);
0280 
0281     item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
0282     root->appendRow(item);
0283 
0284     slotRevertChangesAvailable();
0285 }
0286 
0287 void AdvancedMetadataTab::slotEditNamespace()
0288 {
0289     if (!d->namespaceView->currentIndex().isValid())
0290     {
0291         return;
0292     }
0293 
0294     NamespaceEntry entry = getCurrentContainer().at(d->namespaceView->currentIndex().row());
0295 
0296     if (!NamespaceEditDlg::edit(qApp->activeWindow(), entry))
0297     {
0298         return;
0299     }
0300 
0301     QStandardItem* const root = d->models.at(getModelIndex())->invisibleRootItem();
0302     QStandardItem* const item = root->child(d->namespaceView->currentIndex().row());
0303 
0304     setDataToItem(item, entry);
0305 
0306     slotRevertChangesAvailable();
0307 }
0308 
0309 void AdvancedMetadataTab::applySettings()
0310 {
0311     updateContainer();
0312     DMetadataSettings::instance()->setSettings(d->container);
0313 }
0314 
0315 void AdvancedMetadataTab::slotUnifyChecked(bool value)
0316 {
0317     d->operationType->setDisabled(value);
0318     d->container.setUnifyReadWrite(value);
0319 
0320     d->operationType->setCurrentIndex(0);
0321 
0322     slotIndexChanged();
0323 }
0324 
0325 void AdvancedMetadataTab::slotAllTagsChecked(bool value)
0326 {
0327     d->container.setReadingAllTags(value);
0328 }
0329 
0330 void AdvancedMetadataTab::slotIndexChanged()
0331 {
0332     d->namespaceView->setModel(d->models.at(getModelIndex()));
0333 
0334     bool val = (d->metadataType->currentData().toString() ==
0335                 NamespaceEntry::DM_TAG_CONTAINER());
0336     d->readingAllTags->setEnabled(val);
0337 }
0338 
0339 void AdvancedMetadataTab::slotRevertChangesAvailable()
0340 {
0341     if (!d->changed)
0342     {
0343         d->revertChanges->setEnabled(true);
0344         d->changed = true;
0345     }
0346 
0347     updateContainer();
0348 }
0349 
0350 void AdvancedMetadataTab::connectButtons()
0351 {
0352     connect(d->addButton, SIGNAL(clicked()),
0353             this, SLOT(slotAddNewNamespace()));
0354 
0355     connect(d->editButton, SIGNAL(clicked()),
0356             this, SLOT(slotEditNamespace()));
0357 
0358     connect(d->deleteButton, SIGNAL(clicked()),
0359             d->namespaceView, SLOT(slotDeleteSelected()));
0360 
0361     connect(d->saveProfile, SIGNAL(clicked()),
0362             this, SLOT(slotSaveProfile()));
0363 
0364     connect(d->loadProfile, SIGNAL(clicked()),
0365             this, SLOT(slotLoadProfile()));
0366 
0367     connect(d->resetButton, SIGNAL(clicked()),
0368             this, SLOT(slotResetToDefault()));
0369 
0370     connect(d->revertChanges, SIGNAL(clicked()),
0371             this, SLOT(slotRevertChanges()));
0372 
0373     connect(d->moveUpButton, SIGNAL(clicked()),
0374             d->namespaceView, SLOT(slotMoveItemUp()));
0375 
0376     connect(d->moveDownButton, SIGNAL(clicked()),
0377             d->namespaceView, SLOT(slotMoveItemDown()));
0378 }
0379 
0380 void AdvancedMetadataTab::setModelData(QStandardItemModel* const model,
0381                                        const QList<NamespaceEntry>& container)
0382 {
0383     QStandardItem* const root = model->invisibleRootItem();
0384 
0385     for (NamespaceEntry e : container)
0386     {
0387         QStandardItem* const item = new QStandardItem(e.namespaceName);
0388 
0389         item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
0390         setDataToItem(item, e);
0391         root->appendRow(item);
0392     }
0393 
0394     connect(model, SIGNAL(itemChanged(QStandardItem*)),
0395             this, SLOT(slotRevertChangesAvailable()));
0396 }
0397 
0398 void AdvancedMetadataTab::setUi()
0399 {
0400     QVBoxLayout* const advancedConfLayout = new QVBoxLayout(this);
0401     QGridLayout* const topLayout          = new QGridLayout();
0402     QHBoxLayout* const bottomLayout       = new QHBoxLayout();
0403 
0404     QLabel* const tipLabel = new QLabel(this);
0405     tipLabel->setTextFormat(Qt::RichText);
0406     tipLabel->setWordWrap(true);
0407     tipLabel->setText(i18n("Advanced configuration menu allow you to manage metadata namespaces"
0408                            " used by digiKam to store and retrieve tags, rating and comments.<br/>"
0409                            "<b>Note: </b>Order is important when reading metadata"
0410                           ));
0411 
0412     //--- Top layout ----------------
0413 
0414     d->metadataType   = new QComboBox(this);
0415     d->operationType  = new QComboBox(this);
0416 
0417     d->operationType->insertItems(0, QStringList() << i18n("Read Options")
0418                                                    << i18n("Write Options"));
0419 
0420     d->unifyReadWrite = new QCheckBox(i18n("Unify read and write"));
0421     d->readingAllTags = new QCheckBox(i18n("Read all metadata for tags"));
0422     d->readingAllTags->setEnabled(false);
0423 
0424     topLayout->addWidget(d->metadataType,   0, 0, 1, 1);
0425     topLayout->addWidget(d->operationType,  0, 1, 1, 1);
0426     topLayout->addWidget(d->unifyReadWrite, 0, 2, 1, 1);
0427     topLayout->addWidget(d->readingAllTags, 1, 2, 1, 1);
0428 
0429     //------------ Bottom Layout-------------
0430 
0431     // View
0432 
0433     d->namespaceView = new NamespaceListView(this);
0434 
0435     // Buttons
0436 
0437     QVBoxLayout* const buttonsLayout = new QVBoxLayout();
0438     buttonsLayout->setAlignment(Qt::AlignTop);
0439 
0440     d->addButton      = new QPushButton(QIcon::fromTheme(QLatin1String("list-add")),
0441                                         i18n("Add"));
0442 
0443     d->editButton     = new QPushButton(QIcon::fromTheme(QLatin1String("document-edit")),
0444                                         i18n("Edit"));
0445 
0446     d->deleteButton   = new QPushButton(QIcon::fromTheme(QLatin1String("window-close")),
0447                                         i18n("Delete"));
0448 
0449     d->moveUpButton   = new QPushButton(QIcon::fromTheme(QLatin1String("go-up")),
0450                                         i18n("Move Up"));
0451 
0452     d->moveDownButton = new QPushButton(QIcon::fromTheme(QLatin1String("go-down")),
0453                                         i18n("Move Down"));
0454 
0455     d->revertChanges  = new QPushButton(QIcon::fromTheme(QLatin1String("edit-undo")),
0456                                         i18n("Revert Changes"));
0457 
0458     // Revert changes is disabled, until a change is made
0459 
0460     d->revertChanges->setEnabled(false);
0461     d->saveProfile = new QPushButton(QIcon::fromTheme(QLatin1String("document-save-as")),
0462                                      i18n("Save Profile"));
0463 
0464     d->loadProfile = new QPushButton(QIcon::fromTheme(QLatin1String("document-open")),
0465                                      i18n("Load Profile"));
0466 
0467     d->resetButton = new QPushButton(QIcon::fromTheme(QLatin1String("view-refresh")),
0468                                      i18n("Reset to Default"));
0469 
0470     buttonsLayout->addWidget(d->addButton);
0471     buttonsLayout->addWidget(d->editButton);
0472     buttonsLayout->addWidget(d->deleteButton);
0473     buttonsLayout->addWidget(d->moveUpButton);
0474     buttonsLayout->addWidget(d->moveDownButton);
0475     buttonsLayout->addWidget(d->revertChanges);
0476     buttonsLayout->addWidget(d->saveProfile);
0477     buttonsLayout->addWidget(d->loadProfile);
0478     buttonsLayout->addWidget(d->resetButton);
0479 
0480     QVBoxLayout* const vbox = new QVBoxLayout();
0481     vbox->addWidget(d->namespaceView);
0482 
0483     bottomLayout->addLayout(vbox);
0484     bottomLayout->addLayout(buttonsLayout);
0485 
0486     advancedConfLayout->addWidget(tipLabel);
0487     advancedConfLayout->addLayout(topLayout);
0488     advancedConfLayout->addLayout(bottomLayout);
0489 }
0490 
0491 void AdvancedMetadataTab::setDataToItem(QStandardItem* const item, const NamespaceEntry& entry)
0492 {
0493     item->setData(entry.namespaceName,  Qt::DisplayRole);
0494     item->setData(entry.namespaceName,  NAME_ROLE);
0495     item->setData((int)entry.tagPaths,  ISTAG_ROLE);
0496     item->setData(entry.separator,      SEPARATOR_ROLE);
0497     item->setData((int)entry.nsType,    NSTYPE_ROLE);
0498 
0499     if (entry.nsType == NamespaceEntry::RATING)
0500     {
0501        item->setData(entry.convertRatio.at(0), ZEROSTAR_ROLE);
0502        item->setData(entry.convertRatio.at(1), ONESTAR_ROLE);
0503        item->setData(entry.convertRatio.at(2), TWOSTAR_ROLE);
0504        item->setData(entry.convertRatio.at(3), THREESTAR_ROLE);
0505        item->setData(entry.convertRatio.at(4), FOURSTAR_ROLE);
0506        item->setData(entry.convertRatio.at(5), FIVESTAR_ROLE);
0507     }
0508 
0509     item->setData((int)entry.specialOpts,    SPECIALOPTS_ROLE);
0510     item->setData(entry.alternativeName,     ALTNAME_ROLE);
0511     item->setData((int)entry.subspace,       SUBSPACE_ROLE);
0512     item->setData((int)entry.secondNameOpts, ALTNAMEOPTS_ROLE);
0513     item->setData(entry.isDefault,           ISDEFAULT_ROLE);
0514 
0515     item->setCheckable(true);
0516 
0517     if (!entry.isDisabled)
0518     {
0519         item->setCheckState(Qt::Checked);
0520     }
0521 }
0522 
0523 int AdvancedMetadataTab::getModelIndex()
0524 {
0525     if (d->unifyReadWrite->isChecked())
0526     {
0527         return d->metadataType->currentIndex();
0528     }
0529     else
0530     {
0531         // for 4 metadata types:
0532         // read operation  = 4*0 + (0, 1, 2, 3)
0533         // write operation = 4*1 + (0, 1, 2, 3) = (4, 5, 6, 7)
0534 
0535         return (
0536                 (d->metadataTypeSize * d->operationType->currentIndex()) +
0537                 d->metadataType->currentIndex()
0538                );
0539     }
0540 }
0541 
0542 QList<NamespaceEntry>& AdvancedMetadataTab::getCurrentContainer()
0543 {
0544     int currentIndex = getModelIndex();
0545 
0546     if (currentIndex >= d->metadataTypeSize)
0547     {
0548         return d->container.getWriteMapping(d->metadataType->currentData().toString());
0549     }
0550     else
0551     {
0552         return d->container.getReadMapping(d->metadataType->currentData().toString());
0553     }
0554 }
0555 
0556 void AdvancedMetadataTab::setModels()
0557 {
0558     d->metadataType->blockSignals(true);
0559     d->metadataType->clear();
0560 
0561     QList<QString> keys = d->container.mappingKeys();
0562 
0563     Q_FOREACH (const QString& str, keys)
0564     {
0565         d->metadataType->addItem(d->container.translateMappingKey(str), str);
0566     }
0567 
0568     d->metadataTypeSize = keys.size();
0569 
0570     for (int i = 0 ; i < d->models.size() ; ++i)
0571     {
0572         d->models.at(i)->clear();
0573     }
0574 
0575     d->models.clear();
0576 
0577     for (int i = 0 ; i < keys.size() * 2 ; ++i)
0578     {
0579         d->models.append(new QStandardItemModel(this));
0580     }
0581 
0582     int index = 0;
0583 
0584     Q_FOREACH (const QString& str, keys)
0585     {
0586         setModelData(d->models.at(index++), d->container.getReadMapping(str));
0587     }
0588 
0589     Q_FOREACH (const QString& str, keys)
0590     {
0591         setModelData(d->models.at(index++), d->container.getWriteMapping(str));
0592     }
0593 
0594     d->metadataType->setCurrentIndex(0);
0595     d->metadataType->blockSignals(false);
0596 
0597     slotIndexChanged();
0598 }
0599 
0600 void AdvancedMetadataTab::updateContainer()
0601 {
0602     QList<QString> keys = d->container.mappingKeys();
0603     int index           = 0;
0604 
0605     Q_FOREACH (const QString& str, keys)
0606     {
0607         d->container.getReadMapping(str).clear();
0608         saveModelData(d->models.at(index++), d->container.getReadMapping(str));
0609     }
0610 
0611     Q_FOREACH (const QString& str, keys)
0612     {
0613         d->container.getWriteMapping(str).clear();
0614         saveModelData(d->models.at(index++), d->container.getWriteMapping(str));
0615     }
0616 }
0617 
0618 void AdvancedMetadataTab::saveModelData(QStandardItemModel* const model,
0619                                         QList<NamespaceEntry>& container)
0620 {
0621     QStandardItem* const root = model->invisibleRootItem();
0622 
0623     if (!root->hasChildren())
0624     {
0625         return;
0626     }
0627 
0628     for (int i = 0 ; i < root->rowCount() ; ++i)
0629     {
0630         NamespaceEntry ns;
0631         QStandardItem* const current = root->child(i);
0632         ns.namespaceName             = current->data(NAME_ROLE).toString();
0633         ns.tagPaths                  = (NamespaceEntry::TagType)current->data(ISTAG_ROLE).toInt();
0634         ns.separator                 = current->data(SEPARATOR_ROLE).toString();
0635         ns.nsType                    = (NamespaceEntry::NamespaceType)current->data(NSTYPE_ROLE).toInt();
0636 
0637         if (ns.nsType == NamespaceEntry::RATING)
0638         {
0639             ns.convertRatio.append(current->data(ZEROSTAR_ROLE).toInt());
0640             ns.convertRatio.append(current->data(ONESTAR_ROLE).toInt());
0641             ns.convertRatio.append(current->data(TWOSTAR_ROLE).toInt());
0642             ns.convertRatio.append(current->data(THREESTAR_ROLE).toInt());
0643             ns.convertRatio.append(current->data(FOURSTAR_ROLE).toInt());
0644             ns.convertRatio.append(current->data(FIVESTAR_ROLE).toInt());
0645         }
0646 
0647         ns.specialOpts     = (NamespaceEntry::SpecialOptions)current->data(SPECIALOPTS_ROLE).toInt();
0648         ns.alternativeName = current->data(ALTNAME_ROLE).toString();
0649         ns.subspace        = (NamespaceEntry::NsSubspace)current->data(SUBSPACE_ROLE).toInt();
0650         ns.secondNameOpts  = (NamespaceEntry::SpecialOptions)current->data(ALTNAMEOPTS_ROLE).toInt();
0651         ns.index           = i;
0652         ns.isDefault       = current->data(ISDEFAULT_ROLE).toBool();
0653 
0654         if (current->checkState() == Qt::Checked)
0655         {
0656             ns.isDisabled = false;
0657         }
0658         else
0659         {
0660             ns.isDisabled = true;
0661         }
0662 
0663         container.append(ns);
0664     }
0665 }
0666 
0667 } // namespace Digikam
0668 
0669 #include "moc_advancedmetadatatab.cpp"