Warning, /maui/agenda/src/controls/main.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.15
0002 import QtQml 2.15
0003 import QtQuick.Controls 2.15
0004 import QtQuick.Layouts 1.12
0005 import org.mauikit.controls 1.3 as Maui
0006 import org.mauikit.calendar 1.0 as Cal
0007 
0008 Maui.ApplicationWindow
0009 {
0010     id: root
0011 
0012     Maui.PopupPage
0013     {
0014         id: _eventDialog
0015         persistent: true
0016         headBar.visible: false
0017 
0018 actions: [
0019 
0020     Action
0021     {
0022         text: i18n("Cancel")
0023         onTriggered: _eventDialog.close()
0024     },
0025 
0026     Action
0027     {
0028         text: i18n("Create")
0029         onTriggered:
0030         {
0031             Cal.CalendarManager.addIncidence(_eventPage.incidence)
0032         }
0033     }
0034 ]
0035 
0036         Cal.EventPage
0037         {
0038             id: _eventPage
0039             Layout.fillWidth: true
0040         }
0041     }
0042 
0043     Action
0044     {
0045         id: _newEventAction
0046         text: "New event"
0047         icon.name: "new-event"
0048         onTriggered: _eventDialog.open()
0049     }
0050 
0051     Maui.SideBarView
0052     {
0053         id: _sideBarView
0054         anchors.fill: parent
0055         sideBar.autoHide: true
0056 
0057         sideBarContent:  Maui.Page
0058         {
0059             anchors.fill: parent
0060             Maui.Theme.colorSet: Maui.Theme.Window
0061 
0062             headBar.leftContent: [
0063                 Maui.ToolButtonMenu
0064                 {
0065                     icon.name: "application-menu"
0066 
0067 
0068                     MenuItem
0069                     {
0070                         contentItem: Column
0071                         {
0072                             Repeater
0073                             {
0074                                 model: Cal.CalendarManager.collections
0075                                 delegate: MenuItem
0076                                 {
0077                                     width: parent.width
0078                                     checkable: true
0079                                     text: model.display
0080 
0081                                     checked: model.checkState === 2
0082                                                                     onTriggered: model.checkState = model.checkState === 0 ? 2 : 0
0083 
0084                                 }
0085                             }
0086                         }
0087                     }
0088 
0089                     MenuItem
0090                     {
0091                         text: i18n("Settings")
0092                         icon.name: "settings-configure"
0093                     }
0094 
0095                     MenuItem
0096                     {
0097                         text: i18n("About")
0098                         icon.name: "documentinfo"
0099                         onTriggered: root.about()
0100                     }
0101                 }
0102 
0103             ]
0104 
0105             headBar.rightContent: [
0106                 ToolButton
0107                 {
0108                     action: _newEventAction
0109                 }
0110             ]
0111 
0112             Maui.ListBrowser
0113             {
0114                 anchors.fill: parent
0115                 holder.visible: count === 0
0116 
0117                 holder.emoji: "view-calendar"
0118                 holder.title: i18n("Empty!")
0119                 holder.body: "No events for this day"
0120 
0121                 model: Cal.IncidenceOccurrenceModel
0122                 {
0123                     id: _eventsModel
0124                     start: _stackView.currentItem.selectedDate
0125                     length: 0
0126                     calendar: Cal.CalendarManager.calendar
0127                     filter: Cal.Filter
0128                 }
0129 
0130                 delegate: Maui.ListBrowserDelegate
0131                 {
0132                     width: ListView.view.width
0133 
0134                     property var data : model.incidences
0135                     label1.text: model.summary
0136                     label2.text: model.startTime.toLocaleTimeString()
0137                 }
0138 
0139                 header: Item
0140                 {
0141                     width: parent.width
0142                     height: _cardlayout.height + Maui.Style.space.medium
0143 
0144                     Pane
0145                     {
0146                         id: _cardlayout
0147 
0148                         width: parent.width
0149                         height: implicitContentHeight + topPadding + bottomPadding
0150 
0151                         padding: Maui.Style.space.medium
0152 
0153                         background: Rectangle
0154                         {
0155                             radius: Maui.Style.radiusV
0156                             color: Maui.Theme.alternateBackgroundColor
0157                         }
0158 
0159                         contentItem: ColumnLayout
0160                         {
0161                             spacing: Maui.Style.space.medium
0162 
0163                             Pane
0164                             {
0165                                 implicitWidth: Math.max(implicitContentWidth+ leftPadding + rightPadding, height)
0166                                 implicitHeight: implicitContentHeight + topPadding + bottomPadding
0167 
0168                                 padding: Maui.Style.space.medium
0169 
0170                                 background: Rectangle
0171                                 {
0172                                     color: Maui.Theme.backgroundColor
0173                                     radius: Maui.Style.radiusV
0174                                 }
0175 
0176                                 contentItem: Label
0177                                 {
0178                                     horizontalAlignment: Qt.AlignHCenter
0179                                     color:"orange"
0180                                     text: _eventsModel.start.getDate()
0181                                     font.bold: true
0182                                     font.weight: Font.Black
0183                                     font.pointSize: 32
0184                                 }
0185                             }
0186 
0187                             Label
0188                             {
0189                                 Layout.fillWidth: true
0190                                 text: Qt.formatDateTime(_eventsModel.start, "MMM yyyy")
0191                                 font.bold: true
0192                                 font.weight: Font.DemiBold
0193                                 font.pointSize: 12
0194                             }
0195                         }
0196                     }
0197 
0198 }
0199             }
0200         }
0201 
0202         Maui.Page
0203         {
0204             anchors.fill: parent
0205             showCSDControls: true
0206 //            title: _stackView.currentItem.title
0207             headBar.background: null
0208             headBar.leftContent: [
0209                 ToolButton
0210                 {
0211                     icon.name: checked ? "sidebar-collapse" : "sidebar-expand"
0212                     onClicked: _sideBarView.sideBar.toggle()
0213                     checked: _sideBarView.sideBar.visible
0214                 },
0215 
0216                 ToolButton
0217                 {
0218                     icon.name: "go-previous"
0219                     onClicked: _stackView.pop()
0220                     visible: _stackView.depth === 2
0221                     text: _yearView.title
0222                 }
0223             ]
0224 
0225             headBar.rightContent: Maui.ToolActions
0226             {
0227                 autoExclusive: false
0228                 checkable: false
0229                 display: ToolButton.IconOnly
0230 
0231                 Action
0232                 {
0233                     icon.name: "go-previous"
0234                     text: i18n("Previous Year")
0235                     shortcut: "Left"
0236                     onTriggered: _stackView.currentItem.previousDate()
0237                 }
0238 
0239                 Action
0240                 {
0241                     icon.name: "go-jump-today"
0242                     text: i18n("Today")
0243                     onTriggered: _stackView.currentItem.resetDate()
0244                 }
0245 
0246                 Action
0247                 {
0248                     icon.name: "go-next"
0249                     text: i18n("Next Year")
0250                     shortcut: "Right"
0251                     onTriggered: _stackView.currentItem.nextDate()
0252                 }
0253             }
0254 
0255             StackView
0256             {
0257                 id:_stackView
0258                 anchors.fill: parent
0259                 clip: true
0260                 initialItem: Cal.YearView
0261                 {
0262                     id: _yearView
0263                     onMonthClicked:
0264                     {
0265                         _stackView.push(_monthViewComponent)
0266                         _stackView.currentItem.setToDate(_stackView.currentItem.addMonthsToDate(date, -1))
0267                     }
0268                 }
0269 
0270 
0271                 Component
0272                 {
0273                     id: _monthViewComponent
0274                     Cal.MonthView
0275                     {
0276                         onDateDoubleClicked: _eventDialog.open()
0277                     }
0278                 }
0279 
0280 
0281 
0282                 pushExit: Transition
0283                 {
0284                     ParallelAnimation
0285                     {
0286                         PropertyAnimation
0287                         {
0288                             property: "scale"
0289                             from: 1
0290                             to: 4
0291                             duration: 200
0292                             easing.type: Easing.InOutCubic
0293                         }
0294 
0295                         NumberAnimation { property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.InOutCubic }
0296                     }
0297 
0298                 }
0299 
0300                 pushEnter: Transition
0301                 {
0302                     ParallelAnimation
0303                     {
0304                         PropertyAnimation
0305                         {
0306                             //                        target: _yearView.gridView.currentItem
0307                             property: "scale"
0308                             from: 0
0309                             to: 1
0310                             duration: 200
0311                             easing.type: Easing.OutCubic
0312                         }
0313 
0314                         NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200; easing.type: Easing.OutCubic }
0315                     }
0316                 }
0317 
0318                 popEnter: Transition
0319                 {
0320                     ParallelAnimation
0321                     {
0322                         PropertyAnimation
0323                         {
0324                             //                        target: _yearView.gridView.currentItem
0325                             property: "scale"
0326                             from: 4
0327                             to: 1
0328                             duration: 200
0329                             easing.type: Easing.InOutCubic
0330                         }
0331 
0332                         NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200; easing.type: Easing.InOutCubic }
0333                     }
0334                 }
0335 
0336                 popExit: Transition
0337                 {
0338                     ParallelAnimation
0339                     {
0340                         PropertyAnimation
0341                         {
0342                             //                        target: _yearView.gridView.currentItem
0343                             property: "scale"
0344                             from: 1
0345                             to: 0
0346                             duration: 200
0347                             easing.type: Easing.OutCubic
0348                         }
0349 
0350                         NumberAnimation { property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.OutCubic }
0351                     }
0352 
0353                 }
0354             }
0355         }
0356 
0357     }
0358 
0359 }