1/* 2 * SPDX-FileCopyrightText: 2013 Heena Mahour <heena393@gmail.com> 3 * SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org> 4 * SPDX-FileCopyrightText: 2014 Kai Uwe Broulik <kde@privat.broulik.de> 5 * 6 * SPDX-License-Identifier: GPL-2.0-or-later 7 */ 8import QtQuick 2.0 9import QtQuick.Layouts 1.1 10 11import org.kde.plasma.plasmoid 2.0 12import org.kde.plasma.core 2.0 as PlasmaCore 13import org.kde.plasma.extras 2.0 as PlasmaExtras 14import org.kde.plasma.calendar 2.0 as PlasmaCalendar 15 16Item { 17 id: root 18 19 readonly property date currentDateTime: dataSource.data.Local ? dataSource.data.Local.DateTime : new Date() 20 21 width: PlasmaCore.Units.gridUnit * 10 22 height: PlasmaCore.Units.gridUnit * 4 23 24 Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation 25 26 Plasmoid.toolTipMainText: Qt.formatTime(currentDateTime) 27 Plasmoid.toolTipSubText: Qt.formatDate(currentDateTime, Qt.locale().dateFormat(Locale.LongFormat)) 28 29 Plasmoid.backgroundHints: PlasmaCore.Types.ShadowBackground | PlasmaCore.Types.ConfigurableBackground 30 31 PlasmaCore.DataSource { 32 id: dataSource 33 engine: "time" 34 connectedSources: ["Local"] 35 interval: 60000 36 intervalAlignment: PlasmaCore.Types.AlignToMinute 37 } 38 39 Plasmoid.compactRepresentation: FuzzyClock { } 40 41 Plasmoid.fullRepresentation: PlasmaCalendar.MonthView { 42 Layout.minimumWidth: PlasmaCore.Units.gridUnit * 20 43 Layout.minimumHeight: PlasmaCore.Units.gridUnit * 20 44 45 today: currentDateTime 46 } 47} 48