Bug 186580 - '&' not shown in "copy to"/"move to" menus
Summary: '&' not shown in "copy to"/"move to" menus
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 16.12.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-08 20:08 UTC by Luca Zorzi
Modified: 2009-03-10 19:48 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Zorzi 2009-03-08 20:08:13 UTC
Version:           1.2.1 (using 4.2.1 (KDE 4.2.1), Kubuntu packages)
Compiler:          cc
OS:                Linux (i686) release 2.6.27-13-generic

I enabled "Copy to" and "Move to" menus in Dolphin (I use the Italian translation of KDE, so these names might be inaccurate), since I find them very useful.

I noticed that in KDE 4.2.1 an issue with the '&' character not showing in Dolphin tabs was corrected, and I can confirm that it is, but I noticed that the same issue is present when a directory with a '&' in its name is present in the copy to/move to menu. It is just not shown, it's not replaced by any other char.
In my case, I have an "HTML & xo" folder that is shown as "HTML  xo" (note the double space, so only '&' is missing.

Here is a screenshot showing the solved bug in tab name and not solved in copy to/move to menu
http://www.tuttoeniente.net/free-image-hosting/immagine/1236539258_bug_in_dolphin.png.html
Comment 1 Frank Reininghaus 2009-03-08 20:51:12 UTC
Thanks for the bug report!

The problem is very similar to the tab title bug (bug 181765): a '&' in the title of a sub menu is misinterpreted as an indicator that the following letter should be a keyboard shortcut.

An approach which is similar to the fix for the other bug fixes it for me, see below. I'll CC David because he wrote the code for the "Copy To"/"Move To" menus.

Index: konq/konq_copytomenu.cpp
===================================================================
--- konq/konq_copytomenu.cpp    (revision 936942)
+++ konq/konq_copytomenu.cpp    (working copy)
@@ -204,7 +204,15 @@ void KonqCopyToDirectoryMenu::slotAboutT
             subPath.append('/');
         subPath += subDir;
         KonqCopyToDirectoryMenu* subMenu = new KonqCopyToDirectoryMenu(this, m_mainMenu, subPath);
-        subMenu->setTitle(subDir);
+        if (subDir.indexOf('&') == -1)
+            subMenu->setTitle(subDir);
+        else {
+            // Make sure that a '&' inside the directory name is displayed correctly
+            // and not misinterpreted as a keyboard shortcut
+            QString menuTitle = subDir;
+            menuTitle.replace('&', "&&");
+            subMenu->setTitle(menuTitle);
+        }
         const QString iconName = dirMime->iconName(KUrl(subPath));
         subMenu->setIcon(KIcon(iconName));
         if (QFileInfo(subPath).isSymLink()) { // I hope this isn't too slow...
Comment 2 David Faure 2009-03-10 11:47:16 UTC
I think this could be written in one line with
subMenu->setTitle(menuTitle.replace('&',"&&"));
No need for if+indexOf (which ends up making the code search for '&' twice).
Comment 3 Frank Reininghaus 2009-03-10 19:26:29 UTC
SVN commit 937892 by freininghaus:

Display folder names containing '&' correctly in the "Copy To"/"Move To" menus.

BUG: 186580


 M  +4 -1      konq_copytomenu.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=937892
Comment 4 Frank Reininghaus 2009-03-10 19:48:54 UTC
SVN commit 937903 by freininghaus:

Display folder names containing '&' correctly in the "Copy To"/"Move To" menus.

This fix will be in KDE 4.2.2.

CCBUG: 186580


 M  +4 -1      konq_copytomenu.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=937903