Merge lp:~gerboland/unity-2d/launcher_shortcuts_fix into lp:unity-2d

Proposed by Gerry Boland
Status: Merged
Approved by: Florian Boucault
Approved revision: 687
Merged at revision: 687
Proposed branch: lp:~gerboland/unity-2d/launcher_shortcuts_fix
Merge into: lp:unity-2d
Diff against target: 44 lines (+10/-5)
2 files modified
launcher/LauncherList.qml (+3/-2)
launcher/app/launcherview.cpp (+7/-3)
To merge this branch: bzr merge lp:~gerboland/unity-2d/launcher_shortcuts_fix
Reviewer Review Type Date Requested Status
Florian Boucault (community) Approve
Review via email: mp+73542@code.launchpad.net

Description of the change

[launcher] Fix keyboard shortcuts to start counting applications at index 1.

To post a comment you must log in.
687. By Gerry Boland

[launcher] Small check to ensure no duplicate shortcuts.

Revision history for this message
Florian Boucault (fboucault) wrote :

Excellent!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/LauncherList.qml'
2--- launcher/LauncherList.qml 2011-08-30 20:55:53 +0000
3+++ launcher/LauncherList.qml 2011-08-31 14:23:47 +0000
4@@ -107,12 +107,13 @@
5 emblem: item.emblem ? "image://icons/" + item.emblem : ""
6 emblemVisible: item.emblemVisible
7
8+ /* Launcher of index 0 is the so-called BFB or Dash launcher */
9 shortcutVisible: launcherView.superKeyHeld &&
10- ((item.toString().indexOf("LauncherApplication") == 0 && index <= 9) ||
11+ ((item.toString().indexOf("LauncherApplication") == 0 && index > 0 && index <= 10) ||
12 item.shortcutKey != 0)
13 shortcutText: {
14 if (item.toString().indexOf("LauncherApplication") == 0) {
15- return (index + 1) % 10
16+ return index % 10
17 } else {
18 return String.fromCharCode(item.shortcutKey).toLowerCase()
19 }
20
21=== modified file 'launcher/app/launcherview.cpp'
22--- launcher/app/launcherview.cpp 2011-08-11 15:21:01 +0000
23+++ launcher/app/launcherview.cpp 2011-08-31 14:23:47 +0000
24@@ -177,14 +177,18 @@
25 Hotkey* hotkey = qobject_cast<Hotkey*>(sender());
26 if (hotkey != NULL) {
27 /* Shortcuts from 1 to 9 should activate the items with index
28- from 0 to 8. Shortcut for 0 should activate item with index 9.
29+ from 1 to 9 (index 0 being the so-called "BFB" or Dash launcher).
30+ Shortcut for 0 should activate item with index 10.
31 In other words, the indexes are activated in the same order as
32 the keys appear on a standard keyboard. */
33 Qt::Key key = hotkey->key();
34- if (key >= Qt::Key_0 && key <= Qt::Key_9) {
35- int index = (key - Qt::Key_0 + 9) % 10;
36+ if (key >= Qt::Key_1 && key <= Qt::Key_9) {
37+ int index = key - Qt::Key_0;
38 Q_EMIT keyboardShortcutPressed(index);
39 }
40+ else if (key == Qt::Key_0){
41+ Q_EMIT keyboardShortcutPressed(10);
42+ }
43 }
44 }
45

Subscribers

People subscribed via source and target branches