Warning, /plasma-mobile/calindori/src/contents/ui/Main.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Dimitris Kardarakos <dimkard@posteo.net> 0003 * SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org> 0004 * 0005 * SPDX-License-Identifier: GPL-3.0-or-later 0006 */ 0007 0008 import QtQuick 2.7 0009 import org.kde.kirigami 2.12 as Kirigami 0010 import org.kde.calindori 0.1 as Calindori 0011 0012 Kirigami.ApplicationWindow { 0013 id: root 0014 0015 signal switchToMonthPage(var sDate, var cActionIndex) 0016 0017 /** 0018 * Starting from the last layer in the stack, remove every layer keeping only the first one 0019 */ 0020 function popExtraLayers() { 0021 while (pageStack.layers.depth > 1) { 0022 pageStack.layers.pop(); 0023 } 0024 } 0025 0026 globalDrawer: CalindoriGlobalDrawer { 0027 id: globalDrawer 0028 0029 wideScreen: root.wideScreen 0030 monthView: calendarMonthPage 0031 calendar: Calindori.CalendarController.activeCalendar 0032 applicationFooter: messageFooter 0033 } 0034 0035 contextDrawer: Kirigami.ContextDrawer { 0036 id: contextDrawer 0037 0038 property var contextIconName: (pageStack && pageStack.currentItem && pageStack.currentItem.hasOwnProperty('contextIconName')) ? pageStack.currentItem.contextIconName : null 0039 handleOpenIcon.source: contextIconName 0040 handleClosedIcon.source: contextIconName 0041 0042 title: (pageStack.currentItem && pageStack.currentItem.hasOwnProperty("selectedDate") && !isNaN(pageStack.currentItem.selectedDate)) ? pageStack.currentItem.selectedDate.toLocaleDateString(_appLocale, Locale.ShortFormat) : "" 0043 } 0044 0045 pageStack { 0046 initialPage: [calendarMonthPage] 0047 defaultColumnWidth: Kirigami.Units.gridUnit * 35 0048 0049 globalToolBar.canContainHandles: true 0050 globalToolBar.style: Kirigami.ApplicationHeaderStyle.ToolBar 0051 globalToolBar.showNavigationButtons: Kirigami.ApplicationHeaderStyle.ShowBackButton 0052 popHiddenPages: true 0053 } 0054 0055 Component { 0056 id: calendarMonthPage 0057 0058 CalendarMonthPage { 0059 appContextDrawer: contextDrawer 0060 calendar: Calindori.CalendarController.activeCalendar 0061 dayRectangleWidth: Kirigami.Settings.isMobile ? Kirigami.Units.gridUnit * 2.5 : Kirigami.Units.gridUnit * 3.5 0062 loadWithAction: !Kirigami.Settings.isMobile && root.wideScreen ? 1 : -1 0063 0064 onPageEnd: switchToMonthPage(lastDate, lastActionIndex) 0065 } 0066 } 0067 0068 footer: MessageBoard { 0069 id: messageFooter 0070 0071 leftPadding: (globalDrawer.drawerOpen ? globalDrawer.width : 0) + Kirigami.Units.smallSpacing 0072 activeCalendar: Calindori.CalendarController.activeCalendar 0073 0074 Connections { 0075 target: Calindori.CalendarController 0076 function onStatusMessageChanged (statusMessage, messageType) { 0077 messageFooter.text = statusMessage; 0078 messageFooter.footerMode = (messageType === 0) ? MessageBoard.FooterMode.StartImport : (messageType === 1 ? MessageBoard.FooterMode.EndImportSuccess : MessageBoard.FooterMode.EndImportFailure); 0079 } 0080 } 0081 } 0082 0083 onSwitchToMonthPage: { 0084 pageStack.clear(); 0085 pageStack.push(calendarMonthPage, {selectedDate: sDate, loadWithAction: (!Kirigami.Settings.isMobile && root.wideScreen) ? cActionIndex : -1}); 0086 } 0087 0088 }