File indexing completed on 2025-01-19 03:51:25

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-10-24
0007  * Description : XMP credits settings page.
0008  *
0009  * SPDX-FileCopyrightText: 2014      by Alan Pater <alan dot pater at gmail dot com>
0010  * SPDX-FileCopyrightText: 2007-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "xmpcredits.h"
0017 
0018 // Qt includes
0019 
0020 #include <QCheckBox>
0021 #include <QGroupBox>
0022 #include <QPushButton>
0023 #include <QGridLayout>
0024 #include <QApplication>
0025 #include <QStyle>
0026 #include <QLineEdit>
0027 
0028 // KDE includes
0029 
0030 #include <klocalizedstring.h>
0031 
0032 // Local includes
0033 
0034 #include "multistringsedit.h"
0035 #include "dtextedit.h"
0036 
0037 namespace DigikamGenericMetadataEditPlugin
0038 {
0039 
0040 class Q_DECL_HIDDEN XMPCredits::Private
0041 {
0042 public:
0043 
0044     explicit Private()
0045       : syncEXIFArtistCheck(nullptr),
0046         creatorTitleCheck  (nullptr),
0047         creditCheck        (nullptr),
0048         sourceCheck        (nullptr),
0049         contactCheck       (nullptr),
0050         emailCheck         (nullptr),
0051         urlCheck           (nullptr),
0052         phoneCheck         (nullptr),
0053         addressCheck       (nullptr),
0054         postalCodeCheck    (nullptr),
0055         cityCheck          (nullptr),
0056         regionCheck        (nullptr),
0057         countryCheck       (nullptr),
0058         creatorTitleEdit   (nullptr),
0059         creditEdit         (nullptr),
0060         sourceEdit         (nullptr),
0061         emailEdit          (nullptr),
0062         urlEdit            (nullptr),
0063         phoneEdit          (nullptr),
0064         addressEdit        (nullptr),
0065         postalCodeEdit     (nullptr),
0066         cityEdit           (nullptr),
0067         regionEdit         (nullptr),
0068         countryEdit        (nullptr),
0069         creatorEdit        (nullptr)
0070     {
0071     }
0072 
0073     QCheckBox*        syncEXIFArtistCheck;
0074     QCheckBox*        creatorTitleCheck;
0075     QCheckBox*        creditCheck;
0076     QCheckBox*        sourceCheck;
0077     QCheckBox*        contactCheck;
0078     QCheckBox*        emailCheck;
0079     QCheckBox*        urlCheck;
0080     QCheckBox*        phoneCheck;
0081     QCheckBox*        addressCheck;
0082     QCheckBox*        postalCodeCheck;
0083     QCheckBox*        cityCheck;
0084     QCheckBox*        regionCheck;
0085     QCheckBox*        countryCheck;
0086 
0087     DTextEdit*        creatorTitleEdit;
0088     DTextEdit*        creditEdit;
0089     DTextEdit*        sourceEdit;
0090 
0091     QLineEdit*        emailEdit;
0092     QLineEdit*        urlEdit;
0093     QLineEdit*        phoneEdit;
0094     QLineEdit*        addressEdit;
0095     QLineEdit*        postalCodeEdit;
0096     QLineEdit*        cityEdit;
0097     QLineEdit*        regionEdit;
0098     QLineEdit*        countryEdit;
0099 
0100     MultiStringsEdit* creatorEdit;
0101 };
0102 
0103 XMPCredits::XMPCredits(QWidget* const parent)
0104     : MetadataEditPage(parent),
0105       d               (new Private)
0106 {
0107     QGridLayout* const grid = new QGridLayout(widget());
0108 
0109     // --------------------------------------------------------
0110 
0111     d->creatorEdit         = new MultiStringsEdit(this, i18nc("@option: name of content creator", "Creator:"),
0112                                                   i18n("Set here the name of content creator."));
0113     d->syncEXIFArtistCheck = new QCheckBox(i18n("Sync Exif Artist"), this);
0114 
0115     // --------------------------------------------------------
0116 
0117     d->creatorTitleCheck = new QCheckBox(i18n("Creator Title:"), this);
0118     d->creatorTitleEdit  = new DTextEdit(this);
0119     d->creatorTitleEdit->setPlaceholderText(i18n("Set here the title of content creator."));
0120 
0121     // --------------------------------------------------------
0122 
0123     QGroupBox* const contactBox = new QGroupBox(i18n("Contact"), this);
0124     QGridLayout* const grid2    = new QGridLayout(contactBox);
0125 
0126     d->emailCheck = new QCheckBox(i18nc("contact email address", "E-mail:"), contactBox);
0127     d->emailEdit  = new QLineEdit(contactBox);
0128     d->emailEdit->setClearButtonEnabled(true);
0129     d->emailEdit->setPlaceholderText(i18n("Set here the contact e-mail."));
0130 
0131     d->urlCheck = new QCheckBox(i18n("URL:"), contactBox);
0132     d->urlEdit  = new QLineEdit(contactBox);
0133     d->urlEdit->setClearButtonEnabled(true);
0134     d->urlEdit->setPlaceholderText(i18n("Set here the contact URL."));
0135 
0136     d->phoneCheck = new QCheckBox(i18n("Phone:"), contactBox);
0137     d->phoneEdit  = new QLineEdit(contactBox);
0138     d->phoneEdit->setClearButtonEnabled(true);
0139     d->phoneEdit->setPlaceholderText(i18n("Set here the contact 'phone number."));
0140 
0141     d->addressCheck = new QCheckBox(i18nc("Street address", "Address:"), contactBox);
0142     d->addressEdit  = new QLineEdit(contactBox);
0143     d->addressEdit->setClearButtonEnabled(true);
0144     d->addressEdit->setPlaceholderText(i18n("Set here the contact address."));
0145 
0146     d->postalCodeCheck = new QCheckBox(i18n("Postal code:"), contactBox);
0147     d->postalCodeEdit  = new QLineEdit(contactBox);
0148     d->postalCodeEdit->setClearButtonEnabled(true);
0149     d->postalCodeEdit->setPlaceholderText(i18n("Set here the contact postal code."));
0150 
0151     d->cityCheck = new QCheckBox(i18n("City:"), contactBox);
0152     d->cityEdit  = new QLineEdit(contactBox);
0153     d->cityEdit->setClearButtonEnabled(true);
0154     d->cityEdit->setPlaceholderText(i18n("Set here the contact city."));
0155 
0156     d->regionCheck = new QCheckBox(i18n("State/Province:"), contactBox);
0157     d->regionEdit  = new QLineEdit(contactBox);
0158     d->regionEdit->setClearButtonEnabled(true);
0159     d->regionEdit->setPlaceholderText(i18n("Set here the contact state/province."));
0160 
0161     d->countryCheck = new QCheckBox(i18n("Country:"), contactBox);
0162     d->countryEdit  = new QLineEdit(contactBox);
0163     d->countryEdit->setClearButtonEnabled(true);
0164     d->countryEdit->setPlaceholderText(i18n("Set here the contact country."));
0165 
0166     grid2->addWidget(d->emailCheck,         0, 0, 1, 1);
0167     grid2->addWidget(d->emailEdit,          0, 1, 1, 2);
0168     grid2->addWidget(d->urlCheck,           1, 0, 1, 1);
0169     grid2->addWidget(d->urlEdit,            1, 1, 1, 2);
0170     grid2->addWidget(d->phoneCheck,         2, 0, 1, 1);
0171     grid2->addWidget(d->phoneEdit,          2, 1, 1, 2);
0172     grid2->addWidget(d->addressCheck,       3, 0, 1, 1);
0173     grid2->addWidget(d->addressEdit,        3, 1, 1, 2);
0174     grid2->addWidget(d->postalCodeCheck,    4, 0, 1, 1);
0175     grid2->addWidget(d->postalCodeEdit,     4, 1, 1, 2);
0176     grid2->addWidget(d->cityCheck,          5, 0, 1, 1);
0177     grid2->addWidget(d->cityEdit,           5, 1, 1, 2);
0178     grid2->addWidget(d->regionCheck,        6, 0, 1, 1);
0179     grid2->addWidget(d->regionEdit,         6, 1, 1, 2);
0180     grid2->addWidget(d->countryCheck,       7, 0, 1, 1);
0181     grid2->addWidget(d->countryEdit,        7, 1, 1, 2);
0182     grid2->setColumnStretch(2, 10);
0183 
0184     int spacing = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing),
0185                        QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
0186 
0187     grid2->setContentsMargins(spacing, spacing, spacing, spacing);
0188     grid2->setSpacing(spacing);
0189 
0190     // --------------------------------------------------------
0191 
0192     d->creditCheck = new QCheckBox(i18n("Credit:"), this);
0193     d->creditEdit  = new DTextEdit(this);
0194     d->creditEdit->setPlaceholderText(i18n("Set here the content provider."));
0195 
0196     // --------------------------------------------------------
0197 
0198     d->sourceCheck = new QCheckBox(i18nc("original owner of content", "Source:"), this);
0199     d->sourceEdit  = new DTextEdit(this);
0200     d->sourceEdit->setPlaceholderText(i18n("Set here the original owner of content."));
0201 
0202     // --------------------------------------------------------
0203 
0204     grid->addWidget(d->creatorEdit,         0, 0, 1, 3);
0205     grid->addWidget(d->syncEXIFArtistCheck, 1, 0, 1, 3);
0206     grid->addWidget(d->creatorTitleCheck,   2, 0, 1, 3);
0207     grid->addWidget(d->creatorTitleEdit,    3, 0, 1, 3);
0208     grid->addWidget(contactBox,             4, 0, 1, 3);
0209     grid->addWidget(d->creditCheck,         5, 0, 1, 3);
0210     grid->addWidget(d->creditEdit,          6, 0, 1, 3);
0211     grid->addWidget(d->sourceCheck,         7, 0, 1, 3);
0212     grid->addWidget(d->sourceEdit,          8, 0, 1, 3);
0213     grid->setRowStretch(9, 10);
0214     grid->setColumnStretch(2, 10);
0215     grid->setContentsMargins(spacing, spacing, spacing, spacing);
0216     grid->setSpacing(spacing);
0217 
0218     // --------------------------------------------------------
0219 
0220     connect(d->creatorTitleCheck, SIGNAL(toggled(bool)),
0221             d->creatorTitleEdit, SLOT(setEnabled(bool)));
0222 
0223     connect(d->emailCheck, SIGNAL(toggled(bool)),
0224             d->emailEdit, SLOT(setEnabled(bool)));
0225 
0226     connect(d->urlCheck, SIGNAL(toggled(bool)),
0227             d->urlEdit, SLOT(setEnabled(bool)));
0228 
0229     connect(d->phoneCheck, SIGNAL(toggled(bool)),
0230             d->phoneEdit, SLOT(setEnabled(bool)));
0231 
0232     connect(d->addressCheck, SIGNAL(toggled(bool)),
0233             d->addressEdit, SLOT(setEnabled(bool)));
0234 
0235     connect(d->postalCodeCheck, SIGNAL(toggled(bool)),
0236             d->postalCodeEdit, SLOT(setEnabled(bool)));
0237 
0238     connect(d->cityCheck, SIGNAL(toggled(bool)),
0239             d->cityEdit, SLOT(setEnabled(bool)));
0240 
0241     connect(d->regionCheck, SIGNAL(toggled(bool)),
0242             d->regionEdit, SLOT(setEnabled(bool)));
0243 
0244     connect(d->countryCheck, SIGNAL(toggled(bool)),
0245             d->countryEdit, SLOT(setEnabled(bool)));
0246 
0247     connect(d->creditCheck, SIGNAL(toggled(bool)),
0248             d->creditEdit, SLOT(setEnabled(bool)));
0249 
0250     connect(d->sourceCheck, SIGNAL(toggled(bool)),
0251             d->sourceEdit, SLOT(setEnabled(bool)));
0252 
0253     // --------------------------------------------------------
0254 
0255     connect(d->creatorEdit, SIGNAL(signalModified()),
0256             this, SIGNAL(signalModified()));
0257 
0258     connect(d->creatorTitleCheck, SIGNAL(toggled(bool)),
0259             this, SIGNAL(signalModified()));
0260 
0261     connect(d->emailCheck, SIGNAL(toggled(bool)),
0262             this, SIGNAL(signalModified()));
0263 
0264     connect(d->urlCheck, SIGNAL(toggled(bool)),
0265             this, SIGNAL(signalModified()));
0266 
0267     connect(d->phoneCheck, SIGNAL(toggled(bool)),
0268             this, SIGNAL(signalModified()));
0269 
0270     connect(d->addressCheck, SIGNAL(toggled(bool)),
0271             this, SIGNAL(signalModified()));
0272 
0273     connect(d->postalCodeCheck, SIGNAL(toggled(bool)),
0274             this, SIGNAL(signalModified()));
0275 
0276     connect(d->cityCheck, SIGNAL(toggled(bool)),
0277             this, SIGNAL(signalModified()));
0278 
0279     connect(d->regionCheck, SIGNAL(toggled(bool)),
0280             this, SIGNAL(signalModified()));
0281 
0282     connect(d->countryCheck, SIGNAL(toggled(bool)),
0283             this, SIGNAL(signalModified()));
0284 
0285     connect(d->creditCheck, SIGNAL(toggled(bool)),
0286             this, SIGNAL(signalModified()));
0287 
0288     connect(d->sourceCheck, SIGNAL(toggled(bool)),
0289             this, SIGNAL(signalModified()));
0290 
0291     // --------------------------------------------------------
0292 
0293     connect(d->creatorTitleEdit, SIGNAL(textChanged()),
0294             this, SIGNAL(signalModified()));
0295 
0296     connect(d->emailEdit, SIGNAL(textChanged(QString)),
0297             this, SIGNAL(signalModified()));
0298 
0299     connect(d->urlEdit, SIGNAL(textChanged(QString)),
0300             this, SIGNAL(signalModified()));
0301 
0302     connect(d->phoneEdit, SIGNAL(textChanged(QString)),
0303             this, SIGNAL(signalModified()));
0304 
0305     connect(d->addressEdit, SIGNAL(textChanged(QString)),
0306             this, SIGNAL(signalModified()));
0307 
0308     connect(d->postalCodeEdit, SIGNAL(textChanged(QString)),
0309             this, SIGNAL(signalModified()));
0310 
0311     connect(d->cityEdit, SIGNAL(textChanged(QString)),
0312             this, SIGNAL(signalModified()));
0313 
0314     connect(d->regionEdit, SIGNAL(textChanged(QString)),
0315             this, SIGNAL(signalModified()));
0316 
0317     connect(d->countryEdit, SIGNAL(textChanged(QString)),
0318             this, SIGNAL(signalModified()));
0319 
0320     connect(d->creditEdit, SIGNAL(textChanged()),
0321             this, SIGNAL(signalModified()));
0322 
0323     connect(d->sourceEdit, SIGNAL(textChanged()),
0324             this, SIGNAL(signalModified()));
0325 }
0326 
0327 XMPCredits::~XMPCredits()
0328 {
0329     delete d;
0330 }
0331 
0332 bool XMPCredits::syncEXIFArtistIsChecked() const
0333 {
0334     return d->syncEXIFArtistCheck->isChecked();
0335 }
0336 
0337 void XMPCredits::setCheckedSyncEXIFArtist(bool c)
0338 {
0339     d->syncEXIFArtistCheck->setChecked(c);
0340 }
0341 
0342 QString XMPCredits::getXMPByLine() const
0343 {
0344     QStringList oldv, newv;
0345     bool b = d->creatorEdit->getValues(oldv, newv);
0346     Q_UNUSED(b);
0347 
0348     return (newv.join(QLatin1Char(';')));
0349 }
0350 
0351 void XMPCredits::readMetadata(const DMetadata& meta)
0352 {
0353     blockSignals(true);
0354 
0355     QString     data;
0356     QStringList list;
0357 
0358     list = meta.getXmpTagStringSeq("Xmp.dc.creator", false);
0359     d->creatorEdit->setValues(list);
0360 
0361     d->creatorTitleEdit->clear();
0362     d->creatorTitleCheck->setChecked(false);
0363     data = meta.getXmpTagString("Xmp.photoshop.AuthorsPosition", false);
0364 
0365     if (!data.isNull())
0366     {
0367         d->creatorTitleEdit->setText(data);
0368         d->creatorTitleCheck->setChecked(true);
0369     }
0370 
0371     d->creatorTitleEdit->setEnabled(d->creatorTitleCheck->isChecked());
0372 
0373     // --------------------------------------------------------
0374 
0375     d->emailEdit->clear();
0376     d->emailCheck->setChecked(false);
0377     data = meta.getXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiEmailWork", false);
0378 
0379     if (data.isNull())
0380         data = meta.getXmpTagString("Xmp.iptc.CiEmailWork", false);
0381 
0382     if (!data.isNull())
0383     {
0384         d->emailEdit->setText(data);
0385         d->emailCheck->setChecked(true);
0386     }
0387 
0388     d->emailEdit->setEnabled(d->emailCheck->isChecked());
0389 
0390     // --------------------------------------------------------
0391 
0392     d->urlEdit->clear();
0393     d->urlCheck->setChecked(false);
0394     data = meta.getXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiUrlWork", false);
0395 
0396     if (data.isNull())
0397         data = meta.getXmpTagString("Xmp.iptc.CiUrlWork", false);
0398 
0399     if (!data.isNull())
0400     {
0401         d->urlEdit->setText(data);
0402         d->urlCheck->setChecked(true);
0403     }
0404 
0405     d->urlEdit->setEnabled(d->urlCheck->isChecked());
0406 
0407     // --------------------------------------------------------
0408 
0409     d->phoneEdit->clear();
0410     d->phoneCheck->setChecked(false);
0411     data = meta.getXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiTelWork", false);
0412 
0413     if (data.isNull())
0414         data = meta.getXmpTagString("Xmp.iptc.CiTelWork", false);
0415 
0416     if (!data.isNull())
0417     {
0418         d->phoneEdit->setText(data);
0419         d->phoneCheck->setChecked(true);
0420     }
0421 
0422     d->phoneEdit->setEnabled(d->phoneCheck->isChecked());
0423 
0424     // --------------------------------------------------------
0425 
0426     d->addressEdit->clear();
0427     d->addressCheck->setChecked(false);
0428     data = meta.getXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrExtadr", false);
0429 
0430     if (data.isNull())
0431         data = meta.getXmpTagString("Xmp.iptc.CiAdrExtadr", false);
0432 
0433     if (!data.isNull())
0434     {
0435         d->addressEdit->setText(data);
0436         d->addressCheck->setChecked(true);
0437     }
0438 
0439     d->addressEdit->setEnabled(d->addressCheck->isChecked());
0440 
0441     // --------------------------------------------------------
0442 
0443     d->postalCodeEdit->clear();
0444     d->postalCodeCheck->setChecked(false);
0445     data = meta.getXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrPcode", false);
0446 
0447     if (data.isNull())
0448         data = meta.getXmpTagString("Xmp.iptc.CiAdrPcode", false);
0449 
0450     if (!data.isNull())
0451     {
0452         d->postalCodeEdit->setText(data);
0453         d->postalCodeCheck->setChecked(true);
0454     }
0455 
0456     d->postalCodeEdit->setEnabled(d->postalCodeCheck->isChecked());
0457 
0458     // --------------------------------------------------------
0459 
0460     d->cityEdit->clear();
0461     d->cityCheck->setChecked(false);
0462     data = meta.getXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCity", false);
0463 
0464     if (data.isNull())
0465         data = meta.getXmpTagString("Xmp.iptc.CiAdrCity", false);
0466 
0467     if (!data.isNull())
0468     {
0469         d->cityEdit->setText(data);
0470         d->cityCheck->setChecked(true);
0471     }
0472 
0473     d->cityEdit->setEnabled(d->cityCheck->isChecked());
0474 
0475     // --------------------------------------------------------
0476 
0477     d->regionEdit->clear();
0478     d->regionCheck->setChecked(false);
0479     data = meta.getXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrRegion", false);
0480 
0481     if (data.isNull())
0482     {
0483         data = meta.getXmpTagString("Xmp.iptc.CiAdrRegion", false);
0484     }
0485 
0486     if (!data.isNull())
0487     {
0488         d->regionEdit->setText(data);
0489         d->regionCheck->setChecked(true);
0490     }
0491 
0492     d->regionEdit->setEnabled(d->regionCheck->isChecked());
0493 
0494     // --------------------------------------------------------
0495 
0496     d->countryEdit->clear();
0497     d->countryCheck->setChecked(false);
0498     data = meta.getXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCtry", false);
0499 
0500     if (data.isNull())
0501     {
0502         data = meta.getXmpTagString("Xmp.iptc.CiAdrCtry", false);
0503     }
0504 
0505     if (!data.isNull())
0506     {
0507         d->countryEdit->setText(data);
0508         d->countryCheck->setChecked(true);
0509     }
0510 
0511     d->countryEdit->setEnabled(d->countryCheck->isChecked());
0512 
0513     // --------------------------------------------------------
0514 
0515     d->creditEdit->clear();
0516     d->creditCheck->setChecked(false);
0517     data = meta.getXmpTagString("Xmp.photoshop.Credit", false);
0518 
0519     if (!data.isNull())
0520     {
0521         d->creditEdit->setText(data);
0522         d->creditCheck->setChecked(true);
0523     }
0524 
0525     d->creditEdit->setEnabled(d->creditCheck->isChecked());
0526 
0527     // --------------------------------------------------------
0528 
0529     d->sourceEdit->clear();
0530     d->sourceCheck->setChecked(false);
0531     data = meta.getXmpTagString("Xmp.photoshop.Source", false);
0532 
0533     if (data.isNull())
0534     {
0535         data = meta.getXmpTagString("Xmp.dc.source", false);
0536     }
0537 
0538     if (!data.isNull())
0539     {
0540         d->sourceEdit->setText(data);
0541         d->sourceCheck->setChecked(true);
0542     }
0543 
0544     d->sourceEdit->setEnabled(d->sourceCheck->isChecked());
0545 
0546     blockSignals(false);
0547 }
0548 
0549 void XMPCredits::applyMetadata(const DMetadata& meta)
0550 {
0551     QStringList oldList, newList;
0552 
0553     if (d->creatorEdit->getValues(oldList, newList))
0554     {
0555         meta.setXmpTagStringSeq("Xmp.dc.creator", newList);
0556 
0557         if (syncEXIFArtistIsChecked())
0558         {
0559             meta.removeExifTag("Exif.Image.Artist");
0560             meta.setExifTagString("Exif.Image.Artist", getXMPByLine());
0561         }
0562     }
0563     else
0564     {
0565         meta.removeXmpTag("Xmp.dc.creator");
0566     }
0567 
0568     if (d->creatorTitleCheck->isChecked())
0569     {
0570         meta.setXmpTagString("Xmp.photoshop.AuthorsPosition", d->creatorTitleEdit->text());
0571     }
0572     else
0573     {
0574         meta.removeXmpTag("Xmp.photoshop.AuthorsPosition");
0575     }
0576 
0577     // --------------------------------------------------------
0578 
0579     if (d->emailCheck->isChecked())
0580     {
0581         meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiEmailWork", d->emailEdit->text());
0582         meta.removeXmpTag("Xmp.iptc.CiEmailWork");
0583     }
0584     else
0585     {
0586         meta.removeXmpTag("Xmp.iptc.CiEmailWork");
0587         meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiEmailWork");
0588     }
0589 
0590     if (d->urlCheck->isChecked())
0591     {
0592         meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiUrlWork", d->urlEdit->text());
0593         meta.removeXmpTag("Xmp.iptc.CiUrlWork");
0594     }
0595     else
0596     {
0597         meta.removeXmpTag("Xmp.iptc.CiUrlWork");
0598         meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiUrlWork");
0599     }
0600 
0601     if (d->phoneCheck->isChecked())
0602     {
0603         meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiTelWork", d->phoneEdit->text());
0604         meta.removeXmpTag("Xmp.iptc.CiTelWork");
0605     }
0606     else
0607     {
0608         meta.removeXmpTag("Xmp.iptc.CiTelWork");
0609         meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiTelWork");
0610     }
0611 
0612     if (d->addressCheck->isChecked())
0613     {
0614         meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrExtadr", d->addressEdit->text());
0615         meta.removeXmpTag("Xmp.iptc.CiAdrExtadr");
0616     }
0617     else
0618     {
0619         meta.removeXmpTag("Xmp.iptc.CiAdrExtadr");
0620         meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrExtadr");
0621     }
0622 
0623     if (d->postalCodeCheck->isChecked())
0624     {
0625         meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrPcode", d->postalCodeEdit->text());
0626         meta.removeXmpTag("Xmp.iptc.CiAdrPcode");
0627     }
0628     else
0629     {
0630         meta.removeXmpTag("Xmp.iptc.CiAdrPcode");
0631         meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrPcode");
0632     }
0633 
0634     if (d->cityCheck->isChecked())
0635     {
0636         meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCity", d->cityEdit->text());
0637         meta.removeXmpTag("Xmp.iptc.CiAdrCity");
0638     }
0639     else
0640     {
0641         meta.removeXmpTag("Xmp.iptc.CiAdrCity");
0642         meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCity");
0643     }
0644 
0645     if (d->regionCheck->isChecked())
0646     {
0647         meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrRegion", d->regionEdit->text());
0648         meta.removeXmpTag("Xmp.iptc.CiAdrRegion");
0649     }
0650     else
0651     {
0652         meta.removeXmpTag("Xmp.iptc.CiAdrRegion");
0653         meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrRegion");
0654     }
0655 
0656     if (d->countryCheck->isChecked())
0657     {
0658         meta.setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCtry", d->countryEdit->text());
0659         meta.removeXmpTag("Xmp.iptc.CiAdrCtry");
0660     }
0661     else
0662     {
0663         meta.removeXmpTag("Xmp.iptc.CiAdrCtry");
0664         meta.removeXmpTag("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCtry");
0665     }
0666 
0667     // --------------------------------------------------------
0668 
0669     if (d->creditCheck->isChecked())
0670     {
0671         meta.setXmpTagString("Xmp.photoshop.Credit", d->creditEdit->text());
0672     }
0673     else
0674     {
0675         meta.removeXmpTag("Xmp.photoshop.Credit");
0676     }
0677 
0678     if (d->sourceCheck->isChecked())
0679     {
0680         meta.setXmpTagString("Xmp.photoshop.Source", d->sourceEdit->text());
0681         meta.setXmpTagString("Xmp.dc.source", d->sourceEdit->text());
0682     }
0683     else
0684     {
0685         meta.removeXmpTag("Xmp.photoshop.Source");
0686         meta.removeXmpTag("Xmp.dc.source");
0687     }
0688 }
0689 
0690 } // namespace DigikamGenericMetadataEditPlugin
0691 
0692 #include "moc_xmpcredits.cpp"