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

Subscribers

People subscribed via source and target branches

to status/vote changes: