Merge lp:~pkunal-parmar/ubuntu-calendar-app/Key_Navi into lp:ubuntu-calendar-app

Proposed by Kunal Parmar
Status: Merged
Approved by: Mihir Soni
Approved revision: 194
Merged at revision: 239
Proposed branch: lp:~pkunal-parmar/ubuntu-calendar-app/Key_Navi
Merge into: lp:ubuntu-calendar-app
Diff against target: 337 lines (+152/-23)
9 files modified
DayView.qml (+2/-0)
EventDetails.qml (+27/-15)
MonthView.qml (+2/-0)
NewEvent.qml (+4/-0)
PathViewBase.qml (+24/-0)
TimeLineBaseComponent.qml (+33/-3)
WeekView.qml (+2/-1)
YearView.qml (+33/-0)
calendar.qml (+25/-4)
To merge this branch: bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/Key_Navi
Reviewer Review Type Date Requested Status
Mihir Soni Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+203201@code.launchpad.net

Commit message

Keyboard navigation implemented

Description of the change

Keyboard navigation implemented
Tab navigation implemented, (CTRL + TAB) to switch
In Year, Day, Week, Month View -> Left/Right arrow to go to next or previous item
In Year, Day, Week, Month View -> Up/(Down| Space) to scroll up or down
In Details View - Escape to go back, CTRL + E to Edit
In Add Event - Escape to go back

To post a comment you must log in.
186. By Kunal Parmar

Edit event using key resolved

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
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

There seems to be an odd skip in the year view. It goes January -> March then leaps to September when you press down arrow.

Also, can we add CTRL+SHIFT+TAB to go backwards to match CTRL+TAB going forwards in tabs?

187. By Kunal Parmar

YearView jump resolved and backtab implemented

188. By Kunal Parmar

Merge from trunk

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> There seems to be an odd skip in the year view. It goes January -> March then
> leaps to September when you press down arrow.
>
> Also, can we add CTRL+SHIFT+TAB to go backwards to match CTRL+TAB going
> forwards in tabs?

This two things I addressed, please check again if you find something missing

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
ybon (yohanboniface) wrote :

So, I've set up my env, and been able to test.
Every binding anounced is working for me (including Ctrl-Shift-TAB) :)

One question I can't answer myself: til wich point we want to have key bindings? For example, does Ctrl-S for save when in edit view, Ctrl-N for New from everywhere (unless edit view) make sense? Return for saving when in a textitem? Echap to close a TimePicker?

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> So, I've set up my env, and been able to test.
> Every binding anounced is working for me (including Ctrl-Shift-TAB) :)
>
> One question I can't answer myself: til wich point we want to have key
> bindings? For example, does Ctrl-S for save when in edit view, Ctrl-N for New
> from everywhere (unless edit view) make sense? Return for saving when in a
> textitem? Echap to close a TimePicker?

In this MR I have not addressed keyboard/Mouse handling required for NewEvent.qml component,
we need to consider Tab key and shortcuts you mentioned.
We also need to make sure key and mouse is properly handled in DatePicker/TimePicker and OptionSelectors.

I think its better to handle it in another MR, once we have Date/Time picker available and integrated.

189. By Kunal Parmar

Merge from trunk

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
190. By Kunal Parmar

Merge from trunk

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
191. By Kunal Parmar

Merge from trunk

192. By Kunal Parmar

Merge issue resolved

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
Martin Borho (martin-borho) wrote :

+1

Looks okay for me.

Revision history for this message
Roman Shchekin (mrqtros) wrote :

This line looks strange:
Keys.forwardTo: [yearView,monthView,weekView,dayView,pageStack.currentPage,tabPage]
because of using "pageStack.currentPage". Is it necessary?

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> This line looks strange:
> Keys.forwardTo:
> [yearView,monthView,weekView,dayView,pageStack.currentPage,tabPage]
> because of using "pageStack.currentPage". Is it necessary?

I agree, that should be enought, I will change

Revision history for this message
Mihir Soni (mihirsoni) wrote :

