File indexing completed on 2025-01-05 03:57:18
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-07-09 0007 * Description : Subjects panel. 0008 * 0009 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "subjectedit.h" 0016 0017 // Qt includes 0018 0019 #include <QCheckBox> 0020 #include <QLabel> 0021 #include <QValidator> 0022 0023 // KDE includes 0024 0025 #include <klocalizedstring.h> 0026 0027 namespace Digikam 0028 { 0029 0030 SubjectEdit::SubjectEdit(QWidget* const parent) 0031 : SubjectWidget(parent) 0032 { 0033 m_iprDefault = QLatin1String("XMP"); 0034 0035 // Subject string do not accept these characters: 0036 // - '*' (\x2A) 0037 // - ':' (\x3A) 0038 // - '?' (\x3F) 0039 0040 QRegularExpression subjectRx(QLatin1String("[^*:?]+$")); 0041 QValidator* const subjectValidator = new QRegularExpressionValidator(subjectRx, this); 0042 0043 // -------------------------------------------------------- 0044 0045 m_iprEdit->setText(m_iprDefault); 0046 m_iprEdit->setValidator(subjectValidator); 0047 m_iprEdit->setWhatsThis(i18n("Enter the Informative Provider Reference here. " 0048 "I.P.R is a name registered with the XMP/NAA, identifying the " 0049 "provider that provides an indicator of the content. " 0050 "The default value for the I.P.R is \"XMP\" if a standard Reference " 0051 "Code is used.")); 0052 0053 m_refEdit->setWhatsThis(i18n("Enter the Subject Reference Number here. " 0054 "Provides a numeric code to indicate the Subject Name plus " 0055 "optional Subject Matter and Subject Detail Names in the " 0056 "language of the service. Subject Reference is a number " 0057 "from the range 01000000 to 17999999 and represent a " 0058 "language independent international reference to " 0059 "a Subject. A Subject is identified by its Reference Number " 0060 "and corresponding Names taken from a standard lists given " 0061 "by XMP/NAA. If a standard reference code is used, these lists " 0062 "are the English language reference versions. " 0063 "This field is limited to 8 digit code.")); 0064 0065 m_nameEdit->setIgnoredCharacters(QLatin1String("*:?")); 0066 m_nameEdit->setWhatsThis(i18n("Enter the Subject Name here. English language is used " 0067 "if you selected a standard XMP/NAA reference code.")); 0068 0069 m_matterEdit->setIgnoredCharacters(QLatin1String("*:?")); 0070 m_matterEdit->setWhatsThis(i18n("Enter the Subject Matter Name here. English language is used " 0071 "if you selected a standard XMP/NAA reference code.")); 0072 0073 m_detailEdit->setIgnoredCharacters(QLatin1String("*:?")); 0074 m_detailEdit->setWhatsThis(i18n("Enter the Subject Detail Name here. English language is used " 0075 "if you selected a standard XMP/NAA reference code.")); 0076 0077 // reset the note label, not used in XMP view 0078 0079 if (m_note) 0080 { 0081 delete m_note; 0082 } 0083 } 0084 0085 SubjectEdit::~SubjectEdit() 0086 { 0087 } 0088 0089 void SubjectEdit::slotRefChanged() 0090 { 0091 SubjectWidget::slotRefChanged(); 0092 m_iprEdit->setText(QLatin1String("XMP")); 0093 } 0094 0095 } // namespace Digikam 0096 0097 #include "moc_subjectedit.cpp"