Merge lp:~renatofilho/address-book-app/fix-next-key into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 442
Merged at revision: 441
Proposed branch: lp:~renatofilho/address-book-app/fix-next-key
Merge into: lp:address-book-app
Diff against target: 75 lines (+23/-11)
4 files modified
src/app/addressbookapp.cpp (+0/-9)
src/app/addressbookapp.h (+0/-1)
src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml (+6/-1)
tests/qml/tst_ContactEditor.qml (+17/-0)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/fix-next-key
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+261422@code.launchpad.net

Commit message

Used new "nextItemInFocusChain" function to change field focus while pressing "next" key on keyboard.

To post a comment you must log in.
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

Are there any related MPs required for this MP to build/function as expected?
NO

Is your branch in sync with latest trunk?
YES

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
YES

Did you successfully run all tests found in your component's Test Plan on device or emulator?
YES

If you changed the UI, was the change specified/approved by design?
NO UI CHANGED

If you changed UI labels, did you update the pot file?
NO LABLES CHANGED

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
NO PACKAGE CHANGED

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

Code looks good and works as expected!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/addressbookapp.cpp'
2--- src/app/addressbookapp.cpp 2015-05-07 17:27:16 +0000
3+++ src/app/addressbookapp.cpp 2015-06-08 16:01:16 +0000
4@@ -261,15 +261,6 @@
5 settings.sync();
6 }
7
8-void AddressBookApp::sendTabEvent() const
9-{
10- QKeyEvent keyPressEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier);
11- sendEvent(m_view, &keyPressEvent);
12-
13- QKeyEvent keyReleaseEvent(QEvent::KeyRelease, Qt::Key_Tab, Qt::NoModifier);
14- sendEvent(m_view, &keyReleaseEvent);
15-}
16-
17 void AddressBookApp::goBackToSourceApp()
18 {
19 if (!m_callbackApplication.isEmpty()) {
20
21=== modified file 'src/app/addressbookapp.h'
22--- src/app/addressbookapp.h 2015-05-07 17:27:16 +0000
23+++ src/app/addressbookapp.h 2015-06-08 16:01:16 +0000
24@@ -49,7 +49,6 @@
25 void returnVcard(const QUrl &url);
26 bool isFirstRun() const;
27 void unsetFirstRun() const;
28- void sendTabEvent() const;
29 void goBackToSourceApp();
30
31 // debug
32
33=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml'
34--- src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml 2015-05-07 17:27:16 +0000
35+++ src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml 2015-06-08 16:01:16 +0000
36@@ -92,6 +92,11 @@
37 family: "Ubuntu"
38 pixelSize: activeFocus ? FontUtils.sizeToPixels("large") : FontUtils.sizeToPixels("medium")
39 }
40- Keys.onReturnPressed: application.sendTabEvent();
41+ Keys.onReturnPressed: {
42+ var next = field.nextItemInFocusChain(true)
43+ if (next) {
44+ next.forceActiveFocus()
45+ }
46+ }
47 }
48 }
49
50=== modified file 'tests/qml/tst_ContactEditor.qml'
51--- tests/qml/tst_ContactEditor.qml 2015-04-29 14:22:40 +0000
52+++ tests/qml/tst_ContactEditor.qml 2015-06-08 16:01:16 +0000
53@@ -129,5 +129,22 @@
54 var saveButton = findChild(root, 'save_header_button');
55 tryCompare(saveButton, 'enabled', false);
56 }
57+
58+ function test_enterKeyMoveFocusedItem() {
59+ // firstName start with focus
60+ var textField = findChild(root, 'firstName');
61+ textField.forceActiveFocus()
62+ tryCompare(textField, 'activeFocus', true)
63+
64+ // send a keyreturn click
65+ keyClick(Qt.Key_Return)
66+
67+ // firstName must lost focus
68+ tryCompare(textField, 'activeFocus', false)
69+
70+ // lastName must gain focus
71+ textField = findChild(root, 'lastName');
72+ tryCompare(textField, 'activeFocus', true)
73+ }
74 }
75 }

Subscribers

People subscribed via source and target branches