Merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1373945 into lp:ubuntu-calendar-app

Proposed by Arthur Mello
Status: Merged
Approved by: Renato Araujo Oliveira Filho
Approved revision: 791
Merged at revision: 789
Proposed branch: lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1373945
Merge into: lp:ubuntu-calendar-app
Diff against target: 191 lines (+82/-9)
6 files modified
EventActions.qml (+2/-1)
EventListModel.qml (+17/-2)
NewEvent.qml (+3/-3)
NewEventBottomEdge.qml (+2/-2)
PageWithBottomEdge.qml (+1/-1)
SettingsPage.qml (+57/-0)
To merge this branch: bzr merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1373945
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho (community) Approve
Review via email: mp+288988@code.launchpad.net

Commit message

Add option to Settings page to set the default calendar

Description of the change

Add option to Settings page to set the default calendar

To post a comment you must log in.
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

just one small change

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

looks good.

review: Approve
788. By Arthur Mello

Merge with trunk

789. By Arthur Mello

Make sure only selected calendars are displayed at new event screen

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

works fine.

review: Approve
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

You will need this patch:
http://paste.ubuntu.com/15411068/

790. By Arthur Mello

Apply patch to fix issue when creating events with a long press

791. By Arthur Mello

Merge with trunk

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'EventActions.qml'
2--- EventActions.qml 2016-03-14 20:25:50 +0000
3+++ EventActions.qml 2016-03-18 00:41:07 +0000
4@@ -64,6 +64,7 @@
5 name: "calendarsbutton"
6 iconName: "settings"
7 text: i18n.tr("Settings")
8- onTriggered: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"),{"settings": actionPool.settings});
9+ onTriggered: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"), {"eventModel": eventModel,
10+ "settings": actionPool.settings});
11 }
12 }
13
14=== modified file 'EventListModel.qml'
15--- EventListModel.qml 2016-03-04 16:10:56 +0000
16+++ EventListModel.qml 2016-03-18 00:41:07 +0000
17@@ -75,6 +75,20 @@
18 return cals;
19 }
20
21+ function getWritableAndSelectedCollections(){
22+ var cals = [];
23+ var collections = eventModel.collections;
24+ for(var i = 0 ; i < collections.length ; ++i) {
25+ var cal = collections[i];
26+ if( cal.extendedMetaData("collection-type") === "Calendar" &&
27+ cal.extendedMetaData("collection-selected") === true &&
28+ cal.extendedMetaData("collection-readonly") === false) {
29+ cals.push(cal);
30+ }
31+ }
32+ return cals;
33+ }
34+
35 function getWritableCollections(){
36 var cals = [];
37 var collections = eventModel.collections;
38@@ -110,9 +124,10 @@
39 var cals = getCollections();
40 for(var i = 0 ; i < cals.length ; ++i) {
41 var cal = cals[i]
42- cal.setExtendedMetaData("X-CAL-DEFAULT-CALENDAR", false);
43 if( cal.collectionId === collectionId) {
44- cal.setExtendedMetaData("X-CAL-DEFAULT-CALENDAR", true);
45+ cal.setExtendedMetaData("collection-default", true);
46+ eventModel.saveCollection(cal);
47+ return
48 }
49 }
50 }
51
52=== modified file 'NewEvent.qml'
53--- NewEvent.qml 2016-03-17 21:05:05 +0000
54+++ NewEvent.qml 2016-03-18 00:41:07 +0000
55@@ -74,8 +74,9 @@
56 }
57
58 function updateEventInfo(date, allDay) {
59+ selectCalendar(model.getDefaultCollection().collectionId);
60+ eventReminder.reminderValue = root.reminderValue
61 updateEventDate(date, allDay)
62- eventReminder.reminderValue = root.reminderValue
63 }
64
65 function updateEventDate(date, allDay) {
66@@ -124,7 +125,6 @@
67 //Data for Add events
68 function addEvent() {
69 event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");
70- selectCalendar(model.getDefaultCollection().collectionId);
71 }
72
73 //Editing Event
74@@ -574,7 +574,7 @@
75 }
76
77 containerHeight: itemHeight * 4
78- model: root.model.getWritableCollections();
79+ model: root.model.getWritableAndSelectedCollections();
80
81 delegate: OptionSelectorDelegate{
82 text: modelData.name
83
84=== modified file 'NewEventBottomEdge.qml'
85--- NewEventBottomEdge.qml 2016-03-17 00:24:53 +0000
86+++ NewEventBottomEdge.qml 2016-03-18 00:41:07 +0000
87@@ -37,7 +37,7 @@
88 signal opened()
89 signal eventCreated(var event)
90
91- function updateNewEventDate(date, allDay)
92+ function updateNewEventInfo(date, allDay)
93 {
94 _realPage.updateEventInfo(date, allDay)
95 }
96@@ -74,7 +74,7 @@
97
98 onCommitStarted: {
99 bottomEdge.opened()
100- updateNewEventDate(bottomEdge.date ? bottomEdge.date : new Date(), false)
101+ updateNewEventInfo(bottomEdge.date ? bottomEdge.date : new Date(), false)
102 }
103
104 Component.onCompleted: {
105
106=== modified file 'PageWithBottomEdge.qml'
107--- PageWithBottomEdge.qml 2016-03-15 18:01:08 +0000
108+++ PageWithBottomEdge.qml 2016-03-18 00:41:07 +0000
109@@ -33,7 +33,7 @@
110 function bottomEdgeCommit(date, allDay)
111 {
112 bottomEdge.commit()
113- bottomEdge.updateNewEventDate(date, allDay)
114+ bottomEdge.updateNewEventInfo(date, allDay)
115 }
116
117 NewEventBottomEdge {
118
119=== modified file 'SettingsPage.qml'
120--- SettingsPage.qml 2016-03-14 20:25:50 +0000
121+++ SettingsPage.qml 2016-03-18 00:41:07 +0000
122@@ -24,6 +24,7 @@
123 id: settingsPage
124 objectName: "settings"
125
126+ property EventListModel eventModel
127 property Settings settings: undefined
128
129 Binding {
130@@ -138,5 +139,61 @@
131 }
132 }
133 }
134+
135+ ListItem {
136+ visible: defaultCalendarOptionSelector.model && defaultCalendarOptionSelector.model.length > 0
137+ height: visible ? defaultCalendarLayout.height + divider.height : 0
138+
139+ Component.onCompleted: {
140+ if (!eventModel || !defaultCalendarOptionSelector.model) {
141+ return
142+ }
143+
144+ var defaultCollectionId = eventModel.getDefaultCollection().collectionId
145+ for (var i=0; i<defaultCalendarOptionSelector.model.length; ++i) {
146+ if (defaultCalendarOptionSelector.model[i].collectionId === defaultCollectionId) {
147+ defaultCalendarOptionSelector.selectedIndex = i
148+ return
149+ }
150+ }
151+
152+ defaultCalendarOptionSelector.selectedIndex = 0
153+ }
154+
155+ SlotsLayout {
156+ id: defaultCalendarLayout
157+
158+ mainSlot: Item {
159+ height: defaultCalendarOptionSelector.height
160+
161+ OptionSelector {
162+ id: defaultCalendarOptionSelector
163+
164+ text: i18n.tr("Default calendar")
165+ model: settingsPage.eventModel ? settingsPage.eventModel.getWritableAndSelectedCollections() : null
166+ containerHeight: itemHeight * 4
167+
168+ delegate: OptionSelectorDelegate {
169+ text: modelData.name
170+ height: units.gu(4)
171+
172+ UbuntuShape{
173+ anchors {
174+ right: parent.right
175+ rightMargin: units.gu(4)
176+ verticalCenter: parent.verticalCenter
177+ }
178+
179+ width: height
180+ height: parent.height - units.gu(2)
181+ color: modelData.color
182+ }
183+ }
184+
185+ onDelegateClicked: settingsPage.eventModel.setDefaultCollection(model[index].collectionId)
186+ }
187+ }
188+ }
189+ }
190 }
191 }

Subscribers

People subscribed via source and target branches

to status/vote changes: