Commit 58bafb98 authored by Marco Martin's avatar Marco Martin

Merge branch 'kcm-rework-cleanup' into 'master'

Rework mobile kcms

See merge request kde/plasma-settings!2
parents 0ff28e9a f706b28e
# Install the packages, also make it known to the system
add_subdirectory(theme)
add_subdirectory(development)
if (${KF5KDELibs4Support_FOUND})
add_subdirectory(time)
endif()
#add_subdirectory(locale)
# Web
#install(DIRECTORY web/ DESTINATION ${DATA_INSTALL_DIR}/plasma/packages/org.kde.active.settings.web)
#install(FILES web/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME org.kde.active.settings.web.desktop)
#Power
# Power
add_subdirectory(powermanagement)
#install(DIRECTORY powermanagement/ DESTINATION ${DATA_INSTALL_DIR}/plasma/packages/org.kde.active.settings.powermanagement)
#install(FILES powermanagement/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME org.kde.active.settings.powermanagement.desktop)
#Accounts
# Accounts
if (KAccounts_FOUND AND AccountsQt5_FOUND AND SignOnQt5_FOUND)
add_subdirectory(accounts)
endif()
......@@ -17,144 +17,98 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.2
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.2
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 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
Item {
ScrollViewKCM {
id: kaccountsRoot
objectName: "kaccountsModule"
width: 800; height: 500
// Existing accounts
view: ListView {
Layout.fillWidth: true
Layout.fillHeight: true
StackView {
id: mainView
anchors.fill: parent
model: OA.AccountServiceModel {
id: accountsModel
service: "global"
includeDisabled: true
}
initialItem: ColumnLayout {
delegate: Kirigami.SwipeListItem {
Layout.fillWidth: true
Layout.fillHeight: true
ListView {
Layout.fillWidth: true
Layout.fillHeight: true
spacing: units.smallSpacing
Controls.Label {
text: model.displayName + " (" + providerName + ")"
model: OA.AccountServiceModel {
id: accountsModel
service: "global"
includeDisabled: true
OA.Account {
id: account
objectHandle: model.accountHandle
}
delegate: RowLayout {
anchors {
left: parent.left
right: parent.right
}
PlasmaComponents.Button {
Layout.fillWidth: true
text: model.displayName
onClicked: {
mainView.push(availableServices)
servicesModel.accountId = model.accountId
}
}
PlasmaComponents.Button {
iconSource: "list-remove"
OA.Account {
id: account
objectHandle: model.accountHandle
}
onClicked: {
account.remove();
}
}
actions: [
Kirigami.Action {
iconName: "bookmark-remove"
onTriggered: {
account.remove()
}
}
]
onClicked: {
availableServicesSheet.open()
servicesModel.accountId = model.accountId
}
}
}
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("Add new Account")
onClicked: mainView.push(availableAccounts)
footer: RowLayout {
Controls.Button {
Layout.alignment: Qt.AlignRight
text: i18n("Add new Account")
icon.name: "contact-new"
onClicked: {
availableAccountsSheet.open()
}
}
}
Component {
id: availableAccounts
Kirigami.OverlaySheet {
id: availableAccountsSheet
parent: kaccountsRoot.parent
ColumnLayout {
RowLayout {
PlasmaComponents.Button {
text: "<"
onClicked: {
mainView.push(mainView.initialItem);
}
}
ListView {
Layout.fillWidth: true
Layout.fillHeight: true
PlasmaComponents.Label {
Layout.fillWidth: true
text: i18n("Available Accounts")
}
}
model: OA.ProviderModel {}
GridLayout {
delegate: Kirigami.BasicListItem {
icon: model.iconName
label: model.displayName
Layout.fillWidth: true
Layout.fillHeight: true
columns: 3
Repeater {
model: OA.ProviderModel {}
// We don't have a button that has text under icon _and_ looks like a button
// so this creates one
PlasmaComponents.Button {
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout {
anchors.fill: parent
anchors.margins: units.smallSpacing
PlasmaCore.IconItem {
Layout.fillWidth: true
Layout.fillHeight: true
source: model.iconName
}
PlasmaComponents.Label {
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
text: model.displayName
}
}
Component {
id: jobComponent
CreateAccount {
onFinished: {
mainView.push(mainView.initialItem);
}
}
}
onClicked: {
var job = jobComponent.createObject(mainView, { providerName: providerId})
job.start()
}
}
onClicked: {
var job = jobComponent.createObject(kaccountsRoot, { "providerName": providerId })
job.start()
}
}
}
Component {
id: jobComponent
CreateAccount {
onFinished: {
availableAccountsSheet.close()
}
}
}
......@@ -164,44 +118,32 @@ Item {
id: servicesModel
}
Component {
id: availableServices
Kirigami.OverlaySheet {
id: availableServicesSheet
parent: kaccountsRoot.parent
ColumnLayout {
RowLayout {
Layout.maximumHeight: backButton.height
PlasmaComponents.Button {
id: backButton
text: "<"
onClicked: {
mainView.push(mainView.initialItem);
}
}
PlasmaComponents.Label {
Layout.fillWidth: true
text: i18n("Available Services")
}
Kirigami.Heading {
Layout.fillWidth: true
text: i18n("Available Services")
}
ColumnLayout {
Layout.fillHeight: true
Layout.fillWidth: true
spacing: units.smallSpacing
spacing: Kirigami.Units.smallSpacing
Repeater {
Layout.fillWidth: true
model: servicesModel
PlasmaComponents.CheckBox {
Controls.CheckDelegate {
Layout.fillWidth: true
text: model.serviceName
checked: model.enabled
}
}
}
Item {
Layout.fillHeight: true
}
}
}
}
......@@ -19,51 +19,30 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.2
import QtQuick.Layouts 1.1
import QtQuick 2.7
import QtQuick.Layouts 1.11
import QtQuick.Controls 2.0 as Controls
Item {
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kcm 1.2
SimpleKCM {
id: develModule
objectName: "develModule"
// ActiveSettings.DevelSettings {
// id: settings
// }
GridLayout {
ColumnLayout {
id: formLayout
columns: 2
//rows: 4
columnSpacing: units.gridUnit
rowSpacing: units.gridUnit
anchors {
fill: parent
margins: units.gridUnit
leftMargin: 0
}
Controls.Label {
id: timeZoneLabel
text: i18n("Allow remote SSH access:")
Layout.fillWidth: true
}
Controls.Switch {
Controls.SwitchDelegate {
id: ssh
text: i18n("Allow remote SSH access:")
checked: kcm.sshEnabled
Layout.fillWidth: true
onClicked: {
kcm.sshEnabled = checked;
// we have to check to se if it failed
checked = kcm.sshEnabled;
}
}
Item {
width: 2
Layout.fillHeight: true
}
}
}
......@@ -20,18 +20,18 @@
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
Item {
SimpleKCM {
id: powermanagementModule
objectName: "powermanagementModule"
width: 800; height: 500
ActiveSettings.ConfigGroup {
id: screensaverConfig
file: "kscreensaverrc"
......@@ -98,23 +98,17 @@ Item {
connectedSources: ["PowerDevil"]
}
Column {
ColumnLayout {
id: mainItem
anchors {
fill: parent
margins: units.gridUnit
leftMargin: 0
}
spacing: units.gridUnit / 2
spacing: Kirigami.Units.gridUnit * 0.5
Kirigami.Heading {
text: i18n("Screen Brightness")
level: 3
}
Row {
spacing: units.gridUnit
spacing: Kirigami.Units.gridUnit * 0.5
Controls.Label {
width: screensaverEnabledSwitch.width
text: i18n("0%")
......
......@@ -22,20 +22,15 @@ 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.0
import org.kde.kcm 1.2
Item {
id: timeModule
objectName: "timeModule"
SimpleKCM {
id: themeModule
objectName: "themeModule"
ColumnLayout {
anchors {
left: parent.left
top: parent.top
right: parent.right
rightMargin: units.gridUnit
}
spacing: units.gridUnit / 2
width: parent.width
spacing: Kirigami.Units.gridUnit * 0.5
Kirigami.Heading {
text: i18n("Font")
......@@ -44,7 +39,7 @@ Item {
Controls.Slider {
id: fontSizeSlider
Layout.preferredWidth: timeModule.width - units.gridUnit
Layout.preferredWidth: parent.width - Kirigami.Units.gridUnit * 2
stepSize: 1.0
from: 3
to: 12
......@@ -69,7 +64,7 @@ Item {
delegate: Controls.RadioDelegate {
Layout.fillWidth: true
text: model.display
checked: kcm.themeName == model.packageNameRole
checked: kcm.themeName === model.packageNameRole
onCheckedChanged: {
if (checked) {
kcm.themeName = model.packageNameRole;
......@@ -78,9 +73,7 @@ Item {
}
}
}
Component.onCompleted: {
print("KCM.fontSize: " + kcm.fontSize);
}
}
project( kcm_mobile_time )
project(kcm_mobile_time)
#include_directories(../../../../components/settings)
......
......@@ -17,9 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import QtQuick 2.7
// import org.kde.active.settings.time 2.0
......
This diff is collapsed.
// -*- coding: iso-8859-1 -*-
/*
* Copyright 2011 Sebastian Kügler <mart@kde.org>
*
* 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 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.active.settings 2.0
import org.kde.kquickcontrolsaddons 2.0
Item {
id: timeZonePicker
objectName: "timeZonePicker"
anchors.fill: parent
signal filterChanged(string filter)
function focusTextInput()
{
focusTimer.running = true
}
Timer {
id: focusTimer
interval: 100
onTriggered: {
tzFilter.forceActiveFocus()
}
}
PlasmaComponents.TextField {
id: tzFilter
width: parent.width
placeholderText: "Filter..."
// clearButtonShown: true // FIXME: screws up text layout inside filter field
//Keys.onTabPressed: tf2.forceActiveFocus();
anchors {
//verticalCenter: parent.verticalCenter
topMargin: units.smallSpacing
top: parent.top
left: parent.left
right: parent.right
}
}
PlasmaCore.SortFilterModel {
id: filterModel
sourceModel: kcm.timeZonesModel
filterRole: "display"
filterRegExp: ".*"+tzFilter.text+".*"
sortRole: "display"
sortOrder: "AscendingOrder"
}
ListView {
id: timeZonesList
currentIndex: -1
clip: true
//cacheBuffer: 90000
anchors {
//verticalCenter: parent.verticalCenter
top: tzFilter.bottom
topMargin: units.gridUnit / 2
bottom: parent.bottom
left: parent.left
right: parent.right
}
section {
property: "continent"
criteria: ViewSection.FullString
delegate: PlasmaComponents.ListItem {
sectionDelegate: true
PlasmaExtras.Heading {
text: section
level: 4
horizontalAlignment: Text.AlignLeft
//font { bold: true; }
}
}
}
model: filterModel
delegate: timeZoneDelegate
highlight: PlasmaCore.FrameSvgItem {
id: highlightFrame
imagePath: "widgets/viewitem"
prefix: "selected+hover"
}
}
PlasmaComponents.SectionScroller {
id: sectionScroller
listView: timeZonesList
}
Component {
id: timeZoneDelegate
PlasmaComponents.ListItem {
PlasmaComponents.Label {
text: display
}
enabled: true
checked: kcm.timeZone == display
onClicked: {
print (" save: " + display);
kcm.saveTimeZone(display)
timeZonePickerDialog.close()
}
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment