Merge lp://qastaging/~osomon/unity-2d/launcher-items-keyboard-shortcuts into lp://qastaging/unity-2d/3.0

Proposed by Olivier Tilloy
Status: Merged
Approved by: Ugo Riboni
Approved revision: 563
Merged at revision: 556
Proposed branch: lp://qastaging/~osomon/unity-2d/launcher-items-keyboard-shortcuts
Merge into: lp://qastaging/unity-2d/3.0
Diff against target: 200 lines (+77/-11)
7 files modified
launcher/LauncherList.qml (+10/-3)
launcher/UnityApplications/launcheritem.cpp (+30/-1)
launcher/UnityApplications/launcheritem.h (+10/-0)
launcher/UnityApplications/place.cpp (+15/-0)
launcher/UnityApplications/placeentry.cpp (+1/-0)
launcher/UnityApplications/trash.cpp (+1/-0)
libunity-2d-private/src/hotkey.cpp (+10/-7)
To merge this branch: bzr merge lp://qastaging/~osomon/unity-2d/launcher-items-keyboard-shortcuts
Reviewer Review Type Date Requested Status
Ugo Riboni (community) Needs Fixing
Review via email: mp+59524@code.qastaging.launchpad.net

Commit message

[launcher] Keyboard shortcuts for place entries (Meta+[letter]) and the trash (Meta+T).

To post a comment you must log in.
559. By Olivier Tilloy

No need to manually disconnect from the hotkey event, this is done automatically by Qt upon destruction.

Revision history for this message
Ugo Riboni (uriboni) wrote :

Functionally there's only one corner case where it doesn't work: if the shortcut key is some accented character, it's not displayed as a shortcut. For example if you edit /usr/share/unity/places/applications.place and make the shortcut key "é", it will not work (the key is not even grabbed).

review: Needs Fixing
Revision history for this message
Ugo Riboni (uriboni) wrote :

134 + if (value.size() == 1) {
135 + QChar c = value.at(0);
136 + if (c.isLetter()) {
137 + Qt::Key key = (Qt::Key) (Qt::Key_A + (c.toLower().toAscii() - 'a'));
138 + entry->setShortcutKey(key);
139 + }
140 + }

I am a fan of the principle "be strict in what you emit and relaxed in what you accept", and in this case if the string length is larger than 1 character, why don't you just pick the first character and emit a warning.
Or if you prefer just emit a warning and set no shortcut. But don't just silently do nothing.

review: Needs Fixing
560. By Olivier Tilloy

Print out a warning if the shortcut key is invalid (more than one single character).

561. By Olivier Tilloy

More reliable (and simple) conversion from QString to Qt::Key.

Revision history for this message
Ugo Riboni (uriboni) wrote :

It's still not working. I set the shortcut to "é" (one single accented character), and I get this warning message: unity-2d-launcher: [WARNING] void Place::setFileName(const QString&): Invalid shorcut key (should be one single character): "é"

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

This is very likely because your text editor, when you are typing "é", is in fact inserting two characters (0xc3 + 0xa9) instead of one (0xc9). The visual representation is the same, but the underlying unicode representation isn’t, and as a consequence the string extracted from the place file is too long. At least the code now prints out a warning, it doesn’t ignore it silently.

Still, if you use an hexadecimal editor to set the shortcut to the correct unicode character (0xc9), grabbing the key fails lower down the stack with the following warning:

    Could not convert "É" to an x11 keysym

This happens during the conversion from a Qt::Key to an X11 keysym in the constructor for Hotkey. I’m trying to figure out how to fix the conversion.

562. By Olivier Tilloy

Fix the translation from Qt::Key to an X11 KeySym for unicode characters such as "É".

563. By Olivier Tilloy

Comment to explain why setting the shortcut key of a place entry to an accentuated character might fail.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches