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

Proposed by Kunal Parmar
Status: Merged
Approved by: Mihir Soni
Approved revision: 516
Merged at revision: 516
Proposed branch: lp:~pkunal-parmar/ubuntu-calendar-app/TimeInputComponent
Merge into: lp:ubuntu-calendar-app
Diff against target: 243 lines (+102/-101)
2 files modified
NewEvent.qml (+27/-101)
NewEventTimePicker.qml (+75/-0)
To merge this branch: bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/TimeInputComponent
Reviewer Review Type Date Requested Status
Mihir Soni Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+239120@code.launchpad.net

Commit message

Moved Time input to separate component

Description of the change

Moved Time input to separate component

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

Looks Good to me !
Thanks kunal.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NewEvent.qml'
--- NewEvent.qml 2014-10-20 15:24:00 +0000
+++ NewEvent.qml 2014-10-21 19:00:00 +0000
@@ -43,14 +43,12 @@
43 property bool isEdit: false43 property bool isEdit: false
4444
45 onStartDateChanged: {45 onStartDateChanged: {
46 startDateInput.text = startDate.toLocaleDateString();46 startDateTimeInput.dateTime = startDate;
47 startTimeInput.text = Qt.formatTime(startDate);
48 adjustEndDateToStartDate()47 adjustEndDateToStartDate()
49 }48 }
5049
51 onEndDateChanged: {50 onEndDateChanged: {
52 endDateInput.text = endDate.toLocaleDateString();51 endDateTimeInput.dateTime = endDate;
53 endTimeInput.text = Qt.formatTime(endDate);
54 }52 }
5553
56 head.actions: Action {54 head.actions: Action {
@@ -229,15 +227,6 @@
229 return daysOfWeek;227 return daysOfWeek;
230 }228 }
231229
232 function openDatePicker (element, caller, callerProperty, mode) {
233 element.highlighted = true;
234 var picker = PickerPanel.openDatePicker(caller, callerProperty, mode);
235 if (!picker) return;
236 picker.closed.connect(function () {
237 element.highlighted = false;
238 });
239 }
240
241 // Calucate default hour and minute for start and end time on event230 // Calucate default hour and minute for start and end time on event
242 function roundDate(date) {231 function roundDate(date) {
243 var tempDate = new Date(date)232 var tempDate = new Date(date)
@@ -336,90 +325,29 @@
336325
337 width: parent.width326 width: parent.width
338327
339 ListItem.Header {328 NewEventTimePicker{
340 text: i18n.tr("From")329 id: startDateTimeInput
341 }330 header: i18n.tr("From")
342331 showTimePicker: !allDayEventCheckbox.checked
343 Item {332 anchors {
344 anchors {333 left: parent.left
345 left: parent.left334 right: parent.right
346 right: parent.right335 }
347 margins: units.gu(2)336 onDateTimeChanged: {
348 }337 startDate = dateTime;
349338 }
350 height: startDateInput.height339 }
351340
352 NewEventEntryField{341 NewEventTimePicker{
353 id: startDateInput342 id: endDateTimeInput
354 objectName: "startDateInput"343 header: i18n.tr("To")
355344 showTimePicker: !allDayEventCheckbox.checked
356 text: ""345 anchors {
357 anchors.left: parent.left346 left: parent.left
358 width: allDayEventCheckbox.checked ? parent.width : 4 * parent.width / 5347 right: parent.right
359348 }
360 MouseArea{349 onDateTimeChanged: {
361 anchors.fill: parent350 endDate = dateTime;
362 onClicked: openDatePicker(startDateInput, root, "startDate", "Years|Months|Days")
363 }
364 }
365
366 NewEventEntryField{
367 id: startTimeInput
368 objectName: "startTimeInput"
369
370 text: ""
371 anchors.right: parent.right
372 width: parent.width / 5
373 visible: !allDayEventCheckbox.checked
374 horizontalAlignment: Text.AlignRight
375
376 MouseArea{
377 anchors.fill: parent
378 onClicked: openDatePicker(startTimeInput, root, "startDate", "Hours|Minutes")
379 }
380 }
381 }
382
383 ListItem.Header {
384 text: i18n.tr("To")
385 }
386
387 Item {
388 anchors {
389 left: parent.left
390 right: parent.right
391 margins: units.gu(2)
392 }
393
394 height: endDateInput.height
395
396 NewEventEntryField{
397 id: endDateInput
398 objectName: "endDateInput"
399
400 text: ""
401 anchors.left: parent.left
402 width: allDayEventCheckbox.checked ? parent.width : 4 * parent.width / 5
403
404 MouseArea{
405 anchors.fill: parent
406 onClicked: openDatePicker(endDateInput, root, "endDate", "Years|Months|Days")
407 }
408 }
409
410 NewEventEntryField{
411 id: endTimeInput
412 objectName: "endTimeInput"
413 text: ""
414 width: parent.width / 5
415 visible: !allDayEventCheckbox.checked
416 anchors.right: parent.right
417 horizontalAlignment: Text.AlignRight
418
419 MouseArea{
420 anchors.fill: parent
421 onClicked: openDatePicker(endTimeInput, root, "endDate", "Hours|Minutes")
422 }
423 }351 }
424 }352 }
425353
@@ -676,10 +604,8 @@
676 Qt.inputMethod.hide()604 Qt.inputMethod.hide()
677 titleEdit.focus = false605 titleEdit.focus = false
678 locationEdit.focus = false606 locationEdit.focus = false
679 startDateInput.focus = false607 startDateTimeInput.clearFocus();
680 startTimeInput.focus = false608 endDateTimeInput.clearFocus();
681 endDateInput.focus = false
682 endTimeInput.focus = false
683 messageEdit.focus = false609 messageEdit.focus = false
684 }610 }
685611
686612
=== added file 'NewEventTimePicker.qml'
--- NewEventTimePicker.qml 1970-01-01 00:00:00 +0000
+++ NewEventTimePicker.qml 2014-10-21 19:00:00 +0000
@@ -0,0 +1,75 @@
1import QtQuick 2.3
2import Ubuntu.Components.ListItems 1.0 as ListItem
3import Ubuntu.Components.Themes.Ambiance 1.0
4import Ubuntu.Components.Pickers 1.0
5
6Column {
7 id: dateTimeInput
8 property alias header: listHeader.text
9
10 property date dateTime;
11 property bool showTimePicker;
12
13 function clearFocus() {
14 dateInput.focus = false;
15 timeInput.focus = false;
16 }
17
18 function openDatePicker (element, caller, callerProperty, mode) {
19 element.highlighted = true;
20 var picker = PickerPanel.openDatePicker(caller, callerProperty, mode);
21 if (!picker) return;
22 picker.closed.connect(function () {
23 element.highlighted = false;
24 });
25 }
26
27 onDateTimeChanged: {
28 dateInput.text = dateTime.toLocaleDateString();
29 timeInput.text = Qt.formatTime(dateTime);
30 }
31
32 ListItem.Header {
33 id: listHeader
34 }
35
36 Item {
37 anchors {
38 left: parent.left
39 right: parent.right
40 margins: units.gu(2)
41 }
42
43 height: dateInput.height
44
45 NewEventEntryField{
46 id: dateInput
47 objectName: "dateInput"
48
49 text: ""
50 anchors.left: parent.left
51 width: !showTimePicker ? parent.width : 4 * parent.width / 5
52
53 MouseArea{
54 anchors.fill: parent
55 onClicked: openDatePicker(dateInput, dateTimeInput, "dateTime", "Years|Months|Days")
56 }
57 }
58
59 NewEventEntryField{
60 id: timeInput
61 objectName: "timeInput"
62
63 text: ""
64 anchors.right: parent.right
65 width: parent.width / 5
66 visible: showTimePicker
67 horizontalAlignment: Text.AlignRight
68
69 MouseArea{
70 anchors.fill: parent
71 onClicked: openDatePicker(timeInput, dateTimeInput, "dateTime", "Hours|Minutes")
72 }
73 }
74 }
75}

Subscribers

People subscribed via source and target branches

to status/vote changes: