Warning, /plasma-mobile/calindori/src/contents/ui/kirigami-playground/DayDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2018 Dimitris Kardarakos <dimkard@posteo.net> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 import QtQuick 2.7 0008 import QtQuick.Controls 2.0 as Controls2 0009 import QtQuick.Layouts 1.3 0010 import org.kde.kirigami 2.2 as Kirigami 0011 0012 /** 0013 * Month Day Delegate 0014 * 0015 * Controls the display of each day of a months' grid 0016 * 0017 * Expects a model that provides: 0018 * 0019 * 1. dayNumber 0020 * 2. monthNumber 0021 * 3. yearNumber 0022 */ 0023 Rectangle { 0024 id: dayDelegate 0025 0026 property date currentDate 0027 property int delegateWidth 0028 property date selectedDate 0029 property bool highlight: (model.yearNumber == selectedDate.getFullYear()) && (model.monthNumber == selectedDate.getMonth() + 1) && (model.dayNumber == root.selectedDate.getDate()) 0030 0031 signal dayClicked 0032 signal dayPressed 0033 signal dayLongPressed 0034 signal dayReleased 0035 0036 width: childrenRect.width 0037 height: childrenRect.height 0038 opacity:(isToday || highlight ) ? 0.4 : 1 0039 color: isToday ? Kirigami.Theme.textColor : ( highlight ? Kirigami.Theme.hoverColor : Kirigami.Theme.backgroundColor ) 0040 border.color: Kirigami.Theme.disabledTextColor 0041 0042 0043 Item { 0044 width: dayDelegate.delegateWidth 0045 height: width 0046 0047 /** 0048 * Display a tiny indicator in case that 0049 * todos or events exist for the day of the model 0050 */ 0051 Rectangle { 0052 anchors { 0053 bottom: parent.bottom 0054 bottomMargin: parent.width/15 0055 right: parent.right 0056 rightMargin: parent.width/15 0057 0058 } 0059 0060 width: parent.width/10 0061 height: width 0062 radius: 50 0063 color: Kirigami.Theme.highlightColor 0064 visible: incidenceCount > 0 0065 } 0066 0067 Controls2.Label { 0068 anchors.centerIn: parent 0069 color: isCurrentMonth ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor 0070 text: model.dayNumber 0071 } 0072 0073 MouseArea { 0074 anchors.fill: parent 0075 enabled: isCurrentMonth 0076 onClicked: dayDelegate.dayClicked() 0077 onPressed: dayDelegate.dayPressed() 0078 onPressAndHold: dayDelegate.dayLongPressed() 0079 onReleased: dayDelegate.dayReleased() 0080 } 0081 } 0082 }