Merge lp:~renatofilho/ubuntu-calendar-app/optimize into lp:ubuntu-calendar-app

Proposed by Renato Araujo Oliveira Filho
Status: Superseded
Proposed branch: lp:~renatofilho/ubuntu-calendar-app/optimize
Merge into: lp:ubuntu-calendar-app
Prerequisite: lp:~renatofilho/ubuntu-calendar-app/sdk-1-3
Diff against target: 1478 lines (+455/-559)
11 files modified
DayView.qml (+45/-65)
MonthComponent.qml (+91/-118)
MonthComponentDateDelegate.qml (+14/-57)
MonthView.qml (+26/-61)
PathViewBase.qml (+12/-4)
TimeLineBaseComponent.qml (+21/-16)
WeekView.qml (+8/-22)
YearView.qml (+26/-42)
YearViewDelegate.qml (+45/-66)
calendar.qml (+164/-105)
po/com.ubuntu.calendar.pot (+3/-3)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-calendar-app/optimize
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Needs Fixing
Ubuntu Phone Apps Jenkins Bot continuous-integration Pending
Kunal Parmar Pending
Review via email: mp+283849@code.launchpad.net

This proposal supersedes a proposal from 2015-03-27.

This proposal has been superseded by a proposal from 2016-01-25.

Commit message

Optimize MonthComponent

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote : Posted in a previous version of this proposal

added inline comment

review: Needs Information
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
628. By Renato Araujo Oliveira Filho

Parent merged.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
629. By Renato Araujo Oliveira Filho

Parent merged.

630. By Renato Araujo Oliveira Filho

Fixed wrong merge.

631. By Renato Araujo Oliveira Filho

Make year view delegates async.

632. By Renato Araujo Oliveira Filho

Use only one mouse area for the month view, instead of an individual mouse area for each day delegate.
Split MonthDay delegate in two different classes to be used on year view and month view.

633. By Renato Araujo Oliveira Filho

Fixed WeekView start date.

634. By Renato Araujo Oliveira Filho

Make sure that new events are created in the last selected date.

635. By Renato Araujo Oliveira Filho

Make sure the page on week view scroll to correct position while swiping it.

636. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/week-press-and-hold-create-event

637. By Renato Araujo Oliveira Filho

Create a binding for main event filter to avoid problems with the filter changes.

638. By Renato Araujo Oliveira Filho

Update changes on parent branch.

639. By Renato Araujo Oliveira Filho

Fixed "today" action on week view.

640. By Renato Araujo Oliveira Filho

Merged: lp:~renatofilho/ubuntu-calendar-app/week-press-and-hold-create-event

641. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/fix-add-guest-search-field

642. By Renato Araujo Oliveira Filho

merged: ~renatofilho/ubuntu-calendar-app/week-press-and-hold-create-event

643. By Renato Araujo Oliveira Filho

merged: ~renatofilho/ubuntu-calendar-app/fix-add-guest-search-field

644. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/fix-add-guest-search-field

645. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/optimize-page-load

646. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/bottom-edge

647. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/week-press-and-hold-create-event

648. By Renato Araujo Oliveira Filho

Does not change main date if the current date change on views.

649. By Renato Araujo Oliveira Filho

Trunk merged

650. By Renato Araujo Oliveira Filho

Make sure that new event is created on highlighted date if selected.

651. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/bottom-edge

652. By Renato Araujo Oliveira Filho

Make sure tha the today event get highlight on month and year view.

653. By Renato Araujo Oliveira Filho

lp:~renatofilho/ubuntu-calendar-app/bottom-edge

654. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/ubuntu-calendar-app/bottom-edge

655. By Renato Araujo Oliveira Filho

Revert changes on KeyboardRectangle.qml

656. By Renato Araujo Oliveira Filho

Improve animation when keyboard appears.

657. By Renato Araujo Oliveira Filho

Avoid crash when application closes with bottom edge open.

658. By Renato Araujo Oliveira Filho

Avoid contact list to stole focus from text field on ContactChoicePopup.

659. By Renato Araujo Oliveira Filho

Show a activity indicator while rebuild events.
Make sure only bubble events are destroyed while rebuild events.

660. By Renato Araujo Oliveira Filho

Allow create all day events by pressing and hold at all day header.

661. By Renato Araujo Oliveira Filho

Make sure the timeline events are recreated when model changes.

662. By Renato Araujo Oliveira Filho

Only create all days events after release the mouse button.

663. By Renato Araujo Oliveira Filho

Use bottom edge element to create new events, intead of pushing new pages.
Avoid update unactive pages when model changes.

664. By Renato Araujo Oliveira Filho

Disabled predictive text for event title and location.

665. By Renato Araujo Oliveira Filho

Avoid warning messages if startDate/endDate is unset.

666. By Renato Araujo Oliveira Filho

Fixed event drawing.

667. By Renato Araujo Oliveira Filho

Remove debug message.

668. By Renato Araujo Oliveira Filho

Fix endDate set on new event page.

669. By Renato Araujo Oliveira Filho

Keep new event page visible until the event is saved on database.

670. By Renato Araujo Oliveira Filho

Wek view bottom edge always create event with today date.

671. By Renato Araujo Oliveira Filho

Create new event based on scrolled view.

672. By Renato Araujo Oliveira Filho

Does not create new event on all day click.

You need to press and hold.

673. By Renato Araujo Oliveira Filho

Avoid run several events re-layout at the same time.

674. By Renato Araujo Oliveira Filho

Emit 'bottomEdgeCommit' when opening bottom edge.

675. By Renato Araujo Oliveira Filho

Make sure that week view is scrolled to current time when app is opened.
Fix 'today' action to correct scroll to current date on week view.

676. By Renato Araujo Oliveira Filho

Allow to edit single events on all day header.

677. By Renato Araujo Oliveira Filho

Wait 1sec before do the model query in week view and day view.

678. By Renato Araujo Oliveira Filho

Always create today event on week view bottom edge.
Create current day and now time event in day view bottom edge.

679. By Renato Araujo Oliveira Filho

Make sure that all day views scroll to the same position.

680. By Renato Araujo Oliveira Filho

Only update model events when PathView stop to move.

681. By Renato Araujo Oliveira Filho

Remove debug message.

682. By Renato Araujo Oliveira Filho

Update month view to run query only after scrolls stops.

683. By Renato Araujo Oliveira Filho

Keep dates in sync btw panels.

684. By Renato Araujo Oliveira Filho

Optimize day/week/month view.

685. By Renato Araujo Oliveira Filho

After create a new event scroll view to new event position.

686. By Renato Araujo Oliveira Filho

Show a spinner while saving an item after move it.

687. By Renato Araujo Oliveira Filho

Fixed scroll to today for week view and day view.

688. By Renato Araujo Oliveira Filho

Fixed event drawing.

Make sure that the incubator object is created before continue creating events.

689. By Renato Araujo Oliveira Filho

Write better code.

690. By Renato Araujo Oliveira Filho

Use QOrganizerItemModel instead of EventListModel in TimeLine component.

691. By Renato Araujo Oliveira Filho

Does not try to scroll to created event date if the event is already visible.

692. By Renato Araujo Oliveira Filho

Remove debug messages.

693. By Renato Araujo Oliveira Filho

Vertical centralize view after scroll to a date.

694. By Renato Araujo Oliveira Filho

Does not scroll back to today page after go back from contact details.

695. By Renato Araujo Oliveira Filho

Rewrite events layout and drawing;

Events will be drawed without overlap eachother;
Events will be resized to fit in the day column;

696. By Renato Araujo Oliveira Filho

Use async function to calculate event layout.

697. By Renato Araujo Oliveira Filho

Created unit test for new calentar layout function

698. By Renato Araujo Oliveira Filho

Remove unecessary code.

699. By Renato Araujo Oliveira Filho

Added comments.

700. By Renato Araujo Oliveira Filho

Make the now time separator always visible.

701. By Renato Araujo Oliveira Filho

Avoid to draw events too small and make impossible to read events title.

702. By Renato Araujo Oliveira Filho

Update current time separator line every 5 minutes.

703. By Renato Araujo Oliveira Filho

Use EleventListModel because of helper functions necessary on NewEvent page.
Avoid re-draw events while the worker script still running.

704. By Renato Araujo Oliveira Filho

Centralize event after creation.

705. By Renato Araujo Oliveira Filho

Fixed event date used for bottom edge on day view.

706. By Renato Araujo Oliveira Filho

Year view always create event on today date when using bottom edge.

707. By Renato Araujo Oliveira Filho

Switching from week to day view will show the first day of the week or the last event start date clicked.

708. By Renato Araujo Oliveira Filho

Conflict solved.

709. By Renato Araujo Oliveira Filho

Make sure that year view shows the application global date year when opening.

710. By Renato Araujo Oliveira Filho

Optimize event layout function.

711. By Renato Araujo Oliveira Filho

Fix event drawing.

712. By Renato Araujo Oliveira Filho

Make sur that the week view is opened on the tabs.Day.

713. By Renato Araujo Oliveira Filho

Fixed event edit with contacts.

714. By Renato Araujo Oliveira Filho

Make sure that event bubble is correct drawed if event data changes after bubble creation.

715. By Renato Araujo Oliveira Filho

Does not draw too small events.

716. By Renato Araujo Oliveira Filho

Redraw events if it get update while the worker script was running.

717. By Renato Araujo Oliveira Filho

Does not redraw DayView if the global date only changes the time.

718. By Renato Araujo Oliveira Filho

Fixed floating event size.

719. By Renato Araujo Oliveira Filho

Use the default collection to create events if it is enabled ortherwise return the first enabled collection.
Fix all day events creation.

720. By Renato Araujo Oliveira Filho

If week start and end in different month show both month names in the week view title.

721. By Renato Araujo Oliveira Filho

Fix today scroll in day view.

722. By Renato Araujo Oliveira Filho

Make sure that Day/Week view scroll to correct date while alternating btw views.

723. By Renato Araujo Oliveira Filho

Update application click framework.

724. By Renato Araujo Oliveira Filho

Avoid time scroll after create a all day event.

725. By Renato Araujo Oliveira Filho

Show event full title on all day header if the space is bigger than units.gu(15)

726. By Renato Araujo Oliveira Filho

Fix all day events edit.

727. By Renato Araujo Oliveira Filho

Do not scroll vertically for all day events.

728. By Renato Araujo Oliveira Filho

Parent merged.

729. By Renato Araujo Oliveira Filho

Use events word instead of 'ev.' for all day events.

730. By Renato Araujo Oliveira Filho

Update events filter if the collections changed.

731. By Renato Araujo Oliveira Filho

Update apparmor policy version.

732. By Renato Araujo Oliveira Filho

Disable model update while sync is in progress to avoid several updates.

733. By Renato Araujo Oliveira Filho

Keep event bubble color in sync with calendar event color.

734. By Renato Araujo Oliveira Filho

Fixed day view title.

735. By Renato Araujo Oliveira Filho

Fixed uri handler for eventId.

736. By Renato Araujo Oliveira Filho

Fix new event reminders and repeater.

Unmerged revisions

736. By Renato Araujo Oliveira Filho

