Bug 146744

Summary: tag that contains '&' is not displayed correctly in menus
Product: [Applications] digikam Reporter: Jonathan Marten <jjm>
Component: Usability-MenusAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.2
Attachments: Fix '&' in tag name in popup menus

Description Jonathan Marten 2007-06-13 16:21:15 UTC
Version:           0.9.2-beta3 (using KDE KDE 3.5.7)
Installed from:    Compiled From Sources
OS:                Linux

This refers to the "Assign Tag" and "Remove Tag" menu structure on the image popup menu.  If the tag contains an ampersand character, which is apparently allowed, then the tag name is not displayed correctly in the menu.

For example, creating a tag named "Food & Drink" shows as "Food<space>_Drink", and creating a tag named "A,B&C" shows as "ABC" where the "C" is underlined.

An '&' in a menu item needs to be doubled (except if it is a TagsPopupCheckedMenuItem, QCustomMenuItem doesn't implement accelerators).  Patch to fix is attached.
Comment 1 Jonathan Marten 2007-06-13 16:22:03 UTC
Created attachment 20848 [details]
Fix '&' in tag name in popup menus
Comment 2 caulier.gilles 2007-06-13 16:26:50 UTC
Jonathan,

I have take a look in your patch, and all sound fine for me...

Arnd, Gerhard, can you just perform a test with this patch before to apply it on svn ? I think it can be included to 0.9.2-final

Thanks in advance

Gilles
Comment 3 Arnd Baecker 2007-06-13 18:57:39 UTC
Applied the patch, it compiles fine and I did not see any problems
with tags containing an &.
So it looks fine from me as well.
Comment 4 caulier.gilles 2007-06-13 19:19:22 UTC
SVN commit 674990 by cgilles:

digiKam from KDE3 branch : fix "&" char on tag menus.
BUG: 146744


 M  +5 -2      tagspopupmenu.cpp  


--- branches/extragear/kde3/graphics/digikam/digikam/tagspopupmenu.cpp #674989:674990
@@ -308,9 +308,12 @@
         }
         
         QPixmap pix = SyncJob::getTagThumbnail((TAlbum*)a);
+        QString t = a->title();
+        t.replace('&',"&&");
+
         if (a->firstChild())
         {
-            menu->insertItem(pix, a->title(), buildSubMenu(a->id()));
+            menu->insertItem(pix, t, buildSubMenu(a->id()));
         }
         else
         {
@@ -321,7 +324,7 @@
             }
             else
             {
-                menu->insertItem(pix, a->title(), d->addToID + a->id());
+                menu->insertItem(pix, t, d->addToID + a->id());
             }
         }
     }
Comment 5 Arnd Baecker 2007-06-13 19:51:41 UTC
Jonathan,

I should have been a bit more verbose ;-): thanks a lot for the
patch - contributions to the development of digikam
are very much appreciated!!

Best, Arnd
Comment 6 Jonathan Marten 2007-06-14 12:09:00 UTC
Thanks for the comments Arnd and Gilles - I have only just started using the application seriously, and have not got involved in any serious development yet, but I will try to address any problems that I find!