diff --git a/modules/accounts/package/contents/ui/Accounts.qml b/modules/accounts/package/contents/ui/Accounts.qml index 454e8a5..4fddaaf 100644 --- a/modules/accounts/package/contents/ui/Accounts.qml +++ b/modules/accounts/package/contents/ui/Accounts.qml @@ -1,149 +1,145 @@ /* * Copyright 2015 Martin Klapetek * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.7 import QtQuick.Layouts 1.11 import QtQuick.Controls 2.0 as Controls import org.kde.kirigami 2.4 as Kirigami import org.kde.active.settings 2.0 as ActiveSettings import org.kde.kaccounts 1.0 import org.kde.kcm 1.2 import Ubuntu.OnlineAccounts 0.1 as OA -ScrollViewKCM { +SimpleKCM { id: kaccountsRoot objectName: "kaccountsModule" // Existing accounts - view: ListView { - Layout.fillWidth: true - Layout.fillHeight: true - + ListView { + clip: true model: OA.AccountServiceModel { id: accountsModel service: "global" includeDisabled: true } delegate: Kirigami.SwipeListItem { - Layout.fillWidth: true - Controls.Label { text: model.displayName + " (" + providerName + ")" OA.Account { id: account objectHandle: model.accountHandle } } actions: [ Kirigami.Action { iconName: "bookmark-remove" onTriggered: { account.remove() } } ] onClicked: { availableServicesSheet.open() servicesModel.accountId = model.accountId } } } footer: RowLayout { Controls.Button { Layout.alignment: Qt.AlignRight text: i18n("Add new Account") icon.name: "contact-new" onClicked: { availableAccountsSheet.open() } } } Kirigami.OverlaySheet { id: availableAccountsSheet parent: kaccountsRoot.parent ListView { Layout.fillWidth: true Layout.fillHeight: true model: OA.ProviderModel {} delegate: Kirigami.BasicListItem { icon: model.iconName label: model.displayName Layout.fillWidth: true onClicked: { var job = jobComponent.createObject(kaccountsRoot, { "providerName": providerId }) job.start() } } } Component { id: jobComponent CreateAccount { onFinished: { availableAccountsSheet.close() } } } } OA.AccountServiceModel { id: servicesModel } Kirigami.OverlaySheet { id: availableServicesSheet parent: kaccountsRoot.parent ColumnLayout { Kirigami.Heading { Layout.fillWidth: true text: i18n("Available Services") } ColumnLayout { Layout.fillHeight: true Layout.fillWidth: true spacing: Kirigami.Units.smallSpacing Repeater { Layout.fillWidth: true model: servicesModel Controls.CheckDelegate { Layout.fillWidth: true text: model.serviceName checked: model.enabled } } } } } } diff --git a/modules/powermanagement/package/contents/ui/Power.qml b/modules/powermanagement/package/contents/ui/Power.qml index 212b6f5..ff1336a 100644 --- a/modules/powermanagement/package/contents/ui/Power.qml +++ b/modules/powermanagement/package/contents/ui/Power.qml @@ -1,261 +1,263 @@ /* * Copyright 2011 Sebastian Kügler * Copyright 2012 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.2 import QtQuick.Controls 2.0 as Controls import QtQuick.Layouts 1.11 import org.kde.kirigami 2.1 as Kirigami import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.active.settings 2.0 as ActiveSettings import org.kde.kcm 1.2 SimpleKCM { id: powermanagementModule objectName: "powermanagementModule" + leftPadding: Kirigami.Units.gridUnit + rightPadding: Kirigami.Units.gridUnit ActiveSettings.ConfigGroup { id: screensaverConfig file: "kscreensaverrc" group: "ScreenSaver" } ActiveSettings.ConfigGroup { id: batteryConfig file: "powermanagementprofilesrc" group: "Battery" ActiveSettings.ConfigGroup { id: batteryDpmsConfig group: "DPMSControl" } ActiveSettings.ConfigGroup { id: batterySuspendConfig group: "SuspendSession" } ActiveSettings.ConfigGroup { id: batteryBrightnessConfig group: "BrightnessControl" } } ActiveSettings.ConfigGroup { id: acConfig file: "powermanagementprofilesrc" group: "AC" ActiveSettings.ConfigGroup { id: acDpmsConfig group: "DPMSControl" } ActiveSettings.ConfigGroup { id: acSuspendConfig group: "SuspendSession" } ActiveSettings.ConfigGroup { id: acBrightnessConfig group: "BrightnessControl" } } ActiveSettings.ConfigGroup { id: lowBatteryConfig file: "powermanagementprofilesrc" group: "LowBattery" ActiveSettings.ConfigGroup { id: lowBatteryDpmsConfig group: "DPMSControl" } ActiveSettings.ConfigGroup { id: lowBatterySuspendConfig group: "SuspendSession" } ActiveSettings.ConfigGroup { id: lowBatteryBrightnessConfig group: "BrightnessControl" } } property QtObject pmSource: PlasmaCore.DataSource { id: pmSource engine: "powermanagement" connectedSources: ["PowerDevil"] } ColumnLayout { id: mainItem spacing: Kirigami.Units.gridUnit * 0.5 Kirigami.Heading { text: i18n("Screen Brightness") level: 3 } Row { spacing: Kirigami.Units.gridUnit * 0.5 Controls.Label { width: screensaverEnabledSwitch.width text: i18n("0%") } property int brightness: pmSource.data["PowerDevil"]["Screen Brightness"] onBrightnessChanged: brightnessSlider.value = brightness/100 Controls.Slider { id: brightnessSlider width: mainItem.width * 0.6 onValueChanged: { acBrightnessConfig.writeEntry("value", Math.round(value*100)) batteryBrightnessConfig.writeEntry("value", Math.round(value*100)) lowBatteryBrightnessConfig.writeEntry("value", Math.round(value*100)) var service = pmSource.serviceForSource("PowerDevil"); var operation = service.operationDescription("setBrightness"); operation.silent = true; operation.brightness = Math.round(value*100); service.startOperationCall(operation); } } Controls.Label { text: i18n("100%") } } Kirigami.Heading { text: i18n("Lock screen and Sleep") level: 3 } Row { spacing: units.gridUnit Controls.Switch { id: screensaverEnabledSwitch onCheckedChanged: screensaverConfig.writeEntry("Enabled", checked ? "true" : "false") Component.onCompleted: checked = screensaverConfig.readEntry("Enabled") == "true" } Controls.Slider { id: screensaverTimeSlider enabled: screensaverEnabledSwitch.checked from: 1 to: 60 width: mainItem.width * 0.6 onValueChanged: { if (screensaverEnabledSwitch.checked) { screensaverConfig.writeEntry("Timeout", Math.round(value)*60) } } Component.onCompleted: value = screensaverConfig.readEntry("Timeout")/60 } Controls.Label { enabled: screensaverEnabledSwitch.checked opacity: enabled ? 1 : 0.6 text: i18np("%1 minute", "%1 minutes", screensaverTimeSlider.value) } } Kirigami.Heading { text: i18n("Turn off the screen") level: 3 } Row { spacing: units.gridUnit Controls.Switch { id: dpmsSwitch onCheckedChanged: { if (checked) { batteryDpmsConfig.writeEntry("idleTime", Math.round(dpmsTimeSlider.value)*60) lowBatteryDpmsConfig.writeEntry("idleTime", Math.round(dpmsTimeSlider.value)*60) acDpmsConfig.writeEntry("idleTime", Math.round(dpmsTimeSlider.value)*60) } else { batteryDpmsConfig.deleteEntry("idleTime") lowBatteryDpmsConfig.deleteEntry("idleTime") acDpmsConfig.deleteEntry("idleTime") } } Component.onCompleted: checked = batteryDpmsConfig.readEntry("idleTime") > 0 } Controls.Slider { id: dpmsTimeSlider enabled: dpmsSwitch.checked width: mainItem.width * 0.6 from: 1 to: 60 onValueChanged: { if (dpmsSwitch.checked) { batteryDpmsConfig.writeEntry("idleTime", Math.round(value)*60) lowBatteryDpmsConfig.writeEntry("idleTime", Math.round(value)*60) acDpmsConfig.writeEntry("idleTime", Math.round(value)*60) } } Component.onCompleted: value = batteryDpmsConfig.readEntry("idleTime")/60 } Controls.Label { enabled: dpmsTimeSlider.checked opacity: enabled ? 1 : 0.6 text: i18np("%1 minute", "%1 minutes", dpmsTimeSlider.value) } } /* * This is disabled for now: * the sleep action is done by the lockscreen PlasmaExtras.Heading { text: i18n("Sleep") level: 3 } Row { spacing: units.gridUnit PlasmaComponents.Switch { id: suspendSwitch onCheckedChanged: { if (checked) { batterySuspendConfig.writeEntry("idleTime", Math.round(suspendTimeSlider.value)*60*1000) lowBatterySuspendConfig.writeEntry("idleTime", Math.round(suspendTimeSlider.value)*60*1000) acSuspendConfig.writeEntry("idleTime", Math.round(suspendTimeSlider.value)*60*1000) } else { batterySuspendConfig.deleteEntry("idleTime") lowBatterySuspendConfig.deleteEntry("idleTime") acSuspendConfig.deleteEntry("idleTime") } } Component.onCompleted: checked = batterySuspendConfig.readEntry("idleTime") > 0 } PlasmaComponents.Slider { id: suspendTimeSlider enabled: suspendSwitch.checked minimumValue: 1 maximumValue: 60 onValueChanged: { if (suspendSwitch.checked) { batterySuspendConfig.writeEntry("idleTime", Math.round(value)*60*1000) lowBatterySuspendConfig.writeEntry("idleTime", Math.round(value)*60*1000) acSuspendConfig.writeEntry("idleTime", Math.round(value)*60*1000) } } Component.onCompleted: value = batterySuspendConfig.readEntry("idleTime")/60/1000 } PlasmaComponents.Label { enabled: suspendTimeSlider.checked opacity: enabled ? 1 : 0.6 text: i18np("%1 minute", "%1 minutes", suspendTimeSlider.value) } }*/ } } diff --git a/modules/theme/package/contents/ui/Theme.qml b/modules/theme/package/contents/ui/Theme.qml index 3654262..ed16233 100644 --- a/modules/theme/package/contents/ui/Theme.qml +++ b/modules/theme/package/contents/ui/Theme.qml @@ -1,79 +1,81 @@ /* * Copyright 2015 Sebastian Kügler * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.2 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 as Controls import org.kde.kirigami 2.1 as Kirigami import org.kde.kcm 1.2 SimpleKCM { id: themeModule objectName: "themeModule" + leftPadding: Kirigami.Units.gridUnit + rightPadding: Kirigami.Units.gridUnit ColumnLayout { width: parent.width spacing: Kirigami.Units.gridUnit * 0.5 Kirigami.Heading { text: i18n("Font") level: 3 } Controls.Slider { id: fontSizeSlider Layout.preferredWidth: parent.width - Kirigami.Units.gridUnit * 2 stepSize: 1.0 from: 3 to: 12 value: kcm.fontSize onValueChanged: { if (pressed) { print("Setting font size to " + value); kcm.fontSize = value; } } } Kirigami.Heading { text: i18n("Theme") level: 3 } Repeater { model: kcm.themeListModel delegate: Controls.RadioDelegate { Layout.fillWidth: true text: model.display checked: kcm.themeName === model.packageNameRole onCheckedChanged: { if (checked) { kcm.themeName = model.packageNameRole; } } } } } Component.onCompleted: { print("KCM.fontSize: " + kcm.fontSize); } }