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
=== modified file 'EventActions.qml'
--- EventActions.qml 2016-03-14 20:25:50 +0000
+++ EventActions.qml 2016-03-18 00:41:07 +0000
@@ -64,6 +64,7 @@
64 name: "calendarsbutton"64 name: "calendarsbutton"
65 iconName: "settings"65 iconName: "settings"
66 text: i18n.tr("Settings")66 text: i18n.tr("Settings")
67 onTriggered: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"),{"settings": actionPool.settings});67 onTriggered: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"), {"eventModel": eventModel,
68 "settings": actionPool.settings});
68 }69 }
69}70}
7071
=== modified file 'EventListModel.qml'
--- EventListModel.qml 2016-03-04 16:10:56 +0000
+++ EventListModel.qml 2016-03-18 00:41:07 +0000
@@ -75,6 +75,20 @@
75 return cals;75 return cals;
76 }76 }
7777
78 function getWritableAndSelectedCollections(){
79 var cals = [];
80 var collections = eventModel.collections;
81 for(var i = 0 ; i < collections.length ; ++i) {
82 var cal = collections[i];
83 if( cal.extendedMetaData("collection-type") === "Calendar" &&
84 cal.extendedMetaData("collection-selected") === true &&
85 cal.extendedMetaData("collection-readonly") === false) {
86 cals.push(cal);
87 }
88 }
89 return cals;
90 }
91
78 function getWritableCollections(){92 function getWritableCollections(){
79 var cals = [];93 var cals = [];
80 var collections = eventModel.collections;94 var collections = eventModel.collections;
@@ -110,9 +124,10 @@
110 var cals = getCollections();124 var cals = getCollections();
111 for(var i = 0 ; i < cals.length ; ++i) {125 for(var i = 0 ; i < cals.length ; ++i) {
112 var cal = cals[i]126 var cal = cals[i]
113 cal.setExtendedMetaData("X-CAL-DEFAULT-CALENDAR", false);
114 if( cal.collectionId === collectionId) {127 if( cal.collectionId === collectionId) {
115 cal.setExtendedMetaData("X-CAL-DEFAULT-CALENDAR", true);128 cal.setExtendedMetaData("collection-default", true);
129 eventModel.saveCollection(cal);
130 return
116 }131 }
117 }132 }
118 }133 }
119134
=== modified file 'NewEvent.qml'
--- NewEvent.qml 2016-03-17 21:05:05 +0000
+++ NewEvent.qml 2016-03-18 00:41:07 +0000
@@ -74,8 +74,9 @@
74 }74 }
7575
76 function updateEventInfo(date, allDay) {76 function updateEventInfo(date, allDay) {
77 selectCalendar(model.getDefaultCollection().collectionId);
78 eventReminder.reminderValue = root.reminderValue
77 updateEventDate(date, allDay)79 updateEventDate(date, allDay)
78 eventReminder.reminderValue = root.reminderValue
79 }80 }
8081
81 function updateEventDate(date, allDay) {82 function updateEventDate(date, allDay) {
@@ -124,7 +125,6 @@
124 //Data for Add events125 //Data for Add events
125 function addEvent() {126 function addEvent() {
126 event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");127 event = Qt.createQmlObject("import QtOrganizer 5.0; Event { }", Qt.application,"NewEvent.qml");
127 selectCalendar(model.getDefaultCollection().collectionId);
128 }128 }
129129
130 //Editing Event130 //Editing Event
@@ -574,7 +574,7 @@
574 }574 }
575575
576 containerHeight: itemHeight * 4576 containerHeight: itemHeight * 4
577 model: root.model.getWritableCollections();577 model: root.model.getWritableAndSelectedCollections();
578578
579 delegate: OptionSelectorDelegate{579 delegate: OptionSelectorDelegate{
580 text: modelData.name580 text: modelData.name
581581
=== modified file 'NewEventBottomEdge.qml'
--- NewEventBottomEdge.qml 2016-03-17 00:24:53 +0000
+++ NewEventBottomEdge.qml 2016-03-18 00:41:07 +0000
@@ -37,7 +37,7 @@
37 signal opened()37 signal opened()
38 signal eventCreated(var event)38 signal eventCreated(var event)
3939
40 function updateNewEventDate(date, allDay)40 function updateNewEventInfo(date, allDay)
41 {41 {
42 _realPage.updateEventInfo(date, allDay)42 _realPage.updateEventInfo(date, allDay)
43 }43 }
@@ -74,7 +74,7 @@
7474
75 onCommitStarted: {75 onCommitStarted: {
76 bottomEdge.opened()76 bottomEdge.opened()
77 updateNewEventDate(bottomEdge.date ? bottomEdge.date : new Date(), false)77 updateNewEventInfo(bottomEdge.date ? bottomEdge.date : new Date(), false)
78 }78 }
7979
80 Component.onCompleted: {80 Component.onCompleted: {
8181
=== modified file 'PageWithBottomEdge.qml'
--- PageWithBottomEdge.qml 2016-03-15 18:01:08 +0000
+++ PageWithBottomEdge.qml 2016-03-18 00:41:07 +0000
@@ -33,7 +33,7 @@
33 function bottomEdgeCommit(date, allDay)33 function bottomEdgeCommit(date, allDay)
34 {34 {
35 bottomEdge.commit()35 bottomEdge.commit()
36 bottomEdge.updateNewEventDate(date, allDay)36 bottomEdge.updateNewEventInfo(date, allDay)
37 }37 }
3838
39 NewEventBottomEdge {39 NewEventBottomEdge {
4040
=== modified file 'SettingsPage.qml'
--- SettingsPage.qml 2016-03-14 20:25:50 +0000
+++ SettingsPage.qml 2016-03-18 00:41:07 +0000
@@ -24,6 +24,7 @@
24 id: settingsPage24 id: settingsPage
25 objectName: "settings"25 objectName: "settings"
2626
27 property EventListModel eventModel
27 property Settings settings: undefined28 property Settings settings: undefined
2829
29 Binding {30 Binding {
@@ -138,5 +139,61 @@
138 }139 }
139 }140 }
140 }141 }
142
143 ListItem {
144 visible: defaultCalendarOptionSelector.model && defaultCalendarOptionSelector.model.length > 0
145 height: visible ? defaultCalendarLayout.height + divider.height : 0
146
147 Component.onCompleted: {
148 if (!eventModel || !defaultCalendarOptionSelector.model) {
149 return
150 }
151
152 var defaultCollectionId = eventModel.getDefaultCollection().collectionId
153 for (var i=0; i<defaultCalendarOptionSelector.model.length; ++i) {
154 if (defaultCalendarOptionSelector.model[i].collectionId === defaultCollectionId) {
155 defaultCalendarOptionSelector.selectedIndex = i
156 return
157 }
158 }
159
160 defaultCalendarOptionSelector.selectedIndex = 0
161 }
162
163 SlotsLayout {
164 id: defaultCalendarLayout
165
166 mainSlot: Item {
167 height: defaultCalendarOptionSelector.height
168
169 OptionSelector {
170 id: defaultCalendarOptionSelector
171
172 text: i18n.tr("Default calendar")
173 model: settingsPage.eventModel ? settingsPage.eventModel.getWritableAndSelectedCollections() : null
174 containerHeight: itemHeight * 4
175
176 delegate: OptionSelectorDelegate {
177 text: modelData.name
178 height: units.gu(4)
179
180 UbuntuShape{
181 anchors {
182 right: parent.right
183 rightMargin: units.gu(4)
184 verticalCenter: parent.verticalCenter
185 }
186
187 width: height
188 height: parent.height - units.gu(2)
189 color: modelData.color
190 }
191 }
192
193 onDelegateClicked: settingsPage.eventModel.setDefaultCollection(model[index].collectionId)
194 }
195 }
196 }
197 }
141 }198 }
142}199}

Subscribers

People subscribed via source and target branches

to status/vote changes: