Merge lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-shortcut-fix into lp:ubuntu-calculator-app

Proposed by Bartosz Kosiorek
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 196
Merged at revision: 196
Proposed branch: lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-shortcut-fix
Merge into: lp:ubuntu-calculator-app
Diff against target: 34 lines (+13/-4)
1 file modified
app/ubuntu-calculator-app.qml (+13/-4)
To merge this branch: bzr merge lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-shortcut-fix
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+262517@code.launchpad.net

Commit message

Fix keyboard shortcuts (eg. Ctrl+C)

Description of the change

Fix keyboard shortcuts

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Good catch, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/ubuntu-calculator-app.qml'
2--- app/ubuntu-calculator-app.qml 2015-06-17 20:11:29 +0000
3+++ app/ubuntu-calculator-app.qml 2015-06-20 10:58:10 +0000
4@@ -290,7 +290,9 @@
5 id: calculationHistory
6 }
7
8- Keys.onPressed: { //Some special keys like backspace captured in TextField below as they are for some reason not sent to the application but to the text input
9+ // Some special keys like backspace captured in TextField,
10+ // are for some reason not sent to the application but to the text input
11+ Keys.onPressed: {
12 keyboardLoader.item.pressedKey = event.key;
13 keyboardLoader.item.pressedKeyText = event.text;
14 }
15@@ -633,9 +635,16 @@
16 rightMargin: units.gu(1)
17 }
18
19- Keys.onPressed: { //Need to capture special keys like backspace here as they are for some reason not sent to the application but to the text input
20- keyboardLoader.item.pressedKey = event.key;
21- keyboardLoader.item.pressedKeyText = event.text;
22+ // Need to capture special keys like backspace here,
23+ // as they are for some reason not sent to the application but to the text input
24+ Keys.onPressed: {
25+ // Don't press calculator's visual keys, when modifiers are pressed
26+ // to allow work keyboard shortcuts (eg. Ctrl+C)
27+ if (event.modifiers & Qt.NoModifier) {
28+
29+ keyboardLoader.item.pressedKey = event.key;
30+ keyboardLoader.item.pressedKeyText = event.text;
31+ }
32 }
33
34 Keys.onReleased: {

Subscribers

People subscribed via source and target branches