Merge lp:~gerlowskija/ubuntu-calendar-app/click_day_from_week_view_bug1291504 into lp:ubuntu-calendar-app

Proposed by Jason
Status: Merged
Approved by: Kunal Parmar
Approved revision: 224
Merged at revision: 232
Proposed branch: lp:~gerlowskija/ubuntu-calendar-app/click_day_from_week_view_bug1291504
Merge into: lp:ubuntu-calendar-app
Diff against target: 186 lines (+76/-16)
6 files modified
HeaderDateComponent.qml (+31/-16)
TimeLineHeader.qml (+6/-0)
TimeLineHeaderComponent.qml (+6/-0)
WeekView.qml (+6/-0)
calendar.qml (+5/-0)
tests/autopilot/calendar_app/tests/test_weekview.py (+22/-0)
To merge this branch: bzr merge lp:~gerlowskija/ubuntu-calendar-app/click_day_from_week_view_bug1291504
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Jason (community) Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Kunal Parmar Needs Fixing
Review via email: mp+212959@code.launchpad.net

Commit message

Switch to selected date in 'Day View' when user clicks on day in 'Week View'

Description of the change

As part of the HackDay for the Calendar app, I wanted to address Bug 1921504, which requests that support be added for "zooming-in" to individual days by clicking on the date from the Week View.

This branch should contain a commit for the change that allows users to pull up the Day view when they click on a day, as well as a commit with an autopilot test that can be run to check this behavior.

You can test the change by:
     1) Open the calendar app.
     2) Navigate to the "Week" view/tab.
     3) Click on on of the days of the week (either the name of the day (Mon, Tue, Wed, etc), or the date that should be right below it).
     4) Check that the display now shows the "Day" view/tab, and that you're looking at the day you selected

(Hopefully I staged and pushed my changes correctly; bit of a bzr novice).

To post a comment you must log in.
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

+ MouseArea {
18 + anchors.fill: parent
19 + onClicked: {
20 + root.dateSelected(date);
21 + }
22 + }

I think it would be better if we add this click handler to parent component( i mean the root id), so we dont need to add separate handler for both label component.

review: Needs Fixing
Revision history for this message
Jason (gerlowskija) wrote :

> + MouseArea {
> 18 + anchors.fill: parent
> 19 + onClicked: {
> 20 + root.dateSelected(date);
> 21 + }
> 22 + }
>
> I think it would be better if we add this click handler to parent component( i
> mean the root id), so we dont need to add separate handler for both label
> component.

Thanks for the quick review! Your comment makes sense. I spent 5 minutes trying to make the change naively so it looks like:
Column {
    Label {}
    Label {}
    MouseArea {}
}

but something I did mangles the display a bit, and the click action doesn't work on the dates any more. I'll have to take a harder look later today when I have a little more time.

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

ok, I will also check if same works at my end as well.
thanks for confirmation

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

Take this solution, please :)

import QtQuick 2.0
import Ubuntu.Components 0.1

Item {
    id: root

    property var date;

    property alias dateColor: dateLabel.color
    property alias dayColor: dayLabel.color

    property int dayFormat: Locale.ShortFormat;

    signal dateSelected(var date);

    width: parent.width
    height: innerColumn.height

    Column {
        id: innerColumn
        width: parent.width
        spacing: units.gu(2)

        Label{
            id: dayLabel
            property var day: Qt.locale().standaloneDayName(date.getDay(), dayFormat)
            text: day.toUpperCase();
            fontSize: "medium"
            horizontalAlignment: Text.AlignHCenter
            color: "#AEA79F"
            width: parent.width
        }

        Label{
            id: dateLabel
            objectName: "dateLabel"
            text: date.getDate();
            fontSize: "large"
            horizontalAlignment: Text.AlignHCenter
            width: parent.width
        }
    }

    MouseArea {
        anchors.fill: parent
        onClicked: {
            root.dateSelected(date);
        }
    }
}

> > + MouseArea {
> > 18 + anchors.fill: parent
> > 19 + onClicked: {
> > 20 + root.dateSelected(date);
> > 21 + }
> > 22 + }
> >
> > I think it would be better if we add this click handler to parent component(
> i
> > mean the root id), so we dont need to add separate handler for both label
> > component.
>
> Thanks for the quick review! Your comment makes sense. I spent 5 minutes
> trying to make the change naively so it looks like:
> Column {
> Label {}
> Label {}
> MouseArea {}
> }
>
> but something I did mangles the display a bit, and the click action doesn't
> work on the dates any more. I'll have to take a harder look later today when
> I have a little more time.

Revision history for this message
Jason (gerlowskija) wrote :

I'd be happy to : ) Thanks for the help Roman, I'm embarassed to say I'd been struggling to debug my QML for the last week. Really have some reading up to do.

I'll redraft the changes based on your comment and push up a revision tonight.

Thanks again!

Revision history for this message
Jason (gerlowskija) wrote :

This might be a dumb question, but I couldn't find any advice on StackOverflow/Google/etc...

Does bzr have an equivalent to git's "commit --amend". I'm not sure how to push my new changes, short of making a new revision/commit for the edits, which doesn't seem right to me.

I tried uncommit-ing, adding in the changes, and recommitting, but bzr told me that the branches had diverged. Is that the standard approach for revising pushed commits? (I might have just done it incorrectly).

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

> This might be a dumb question, but I couldn't find any advice on
> StackOverflow/Google/etc...
>
> Does bzr have an equivalent to git's "commit --amend". I'm not sure how to
> push my new changes, short of making a new revision/commit for the edits,
> which doesn't seem right to me.
>
> I tried uncommit-ing, adding in the changes, and recommitting, but bzr told me
> that the branches had diverged. Is that the standard approach for revising
> pushed commits? (I might have just done it incorrectly).

I follow, following worksflow.

bzr branch ...
bzr commit -m 'New changes"
bzr push

bzr merge
bzr commit -m "furhter changes"
bzr push

Revision history for this message
David Planella (dpm) wrote :

Jason,

Amending or uncommitting (bzr uncommit) is only for local changes before a
push to a server. In general, you should not be amending branches that have
already been pushed publicly, as it will mess up the VCS hosting and anyone
else's local branches that have been checked out from there. Last time I
checked git out, this was also the advice there, although I've not been
using it for a while.

In summary: it's ok to do new commits for the corrections. Let us know if
we can help you with questions on #ubuntu-app-devel

Cheers,
David.

On Wed, Apr 2, 2014 at 6:22 AM, Kunal Parmar <email address hidden>wrote:

> > This might be a dumb question, but I couldn't find any advice on
> > StackOverflow/Google/etc...
> >
> > Does bzr have an equivalent to git's "commit --amend". I'm not sure how
> to
> > push my new changes, short of making a new revision/commit for the edits,
> > which doesn't seem right to me.
> >
> > I tried uncommit-ing, adding in the changes, and recommitting, but bzr
> told me
> > that the branches had diverged. Is that the standard approach for
> revising
> > pushed commits? (I might have just done it incorrectly).
>
> I follow, following worksflow.
>
> bzr branch ...
> bzr commit -m 'New changes"
> bzr push
>
> bzr merge
> bzr commit -m "furhter changes"
> bzr push
> --
>
> https://code.launchpad.net/~gerlowskija/ubuntu-calendar-app/click_day_from_week_view_bug1291504/+merge/212959
> Your team Ubuntu Calendar Developers is subscribed to branch
> lp:ubuntu-calendar-app.
>

Revision history for this message
Jason (gerlowskija) wrote :

Thanks David, I figured out my problem thanks to the comments you and Kunal posted. I repushed the branch and it should be ready for review whenever.

Thanks again for all the noob help.

Jason

> Jason,
>
> Amending or uncommitting (bzr uncommit) is only for local changes before a
> push to a server. In general, you should not be amending branches that have
> already been pushed publicly, as it will mess up the VCS hosting and anyone
> else's local branches that have been checked out from there. Last time I
> checked git out, this was also the advice there, although I've not been
> using it for a while.
>
> In summary: it's ok to do new commits for the corrections. Let us know if
> we can help you with questions on #ubuntu-app-devel
>
> Cheers,
> David.
>
>
> On Wed, Apr 2, 2014 at 6:22 AM, Kunal Parmar <email address hidden>wrote:
>
> > > This might be a dumb question, but I couldn't find any advice on
> > > StackOverflow/Google/etc...
> > >
> > > Does bzr have an equivalent to git's "commit --amend". I'm not sure how
> > to
> > > push my new changes, short of making a new revision/commit for the edits,
> > > which doesn't seem right to me.
> > >
> > > I tried uncommit-ing, adding in the changes, and recommitting, but bzr
> > told me
> > > that the branches had diverged. Is that the standard approach for
> > revising
> > > pushed commits? (I might have just done it incorrectly).
> >
> > I follow, following worksflow.
> >
> > bzr branch ...
> > bzr commit -m 'New changes"
> > bzr push
> >
> > bzr merge
> > bzr commit -m "furhter changes"
> > bzr push
> > --
> >
> > https://code.launchpad.net/~gerlowskija/ubuntu-calendar-
> app/click_day_from_week_view_bug1291504/+merge/212959
> > Your team Ubuntu Calendar Developers is subscribed to branch
> > lp:ubuntu-calendar-app.
> >

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Looks good to me, thanks!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https://code.launchpad.net/~gerlowskija/ubuntu-calendar-app/click_day_from_week_view_bug1291504/+merge/212959/+edit-commit-message

review: Needs Fixing (continuous-integration)
Revision history for this message
Jason (gerlowskija) wrote :

Added a commit message, and remarked as approve.

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'HeaderDateComponent.qml'
2--- HeaderDateComponent.qml 2013-10-28 21:08:48 +0000
3+++ HeaderDateComponent.qml 2014-04-02 10:38:29 +0000
4@@ -1,7 +1,7 @@
5 import QtQuick 2.0
6 import Ubuntu.Components 0.1
7
8-Column{
9+Item {
10 id: root
11
12 property var date;
13@@ -11,25 +11,40 @@
14
15 property int dayFormat: Locale.ShortFormat;
16
17+ signal dateSelected(var date);
18+
19 width: parent.width
20- spacing: units.gu(2)
21+ height: innerColumn.height
22
23- Label{
24- id: dayLabel
25- property var day: Qt.locale().standaloneDayName(date.getDay(), dayFormat)
26- text: day.toUpperCase();
27- fontSize: "medium"
28- horizontalAlignment: Text.AlignHCenter
29- color: "#AEA79F"
30+ Column {
31+ id: innerColumn
32 width: parent.width
33+ spacing: units.gu(2)
34+
35+ Label{
36+ id: dayLabel
37+ property var day: Qt.locale().standaloneDayName(date.getDay(), dayFormat)
38+ text: day.toUpperCase();
39+ fontSize: "medium"
40+ horizontalAlignment: Text.AlignHCenter
41+ color: "#AEA79F"
42+ width: parent.width
43+ }
44+
45+ Label{
46+ id: dateLabel
47+ objectName: "dateLabel"
48+ text: date.getDate();
49+ fontSize: "large"
50+ horizontalAlignment: Text.AlignHCenter
51+ width: parent.width
52+ }
53 }
54
55- Label{
56- id: dateLabel
57- objectName: "dateLabel"
58- text: date.getDate();
59- fontSize: "large"
60- horizontalAlignment: Text.AlignHCenter
61- width: parent.width
62+ MouseArea {
63+ anchors.fill: parent
64+ onClicked: {
65+ root.dateSelected(date);
66+ }
67 }
68 }
69
70=== modified file 'TimeLineHeader.qml'
71--- TimeLineHeader.qml 2014-02-12 00:24:25 +0000
72+++ TimeLineHeader.qml 2014-04-02 10:38:29 +0000
73@@ -17,6 +17,8 @@
74
75 property var date;
76
77+ signal dateSelected(var date);
78+
79 DayHeaderBackground{
80 height: FontUtils.sizeToPixels("medium") + units.gu(1.5)
81 }
82@@ -38,6 +40,10 @@
83
84 startDay: getStartDate();
85
86+ onDateSelected: {
87+ header.dateSelected(date);
88+ }
89+
90 function getStartDate() {
91 switch(type) {
92 case ViewType.ViewTypeWeek:
93
94=== modified file 'TimeLineHeaderComponent.qml'
95--- TimeLineHeaderComponent.qml 2014-01-31 03:20:40 +0000
96+++ TimeLineHeaderComponent.qml 2014-04-02 10:38:29 +0000
97@@ -13,6 +13,8 @@
98 property var startDay: DateExt.today();
99 property bool isCurrentItem: false
100
101+ signal dateSelected(var date);
102+
103 width: parent.width
104
105 Repeater{
106@@ -45,6 +47,10 @@
107 header.width
108 }
109 }
110+
111+ onDateSelected: {
112+ header.dateSelected(date);
113+ }
114 }
115 }
116 }
117
118=== modified file 'WeekView.qml'
119--- WeekView.qml 2014-03-26 14:39:17 +0000
120+++ WeekView.qml 2014-04-02 10:38:29 +0000
121@@ -12,6 +12,8 @@
122 property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek);
123 property bool isCurrentPage: false
124
125+ signal dateSelected(var date);
126+
127 anchors.fill: parent
128 anchors.top: parent.top
129 anchors.topMargin: units.gu(1.5)
130@@ -28,6 +30,10 @@
131 objectName: "weekHeader"
132 type: ViewType.ViewTypeWeek
133 date: weekViewPath.weekStart
134+
135+ onDateSelected: {
136+ root.dateSelected(date);
137+ }
138 }
139
140 PathViewBase{
141
142=== modified file 'calendar.qml'
143--- calendar.qml 2014-03-30 13:13:35 +0000
144+++ calendar.qml 2014-04-02 10:38:29 +0000
145@@ -290,6 +290,11 @@
146 onDayStartChanged: {
147 tabPage.currentDay = dayStart;
148 }
149+
150+ onDateSelected: {
151+ tabs.selectedTabIndex = 3;
152+ tabPage.currentDay = date;
153+ }
154 }
155 }
156 }
157
158=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
159--- tests/autopilot/calendar_app/tests/test_weekview.py 2014-02-24 15:58:49 +0000
160+++ tests/autopilot/calendar_app/tests/test_weekview.py 2014-04-02 10:38:29 +0000
161@@ -154,3 +154,25 @@
162 """It must be possible to show previous weeks by swiping the view."""
163 for i in range(6):
164 self._change_week(-1)
165+
166+ def test_selecting_a_day_switches_to_day_view(self):
167+ """It must be possible to show a single day by clicking on it."""
168+ first_day_date = self.week_view.firstDay
169+ expected_day = first_day_date.day
170+ expected_month = first_day_date.month
171+ expected_year = first_day_date.year
172+
173+ days = self._get_days_of_week()
174+ day_to_select = self.main_view.get_label_with_text(days[0])
175+
176+ self.pointing_device.click_object(day_to_select)
177+
178+ #Check that the view changed from 'Week' to 'Day'
179+ day_view = self.main_view.get_day_view()
180+ self.assertThat(day_view.visible, Eventually(Equals(True)))
181+
182+ #Check that the 'Day' view is on the correct/selected day.
183+ selected_date = day_view.select_single("TimeLineHeader").date
184+ self.assertThat(expected_day, Equals(selected_date.day))
185+ self.assertThat(expected_month, Equals(selected_date.month))
186+ self.assertThat(expected_year, Equals(selected_date.year))

Subscribers

People subscribed via source and target branches

to status/vote changes: