Renato Araujo Oliveira Filho has proposed merging lp:~renatofilho/ubuntu-calendar-app/optimize-page-load into lp:ubuntu-calendar-app with lp:~popey/ubuntu-calendar-app/Uitk1_3_and_font_fix as a prerequisite.
Commit message: Simplify Tab loading, declaring individual components for each tab. Make sure that year view is not loaded on app startup without request. Requested reviews: Jenkins Bot (ubuntu-core-apps-jenkins-bot): continuous-integration Ubuntu Calendar Developers (ubuntu-calendar-dev) For more details, see: https://code.launchpad.net/~renatofilho/ubuntu-calendar-app/optimize-page-load/+merge/284451 -- Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~renatofilho/ubuntu-calendar-app/optimize-page-load into lp:ubuntu-calendar-app.
=== modified file 'AgendaView.qml' --- AgendaView.qml 2016-01-29 14:14:55 +0000 +++ AgendaView.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import QtOrganizer 5.0 import Ubuntu.Components 1.3 import Ubuntu.Components.ListItems 1.0 as ListItem === modified file 'AllDayEventComponent.qml' --- AllDayEventComponent.qml 2016-01-29 14:14:55 +0000 +++ AllDayEventComponent.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.Popups 1.0 import QtOrganizer 5.0 === modified file 'CalendarChoicePopup.qml' --- CalendarChoicePopup.qml 2016-01-29 14:14:55 +0000 +++ CalendarChoicePopup.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.Popups 1.0 import Ubuntu.Components.ListItems 1.0 as ListItem === modified file 'CalendarListButtonDelegate.qml' --- CalendarListButtonDelegate.qml 2016-01-29 14:14:55 +0000 +++ CalendarListButtonDelegate.qml 2016-01-29 14:14:55 +0000 @@ -14,7 +14,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.0 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.ListItems 1.0 as ListItem === modified file 'ColorPickerDialog.qml' --- ColorPickerDialog.qml 2016-01-29 14:14:55 +0000 +++ ColorPickerDialog.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.Popups 1.0 === modified file 'ContactChoicePopup.qml' --- ContactChoicePopup.qml 2016-01-29 14:14:55 +0000 +++ ContactChoicePopup.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.Popups 1.0 import Ubuntu.Components.ListItems 1.0 === modified file 'DayHeaderBackground.qml' --- DayHeaderBackground.qml 2014-09-20 10:45:35 +0000 +++ DayHeaderBackground.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 Item { width: parent.width === modified file 'DayView.qml' --- DayView.qml 2016-01-29 14:14:55 +0000 +++ DayView.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import "dateExt.js" as DateExt import "ViewType.js" as ViewType === modified file 'Defines.js' --- Defines.js 2016-01-29 14:14:55 +0000 +++ Defines.js 2016-01-29 14:14:55 +0000 @@ -43,7 +43,7 @@ function getWeekLabels(){ var object = Qt.createQmlObject('\ - import QtQuick 2.3;\ + import QtQuick 2.4;\ import Ubuntu.Components 1.3;\ QtObject {\ property var weekLabel:[Qt.locale().dayName(7,Locale.NarrowFormat),\ === modified file 'DeleteConfirmationDialog.qml' --- DeleteConfirmationDialog.qml 2016-01-29 14:14:55 +0000 +++ DeleteConfirmationDialog.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.Popups 1.0 === modified file 'EditEventConfirmationDialog.qml' --- EditEventConfirmationDialog.qml 2016-01-29 14:14:55 +0000 +++ EditEventConfirmationDialog.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.Popups 1.0 === modified file 'EventActions.qml' --- EventActions.qml 2016-01-29 14:14:55 +0000 +++ EventActions.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.SyncMonitor 0.1 === modified file 'EventBubble.qml' --- EventBubble.qml 2016-01-29 14:14:55 +0000 +++ EventBubble.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import QtOrganizer 5.0 === modified file 'EventDetails.qml' --- EventDetails.qml 2016-01-29 14:14:55 +0000 +++ EventDetails.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.ListItems 1.0 as ListItem import Ubuntu.Components.Themes.Ambiance 1.0 @@ -209,7 +209,7 @@ dialog.editEvent.connect( function(eventId){ if( eventId === event.parentId ) { showEditEventPage(internal.parentEvent, model) - } else { + } else { showEditEventPage(event, model) } }); === modified file 'EventListModel.qml' --- EventListModel.qml 2015-08-24 05:08:46 +0000 +++ EventListModel.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import QtOrganizer 5.0 OrganizerModel { @@ -41,7 +41,7 @@ } function startLoadingTimer() { - var newObject = Qt.createQmlObject("import QtQuick 2.3; Timer {interval: 1000; running: true; repeat: false;}", + var newObject = Qt.createQmlObject("import QtQuick 2.4; Timer {interval: 1000; running: true; repeat: false;}", eventModel, "EventListMode.qml"); newObject.onTriggered.connect( function(){ var items = itemsByTimePeriod(eventModel.startPeriod, eventModel.endPeriod); @@ -73,7 +73,7 @@ } } return cals; - } + } function getWritableCollections(){ var cals = []; === modified file 'EventReminder.qml' --- EventReminder.qml 2016-01-29 14:14:55 +0000 +++ EventReminder.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.ListItems 1.0 as ListItem === modified file 'EventRepetition.qml' --- EventRepetition.qml 2016-01-29 14:14:55 +0000 +++ EventRepetition.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import QtOrganizer 5.0 import Ubuntu.Components 1.3 import Ubuntu.Components.ListItems 1.0 as ListItem === modified file 'EventUtils.qml' --- EventUtils.qml 2016-01-29 14:14:55 +0000 +++ EventUtils.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import QtOrganizer 5.0 import "Defines.js" as Defines === modified file 'HeaderDateComponent.qml' --- HeaderDateComponent.qml 2016-01-29 14:14:55 +0000 +++ HeaderDateComponent.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 Item { === modified file 'KeyboardRectangle.qml' --- KeyboardRectangle.qml 2014-09-20 10:45:35 +0000 +++ KeyboardRectangle.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 Item { id: keyboardRect === modified file 'LimitLabelModel.qml' --- LimitLabelModel.qml 2014-10-22 17:32:15 +0000 +++ LimitLabelModel.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3; +import QtQuick 2.4 ListModel { id:limitLables === modified file 'MonthComponent.qml' --- MonthComponent.qml 2016-01-29 14:14:55 +0000 +++ MonthComponent.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import "dateExt.js" as DateExt import "colorUtils.js" as Color === modified file 'MonthComponentDateDelegate.qml' --- MonthComponentDateDelegate.qml 2016-01-29 14:14:55 +0000 +++ MonthComponentDateDelegate.qml 2016-01-29 14:14:55 +0000 @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.4 import Ubuntu.Components 1.3 Item{ === modified file 'MonthView.qml' --- MonthView.qml 2016-01-29 14:14:55 +0000 +++ MonthView.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import "dateExt.js" as DateExt import "colorUtils.js" as Color === modified file 'NewEvent.qml' --- NewEvent.qml 2016-01-29 14:14:55 +0000 +++ NewEvent.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import QtOrganizer 5.0 import Ubuntu.Components 1.3 import Ubuntu.Components.Popups 1.0 === modified file 'NewEventEntryField.qml' --- NewEventEntryField.qml 2016-01-29 14:14:55 +0000 +++ NewEventEntryField.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 Label { === modified file 'NewEventTimePicker.qml' --- NewEventTimePicker.qml 2014-10-21 18:58:31 +0000 +++ NewEventTimePicker.qml 2016-01-29 14:14:55 +0000 @@ -1,4 +1,4 @@ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components.ListItems 1.0 as ListItem import Ubuntu.Components.Themes.Ambiance 1.0 import Ubuntu.Components.Pickers 1.0 === modified file 'OnlineAccountsHelper.qml' --- OnlineAccountsHelper.qml 2016-01-29 14:14:55 +0000 +++ OnlineAccountsHelper.qml 2016-01-29 14:14:55 +0000 @@ -14,7 +14,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.2 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.OnlineAccounts 0.1 import Ubuntu.OnlineAccounts.Client 0.1 === modified file 'PathViewBase.qml' --- PathViewBase.qml 2015-08-29 08:59:47 +0000 +++ PathViewBase.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 PathView { id: root === modified file 'RecurrenceLabelDefines.qml' --- RecurrenceLabelDefines.qml 2016-01-29 14:14:55 +0000 +++ RecurrenceLabelDefines.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 QtObject { === modified file 'RemindersModel.qml' --- RemindersModel.qml 2014-10-17 05:42:34 +0000 +++ RemindersModel.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 ListModel { id: reminderModel === modified file 'ScrollAnimation.qml' --- ScrollAnimation.qml 2014-09-20 10:45:35 +0000 +++ ScrollAnimation.qml 2016-01-29 14:14:55 +0000 @@ -1,4 +1,4 @@ -import QtQuick 2.3 +import QtQuick 2.4 PropertyAnimation { duration: 500 === modified file 'Scroller.qml' --- Scroller.qml 2016-01-29 14:14:55 +0000 +++ Scroller.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.ListItems 1.0 as ListItems === modified file 'Settings.qml' --- Settings.qml 2016-01-29 14:14:55 +0000 +++ Settings.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.Popups 1.0 import Ubuntu.Components.ListItems 1.0 as ListItem @@ -27,7 +27,7 @@ visible: false head { - title: i18n.tr("Settings") + title: i18n.tr("Settings") backAction: Action { text: i18n.tr("Back") iconName: "back" === modified file 'SimpleDivider.qml' --- SimpleDivider.qml 2014-12-11 20:29:27 +0000 +++ SimpleDivider.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.0 +import QtQuick 2.4 Rectangle{ height: units.gu(0.1) === modified file 'TimeLineBackground.qml' --- TimeLineBackground.qml 2016-01-29 14:14:55 +0000 +++ TimeLineBackground.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 Column { === modified file 'TimeLineBase.qml' --- TimeLineBase.qml 2016-01-29 14:14:55 +0000 +++ TimeLineBase.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import QtOrganizer 5.0 === modified file 'TimeLineBaseComponent.qml' --- TimeLineBaseComponent.qml 2016-01-29 14:14:55 +0000 +++ TimeLineBaseComponent.qml 2016-01-29 14:14:55 +0000 @@ -16,8 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 -import QtQuick.Layouts 1.1 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.Popups 1.0 import QtOrganizer 5.0 === modified file 'TimeLineHeader.qml' --- TimeLineHeader.qml 2016-01-29 14:14:55 +0000 +++ TimeLineHeader.qml 2016-01-29 14:14:55 +0000 @@ -16,9 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.0 +import QtQuick 2.4 import Ubuntu.Components 1.3 -import QtQuick.Layouts 1.1 import "ViewType.js" as ViewType @@ -50,7 +49,7 @@ id: weekNumLabel objectName: "weeknumber" - // TRANSLATORS: W refers to Week, followed by the actual week number (%1) + // TRANSLATORS: W refers to Week, followed by the actual week number (%1) text: i18n.tr("W%1").arg(startDay.weekNumber(Qt.locale().firstDayOfWeek)) fontSize: "small" height: units.gu(5) === modified file 'TimeLineHeaderComponent.qml' --- TimeLineHeaderComponent.qml 2016-01-29 14:14:55 +0000 +++ TimeLineHeaderComponent.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import "dateExt.js" as DateExt import "ViewType.js" as ViewType === modified file 'TimeLineTimeScale.qml' --- TimeLineTimeScale.qml 2016-01-29 14:14:55 +0000 +++ TimeLineTimeScale.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.0 +import QtQuick 2.4 import Ubuntu.Components 1.3 Flickable{ === modified file 'TimeSeparator.qml' --- TimeSeparator.qml 2014-09-20 10:45:35 +0000 +++ TimeSeparator.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 Rectangle { id: separator === modified file 'ViewHeader.qml' --- ViewHeader.qml 2016-01-29 14:14:55 +0000 +++ ViewHeader.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 Item{ === modified file 'WeekView.qml' --- WeekView.qml 2016-01-29 14:14:55 +0000 +++ WeekView.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import "dateExt.js" as DateExt import "ViewType.js" as ViewType === modified file 'YearView.qml' --- YearView.qml 2016-01-29 14:14:55 +0000 +++ YearView.qml 2016-01-29 14:14:55 +0000 @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import "dateExt.js" as DateExt === modified file 'YearViewDelegate.qml' --- YearViewDelegate.qml 2016-01-29 14:14:55 +0000 +++ YearViewDelegate.qml 2016-01-29 14:14:55 +0000 @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.4 import Ubuntu.Components 1.3 GridView{ === modified file 'calendar.qml' --- calendar.qml 2016-01-29 14:14:55 +0000 +++ calendar.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 import Ubuntu.Components.Popups 1.0 import QtOrganizer 5.0 @@ -126,6 +126,7 @@ } } + // Load events after the app startup Timer { id: applyFilterTimer interval: 200; running: false; repeat: false @@ -157,6 +158,16 @@ id: collectionFilter } + InvalidFilter { + id: invalidFilter + } + + IntersectionFilter { + id: mainFilter + + filters: [ collectionFilter, itemTypeFilter] + } + EventListModel{ id: eventModel @@ -164,9 +175,7 @@ startPeriod: tabs.currentDay endPeriod: tabs.currentDay - filter: IntersectionFilter { - filters: [ collectionFilter, itemTypeFilter] - } + filter: invalidFilter function delayedApplyFilter() { applyFilterTimer.restart(); @@ -182,6 +191,7 @@ } } collectionFilter.ids = collectionIds; + filter = mainFilter } function showEventFromId(eventId) { @@ -214,6 +224,7 @@ id: tabs Keys.forwardTo: [tabs.currentPage] + property bool isReady: false property var currentDay: DateExt.today(); property var selectedDay; @@ -313,6 +324,7 @@ else { tabs.selectedTabIndex = settings.defaultViewIndex; } + tabs.isReady = true } // End of Component.onCompleted: EventActions { @@ -347,139 +359,194 @@ } } - onSelectedTabChanged: { - switch (tabs.selectedTab) { - case yearTab:{ - if (yearTab.page === null) { - var yearViewCom = Qt.createComponent("YearView.qml"); - if (yearViewCom.status === Component.Ready) { - var yearViewObj = yearViewCom.createObject(mainView); - - yearViewObj.monthSelected.connect(function (date){ - var now = DateExt.today(); - if( date.getMonth() === now.getMonth() - && date.getFullYear() === now.getFullYear()) { - tabs.currentDay = now; - } else { - tabs.currentDay = date.midnight(); - } - tabs.selectedTabIndex = monthTab.index; - }) - - yearTab.page = yearViewObj; - } - } else { - yearTab.page.refreshCurrentYear(DateExt.today().getFullYear()); - } - } break; - case monthTab: { - if (monthTab.page === null) { - var monthViewCom = Qt.createComponent("MonthView.qml"); - if (monthViewCom.status === Component.Ready) { - var monthViewObj = monthViewCom.createObject(mainView); - - monthViewObj.dateSelected.connect(function (date) { - tabs.currentDay = date; - tabs.selectedTabIndex = dayTab.index; - }) - - monthTab.page = monthViewObj; - } - } else { - monthTab.page.currentMonth = tabs.currentDay.midnight(); - } - } break; - case weekTab: { - if (weekTab.page === null) { - var weekViewCom = Qt.createComponent("WeekView.qml"); - if (weekViewCom.status === Component.Ready) { - var weekViewObj = weekViewCom.createObject(mainView); - - weekViewObj.isCurrentPage = Qt.binding(function() { return tabs.selectedTab == weekTab }) - weekViewObj.onDayStartChanged.connect(function (){ - tabs.currentDay = weekViewObj.dayStart; - }); - weekViewObj.dateSelected.connect(function (date){ - tabs.currentDay = date; - tabs.selectedTabIndex = dayTab.index; - }); - - weekTab.page = weekViewObj; - } - } else { - weekTab.page.dayStart = tabs.currentDay; - } - } break; - case dayTab: { - if (dayTab.page === null) { - var dayViewCom = Qt.createComponent("DayView.qml"); - if (dayViewCom.status === Component.Ready) { - var dayViewObj = dayViewCom.createObject(mainView); - - dayViewObj.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == dayTab }) - dayViewObj.onCurrentDayChanged.connect(function (){ - tabs.currentDay = dayViewObj.currentDay; - }); - dayViewObj.dateSelected.connect(function (date) { - tabs.currentDay = date; - }); - - dayTab.page =dayViewObj; - } - } else { - dayTab.page.currentDay = tabs.currentDay; - } - } break; - case agendaTab: { - var agendaViewCom = Qt.createComponent("AgendaView.qml"); - if (agendaViewCom.status === Component.Ready) { - var agendaViewObj = agendaViewCom.createObject(mainView); - - agendaViewObj.dateSelected.connect(function (date){ - tabs.currentDay = date; - tabs.selectedTabIndex = dayTab.index; - }) - agendaTab.page = agendaViewObj; - } - } break; - default: - break; - } - } - Tab{ id: yearTab objectName: "yearTab" title: i18n.tr("Year") - page: null + + page: Loader { + id: yearViewLoader + + asynchronous: true + sourceComponent: yearViewComp + active: false + // Load page on demand and keep it on memory until the application is closed + enabled: tabs.isReady && (tabs.selectedTab == yearTab) + onEnabledChanged: { + if (enabled && !active) { + active = true + } + } + } } Tab{ id: monthTab objectName: "monthTab" title: i18n.tr("Month") - page: null + + page: Loader { + id: monthTabLoader + + asynchronous: true + sourceComponent: monthViewComp + active: false + // Load page on demand and keep it on memory until the application is closed + enabled: tabs.isReady && (tabs.selectedTab == monthTab) + onEnabledChanged: { + if (enabled && !active) { + active = true + } + } + } } Tab{ id: weekTab objectName: "weekTab" title: i18n.tr("Week") - page: null + + page: Loader { + id: weekTabLoader + + asynchronous: true + sourceComponent: weekViewComp + active: false + // Load page on demand and keep it on memory until the application is closed + enabled: tabs.isReady && (tabs.selectedTab == weekTab) + onEnabledChanged: { + if (enabled && !active) { + active = true + } + } + } } Tab{ id: dayTab objectName: "dayTab" title: i18n.tr("Day") - page: null + + page:Loader { + id: dayTabLoader + + asynchronous: true + sourceComponent: dayViewComp + active: false + // Load page on demand and keep it on memory until the application is closed + enabled: tabs.isReady && (tabs.selectedTab == dayTab) + onEnabledChanged: { + if (enabled && !active) { + active = true + } + } + } } Tab { id: agendaTab objectName: "agendaTab" title: i18n.tr("Agenda") - page: null + + page: Loader { + id: agendaTabLoader + + asynchronous: true + sourceComponent: agendaViewComp + active: false + // Load page on demand and keep it on memory until the application is closed + enabled: tabs.isReady && (tabs.selectedTab == agendaTab) + onEnabledChanged: { + if (enabled && !active) { + active = true + } + } + } + } + } + } + + Component { + id: yearViewComp + + YearView { + onMonthSelected: { + var now = DateExt.today(); + if ((date.getMonth() === now.getMonth()) && + (date.getFullYear() === now.getFullYear())) { + tabs.currentDay = now; + } else { + tabs.currentDay = date.midnight(); + } + tabs.selectedTabIndex = monthTab.index; + } + onActiveChanged: { + if (active) { + refreshCurrentYear(DateExt.today().getFullYear()) + } + } + } + } + + Component { + id: monthViewComp + + MonthView { + onDateSelected: { + tabs.currentDay = date; + tabs.selectedTabIndex = dayTab.index + } + onActiveChanged: { + if (active) + currentMonth = tabs.currentDay.midnight() + } + } + } + + Component { + id: weekViewComp + + WeekView { + onDayStartChanged: { + tabs.currentDay = dayStart + } + onDateSelected: { + tabs.currentDay = date; + tabs.selectedTabIndex = dayTab.index + } + onActiveChanged: { + if (active) + dayStart = tabs.currentDay + } + } + } + + Component { + id: dayViewComp + + DayView { + onCurrentDayChanged: { + tabs.currentDay = currentDay; + } + + onDateSelected: { + tabs.currentDay = date + } + + onActiveChanged: { + if (active) + currentDay = tabs.currentDay; + } + } + } + + Component { + id: agendaViewComp + + AgendaView { + onDateSelected: { + tabs.currentDay = date; + tabs.selectedTabIndex = dayTab.index } } } === modified file 'calendarTests.qml' --- calendarTests.qml 2016-01-29 14:14:55 +0000 +++ calendarTests.qml 2016-01-29 14:14:55 +0000 @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import QtQuick 2.3 +import QtQuick 2.4 import Ubuntu.Components 1.3 MainView {
-- Mailing list: https://launchpad.net/~ubuntu-touch-coreapps-reviewers Post to : [email protected] Unsubscribe : https://launchpad.net/~ubuntu-touch-coreapps-reviewers More help : https://help.launchpad.net/ListHelp

