diff --git a/applets/binary-clock/package/contents/ui/main.qml b/applets/binary-clock/package/contents/ui/main.qml index dfa28ee0d..8e4fab37c 100644 --- a/applets/binary-clock/package/contents/ui/main.qml +++ b/applets/binary-clock/package/contents/ui/main.qml @@ -1,72 +1,73 @@ /* * Copyright 2014 Joseph Wenninger * * Based on fuzzy-clock main.qml: * Copyright 2013 Heena Mahour * Copyright 2013 Sebastian Kügler * Copyright 2014 Kai Uwe Broulik * Copyright 2018 Piotr Kąkol * * 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) any later version. * * 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 . */ import QtQuick 2.0 import QtQuick.Layouts 1.1 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.plasma.calendar 2.0 as PlasmaCalendar Item { id: root property bool showSeconds: plasmoid.configuration.showSeconds property int hours property int minutes property int seconds width: units.gridUnit * 10 height: units.gridUnit * 4 Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation Plasmoid.toolTipMainText: Qt.formatDate(dataSource.data["Local"]["DateTime"], "dddd") Plasmoid.toolTipSubText: Qt.formatDate(dataSource.data["Local"]["DateTime"], Qt.locale().dateFormat(Locale.LongFormat).replace(/(^dddd.?\s)|(,?\sdddd$)/, "")) PlasmaCore.DataSource { id: dataSource engine: "time" connectedSources: ["Local"] - interval: showSeconds ? 1000 : 30000 + intervalAlignment: plasmoid.configuration.showSeconds ? PlasmaCore.Types.NoAlignment : PlasmaCore.Types.AlignToMinute + interval: showSeconds ? 1000 : 60000 onDataChanged: { var date = new Date(data["Local"]["DateTime"]); hours = date.getHours(); minutes = date.getMinutes(); seconds = date.getSeconds(); } Component.onCompleted: { onDataChanged(); } } Plasmoid.compactRepresentation: BinaryClock { } Plasmoid.fullRepresentation: PlasmaCalendar.MonthView { Layout.minimumWidth: units.gridUnit * 20 Layout.minimumHeight: units.gridUnit * 20 today: dataSource.data["Local"]["DateTime"] } } \ No newline at end of file