Fix new event reminders and repeater.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DayView.qml'
2--- DayView.qml 2016-01-25 19:05:30 +0000
3+++ DayView.qml 2016-01-25 19:05:31 +0000
4@@ -25,8 +25,8 @@
5 id: dayViewPage
6 objectName: "dayViewPage"
7
8- property var currentDay: new Date()
9- property bool isCurrentPage: false
10+ property var anchorDate: new Date()
11+ readonly property var currentDate: dayViewPath.currentItem.startDay
12
13 signal dateSelected(var date);
14
15@@ -39,7 +39,8 @@
16 iconName: "calendar-today"
17 text: i18n.tr("Today")
18 onTriggered: {
19- currentDay = new Date()
20+ dayViewPath.scrollToBegginer()
21+ anchorDate = new Date()
22 }
23 }
24
25@@ -57,7 +58,7 @@
26 id:monthYear
27 objectName:"monthYearLabel"
28 fontSize: "x-large"
29- text: currentDay.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))
30+ text: currentDate.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))
31 font.capitalization: Font.Capitalize
32 }
33 }
34@@ -66,74 +67,53 @@
35 id: dayViewPath
36 objectName: "dayViewPath"
37
38- property var startDay: currentDay
39 //This is used to scroll all view together when currentItem scrolls
40 property var childContentY;
41
42 anchors.fill: parent
43
44- onNextItemHighlighted: {
45- //next day
46- currentDay = currentDay.addDays(1);
47- }
48-
49- onPreviousItemHighlighted: {
50- //previous day
51- currentDay = currentDay.addDays(-1);
52- }
53-
54- delegate: Loader {
55+ delegate: TimeLineBaseComponent {
56+ id: timeLineView
57+ objectName: "DayComponent-"+index
58+
59 width: parent.width
60 height: parent.height
61- asynchronous: !dayViewPath.isCurrentItem
62- sourceComponent: delegateComponent
63-
64- Component {
65- id: delegateComponent
66-
67- TimeLineBaseComponent {
68- id: timeLineView
69- objectName: "DayComponent-"+index
70-
71- type: ViewType.ViewTypeDay
72- anchors.fill: parent
73-
74- isActive: parent.PathView.isCurrentItem
75- contentInteractive: parent.PathView.isCurrentItem
76- startDay: dayViewPath.startDay.addDays(dayViewPath.indexType(index))
77- keyboardEventProvider: dayViewPath
78-
79- Component.onCompleted: {
80- if(dayViewPage.isCurrentPage){
81- timeLineView.scrollToCurrentTime();
82- }
83- }
84-
85- Connections{
86- target: dayViewPage
87- onIsCurrentPageChanged:{
88- if(dayViewPage.isCurrentPage){
89- timeLineView.scrollToCurrentTime();
90- }
91- }
92- }
93-
94- //get contentY value from PathView, if its not current Item
95- Binding{
96- target: timeLineView
97- property: "contentY"
98- value: dayViewPath.childContentY;
99- when: !parent.PathView.isCurrentItem
100- }
101-
102- //set PathView's contentY property, if its current item
103- Binding{
104- target: dayViewPath
105- property: "childContentY"
106- value: contentY
107- when: parent.PathView.isCurrentItem
108- }
109- }
110+
111+ type: ViewType.ViewTypeDay
112+ isActive: PathView.isCurrentItem
113+ contentInteractive: PathView.isCurrentItem
114+ startDay: anchorDate.addDays(dayViewPath.loopCurrentIndex + dayViewPath.indexType(index))
115+ keyboardEventProvider: dayViewPath
116+
117+ Component.onCompleted: {
118+ if(dayViewPage.active){
119+ timeLineView.scrollToCurrentTime();
120+ }
121+ }
122+
123+ Connections{
124+ target: dayViewPage
125+ onActiveChanged: {
126+ if(dayViewPage.active){
127+ timeLineView.scrollToCurrentTime();
128+ }
129+ }
130+ }
131+
132+ //get contentY value from PathView, if its not current Item
133+ Binding{
134+ target: timeLineView
135+ property: "contentY"
136+ value: dayViewPath.childContentY;
137+ when: !parent.PathView.isCurrentItem
138+ }
139+
140+ //set PathView's contentY property, if its current item
141+ Binding{
142+ target: dayViewPath
143+ property: "childContentY"
144+ value: contentY
145+ when: parent.PathView.isCurrentItem
146 }
147 }
148 }
149
150=== modified file 'MonthComponent.qml'
151--- MonthComponent.qml 2016-01-25 19:05:30 +0000
152+++ MonthComponent.qml 2016-01-25 19:05:31 +0000
153@@ -17,6 +17,7 @@
154 */
155 import QtQuick 2.4
156 import Ubuntu.Components 1.3
157+
158 import "dateExt.js" as DateExt
159 import "colorUtils.js" as Color
160
161@@ -25,12 +26,11 @@
162 objectName: "MonthComponent"
163
164 property bool isCurrentItem;
165-
166- property bool showEvents: false
167-
168- property var currentMonth;
169+ property int currentYear;
170+ property int currentMonth;
171+
172 property var isYearView;
173- property var selectedDay;
174+ property var highlightedDate;
175 property bool displayWeekNumber:false;
176
177 property string dayLabelFontSize: "medium"
178@@ -40,91 +40,59 @@
179
180 property alias dayLabelDelegate : dayLabelRepeater.delegate
181 property alias dateLabelDelegate : dateLabelRepeater.delegate
182+ readonly property alias monthStartDate: intern.monthStart
183
184 signal monthSelected(var date);
185 signal dateSelected(var date);
186 signal dateHighlighted(var date);
187
188- //creatng timer only if we need to show events in month
189- Loader {
190- id: timerLoader
191- sourceComponent: showEvents ? timerComp : undefined
192- }
193-
194- // Timer to delay creation of Model, There seems some problem fetching events if we create Model immediatly
195- Component {
196- id: timerComp
197- Timer{
198- interval: 200; running: true; repeat: false
199- onTriggered: {
200- modelLoader.sourceComponent = modelComponent
201- }
202- }
203- }
204-
205- Loader{
206- id: modelLoader
207- }
208-
209- Component{
210- id: modelComponent
211- EventListModel {
212- id: mainModel
213- startPeriod: intern.monthStart.midnight();
214- endPeriod: intern.monthStart.addDays((/*monthGrid.rows * cols */ 42 )-1).endOfDay()
215- filter: eventModel.filter
216- onModelChanged: {
217- intern.eventStatus = Qt.binding(function() { return mainModel.containsItems(startPeriod, endPeriod, 86400/*24*60*60*/)});
218- }
219- }
220+ function updateEvents(events) {
221+ intern.eventStatus = events
222 }
223
224 QtObject{
225 id: intern
226
227- property var eventStatus;
228-
229- property int curMonthDate: currentMonth.getDate()
230- property int curMonth: currentMonth.getMonth()
231- property int curMonthYear: currentMonth.getFullYear()
232+ property var eventStatus: new Array(42)
233
234 property var today: DateExt.today()
235 property int todayDate: today.getDate()
236 property int todayMonth: today.getMonth()
237 property int todayYear: today.getFullYear()
238
239-
240 //date from month will start, this date might be from previous month
241- property var monthStart: currentMonth.weekStart( Qt.locale().firstDayOfWeek )
242+ property var currentDate: new Date(root.currentYear, root.currentMonth, 1, 0, 0, 0, 0)
243+ property var monthStart: currentDate.weekStart( Qt.locale().firstDayOfWeek )
244 property int monthStartDate: monthStart.getDate()
245 property int monthStartMonth: monthStart.getMonth()
246 property int monthStartYear: monthStart.getFullYear()
247-
248 property int daysInStartMonth: Date.daysInMonth(monthStartYear, monthStartMonth)
249- property int daysInCurMonth: Date.daysInMonth(curMonthYear,curMonth)
250
251 //check if current month is start month
252- property bool isCurMonthStartMonth: curMonthDate === monthStartDate
253- && curMonth === monthStartMonth
254- && curMonthYear === monthStartYear
255+ property bool isCurMonthStartMonth: root.currentMonth === monthStartMonth &&
256+ root.currentYear === monthStartYear
257
258 //check current month is same as today's month
259- property bool isCurMonthTodayMonth: todayYear === curMonthYear && todayMonth == curMonth
260+ property bool isCurMonthTodayMonth: todayYear === root.currentYear &&
261+ todayMonth == root.currentMonth
262 //offset from current month's first date to start date of current month
263 property int offset: isCurMonthStartMonth ? -1 : (daysInStartMonth - monthStartDate)
264
265 property int dateFontSize: FontUtils.sizeToPixels(root.dateLabelFontSize)
266 property int dayFontSize: FontUtils.sizeToPixels(root.dayLabelFontSize)
267
268- property int selectedIndex: -1
269-
270- function findSelectedDayIndex(){
271- if(!selectedDay) {
272+ property int highlightedIndex: root.isCurrentItem &&
273+ root.highlightedDate ?
274+ intern.indexByDate(root.highlightedDate) : -1
275+ function indexByDate(date){
276+ if (!date) {
277 return -1;
278 }
279
280- if( todayMonth === selectedDay.getMonth() && selectedDay.getFullYear() === todayYear){
281- return selectedDay.getDate() +
282+ if ((root.currentMonth === date.getMonth()) &&
283+ (root.currentYear === date.getFullYear())) {
284+
285+ return date.getDate() +
286 (Date.daysInMonth(monthStartYear, monthStartMonth) - monthStartDate);
287 } else {
288 return -1;
289@@ -132,14 +100,40 @@
290 }
291 }
292
293- onSelectedDayChanged: {
294- if( isCurrentItem ) {
295- intern.selectedIndex = intern.findSelectedDayIndex();
296+ UbuntuShape{
297+ id: todayShape
298+
299+ visible: root.isCurrentItem && intern.isCurMonthTodayMonth && monthGrid.todayItem != null
300+ color: (monthGrid.highlightedItem === monthGrid.todayItem) ? UbuntuColors.darkGrey : UbuntuColors.orange
301+ width: parent ? Math.min(parent.height, parent.width) / 1.3 : 0
302+ height: width
303+ parent: monthGrid.todayItem
304+ anchors.centerIn: parent
305+ z: -1
306+ Rectangle {
307+ anchors.fill: parent
308+ anchors.margins: units.gu(0.5)
309+ color: UbuntuColors.orange
310+ radius: 5
311 }
312 }
313
314- onCurrentMonthChanged: {
315- intern.selectedIndex = -1;
316+ UbuntuShape{
317+ id: highlightedShape
318+
319+ visible: monthGrid.highlightedItem && (monthGrid.highlightedItem != monthGrid.todayItem)
320+ color: UbuntuColors.darkGrey
321+ width: parent ? Math.min(parent.height, parent.width) / 1.3 : 0
322+ height: width
323+ parent: monthGrid.highlightedItem
324+ anchors.centerIn: parent
325+ z: -1
326+ Rectangle {
327+ anchors.fill: parent
328+ anchors.margins: units.gu(0.5)
329+ color: UbuntuColors.lightGrey
330+ radius: 5
331+ }
332 }
333
334 Column{
335@@ -165,8 +159,8 @@
336 ViewHeader{
337 id: monthHeader
338 anchors.fill: parent
339- month: intern.curMonth
340- year: intern.curMonthYear
341+ month: root.currentMonth
342+ year: root.currentYear
343
344 monthLabelFontSize: root.monthLabelFontSize
345 yearLabelFontSize: root.yearLabelFontSize
346@@ -184,9 +178,11 @@
347
348 property int dayWidth: width / 7;
349
350- width: parent.width
351- anchors.horizontalCenter: parent.horizontalCenter
352- anchors.verticalCenter: parent.verticalCenter
353+ anchors{
354+ left: parent.left
355+ right: parent.right
356+ verticalCenter: parent.verticalCenter
357+ }
358
359 Repeater{
360 id: dayLabelRepeater
361@@ -196,23 +192,43 @@
362 }
363 }
364
365- Grid{
366+ Grid {
367 id: monthGrid
368 objectName: "monthGrid"
369
370- width: parent.width
371- height: parent.height - monthGrid.y
372-
373 property int dayWidth: width / 7 /*cols*/;
374 property int dayHeight: height / 6/*rows*/;
375-
376- rows: 6
377+ property var todayItem: null
378+ readonly property var highlightedItem: intern.highlightedIndex != -1 ?
379+ dateLabelRepeater.itemAt(intern.highlightedIndex) : null
380+ anchors {
381+ left: parent.left
382+ right: parent.right
383+ }
384+ height: parent.height - monthGrid.y
385 columns: 7
386
387 Repeater{
388 id: dateLabelRepeater
389- model: 42 //monthGrid.rows * monthGrid.columns
390- delegate: defaultDateLabelComponent
391+ model: 42
392+ delegate: MonthComponentDateDelegate {
393+ property var delegateDate: intern.monthStart.addDays(index)
394+
395+ date: delegateDate.getDate()
396+ isCurrentMonth: delegateDate.getMonth() === root.currentMonth
397+ showEvent: intern.eventStatus[index] === true
398+
399+ isToday: intern.todayDate == date && intern.isCurMonthTodayMonth
400+ isSelected: intern.highlightedIndex == index
401+ width: monthGrid.dayWidth
402+ height: monthGrid.dayHeight
403+
404+ onIsTodayChanged: {
405+ if (isToday) {
406+ monthGrid.todayItem = this
407+ }
408+ }
409+ }
410 }
411 }
412 }
413@@ -299,52 +315,9 @@
414 }
415
416 Component{
417- id: defaultDateLabelComponent
418- MonthComponentDateDelegate{
419- date: {
420- //try to find date from index and month's first week's first date
421- var temp = intern.daysInStartMonth - intern.offset + index
422- //date exceeds days in startMonth,
423- //this means previous month is over and we are now in current month
424- //to get actual date we need to remove number of days in startMonth
425- if( temp > intern.daysInStartMonth ) {
426- temp = temp - intern.daysInStartMonth
427- //date exceeds days in current month
428- // this means date is from next month
429- //to get actual date we need to remove number of days in current month
430- if( temp > intern.daysInCurMonth ) {
431- temp = temp - intern.daysInCurMonth
432- }
433- }
434- return temp;
435- }
436-
437- isCurrentMonth: {
438- //remove offset from index
439- //if index falls in 1 to no of days in current month
440- //then date is inside current month
441- var temp = index - intern.offset
442- return (temp >= 1 && temp <= intern.daysInCurMonth)
443- }
444-
445- isToday: intern.todayDate == date && intern.isCurMonthTodayMonth
446-
447- isSelected: showEvents && intern.selectedIndex == index
448-
449- width: parent.dayWidth
450- height: parent.dayHeight
451- fontSize: intern.dateFontSize
452- showEvent: showEvents
453- && intern.eventStatus !== undefined
454- && intern.eventStatus[index] !== undefined
455- && intern.eventStatus[index]
456- }
457- }
458-
459- Component{
460 id: dafaultDayLabelComponent
461
462- Label{
463+ Text {
464 id: weekDay
465 objectName: "weekDay" + index
466 width: parent.dayWidth
467
468=== modified file 'MonthComponentDateDelegate.qml'
469--- MonthComponentDateDelegate.qml 2016-01-25 19:05:30 +0000
470+++ MonthComponentDateDelegate.qml 2016-01-25 19:05:31 +0000
471@@ -9,27 +9,12 @@
472 property bool isToday;
473 property bool showEvent;
474 property alias fontSize: dateLabel.font.pixelSize
475-
476 property bool isSelected: false
477
478- Loader {
479- sourceComponent: (isToday && isCurrentMonth) || isSelected ? highLightComp : undefined
480-
481- onSourceComponentChanged: {
482- width = Qt.binding( function() {
483- var width = dateRootItem.height > dateRootItem.width ? dateRootItem.width :dateRootItem.height
484- return ( width / 1.3 );
485- });
486- height = Qt.binding ( function() { return width} );
487- anchors.centerIn = Qt.binding( function() { return dateLabel});
488- }
489- }
490-
491- Label {
492+ Text {
493 id: dateLabel
494 anchors.centerIn: parent
495 text: date
496- fontSize: root.dateLabelFontSize
497 color: {
498 if( isCurrentMonth ) {
499 if( isToday || isSelected ) {
500@@ -47,46 +32,19 @@
501 }
502 }
503
504- Loader{
505- sourceComponent: showEvent ? eventIndicatorComp : undefined
506- onSourceComponentChanged: {
507- width = Qt.binding( function() { return units.gu(0.8)})
508- height = Qt.binding( function() { return width })
509- anchors.horizontalCenter = Qt.binding( function() { return parent.horizontalCenter })
510- anchors.top = Qt.binding( function() { return parent.verticalCenter })
511- anchors.topMargin = Qt.binding( function() {
512- var w = (dateRootItem.height > dateRootItem.width ? dateRootItem.width :dateRootItem.height)/1.3
513- return (w/2) + units.gu(0.1)
514- });
515- }
516- }
517-
518- Component{
519- id: eventIndicatorComp
520- Rectangle {
521- anchors.fill: parent
522- radius: height/2
523- color: "black"
524- }
525- }
526-
527- Component{
528- id: highLightComp
529- UbuntuShape{
530- color: {
531- if( isToday && !isSelected ) {
532- "#DD4814"
533- } else {
534- "gray"
535- }
536- }
537-
538- Rectangle{
539- anchors.fill: parent
540- anchors.margins: units.gu(0.5)
541- color: isToday ? "#DD4814" : "darkgray"
542- }
543- }
544+ Rectangle {
545+ id: eventIndicator
546+
547+ width: units.gu(0.8)
548+ height: width
549+ anchors {
550+ horizontalCenter: parent.horizontalCenter
551+ top: parent.verticalCenter
552+ topMargin: ((Math.min(parent.height, dateRootItem.width) / 1.3) / 2) + units.gu(0.1)
553+ }
554+ radius: height/2
555+ color:"black"
556+ visible: showEvent
557 }
558
559 MouseArea {
560@@ -113,7 +71,6 @@
561 //If monthView is clicked then open selected DayView
562 root.dateSelected(selectedDate);
563 } else {
564- intern.selectedIndex = index
565 root.dateHighlighted(selectedDate)
566 }
567 }
568
569=== modified file 'MonthView.qml'
570--- MonthView.qml 2016-01-25 19:05:30 +0000
571+++ MonthView.qml 2016-01-25 19:05:31 +0000
572@@ -24,8 +24,10 @@
573 id: monthViewPage
574 objectName: "monthViewPage"
575
576- property var currentMonth: DateExt.today();
577+ property var anchorDate: DateExt.today();
578+ readonly property var currentDate: monthViewPath.currentItem.indexDate
579 property var selectedDay;
580+ property var highlightedDate;
581
582 signal dateSelected(var date);
583 signal dateHighlighted(var date);
584@@ -38,7 +40,8 @@
585 iconName: "calendar-today"
586 text: i18n.tr("Today")
587 onTriggered: {
588- currentMonth = new Date().midnight()
589+ monthViewPath.scrollToBegginer()
590+ anchorDate = new Date().midnight()
591 }
592 }
593
594@@ -58,7 +61,7 @@
595 // TRANSLATORS: this is a time formatting string,
596 // see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
597 // It's used in the header of the month and week views
598- text: currentMonth.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))
599+ text: currentDate.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))
600 font.capitalization: Font.Capitalize
601 }
602 }
603@@ -67,66 +70,28 @@
604 id: monthViewPath
605 objectName: "monthViewPath"
606
607- property var startMonth: currentMonth;
608-
609- anchors.top:parent.top
610-
611- width:parent.width
612- height: parent.height
613-
614- onNextItemHighlighted: {
615- nextMonth();
616- }
617-
618- onPreviousItemHighlighted: {
619- previousMonth();
620- }
621-
622- function nextMonth() {
623- currentMonth = addMonth(currentMonth, 1);
624- }
625-
626- function previousMonth() {
627- currentMonth = addMonth(currentMonth, -1);
628- }
629-
630- function addMonth(date,month) {
631- return new Date(date.getFullYear(), date.getMonth() + month, 1, 0, 0, 0);
632- }
633-
634- delegate: Loader {
635+ anchors.fill: parent
636+
637+ delegate: MonthWithEventsComponent {
638+ property var indexDate: monthViewPath.loopCurrentIndex === 0 ?
639+ anchorDate : anchorDate.addMonths(monthViewPath.loopCurrentIndex + monthViewPath.indexType(index))
640+
641+ currentMonth: indexDate.getMonth()
642+ currentYear: indexDate.getFullYear()
643+
644 width: parent.width - units.gu(4)
645 height: parent.height
646-
647- sourceComponent: delegateComponent
648- asynchronous: index !== monthViewPath.currentIndex
649-
650- Component {
651- id: delegateComponent
652-
653- MonthComponent {
654- isCurrentItem: index === monthViewPath.currentIndex
655-
656- showEvents: true
657-
658- displayWeekNumber: mainView.displayWeekNumber;
659-
660- anchors.fill: parent
661-
662- currentMonth: monthViewPath.addMonth(monthViewPath.startMonth,
663- monthViewPath.indexType(index));
664-
665- selectedDay: monthViewPage.selectedDay
666- isYearView: false
667-
668- onDateSelected: {
669- monthViewPage.dateSelected(date);
670- }
671-
672- onDateHighlighted: {
673- monthViewPage.dateHighlighted(date);
674- }
675- }
676+ isCurrentItem: (index === monthViewPath.currentIndex)
677+ displayWeekNumber: mainView.displayWeekNumber
678+ highlightedDate: monthViewPage.highlightedDate
679+ isYearView: false
680+
681+ onDateSelected: {
682+ monthViewPage.dateSelected(date);
683+ }
684+ onDateHighlighted: {
685+ monthViewPage.highlightedDate = date
686+ monthViewPage.dateHighlighted(date);
687 }
688 }
689 }
690
691=== modified file 'PathViewBase.qml'
692--- PathViewBase.qml 2016-01-25 19:05:30 +0000
693+++ PathViewBase.qml 2016-01-25 19:05:31 +0000
694@@ -20,8 +20,7 @@
695 PathView {
696 id: root
697
698- model: 3
699- snapMode: PathView.SnapOneItem
700+ readonly property alias loopCurrentIndex: intern.loopCurrentIndex
701
702 signal nextItemHighlighted();
703 signal previousItemHighlighted();
704@@ -29,6 +28,8 @@
705 signal scrollUp();
706 signal scrollDown();
707
708+ model: 3
709+ snapMode: PathView.SnapOneItem
710 preferredHighlightBegin: 0.5
711 preferredHighlightEnd: 0.5
712
713@@ -68,6 +69,11 @@
714 }
715 }
716
717+ function scrollToBegginer()
718+ {
719+ intern.loopCurrentIndex = intern.previousIndex = currentIndex = 0
720+ }
721+
722 Keys.onLeftPressed:{
723 root.decrementCurrentIndex();
724 }
725@@ -98,15 +104,17 @@
726 intern.previousIndex = currentIndex
727
728 if ( diff > 0 ) {
729- root.nextItemHighlighted();
730+ intern.loopCurrentIndex++
731 }
732 else {
733- root.previousItemHighlighted();
734+ intern.loopCurrentIndex--
735 }
736 }
737
738 QtObject{
739 id: intern
740+
741+ property int loopCurrentIndex: 0
742 property int previousIndex: root.currentIndex
743 }
744 }
745
746=== modified file 'TimeLineBaseComponent.qml'
747--- TimeLineBaseComponent.qml 2016-01-25 19:05:30 +0000
748+++ TimeLineBaseComponent.qml 2016-01-25 19:05:31 +0000
749@@ -111,28 +111,33 @@
750 }
751
752 Timer{
753- interval: 200; running: true; repeat: false
754- onTriggered: {
755- mainModel = modelComponent.createObject();
756- activityLoader.running = Qt.binding( function (){ return mainModel.isLoading;});
757- }
758- }
759-
760- Component {
761- id: modelComponent
762- EventListModel {
763- id: mainModel
764- startPeriod: startDay.midnight();
765- endPeriod: type == ViewType.ViewTypeWeek ? startPeriod.addDays(7).endOfDay(): startPeriod.endOfDay()
766- filter: eventModel.filter
767+ interval: 200
768+ running: true
769+ repeat: false
770+ onTriggered: {
771+ mainModel.filter = eventModel.filter
772 }
773 }
774
775+ InvalidFilter {
776+ id: invalidFilter
777+ }
778+
779+ EventListModel {
780+ id: mainModel
781+
782+ filter: invalidFilter // delay event filter in case the user is scrolling too fast
783+ startPeriod: startDay.midnight();
784+ endPeriod: type == ViewType.ViewTypeWeek ? startPeriod.addDays(7).endOfDay(): startPeriod.endOfDay()
785+ }
786+
787 ActivityIndicator {
788 id: activityLoader
789+ objectName : "activityIndicator"
790+
791 visible: running
792- objectName : "activityIndicator"
793 anchors.centerIn: parent
794+ running: mainModel.isLoading
795 z:2
796 }
797
798@@ -183,7 +188,7 @@
799
800 property int delegateWidth: {
801 if( type == ViewType.ViewTypeWeek ) {
802- width/3 - units.gu(1) /*partial visible area*/
803+ width/3 - units.gu(1) // partial visible area
804 } else {
805 width
806 }
807
808=== modified file 'WeekView.qml'
809--- WeekView.qml 2016-01-25 19:05:30 +0000
810+++ WeekView.qml 2016-01-25 19:05:31 +0000
811@@ -25,8 +25,10 @@
812 id: weekViewPage
813 objectName: "weekViewPage"
814
815- property var dayStart: new Date();
816- property var firstDay: dayStart.weekStart(Qt.locale().firstDayOfWeek);
817+ property var anchorDate: new Date();
818+ readonly property var currentDate: weekViewPath.currentItem.item.startDay
819+
820+ property var firstDayOfWeek: currentDate.weekStart(Qt.locale().firstDayOfWeek);
821 property bool isCurrentPage: false
822 property var selectedDay;
823
824@@ -61,7 +63,7 @@
825 id:monthYear
826 objectName:"monthYearLabel"
827 fontSize: "x-large"
828- text: i18n.tr(dayStart.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy")))
829+ text: i18n.tr(currentDate.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy")))
830 font.capitalization: Font.Capitalize
831 }
832 }
833@@ -75,22 +77,6 @@
834 //This is used to scroll all view together when currentItem scrolls
835 property var childContentY;
836
837- onNextItemHighlighted: {
838- nextWeek();
839- }
840-
841- onPreviousItemHighlighted: {
842- previousWeek();
843- }
844-
845- function nextWeek() {
846- dayStart = firstDay.addDays(7);
847- }
848-
849- function previousWeek(){
850- dayStart = firstDay.addDays(-7);
851- }
852-
853 delegate: Loader {
854 id: timelineLoader
855 width: parent.width
856@@ -104,10 +90,10 @@
857 TimeLineBaseComponent {
858 id: timeLineView
859
860+ anchors.fill: parent
861 type: ViewType.ViewTypeWeek
862- anchors.fill: parent
863+ startDay: anchorDate.addDays((weekViewPath.loopCurrentIndex + weekViewPath.indexType(index)) * 7)
864 isActive: parent.PathView.isCurrentItem
865- startDay: firstDay.addDays( weekViewPath.indexType(index) * 7)
866 keyboardEventProvider: weekViewPath
867 selectedDay: weekViewPage.selectedDay
868
869@@ -128,7 +114,7 @@
870 onTriggered:{
871 if( isActive )
872 timeLineView.scrollTocurrentDate();
873- }
874+ }
875 }
876
877 Connections{
878
879=== modified file 'YearView.qml'
880--- YearView.qml 2016-01-25 19:05:30 +0000
881+++ YearView.qml 2016-01-25 19:05:31 +0000
882@@ -24,14 +24,15 @@
883 id: yearViewPage
884 objectName: "yearViewPage"
885
886- property int currentYear: DateExt.today().getFullYear();
887+ property int anchorYear: new Date().getFullYear()
888+ readonly property int currentYear: yearPathView.currentItem.year
889+
890 signal monthSelected(var date);
891
892- Keys.forwardTo: [yearPathView]
893-
894- function refreshCurrentYear(year) {
895- currentYear = year;
896- var yearViewDelegate = yearPathView.currentItem.item;
897+ function refreshCurrentYear(year)
898+ {
899+ anchorYear = year;
900+ var yearViewDelegate = yearPathView.currentItem;
901 yearViewDelegate.refresh();
902 }
903
904@@ -41,10 +42,14 @@
905 iconName: "calendar-today"
906 text: i18n.tr("Today")
907 onTriggered: {
908- currentYear = new Date().getFullYear()
909+ yearPathView.scrollToBegginer()
910+ anchorYear = new Date().getFullYear()
911 }
912 }
913
914+ Keys.forwardTo: [yearPathView]
915+ title: i18n.tr("Year %1").arg(currentYear)
916+
917 head {
918 actions: [
919 calendarTodayAction,
920@@ -54,48 +59,27 @@
921 commonHeaderActions.syncCalendarAction,
922 commonHeaderActions.settingsAction
923 ]
924- contents: Label {
925- id:year
926- objectName:"yearLabel"
927- fontSize: "x-large"
928- text: i18n.tr("Year %1").arg(currentYear)
929- }
930 }
931
932+ flickable: null
933+
934 PathViewBase {
935 id: yearPathView
936 objectName: "yearPathView"
937
938 anchors.fill: parent
939-
940- onNextItemHighlighted: {
941- currentYear = currentYear + 1;
942- }
943-
944- onPreviousItemHighlighted: {
945- currentYear = currentYear - 1;
946- }
947-
948- delegate: Loader {
949- width: parent.width
950- height: parent.height
951- anchors.top: parent.top
952-
953- asynchronous: index !== yearPathView.currentIndex
954- sourceComponent: delegateComponent
955-
956- Component{
957- id: delegateComponent
958-
959- YearViewDelegate{
960- focus: index == yearPathView.currentIndex
961-
962- scrollMonth: 0;
963- isCurrentItem: index == yearPathView.currentIndex
964- year: (currentYear + yearPathView.indexType(index))
965-
966- anchors.fill: parent
967- }
968+ snapMode: PathView.NoSnap
969+
970+ delegate: YearViewDelegate{
971+ width: PathView.view.width
972+ height: PathView.view.height
973+ focus: index == yearPathView.currentIndex
974+
975+ scrollMonth: 0;
976+ isCurrentItem: (index == yearPathView.currentIndex)
977+ year: (anchorYear + yearPathView.loopCurrentIndex + yearPathView.indexType(index))
978+ onMonthSelected: {
979+ yearViewPage.monthSelected(date)
980 }
981 }
982 }
983
984=== modified file 'YearViewDelegate.qml'
985--- YearViewDelegate.qml 2016-01-25 19:05:30 +0000
986+++ YearViewDelegate.qml 2016-01-25 19:05:31 +0000
987@@ -3,24 +3,35 @@
988
989 GridView{
990 id: yearView
991- clip: true
992
993 property int scrollMonth;
994 property bool isCurrentItem;
995 property int year;
996-
997+ readonly property var currentDate: new Date()
998+ readonly property int currentYear: currentDate.getFullYear()
999+ readonly property int currentMonth: currentDate.getMonth()
1000 readonly property int minCellWidth: units.gu(30)
1001+
1002+ signal monthSelected(var date);
1003+
1004+ function refresh() {
1005+ scrollMonth = 0;
1006+ if(year == currentYear) {
1007+ scrollMonth = currentMonth
1008+ }
1009+ yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
1010+ }
1011+
1012+ // Does not increase cash buffer if user is scolling
1013+ cacheBuffer: PathView.view.flicking || PathView.view.dragging || !isCurrentItem ? 0 : 6 * cellHeight
1014+
1015 cellWidth: Math.floor(Math.min.apply(Math, [3, 4].map(function(n)
1016 { return ((width / n >= minCellWidth) ? width / n : width / 2) })))
1017-
1018 cellHeight: cellWidth * 1.4
1019
1020+ clip: true
1021 model: 12 /* months in a year */
1022
1023- onYearChanged: {
1024- refresh();
1025- }
1026-
1027 //scroll in case content height changed
1028 onHeightChanged: {
1029 yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
1030@@ -30,68 +41,36 @@
1031 yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
1032 }
1033
1034- function refresh() {
1035- scrollMonth = 0;
1036- var today = new Date();
1037- if(year == today.getFullYear()) {
1038- scrollMonth = today.getMonth();
1039- }
1040- yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
1041- }
1042-
1043- Connections{
1044- target: yearPathView
1045- onScrollUp: {
1046- scrollMonth -= 2;
1047- if(scrollMonth < 0) {
1048- scrollMonth = 0;
1049- }
1050- yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
1051- }
1052-
1053- onScrollDown: {
1054- scrollMonth += 2;
1055- var visibleMonths = yearView.height / cellHeight;
1056- if( scrollMonth >= (11 - visibleMonths)) {
1057- scrollMonth = (11 - visibleMonths);
1058- }
1059- yearView.positionViewAtIndex(scrollMonth, GridView.Beginning);
1060- }
1061- }
1062-
1063- delegate: Loader {
1064+ delegate: Item {
1065 width: yearView.cellWidth
1066 height: yearView.cellHeight
1067
1068- sourceComponent: delegateComponent
1069- asynchronous: !yearView.focus
1070-
1071- Component {
1072- id: delegateComponent
1073-
1074- Item {
1075- anchors.fill: parent
1076- anchors.margins: units.gu(0.5)
1077-
1078- MonthComponent {
1079- id: monthComponent
1080- objectName: "monthComponent" + index
1081- showEvents: false
1082- currentMonth: new Date(yearView.year, index, 1, 0, 0, 0, 0)
1083- displayWeekNumber: mainView.displayWeekNumber;
1084- isCurrentItem: yearView.focus
1085-
1086- isYearView: true
1087- anchors.fill: parent
1088-
1089- dayLabelFontSize:"x-small"
1090- dateLabelFontSize: "medium"
1091- monthLabelFontSize: "medium"
1092- yearLabelFontSize: "medium"
1093-
1094- onMonthSelected: {
1095- yearViewPage.monthSelected(date);
1096- }
1097+ UbuntuShape {
1098+ radius: "medium"
1099+ anchors {
1100+ fill: parent
1101+ margins: units.gu(0.5)
1102+ }
1103+
1104+ MonthComponent {
1105+ id: monthComponent
1106+ objectName: "monthComponent" + index
1107+
1108+ anchors {
1109+ margins: units.gu(0.5)
1110+ fill: parent
1111+ }
1112+
1113+ currentYear: yearView.year
1114+ currentMonth: index
1115+ isCurrentItem: yearView.focus
1116+ isYearView: true
1117+ dayLabelFontSize:"x-small"
1118+ dateLabelFontSize: "medium"
1119+ monthLabelFontSize: "medium"
1120+ yearLabelFontSize: "medium"
1121+ onMonthSelected: {
1122+ yearView.monthSelected(date);
1123 }
1124 }
1125 }
1126
1127=== modified file 'calendar.qml'
1128--- calendar.qml 2016-01-25 19:05:30 +0000
1129+++ calendar.qml 2016-01-25 19:05:31 +0000
1130@@ -214,6 +214,7 @@
1131 id: tabs
1132 Keys.forwardTo: [tabs.currentPage]
1133
1134+ property bool isReady: false
1135 property var currentDay: DateExt.today();
1136 property var selectedDay;
1137
1138@@ -313,6 +314,7 @@
1139 else {
1140 tabs.selectedTabIndex = settings.defaultViewIndex;
1141 }
1142+ tabs.isReady = true
1143 } // End of Component.onCompleted:
1144
1145 EventActions {
1146@@ -347,139 +349,196 @@
1147 }
1148 }
1149
1150- onSelectedTabChanged: {
1151- switch (tabs.selectedTab) {
1152- case yearTab:{
1153- if (yearTab.page === null) {
1154- var yearViewCom = Qt.createComponent("YearView.qml");
1155- if (yearViewCom.status === Component.Ready) {
1156- var yearViewObj = yearViewCom.createObject(mainView);
1157-
1158- yearViewObj.monthSelected.connect(function (date){
1159- var now = DateExt.today();
1160- if( date.getMonth() === now.getMonth()
1161- && date.getFullYear() === now.getFullYear()) {
1162- tabs.currentDay = now;
1163- } else {
1164- tabs.currentDay = date.midnight();
1165- }
1166- tabs.selectedTabIndex = monthTab.index;
1167- })
1168-
1169- yearTab.page = yearViewObj;
1170- }
1171- } else {
1172- yearTab.page.refreshCurrentYear(DateExt.today().getFullYear());
1173- }
1174- } break;
1175- case monthTab: {
1176- if (monthTab.page === null) {
1177- var monthViewCom = Qt.createComponent("MonthView.qml");
1178- if (monthViewCom.status === Component.Ready) {
1179- var monthViewObj = monthViewCom.createObject(mainView);
1180-
1181- monthViewObj.dateSelected.connect(function (date) {
1182- tabs.currentDay = date;
1183- tabs.selectedTabIndex = dayTab.index;
1184- })
1185-
1186- monthTab.page = monthViewObj;
1187- }
1188- } else {
1189- monthTab.page.currentMonth = tabs.currentDay.midnight();
1190- }
1191- } break;
1192- case weekTab: {
1193- if (weekTab.page === null) {
1194- var weekViewCom = Qt.createComponent("WeekView.qml");
1195- if (weekViewCom.status === Component.Ready) {
1196- var weekViewObj = weekViewCom.createObject(mainView);
1197-
1198- weekViewObj.isCurrentPage = Qt.binding(function() { return tabs.selectedTab == weekTab })
1199- weekViewObj.onDayStartChanged.connect(function (){
1200- tabs.currentDay = weekViewObj.dayStart;
1201- });
1202- weekViewObj.dateSelected.connect(function (date){
1203- tabs.currentDay = date;
1204- tabs.selectedTabIndex = dayTab.index;
1205- });
1206-
1207- weekTab.page = weekViewObj;
1208- }
1209- } else {
1210- weekTab.page.dayStart = tabs.currentDay;
1211- }
1212- } break;
1213- case dayTab: {
1214- if (dayTab.page === null) {
1215- var dayViewCom = Qt.createComponent("DayView.qml");
1216- if (dayViewCom.status === Component.Ready) {
1217- var dayViewObj = dayViewCom.createObject(mainView);
1218-
1219- dayViewObj.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == dayTab })
1220- dayViewObj.onCurrentDayChanged.connect(function (){
1221- tabs.currentDay = dayViewObj.currentDay;
1222- });
1223- dayViewObj.dateSelected.connect(function (date) {
1224- tabs.currentDay = date;
1225- });
1226-
1227- dayTab.page =dayViewObj;
1228- }
1229- } else {
1230- dayTab.page.currentDay = tabs.currentDay;
1231- }
1232- } break;
1233- case agendaTab: {
1234- var agendaViewCom = Qt.createComponent("AgendaView.qml");
1235- if (agendaViewCom.status === Component.Ready) {
1236- var agendaViewObj = agendaViewCom.createObject(mainView);
1237-
1238- agendaViewObj.dateSelected.connect(function (date){
1239- tabs.currentDay = date;
1240- tabs.selectedTabIndex = dayTab.index;
1241- })
1242- agendaTab.page = agendaViewObj;
1243- }
1244- } break;
1245- default:
1246- break;
1247- }
1248- }
1249-
1250 Tab{
1251 id: yearTab
1252 objectName: "yearTab"
1253 title: i18n.tr("Year")
1254- page: null
1255+
1256+ page: Loader {
1257+ id: yearViewLoader
1258+
1259+ asynchronous: true
1260+ sourceComponent: yearViewComp
1261+ active: false
1262+ // Load page on demand and keep it on memory until the application is closed
1263+ enabled: tabs.isReady && (tabs.selectedTab == yearTab)
1264+ onEnabledChanged: {
1265+ if (enabled && !active) {
1266+ active = true
1267+ }
1268+ }
1269+ }
1270 }
1271
1272 Tab{
1273 id: monthTab
1274 objectName: "monthTab"
1275 title: i18n.tr("Month")
1276- page: null
1277+
1278+ page: Loader {
1279+ id: monthTabLoader
1280+
1281+ asynchronous: true
1282+ sourceComponent: monthViewComp
1283+ active: false
1284+ // Load page on demand and keep it on memory until the application is closed
1285+ enabled: tabs.isReady && (tabs.selectedTab == monthTab)
1286+ onEnabledChanged: {
1287+ if (enabled && !active) {
1288+ active = true
1289+ }
1290+ }
1291+ }
1292 }
1293
1294 Tab{
1295 id: weekTab
1296 objectName: "weekTab"
1297 title: i18n.tr("Week")
1298- page: null
1299+
1300+ page: Loader {
1301+ id: weekTabLoader
1302+
1303+ asynchronous: true
1304+ sourceComponent: weekViewComp
1305+ active: false
1306+ // Load page on demand and keep it on memory until the application is closed
1307+ enabled: tabs.isReady && (tabs.selectedTab == weekTab)
1308+ onEnabledChanged: {
1309+ if (enabled && !active) {
1310+ active = true
1311+ }
1312+ }
1313+ }
1314 }
1315
1316 Tab{
1317 id: dayTab
1318 objectName: "dayTab"
1319 title: i18n.tr("Day")
1320- page: null
1321+
1322+ page:Loader {
1323+ id: dayTabLoader
1324+
1325+ asynchronous: true
1326+ sourceComponent: dayViewComp
1327+ active: false
1328+ // Load page on demand and keep it on memory until the application is closed
1329+ enabled: tabs.isReady && (tabs.selectedTab == dayTab)
1330+ onEnabledChanged: {
1331+ if (enabled && !active) {
1332+ active = true
1333+ }
1334+ }
1335+ }
1336 }
1337
1338 Tab {
1339 id: agendaTab
1340 objectName: "agendaTab"
1341 title: i18n.tr("Agenda")
1342- page: null
1343+
1344+ page: Loader {
1345+ id: agendaTabLoader
1346+
1347+ asynchronous: true
1348+ sourceComponent: agendaViewComp
1349+ // Load page on demand and keep it on memory until the application is closed
1350+ enabled: tabs.isReady && (tabs.selectedTab == agendaTab)
1351+ onEnabledChanged: {
1352+ if (enabled && !active) {
1353+ active = true
1354+ }
1355+ }
1356+ }
1357+ }
1358+ }
1359+
1360+ Component {
1361+ id: yearViewComp
1362+
1363+ YearView {
1364+ onMonthSelected: {
1365+ var now = DateExt.today();
1366+ if ((date.getMonth() === now.getMonth()) &&
1367+ (date.getFullYear() === now.getFullYear())) {
1368+ tabs.currentDay = now;
1369+ } else {
1370+ tabs.currentDay = date.midnight();
1371+ }
1372+ tabs.selectedTabIndex = monthTab.index;
1373+ }
1374+ onActiveChanged: {
1375+ if (active) {
1376+ refreshCurrentYear(tabs.currentDay.getFullYear())
1377+ }
1378+ }
1379+ }
1380+ }
1381+
1382+ Component {
1383+ id: monthViewComp
1384+
1385+ MonthView {
1386+ onDateSelected: {
1387+ tabs.currentDay = date
1388+ tabs.selectedTabIndex = dayTab.index
1389+ }
1390+ onActiveChanged: {
1391+ if (active) {
1392+ anchorDate = tabs.currentDay.midnight()
1393+ }
1394+ }
1395+ }
1396+ }
1397+
1398+ Component {
1399+ id: weekViewComp
1400+
1401+ WeekView {
1402+ onCurrentDateChanged: {
1403+ tabs.currentDay = currentDate
1404+ }
1405+ onDateSelected: {
1406+ tabs.currentDay = date;
1407+ tabs.selectedTabIndex = dayTab.index;
1408+ }
1409+ onActiveChanged: {
1410+ if (active) {
1411+ anchorDate = tabs.currentDay.midnight()
1412+ }
1413+ }
1414+ }
1415+ }
1416+
1417+ Component {
1418+ id: dayViewComp
1419+
1420+ DayView {
1421+ onCurrentDateChanged: {
1422+ tabs.currentDay = currentDate;
1423+ }
1424+
1425+ onDateSelected: {
1426+ tabs.currentDay = date
1427+ }
1428+
1429+ onActiveChanged: {
1430+ if (active) {
1431+ anchorDate = tabs.currentDay
1432+ }
1433+ }
1434+ }
1435+ }
1436+
1437+ Component {
1438+ id: agendaViewComp
1439+
1440+ AgendaView {
1441+ onDateSelected: {
1442+ tabs.currentDay = date;
1443+ tabs.selectedTabIndex = dayTab.index;
1444+ }
1445 }
1446 }
1447 }
1448
1449=== modified file 'po/com.ubuntu.calendar.pot'
1450--- po/com.ubuntu.calendar.pot 2015-11-23 07:15:20 +0000
1451+++ po/com.ubuntu.calendar.pot 2016-01-25 19:05:31 +0000
1452@@ -8,7 +8,7 @@
1453 msgstr ""
1454 "Project-Id-Version: \n"
1455 "Report-Msgid-Bugs-To: \n"
1456-"POT-Creation-Date: 2015-11-23 15:14+0800\n"
1457+"POT-Creation-Date: 2016-01-12 12:03-0300\n"
1458 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1459 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1460 "Language-Team: LANGUAGE <LL@li.org>\n"
1461@@ -263,7 +263,7 @@
1462 msgid "After Date"
1463 msgstr ""
1464
1465-#: ../MonthComponent.qml:260
1466+#: ../MonthComponent.qml:263
1467 msgid "Wk"
1468 msgstr ""
1469
1470@@ -416,7 +416,7 @@
1471 msgid "All Day"
1472 msgstr ""
1473
1474-#: ../YearView.qml:61
1475+#: ../YearView.qml:48
1476 #, qt-format
1477 msgid "Year %1"
1478 msgstr ""

Subscribers

People subscribed via source and target branches

to status/vote changes: