← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

Bartosz Kosiorek has proposed merging lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-shortcut-fix into lp:ubuntu-calculator-app.

Commit message:
Fix keyboard shortcuts (eg. Ctrl+C)

Requested reviews:
  Ubuntu Calculator Developers (ubuntu-calculator-dev)
Related bugs:
  Bug #1466634 in Ubuntu Calculator App: "Fix copy/paste using keyboard"
  https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1466634

For more details, see:
https://code.launchpad.net/~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-shortcut-fix/+merge/262517

Fix keyboard shortcuts
-- 
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-app-keyboard-shortcut-fix into lp:ubuntu-calculator-app.
=== modified file 'app/ubuntu-calculator-app.qml'
--- app/ubuntu-calculator-app.qml	2015-06-17 20:11:29 +0000
+++ app/ubuntu-calculator-app.qml	2015-06-20 10:58:10 +0000
@@ -290,7 +290,9 @@
                 id: calculationHistory
             }
 
-            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
+            // Some special keys like backspace captured in TextField,
+            // are for some reason not sent to the application but to the text input
+            Keys.onPressed: {                 
                 keyboardLoader.item.pressedKey = event.key;
                 keyboardLoader.item.pressedKeyText = event.text;
             }
@@ -633,9 +635,16 @@
                             rightMargin: units.gu(1)
                         }
 
-                        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
-                            keyboardLoader.item.pressedKey = event.key;
-                            keyboardLoader.item.pressedKeyText = event.text;
+                        // Need to capture special keys like backspace here,
+                        // as they are for some reason not sent to the application but to the text input
+                        Keys.onPressed: { 
+                            // Don't press calculator's visual keys, when modifiers are pressed
+                            // to allow work keyboard shortcuts (eg. Ctrl+C)
+                            if (event.modifiers & Qt.NoModifier) {
+                                
+                                keyboardLoader.item.pressedKey = event.key;
+                                keyboardLoader.item.pressedKeyText = event.text;
+                            }
                         }
 
                         Keys.onReleased: {


Follow ups