Works great , i just tested it.
Once you push last changes will make status approved for continuous integration.

Thank you.

review: Approve
Revision history for this message
Mihir Soni (mihirsoni) wrote :

> > This line looks strange:
> > Keys.forwardTo:
> > [yearView,monthView,weekView,dayView,pageStack.currentPage,tabPage]
> > because of using "pageStack.currentPage". Is it necessary?
>
> I agree, that should be enought, I will change

Could you please push this small change , then we can merge this MR.

193. By Kunal Parmar

Merge from Trunk

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> > This line looks strange:
> > Keys.forwardTo:
> > [yearView,monthView,weekView,dayView,pageStack.currentPage,tabPage]
> > because of using "pageStack.currentPage". Is it necessary?
>
> I agree, that should be enought, I will change

Somehow if keys are not forwarded to individual views then they are not getting key events.

I am refacroring the cal app and planning to load only one view at a time.
I will handle this properly there. as I need to change this code anyhow that time

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
194. By Kunal Parmar

merge from trunk

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
Mihir Soni (mihirsoni) wrote :

Looks good.

Thanks you Kunal.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DayView.qml'
2--- DayView.qml 2014-03-26 14:39:17 +0000
3+++ DayView.qml 2014-04-08 08:59:31 +0000
4@@ -11,6 +11,8 @@
5 property var currentDay: new Date()
6 property bool isCurrentPage: false
7
8+ Keys.forwardTo: [dayViewPath]
9+
10 Column {
11 id: column
12 anchors.top: parent.top
13
14=== modified file 'EventDetails.qml'
15--- EventDetails.qml 2014-04-05 06:31:50 +0000
16+++ EventDetails.qml 2014-04-08 08:59:31 +0000
17@@ -95,8 +95,17 @@
18 }
19 }
20
21+ Keys.onEscapePressed: {
22+ pageStack.pop();
23+ }
24+
25+ Keys.onPressed: {
26+ if ((event.key === Qt.Key_E) && ( event.modifiers & Qt.ControlModifier)) {
27+ pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event": root.event});
28+ }
29+ }
30+
31 tools: ToolbarItems {
32-
33 ToolbarButton {
34 action:Action {
35 text: i18n.tr("Delete");
36@@ -214,28 +223,31 @@
37 font.bold: true
38 }
39 //Guest Entery Model starts
40- ListView {
41- id:contactList
42+ Column{
43+ id: contactList
44 spacing: units.gu(1)
45 width: parent.width
46- height: units.gu((contactModel.count*4.5)+3)
47 clip: true
48- model: ListModel {
49+ ListModel {
50 id: contactModel
51 }
52- delegate: Row{
53- spacing: units.gu(1)
54- CheckBox{
55- checked: participationStatus
56- enabled: false
57- }
58- Label {
59- text:name
60- anchors.verticalCenter: parent.verticalCenter
61- color: detailColor
62+ Repeater{
63+ model: contactModel
64+ delegate: Row{
65+ spacing: units.gu(1)
66+ CheckBox{
67+ checked: participationStatus
68+ enabled: false
69+ }
70+ Label {
71+ text:name
72+ anchors.verticalCenter: parent.verticalCenter
73+ color: detailColor
74+ }
75 }
76 }
77 }
78+
79 //Guest Entries ends
80 ThinDivider{}
81 property int recurranceAreaMaxWidth: Math.max( recurrentHeader.headerWidth, reminderHeader.headerWidth) //Dynamic Height
82
83=== modified file 'MonthView.qml'
84--- MonthView.qml 2014-03-22 03:09:07 +0000
85+++ MonthView.qml 2014-04-08 08:59:31 +0000
86@@ -11,6 +11,8 @@
87
88 signal dateSelected(var date);
89
90+ Keys.forwardTo: [monthViewPath]
91+
92 PathViewBase{
93 id: monthViewPath
94
95
96=== modified file 'NewEvent.qml'
97--- NewEvent.qml 2014-04-05 04:49:47 +0000
98+++ NewEvent.qml 2014-04-08 08:59:31 +0000
99@@ -177,6 +177,10 @@
100
101 title: isEdit ? i18n.tr("Edit Event"):i18n.tr("New Event")
102
103+ Keys.onEscapePressed: {
104+ pageStack.pop();
105+ }
106+
107 tools: ToolbarItems {
108 //keeping toolbar always open
109 opened: true
110
111=== modified file 'PathViewBase.qml'
112--- PathViewBase.qml 2013-12-14 02:44:09 +0000
113+++ PathViewBase.qml 2014-04-08 08:59:31 +0000
114@@ -9,6 +9,9 @@
115 signal nextItemHighlighted();
116 signal previousItemHighlighted();
117
118+ signal scrollUp();
119+ signal scrollDown();
120+
121 preferredHighlightBegin: 0.5
122 preferredHighlightEnd: 0.5
123
124@@ -31,8 +34,29 @@
125 return 1;
126 }
127
128+ Keys.onLeftPressed:{
129+ root.decrementCurrentIndex();
130+ }
131+
132+ Keys.onRightPressed:{
133+ root.incrementCurrentIndex();
134+ }
135+
136+ Keys.onSpacePressed: {
137+ root.scrollDown();
138+ }
139+
140+ Keys.onDownPressed: {
141+ root.scrollDown();
142+ }
143+
144+ Keys.onUpPressed: {
145+ root.scrollUp();
146+ }
147+
148 onCurrentIndexChanged: {
149 var diff = currentIndex - intern.previousIndex
150+ if(diff == 0) return;
151
152 if (intern.previousIndex === count - 1 && currentIndex === 0) diff = 1
153 if (intern.previousIndex === 0 && currentIndex === count - 1) diff = -1
154
155=== modified file 'TimeLineBaseComponent.qml'
156--- TimeLineBaseComponent.qml 2014-04-05 04:49:47 +0000
157+++ TimeLineBaseComponent.qml 2014-04-08 08:59:31 +0000
158@@ -15,13 +15,43 @@
159
160 property int type: ViewType.ViewTypeWeek
161
162+ //visible hour
163+ property int scrollHour;
164+
165 function scrollToCurrentTime() {
166 //scroll to current time
167 var currentTime = new Date();
168 //TODO: if current time is early morning should we show time from 9 am ?
169- var hour = currentTime.getHours();
170-
171- timeLineView.contentY = hour * units.gu(10);
172+ scrollHour = currentTime.getHours();
173+
174+ timeLineView.contentY = scrollHour * units.gu(10);
175+ if(timeLineView.contentY >= timeLineView.contentHeight - timeLineView.height) {
176+ timeLineView.contentY = timeLineView.contentHeight - timeLineView.height
177+ }
178+ }
179+
180+ Connections{
181+ target: parent
182+ onScrollUp:{
183+ scrollHour--;
184+ if( scrollHour < 0) {
185+ scrollHour =0;
186+ }
187+ scrollToHour();
188+ }
189+
190+ onScrollDown:{
191+ scrollHour++;
192+ var visibleHour = root.height / units.gu(10);
193+ if( scrollHour > (25 -visibleHour)) {
194+ scrollHour = 25 - visibleHour;
195+ }
196+ scrollToHour();
197+ }
198+ }
199+
200+ function scrollToHour() {
201+ timeLineView.contentY = scrollHour * units.gu(10);
202 if(timeLineView.contentY >= timeLineView.contentHeight - timeLineView.height) {
203 timeLineView.contentY = timeLineView.contentHeight - timeLineView.height
204 }
205
206=== modified file 'WeekView.qml'
207--- WeekView.qml 2014-04-05 04:57:34 +0000
208+++ WeekView.qml 2014-04-08 08:59:31 +0000
209@@ -19,6 +19,8 @@
210 anchors.topMargin: units.gu(1.5)
211 spacing: units.gu(1)
212
213+ Keys.forwardTo: [weekViewPath]
214+
215 ViewHeader{
216 id: viewHeader
217 month: dayStart.getMonth()
218@@ -65,7 +67,6 @@
219
220 delegate: TimeLineBaseComponent {
221 id: timeLineView
222-
223 type: ViewType.ViewTypeWeek
224
225 width: parent.width
226
227=== modified file 'YearView.qml'
228--- YearView.qml 2014-04-04 02:14:33 +0000
229+++ YearView.qml 2014-04-08 08:59:31 +0000
230@@ -25,6 +25,7 @@
231 clip: true
232 focus: index == root.currentIndex
233
234+ property int scrollMonth: 0;
235 property bool isCurrentItem: index == root.currentIndex
236 property int year: (root.currentYear + root.indexType(index))
237
238@@ -39,6 +40,38 @@
239 cellHeight: cellWidth * 1.4
240
241 model: 12 /* months in a year */
242+
243+ onYearChanged : {
244+ scrollMonth=0;
245+ yearView.positionViewAtIndex(scrollMonth,GridView.Beginning);
246+ }
247+
248+ //scroll in case content height changed
249+ onHeightChanged: {
250+ scrollMonth=0;
251+ yearView.positionViewAtIndex(scrollMonth,GridView.Beginning);
252+ }
253+
254+ Connections{
255+ target: root
256+ onScrollUp:{
257+ scrollMonth -= 2;
258+ if(scrollMonth < 0) {
259+ scrollMonth = 0;
260+ }
261+ yearView.positionViewAtIndex(scrollMonth,GridView.Beginning);
262+ }
263+
264+ onScrollDown:{
265+ scrollMonth += 2;
266+ var visibleMonths = yearView.height / cellHeight;
267+ if( scrollMonth >= (11 - visibleMonths)) {
268+ scrollMonth = (11 - visibleMonths);
269+ }
270+ yearView.positionViewAtIndex(scrollMonth,GridView.Beginning);
271+ }
272+ }
273+
274 delegate: Item {
275 width: yearView.cellWidth
276 height: yearView.cellHeight
277
278=== modified file 'calendar.qml'
279--- calendar.qml 2014-04-05 06:34:47 +0000
280+++ calendar.qml 2014-04-08 08:59:31 +0000
281@@ -52,6 +52,8 @@
282
283 width: units.gu(100)
284 height: units.gu(80)
285+ focus: true
286+ Keys.forwardTo: [yearView,monthView,weekView,dayView,pageStack.currentPage,tabPage]
287
288 headerColor: "#266249"
289 backgroundColor: "#478158"
290@@ -184,9 +186,7 @@
291 // This is for wait that the app is load when newEvent is invoked by argument
292 Timer {
293 id: timer
294- interval: 200;
295- running: false;
296- repeat: false
297+ interval: 200; running: false; repeat: false
298 onTriggered: {
299 tabPage.newEvent();
300 }
301@@ -224,6 +224,28 @@
302 }
303 }
304
305+ Keys.onTabPressed: {
306+ if( event.modifiers & Qt.ControlModifier) {
307+ var currentTab = tabs.selectedTabIndex;
308+ currentTab ++;
309+ if( currentTab >= tabs.tabChildren.length){
310+ currentTab = 0;
311+ }
312+ tabs.selectedTabIndex = currentTab;
313+ }
314+ }
315+
316+ Keys.onBacktabPressed: {
317+ if( event.modifiers & Qt.ControlModifier) {
318+ var currentTab = tabs.selectedTabIndex;
319+ currentTab --;
320+ if( currentTab < 0){
321+ currentTab = tabs.tabChildren.length -1;
322+ }
323+ tabs.selectedTabIndex = currentTab;
324+ }
325+ }
326+
327 Tabs{
328 id: tabs
329
330@@ -275,7 +297,6 @@
331 id: weekView
332 anchors.fill: parent
333 isCurrentPage: tabs.selectedTab == weekTab
334-
335 onDayStartChanged: {
336 tabPage.currentDay = dayStart;
337 }

Subscribers

People subscribed via source and target branches

to status/vote changes: