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

Proposed by Kunal Parmar
Status: Merged
Approved by: Frank Mertens
Approved revision: 18
Merged at revision: 19
Proposed branch: lp:~pkunal-parmar/ubuntu-calendar-app/DiaryViewDelegate
Merge into: lp:ubuntu-calendar-app
Diff against target: 219 lines (+175/-4)
3 files modified
DiaryView.qml (+3/-3)
DiaryViewDelegate.qml (+171/-0)
EventDetails.qml (+1/-1)
To merge this branch: bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/DiaryViewDelegate
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Calendar Developers Pending
Review via email: mp+158740@code.launchpad.net

Commit message

DiaryViewDelegate.qml added and some other minor modification

Description of the change

Delegate for Diary view (DiaryViewDelegate.qml) added and done some other minor modification

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
Frank Mertens (frankencode) wrote :

On Raring I get errors unrelated to the changes.

frank@nova:~/Source/Ubuntu/Calendar/DiaryViewDelegate$ qmlscene calendar.qml
"Error on creating style rule:
import QtQuick 2.0
import qmltheme 0.1
import Ubuntu.Components 0.1

HeaderDelegate{}

:5 Type HeaderDelegate unavailable
file:///usr/share/themes/Ambiance/qmltheme/HeaderDelegate.qml:110 Header is not a type
"
QQmlComponent: Component is not ready
file:///home/frank/Source/Ubuntu/Calendar/DiaryViewDelegate/EventDetails.qml:17: TypeError: Cannot read property 'header' of null

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DiaryView.qml'
2--- DiaryView.qml 2013-04-02 11:34:52 +0000
3+++ DiaryView.qml 2013-04-13 04:52:26 +0000
4@@ -1,6 +1,7 @@
5 import QtQuick 2.0
6 import Ubuntu.Components 0.1
7 import Ubuntu.Components.ListItems 0.1 as ListItem
8+
9 import "dateExt.js" as DateExt
10 import "colorUtils.js" as Color
11
12@@ -21,6 +22,7 @@
13 clip: true
14
15 model: EventListModel {
16+ id: eventModel
17 termStart: dayStart
18 termLength: Date.msPerDay
19 }
20@@ -42,9 +44,7 @@
21 }
22 }
23
24- delegate: ListItem.Standard {
25- text: startTime.toLocaleTimeString(Qt.locale(i18n.language), Locale.ShortFormat) + " " + title
26-
27+ delegate: DiaryViewDelegate{
28 onClicked: {
29 pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{event:diaryView.model.get(index)});
30 }
31
32=== added file 'DiaryViewDelegate.qml'
33--- DiaryViewDelegate.qml 1970-01-01 00:00:00 +0000
34+++ DiaryViewDelegate.qml 2013-04-13 04:52:26 +0000
35@@ -0,0 +1,171 @@
36+import QtQuick 2.0
37+import Ubuntu.Components 0.1
38+
39+import "dataService.js" as DataService
40+
41+Item {
42+ id: delegateRoot
43+
44+ property color textColor: "black"
45+ //property color bgColor: "#f1f1f1";
46+ property color bgColor: "white";
47+
48+ signal clicked(int index);
49+
50+ function collapse( collapse ) {
51+ attendeesLayout.visible = !collapse;
52+ locationLayout.visible = !collapse;
53+ eventRoot.collapsed = collapse;
54+ }
55+
56+ function showEventData() {
57+ // FIXME: remove test value, need to decide what to do if there is no location, hide it ?
58+ var venues = [{"name":"Test Venue"}]
59+ DataService.getVenues(eventModel.get(index), venues)
60+ if( venues.length > 0 ) {
61+ locationLabel.text = venues[0].name;
62+ }
63+
64+ // FIXME: remove test value, need to decide what to do if there are no attendees, hide it ?
65+ var attendees = ["Test One","Test Two"]
66+ DataService.getAttendees(eventModel.get(index),attendees)
67+ attendeeLabel.text = attendees.toString();
68+ }
69+
70+ function dataChanged() {
71+ collapse(true);
72+
73+ var now = new Date;
74+ var lastEvent = eventModel.get(index-1);
75+
76+ if( endTime >= now && (lastEvent === undefined || lastEvent.endTime < now ) ) {
77+ collapse(false);
78+ bgColor = "#fffdaa";
79+ seperator.visible = true;
80+ } else if( startTime < now) {
81+ textColor = "#747474"
82+ }
83+
84+ showEventData();
85+ }
86+
87+ height: eventRoot.height + seperator.height + (seperator.visible ? units.gu(1.5) : units.gu(0.5)) /*margins*/
88+ width: parent.width
89+
90+ Rectangle {
91+ id: seperator
92+ height: units.gu(0.5)
93+ width: delegateRoot.width - units.gu(2)
94+ anchors.top: parent.top
95+ anchors.topMargin: units.gu(1)
96+ anchors.horizontalCenter: parent.horizontalCenter
97+ color: "#c94212"
98+ visible: false
99+ }
100+
101+ Rectangle {
102+ id: eventRoot
103+
104+ property var event;
105+ property bool collapsed: false;
106+
107+ color: delegateRoot.bgColor;
108+ height: eventContainer.height;
109+ width: parent.width - units.gu(2)
110+
111+ anchors {
112+ top: seperator.visible ? seperator.bottom : parent.top
113+ topMargin: units.gu(1)
114+ horizontalCenter: parent.horizontalCenter
115+ }
116+
117+ MouseArea{
118+ anchors.fill: parent;
119+ onClicked: {
120+ delegateRoot.clicked(index);
121+ }
122+ }
123+
124+ Column{
125+ id: eventContainer
126+
127+ spacing: units.gu(1)
128+
129+ anchors {
130+ left: parent.left
131+ right: parent.right
132+ leftMargin: units.gu(1)
133+ rightMargin: units.gu(1)
134+ }
135+
136+ Row{
137+ width:parent.width
138+ spacing: units.gu(2)
139+ height: timeLabel.height + units.gu(3)
140+
141+ Label{
142+ id:timeLabel
143+ fontSize: "large"
144+ text: Qt.formatTime(startTime,"hh:mm");
145+ anchors.verticalCenter: parent.verticalCenter
146+ color: delegateRoot.textColor
147+
148+ onTextChanged: {
149+ delegateRoot.dataChanged();
150+ }
151+ }
152+
153+ Label{
154+ id: titleLabel
155+ fontSize: "large"
156+ text: title
157+ anchors.verticalCenter: parent.verticalCenter
158+ color: delegateRoot.textColor
159+ wrapMode: Text.Wrap
160+ }
161+ }
162+
163+ Row{
164+ id: locationLayout
165+ width:parent.width
166+ spacing: units.gu(2)
167+ Item {
168+ id: locationIconContainer
169+ width: timeLabel.width
170+ height: units.gu(4)
171+ Image{
172+ source: "icon-location.png"
173+ anchors.right: parent.right
174+ }
175+ }
176+ Label{
177+ id: locationLabel
178+ width: parent.width - units.gu(2) - locationIconContainer.width
179+ color: delegateRoot.textColor
180+ wrapMode: Text.Wrap
181+ }
182+ }
183+
184+ Row{
185+ id: attendeesLayout
186+ width:parent.width
187+ spacing: units.gu(2)
188+ Item {
189+ id: contactIconContainer
190+ width: timeLabel.width
191+ height: units.gu(4)
192+ Image{
193+ source: "icon-contacts.png"
194+ anchors.right: parent.right
195+ }
196+ }
197+ Label{
198+ id: attendeeLabel
199+ width: parent.width - units.gu(2) - contactIconContainer.width
200+ color: delegateRoot.textColor
201+ wrapMode: Text.Wrap
202+ }
203+ }
204+ }
205+ }
206+}
207
208=== modified file 'EventDetails.qml'
209--- EventDetails.qml 2013-03-31 04:56:58 +0000
210+++ EventDetails.qml 2013-04-13 04:52:26 +0000
211@@ -44,7 +44,7 @@
212 if( venues.length > 0 ) {
213 //FIXME: what to do for multiple venue
214 var place = venues[0];
215- locationLabel.text = address;
216+ locationLabel.text = place.address;
217 if( place.latitude && place.longitude) {
218 location = place.latitude +"," + place.longitude;
219 }

Subscribers

People subscribed via source and target branches

to status/vote changes: