[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasma-workspace] applets/digital-clock/package/contents/ui: [digital-clock] Bring back the agenda
From: Martin Klapetek <mklapetek () kde ! org>
Date: 2015-11-16 21:03:44
Message-ID: E1ZyQwC-0003Li-P5 () scm ! kde ! org
[Download RAW message or body]
Git commit ea6691a307f22490030a4fbfcc8d85535cc32284 by Martin Klapetek.
Committed on 16/11/2015 at 20:51.
Pushed by mklapetek into branch 'master'.
[digital-clock] Bring back the agenda part of calendar
Revert "Remove the agenda part of the calendar"
This reverts commit bfd62154d8e892d4fdc87d27d25d07cb7841c1e6.
M +143 -11 applets/digital-clock/package/contents/ui/CalendarView.qml
http://commits.kde.org/plasma-workspace/ea6691a307f22490030a4fbfcc8d85535cc32284
diff --git a/applets/digital-clock/package/contents/ui/CalendarView.qml \
b/applets/digital-clock/package/contents/ui/CalendarView.qml index b52eb10..ebc54a9 \
100644
--- a/applets/digital-clock/package/contents/ui/CalendarView.qml
+++ b/applets/digital-clock/package/contents/ui/CalendarView.qml
@@ -22,23 +22,19 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
- /******************************************************************
- *
- * TODO: Revert commit bfd62154d8e892d4fdc87d27d25d07cb7841c1e6
- * to bring back the original agenda part
- *
- ******************************************************************/
-
id: calendar
Layout.minimumWidth: _minimumWidth
Layout.minimumHeight: _minimumHeight
// The "sensible" values
- property int _minimumWidth: monthView.showWeekNumbers ? \
Math.round(_minimumHeight * 1.75) : Math.round(_minimumHeight * 1.5) +property int \
_minimumWidth: _minimumHeight * 1.5 + (monthView.showWeekNumbers ? \
Math.round(_minimumHeight * 1.75) : Math.round(_minimumHeight * 1.5)) property int \
_minimumHeight: units.gridUnit * 14 Layout.preferredWidth: _minimumWidth
- Layout.preferredHeight: Math.round(_minimumHeight * 1.5)
+ Layout.preferredHeight: _minimumHeight * 1.5
+
+ property int avWidth: (parent.width - (3 * units.largeSpacing)) / 2
+ property int avHeight: parent.height - (2 * units.largeSpacing)
//anchors.margins: units.largeSpacing
property int spacing: units.largeSpacing
@@ -54,13 +50,149 @@ Item {
// clear all the selections when the plasmoid is hiding
monthView.date = null;
monthView.resetToToday();
+ agenda.day = null;
}
}
Item {
+ id: agenda
+ property QtObject day
+
+ width: avWidth
+ anchors {
+ top: parent.top
+ left: parent.left
+ bottom: parent.bottom
+ leftMargin: spacing
+ topMargin: spacing
+ bottomMargin: spacing
+ }
+
+ Rectangle { anchors.fill: parent; color: "orange"; opacity: 0.2; visible: \
debug; } +
+ function dateString(format) {
+ var d;
+ if (agenda.day != undefined) {
+ var day = agenda.day;
+ d = new Date(day.yearNumber, day.monthNumber-1, day.dayNumber);
+ } else {
+ d = new Date();
+ }
+ var o = Qt.formatDate(d, format);
+ return o;
+ }
+
+ Connections {
+ target: monthView
+ onDateChanged: {
+ if (monthView.date != null) {
+ agenda.day = monthView.date;
+ }
+ }
+ }
+
+ PlasmaComponents.Label {
+ id: dayLabel
+ height: dayHeading.height + dateHeading.height
+ width: paintedWidth
+ font.pixelSize: height
+ font.weight: Font.Light
+ text: agenda.dateString("dd")
+ opacity: 0.5
+ }
+
+ PlasmaExtras.Heading {
+ id: dayHeading
+ anchors {
+ top: parent.top
+ left: dayLabel.right
+ right: parent.right
+ leftMargin: spacing / 2
+ }
+ level: 1
+ elide: Text.ElideRight
+ text: agenda.dateString("dddd")
+ }
+ PlasmaComponents.Label {
+ id: dateHeading
+ anchors {
+ top: dayHeading.bottom
+ left: dayLabel.right
+ right: parent.right
+ leftMargin: spacing / 2
+ }
+ elide: Text.ElideRight
+ text: Qt.locale().standaloneMonthName(agenda.day == null ? new \
Date().getMonth() : agenda.day.monthNumber - 1) + + \
agenda.dateString(" yyyy") + }
+
+ ListView {
+ id: eventList
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ top: parent.top
+ topMargin: monthView.cellHeight + dayHeading.height
+ }
+
+ // Time slots shown
+ model: [ 8, 10, 12, 14, 16, 18 ]
+
+ delegate: Item {
+ height: monthView.cellHeight
+ width: parent.width
+ Rectangle {
+ height: monthView.borderWidth
+ color: theme.textColor
+ opacity: monthView.borderOpacity
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: parent.top
+ leftMargin: spacing
+ rightMargin: spacing
+ }
+ }
+
+ PlasmaComponents.Label {
+ id: hourLabel
+ height: paintedHeight
+ font.pixelSize: monthView.cellHeight / 3
+ opacity: 0.5
+ anchors {
+ right: minuteLabel.left
+ verticalCenter: parent.verticalCenter
+ }
+ text: modelData
+ }
+ PlasmaComponents.Label {
+ id: minuteLabel
+ x: units.largeSpacing*2
+
+ height: paintedHeight
+ font.pixelSize: hourLabel.paintedHeight / 2
+ opacity: hourLabel.opacity
+ anchors {
+ top: hourLabel.top
+ }
+ text: "00"
+ }
+ }
+ }
+
+ }
+ Item {
id: cal
- anchors.fill: parent
- anchors.margins: spacing
+ width: avWidth
+ anchors {
+ top: parent.top
+ right: parent.right
+ bottom: parent.bottom
+ rightMargin: spacing
+ topMargin: spacing
+ bottomMargin: spacing
+ }
PlasmaCalendar.MonthView {
id: monthView
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic