ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #02690
[Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
Niklas Wenzel has proposed merging lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app.
Commit message:
Fix typing special characters on hardware keyboards
Requested reviews:
Ubuntu Calculator Developers (ubuntu-calculator-dev)
Related bugs:
Bug #1449037 in Ubuntu Calculator App: ""Backspace" and "delete" keys don't work on Desktop"
https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1449037
For more details, see:
https://code.launchpad.net/~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts/+merge/261747
Fix typing special characters on hardware keyboards.
Makes the app usable on the desktop. :)
--
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app.
=== modified file 'app/ubuntu-calculator-app.qml'
--- app/ubuntu-calculator-app.qml 2015-04-26 22:41:49 +0000
+++ app/ubuntu-calculator-app.qml 2015-06-11 15:45:00 +0000
@@ -287,7 +287,7 @@
id: calculationHistory
}
- Keys.onPressed: {
+ 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
keyboardLoader.item.pressedKey = event.key;
keyboardLoader.item.pressedKeyText = event.text;
}
@@ -630,6 +630,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;
+ }
+
+ Keys.onReleased: {
+ keyboardLoader.item.pressedKey = -1;
+ keyboardLoader.item.pressedKeyText = "";
+ }
+
readOnly: true
selectByMouse: true
cursorVisible: true
=== modified file 'app/ui/LandscapeKeyboard.qml'
--- app/ui/LandscapeKeyboard.qml 2015-03-12 21:21:47 +0000
+++ app/ui/LandscapeKeyboard.qml 2015-06-11 15:45:00 +0000
@@ -10,12 +10,12 @@
columns: 8
keyboardModel: new Array(
- { text: "←", name: "delete", wFactor: 2, action: "delete", kbdKeys: [Qt.Key_Backspace], secondaryAction: "clearFormula" },
+ { text: "←", name: "delete", wFactor: 2, action: "delete", kbdKeys: [Qt.Key_Backspace, Qt.Key_Delete], secondaryAction: "clearFormula" },
{ text: "√", name: "sqrt", pushText: "sqrt(" },
{ text: "÷", name: "divide", pushText: "/", kbdKeys: [Qt.Key_Slash] },
- { text: "xⁿ", name: "power", pushText: "^", kbdKeys: [Qt.Key_AsciiCircum] },
- { text: "x²", name: "square", pushText: "^2" },
- { text: "x³", name: "cube", pushText: "^3" },
+ { text: "xⁿ", name: "power", pushText: "^", kbdKeys: [Qt.Key_AsciiCircum, 16781906] }, //Number needed to make key work with the German keyboard layout as that character is normally typed by pressing the circumflex key twice but that does not work here
+ { text: "x²", name: "square", pushText: "^2", kbdKeys: [Qt.Key_twosuperior] },
+ { text: "x³", name: "cube", pushText: "^3", kbdKeys: [Qt.Key_threesuperior] },
{ text: i18n.tr("log"), name: "logarithm", pushText: "log(", kbdKeys: [Qt.Key_L] },
{ number: 7, name: "seven", textColor: "#DD4814" },
{ number: 8, name: "eight", textColor: "#DD4814" },
@@ -43,9 +43,9 @@
{ text: "tan", name: "tangens", pushText: "tan(", kbdKeys: [Qt.Key_T] },
{ text: decimalPoint, name: "point", pushText: ".", textColor: "#DD4814" },
{ number: 0, name: "zero", textColor: "#DD4814", forceNumber: true },
- { text: "( )", name: "universalBracket", pushText: "()", textColor: "#DD4814" },
+ { text: "( )", name: "universalBracket", pushText: "()", textColor: "#DD4814", kbdKeys: [Qt.Key_ParenLeft, Qt.Key_ParenRight, Qt.Key_BracketLeft, Qt.Key_BracketRight] },
{ text: "=", name: "equals", action: "calculate", kbdKeys: [Qt.Key_Enter, Qt.Key_Return] },
- { text: "|x|", name: "abs", pushText: "abs(", kbdKeys: [Qt.Key_A] },
+ { text: "|x|", name: "abs", pushText: "abs(", kbdKeys: [Qt.Key_A, Qt.Key_Bar] },
{ text: "sin⁻¹", name: "arcsinus", pushText: "asin(" },
{ text: "cos⁻¹", name: "arccos", pushText: "acos(" },
{ text: "tan⁻¹", name: "arctangens", pushText: "atan(" }
=== modified file 'app/ui/PortraitKeyboard.qml'
--- app/ui/PortraitKeyboard.qml 2015-03-12 21:21:47 +0000
+++ app/ui/PortraitKeyboard.qml 2015-06-11 15:45:00 +0000
@@ -9,7 +9,7 @@
buttonMaxHeight: scrollableView.height / 10.0
keyboardModel: new Array(
- { text: "←", name: "delete", wFactor: 2, action: "delete", kbdKeys: [Qt.Key_Backspace], secondaryAction: "clearFormula" },
+ { text: "←", name: "delete", wFactor: 2, action: "delete", kbdKeys: [Qt.Key_Backspace, Qt.Key_Delete], secondaryAction: "clearFormula" },
{ text: "√", name: "sqrt", pushText: "sqrt("},
{ text: "÷", name: "divide", pushText: "/", kbdKeys: [Qt.Key_Slash] },
{ number: 7, name: "seven", textColor: "#DD4814" },
@@ -26,7 +26,7 @@
{ text: "+", name: "plus" },
{ text: decimalPoint, name: "point", pushText: ".", textColor: "#DD4814" },
{ number: 0, name: "zero", textColor: "#DD4814", forceNumber: true },
- { text: "( )", name: "universalBracket", pushText: "()", textColor: "#DD4814" },
+ { text: "( )", name: "universalBracket", pushText: "()", textColor: "#DD4814", kbdKeys: [Qt.Key_ParenLeft, Qt.Key_ParenRight, Qt.Key_BracketLeft, Qt.Key_BracketRight] },
{ text: "=", name: "equals", action: "calculate", kbdKeys: [Qt.Key_Enter, Qt.Key_Return] }
)
}
@@ -36,15 +36,15 @@
buttonMaxHeight: scrollableView.height / 10.0
keyboardModel: new Array(
- { text: "xⁿ", name: "power", pushText: "^", kbdKeys: [Qt.Key_AsciiCircum] },
- { text: "x²", name: "square", pushText: "^2" },
- { text: "x³", name: "cube", pushText: "^3" },
+ { text: "xⁿ", name: "power", pushText: "^", kbdKeys: [Qt.Key_AsciiCircum, 16781906] }, //Number needed to make key work with the German keyboard layout as that character is normally typed by pressing the circumflex key twice but that does not work here
+ { text: "x²", name: "square", pushText: "^2", kbdKeys: [Qt.Key_twosuperior] },
+ { text: "x³", name: "cube", pushText: "^3", kbdKeys: [Qt.Key_threesuperior] },
{ text: i18n.tr("log"), name: "logarithm", pushText: "log(", kbdKeys: [Qt.Key_L] },
{ text: "ℯ", name: "eNumber", pushText: "E", kbdKeys: [Qt.Key_E] },
{ text: "π", name: "piNumber", pushText: "pi", kbdKeys: [Qt.Key_P] },
{ text: i18n.tr("mod"), name: "modulo", pushText: "%", kbdKeys: [Qt.Key_Percent] },
{ text: "!", name: "factorialNumber", kbdKeys: [Qt.Key_Exclam] },
- { text: "ℯⁿ", name: "exp", pushText: "E^"},
+ { text: "ℯⁿ", name: "exp", pushText: "E^" },
{ text: "1/x", name: "multiplicativeInverse", pushText: "^-1" },
{ text: "1/x²", name: "multiplicativeInverse2", pushText: "^-2" },
{ text: "1/x³", name: "multiplicativeInverse3", pushText: "^-3" },
@@ -52,7 +52,7 @@
{ text: "sin", name: "sinus", pushText: "sin(", kbdKeys: [Qt.Key_S] },
{ text: "cos", name: "cos", pushText: "cos(", kbdKeys: [Qt.Key_C] },
{ text: "tan", name: "tangens", pushText: "tan(", kbdKeys: [Qt.Key_T] },
- { text: "|x|", name: "abs", pushText: "abs(", kbdKeys: [Qt.Key_A] },
+ { text: "|x|", name: "abs", pushText: "abs(", kbdKeys: [Qt.Key_A, Qt.Key_Bar] },
{ text: "sin⁻¹", name: "arcsinus", pushText: "asin(" },
{ text: "cos⁻¹", name: "arccos", pushText: "acos(" },
{ text: "tan⁻¹", name: "arctangens", pushText: "atan(" }
Follow ups
-
Re: [Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Niklas Wenzel, 2015-06-12
-
Re: [Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Niklas Wenzel, 2015-06-12
-
Re: [Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Bartosz Kosiorek, 2015-06-12
-
[Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: noreply, 2015-06-12
-
Re: [Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-06-12
-
Re: [Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Niklas Wenzel, 2015-06-11
-
[Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Riccardo Padovani, 2015-06-11
-
Re: [Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Riccardo Padovani, 2015-06-11
-
Re: [Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Niklas Wenzel, 2015-06-11
-
[Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-06-11
-
Re: [Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-06-11
-
[Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Riccardo Padovani, 2015-06-11
-
Re: [Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Riccardo Padovani, 2015-06-11
-
Re: [Merge] lp:~nikwen/ubuntu-calculator-app/fix-desktop-shortcuts into lp:ubuntu-calculator-app
From: Ubuntu Phone Apps Jenkins Bot, 2015-06-11