[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasma-workspace] applets/digital-clock/package/contents: Revert "Revert all of the Calendar-agenda
From: Martin Klapetek <mklapetek () kde ! org>
Date: 2016-05-03 0:20:54
Message-ID: E1axO58-00068v-4b () scm ! kde ! org
[Download RAW message or body]
Git commit e8c5a28df28d2d66e8eaee47550425941e3e7ade by Martin Klapetek.
Committed on 03/05/2016 at 00:20.
Pushed by mklapetek into branch 'master'.
Revert "Revert all of the Calendar-agenda changes"
This reverts commit 697aaf8067ebac4c649895e57eff73a5f071b430
and brings back the agenda part of calendar.
REVIEW: 127734
BUG: 357642
BUG: 349676
FIXED-IN: 5.7
M +25 -5 applets/digital-clock/package/contents/config/config.qml
M +3 -0 applets/digital-clock/package/contents/config/main.xml
M +157 -12 applets/digital-clock/package/contents/ui/CalendarView.qml
M +1 -6 applets/digital-clock/package/contents/ui/configAppearance.qml
A +72 -0 applets/digital-clock/package/contents/ui/configCalendar.qml \
[License: GPL (v2/3)] M +5 -1 \
applets/digital-clock/package/contents/ui/main.qml
http://commits.kde.org/plasma-workspace/e8c5a28df28d2d66e8eaee47550425941e3e7ade
diff --git a/applets/digital-clock/package/contents/config/config.qml \
b/applets/digital-clock/package/contents/config/config.qml index 877e40c..ce03b16 \
100644
--- a/applets/digital-clock/package/contents/config/config.qml
+++ b/applets/digital-clock/package/contents/config/config.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Bhushan Shah <bhush94@gmail.com>
+ * Copyright 2015 Martin Klapetek <mklapetek@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -21,21 +22,40 @@
import QtQuick 2.0
import org.kde.plasma.configuration 2.0
+import org.kde.plasma.calendar 2.0 as PlasmaCalendar
ConfigModel {
-// ConfigCategory {
-// name: i18n("General")
-// icon: "preferences-system-time"
-// source: "configGeneral.qml"
-// }
+ id: configModel
+
ConfigCategory {
name: i18n("Appearance")
icon: "preferences-desktop-color"
source: "configAppearance.qml"
}
ConfigCategory {
+ name: i18n("Calendar")
+ icon: "view-calendar"
+ source: "configCalendar.qml"
+ }
+ ConfigCategory {
name: i18n("Time Zones")
icon: "preferences-system-time"
source: "configTimeZones.qml"
}
+
+ Component.onCompleted: {
+ var model = PlasmaCalendar.EventPluginsManager.model;
+
+ for (var i = 0; i < model.rowCount(); i++) {
+ //FIXME: this check doesn't work because the engines
+ // of the applet and the config are not shared
+// if (model.get(i, "checked") == true) {
+ configModel.appendCategory(model.get(i, "decoration"),
+ model.get(i, "display"),
+ model.get(i, "configUi"),
+ "",
+ true);
+// }
+ }
+ }
}
diff --git a/applets/digital-clock/package/contents/config/main.xml \
b/applets/digital-clock/package/contents/config/main.xml index aacbe27..b8b3d8d \
100644
--- a/applets/digital-clock/package/contents/config/main.xml
+++ b/applets/digital-clock/package/contents/config/main.xml
@@ -48,6 +48,9 @@
<entry name="use24hFormat" type="UInt">
<default>1</default>
</entry>
+ <entry name="enabledCalendarPlugins" type="StringList">
+ <default></default>
+ </entry>
</group>
</kcfg>
diff --git a/applets/digital-clock/package/contents/ui/CalendarView.qml \
b/applets/digital-clock/package/contents/ui/CalendarView.qml index 381bddb..fcafe5a \
100644
--- a/applets/digital-clock/package/contents/ui/CalendarView.qml
+++ b/applets/digital-clock/package/contents/ui/CalendarView.qml
@@ -23,23 +23,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
@@ -58,9 +54,159 @@ Item {
}
Item {
+ id: agenda
+
+ width: avWidth
+ anchors {
+ top: parent.top
+ left: parent.left
+ bottom: parent.bottom
+ leftMargin: spacing
+ topMargin: spacing
+ bottomMargin: spacing
+ }
+
+ function dateString(format) {
+ return Qt.formatDate(monthView.currentDate, format);
+ }
+
+ Connections {
+ target: monthView
+
+ onCurrentDateChanged: {
+ // Apparently this is needed because this is a simple QList being
+ // returned and if the list for the current day has 1 event and the
+ // user clicks some other date which also has 1 event, QML sees the
+ // sizes match and does not update the labels with the content.
+ // Resetting the model to null first clears it and then correct data
+ // are displayed.
+ holidaysList.model = null;
+ holidaysList.model = \
monthView.daysModel.eventsForDate(monthView.currentDate); + }
+ }
+
+ Connections {
+ target: monthView.daysModel
+
+ onAgendaUpdated: {
+ // Checks if the dates are the same, comparing the date objects
+ // directly won't work and this does a simple integer subtracting
+ // so should be fastest. One of the JS weirdness.
+ if (updatedDate - monthView.currentDate === 0) {
+ holidaysList.model = null;
+ holidaysList.model = \
monthView.daysModel.eventsForDate(monthView.currentDate); + }
+ }
+ }
+
+ Connections {
+ target: plasmoid.configuration
+
+ onEnabledCalendarPluginsChanged: {
+ PlasmaCalendar.EventPluginsManager.enabledPlugins = \
plasmoid.configuration.enabledCalendarPlugins; + }
+ }
+
+ PlasmaComponents.Label {
+ id: dayLabel
+ height: dayHeading.height + dateHeading.height
+ width: paintedWidth
+ font.pixelSize: height
+ font.weight: Font.Light
+ text: agenda.dateString("dd")
+ opacity: 0.6
+ }
+
+ 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(monthView.currentDate.getMonth())
+ + agenda.dateString(" yyyy")
+ }
+
+ ListView {
+ id: holidaysList
+ anchors {
+ top: dateHeading.bottom
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+
+ delegate: Item {
+ id: eventItem
+ width: holidaysList.width
+ height: eventTitle.paintedHeight
+ property bool hasTime: {
+ var startIsMidnight = modelData.startDateTime.getHours() == 0
+ && modelData.startDateTime.getMinutes() == 0;
+
+ var endIsMidnight = modelData.endDateTime.getHours() == 0
+ && modelData.endDateTime.getMinutes() == 0;
+
+ var sameDay = modelData.startDateTime.getDate() == \
modelData.endDateTime.getDate() + && \
modelData.startDateTime.getDay() == modelData.endDateTime.getDay() +
+ if (startIsMidnight && endIsMidnight && sameDay) {
+ return false
+ }
+
+ return true;
+ }
+
+ PlasmaComponents.Label {
+ text: {
+ if (modelData.startDateTime - modelData.endDateTime === 0) {
+ return Qt.formatTime(modelData.startDateTime);
+ } else {
+ return Qt.formatTime(modelData.startDateTime) + " - " + \
Qt.formatTime(modelData.endDateTime); + }
+ }
+ visible: eventItem.hasTime
+ }
+ PlasmaComponents.Label {
+ id: eventTitle
+ width: eventItem.hasTime ? parent.width * 0.7 : parent.width
+ anchors.right: parent.right
+ text: modelData.title
+ }
+ }
+
+ section.property: "modelData.eventType"
+ section.delegate: PlasmaExtras.Heading {
+ level: 3
+ elide: Text.ElideRight
+ text: section
+ }
+ }
+ }
+ Item {
id: cal
- anchors.fill: parent
- anchors.margins: spacing
+ width: avWidth
+ anchors {
+ top: parent.top
+ right: parent.right
+ bottom: parent.bottom
+ margins: spacing
+ }
PlasmaCalendar.MonthView {
id: monthView
@@ -81,5 +227,4 @@ Item {
iconSource: "window-pin"
onCheckedChanged: plasmoid.hideOnWindowDeactivate = !checked
}
-
}
diff --git a/applets/digital-clock/package/contents/ui/configAppearance.qml \
b/applets/digital-clock/package/contents/ui/configAppearance.qml index \
fc9a09e..5d562b0 100644
--- a/applets/digital-clock/package/contents/ui/configAppearance.qml
+++ b/applets/digital-clock/package/contents/ui/configAppearance.qml
@@ -23,6 +23,7 @@
import QtQuick 2.0
import QtQuick.Controls 1.0 as QtControls
import QtQuick.Layouts 1.0 as QtLayouts
+import org.kde.plasma.calendar 2.0 as PlasmaCalendar
Item {
id: appearancePage
@@ -39,7 +40,6 @@ Item {
property alias cfg_showLocalTimezone: showLocalTimezone.checked
property alias cfg_displayTimezoneAsCode: timezoneCodeRadio.checked
property alias cfg_showSeconds: showSeconds.checked
- property alias cfg_showWeekNumbers: showWeekNumbers.checked
property alias cfg_showDate: showDate.checked
property string cfg_dateFormat: "shortDate"
@@ -134,10 +134,6 @@ Item {
id: showDate
text: i18n("Show date")
}
- QtControls.CheckBox {
- id: showWeekNumbers
- text: i18n("Show week numbers in Calendar")
- }
QtControls.CheckBox {
id: showSeconds
@@ -154,7 +150,6 @@ Item {
text: i18n("Show local time zone")
}
-
QtControls.Label {
text: i18n("Display time zone as:")
}
diff --git a/applets/digital-clock/package/contents/ui/configCalendar.qml \
b/applets/digital-clock/package/contents/ui/configCalendar.qml new file mode 100644
index 0000000..7ff92e5
--- /dev/null
+++ b/applets/digital-clock/package/contents/ui/configCalendar.qml
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2015 Martin Klapetek <mklapetek@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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.0
+import QtQuick.Controls 1.0 as QtControls
+import QtQuick.Layouts 1.0 as QtLayouts
+import org.kde.plasma.calendar 2.0 as PlasmaCalendar
+
+Item {
+ id: calendarPage
+ width: childrenRect.width
+ height: childrenRect.height
+
+ signal configurationChanged
+
+ property alias cfg_showWeekNumbers: showWeekNumbers.checked
+
+ function saveConfig()
+ {
+ plasmoid.configuration.enabledCalendarPlugins = \
PlasmaCalendar.EventPluginsManager.enabledPlugins; + }
+
+ QtLayouts.ColumnLayout {
+ QtControls.CheckBox {
+ id: showWeekNumbers
+ text: i18n("Show week numbers in Calendar")
+ }
+
+ QtControls.GroupBox {
+ QtLayouts.Layout.fillWidth: true
+ title: i18n("Available Calendar Plugins")
+ flat: true
+
+ Repeater {
+ id: calendarPluginsRepeater
+ model: PlasmaCalendar.EventPluginsManager.model
+ delegate: QtLayouts.RowLayout {
+ QtControls.CheckBox {
+ text: model.display
+ checked: model.checked
+ onClicked: {
+ //needed for model's setData to be called
+ model.checked = checked;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ PlasmaCalendar.EventPluginsManager.populateEnabledPluginsList(plasmoid.configuration.enabledCalendarPlugins);
+ }
+}
+
diff --git a/applets/digital-clock/package/contents/ui/main.qml \
b/applets/digital-clock/package/contents/ui/main.qml index b86b7fe..e4ff86f 100644
--- a/applets/digital-clock/package/contents/ui/main.qml
+++ b/applets/digital-clock/package/contents/ui/main.qml
@@ -24,7 +24,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.private.digitalclock 1.0
import org.kde.kquickcontrolsaddons 2.0
-//import org.kde.plasma.calendar 2.0
+import org.kde.plasma.calendar 2.0 as PlasmaCalendar
Item {
id: root
@@ -85,5 +85,9 @@ Item {
Component.onCompleted: {
plasmoid.setAction("clockkcm", i18n("Adjust Date and Time..."), \
"preferences-system-time"); plasmoid.setAction("formatskcm", i18n("Set Time \
Format...")); +
+ // Set the list of enabled plugins from config
+ // to the manager
+ PlasmaCalendar.EventPluginsManager.enabledPlugins = \
plasmoid.configuration.enabledCalendarPlugins; }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic