[Digikam-devel] [Bug 134841] weird behaviour of identity setup

Gilles Caulier caulier.gilles at free.fr
Mon Oct 2 10:47:01 BST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=134841         
caulier.gilles free fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From caulier.gilles free fr  2006-10-02 11:47 -------
SVN commit 591296 by cgilles:

digikam from trunk : Use a QValidator to limit string characters to all printable ASCII char.
BUG: 134841

 M  +18 -9     setupidentity.cpp  


--- trunk/extragear/graphics/digikam/utilities/setup/setupidentity.cpp #591295:591296
 @ -25,6 +25,7  @
 #include <qgroupbox.h>
 #include <qlabel.h>
 #include <qwhatsthis.h>
+#include <qvalidator.h>
 
 // KDE includes.
 
 @ -68,15 +69,17  @
     QVBoxLayout *layout = new QVBoxLayout( parent, 0, KDialog::spacingHint() );
     
     // --------------------------------------------------------
-    QString asciiMask("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
-                      "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
 
+    // IPTC only accept printable Ascii char.
+    QRegExp asciiRx("[\x20-\x7F]+$");
+    QValidator *asciiValidator = new QRegExpValidator(asciiRx, this);
+
     QGroupBox *photographerIdGroup = new QGroupBox(0, Qt::Horizontal, i18n("Photographer Informations"), parent);
     QGridLayout* grid = new QGridLayout( photographerIdGroup->layout(), 1, 1, KDialog::spacingHint());
 
     QLabel *label1 = new QLabel(i18n("Author:"), photographerIdGroup);
     d->authorEdit  = new KLineEdit(photographerIdGroup);
-    d->authorEdit->setInputMask(asciiMask);
+    d->authorEdit->setValidator(asciiValidator);
     d->authorEdit->setMaxLength(32);
     label1->setBuddy(d->authorEdit);
     grid->addMultiCellWidget(label1, 0, 0, 0, 0);
 @ -86,7 +89,7  @
 
     QLabel *label2 = new QLabel(i18n("Author Title:"), photographerIdGroup);
     d->authorTitleEdit = new KLineEdit(photographerIdGroup);
-    d->authorTitleEdit->setInputMask(asciiMask);
+    d->authorEdit->setValidator(asciiValidator);
     d->authorTitleEdit->setMaxLength(32);
     label2->setBuddy(d->authorTitleEdit);
     grid->addMultiCellWidget(label2, 1, 1, 0, 0);
 @ -101,7 +104,7  @
 
     QLabel *label3 = new QLabel(i18n("Credit:"), creditsGroup);
     d->creditEdit = new KLineEdit(creditsGroup);
-    d->creditEdit->setInputMask(asciiMask);
+    d->authorEdit->setValidator(asciiValidator);
     d->creditEdit->setMaxLength(32);
     label3->setBuddy(d->creditEdit);
     grid2->addMultiCellWidget(label3, 0, 0, 0, 0);
 @ -112,7 +115,7  @
 
     QLabel *label4 = new QLabel(i18n("Source:"), creditsGroup);
     d->sourceEdit = new KLineEdit(creditsGroup);
-    d->sourceEdit->setInputMask(asciiMask);
+    d->authorEdit->setValidator(asciiValidator);
     d->sourceEdit->setMaxLength(32);
     label4->setBuddy(d->sourceEdit);
     grid2->addMultiCellWidget(label4, 1, 1, 0, 0);
 @ -124,18 +127,24  @
 
     QLabel *label5 = new QLabel(i18n("Copyright:"), creditsGroup);
     d->copyrightEdit = new KLineEdit(creditsGroup);
-    d->copyrightEdit->setInputMask(asciiMask);
+    d->authorEdit->setValidator(asciiValidator);
     d->copyrightEdit->setMaxLength(128);
     label5->setBuddy(d->copyrightEdit);
     grid2->addMultiCellWidget(label5, 2, 2, 0, 0);
     grid2->addMultiCellWidget(d->copyrightEdit, 2, 2, 1, 1);
-    QWhatsThis::add( d->copyrightEdit, i18n("<p>Set here the default copyright notice of the pictures. This field is limited "
-                                            "to 128 ASCII characters."));
+    QWhatsThis::add( d->copyrightEdit, i18n("<p>Set here the default copyright notice of the pictures. "
+                                            "This field is limited to 128 ASCII characters."));
+
+    // --------------------------------------------------------
+
+    QLabel *iptcNote = new QLabel(i18n("<b>Note: IPTC text tags only support printable "
+                                       "ASCII characters set.</b>"), parent);
                                          
     // --------------------------------------------------------
     
     layout->addWidget(photographerIdGroup);
     layout->addWidget(creditsGroup);
+    layout->addWidget(iptcNote);
     layout->addStretch();
     
     readSettings();



More information about the Digikam-devel mailing list