Commit f706b28e authored by Jonah Brüchert's avatar Jonah Brüchert 🌳 Committed by Bhushan Shah

Rework mobile kcms

 * Redesign accounts kcm

 * Use SimpleKCM and ScrollableKCM for all kcms
parent 104762e8
# 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
......
......@@ -18,100 +18,62 @@
* 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.3
import QtQuick.Controls 2.3 as Controls
import QtQuick.Controls 1.3 as QQC1
import org.kde.kirigami 2.4 as Kirigami
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kcm 1.0
import org.kde.active.settings 2.0
import org.kde.kcm 1.2
Item {
SimpleKCM {
id: timeModule
objectName: "timeModule"
QQC1.ScrollView {
id: scrollView
anchors.fill: parent
ColumnLayout {
width: parent.width
spacing: 0
id: formLayout
GridLayout {
id: formLayout
property int gridspacing: Kirigami.Units.gridUnit
//anchors.fill: parent
//height: implicitHeight
width: scrollView.width - Kirigami.Units.gridUnit
//Rectangle { color: "orange"; opacity: 0.3; anchors.fill: parent}
columns: 2
//rows: 4
//anchors.fill: parent
//anchors.rightMargin: gridspacing
//rowSpacing: gridspacing
columnSpacing: gridspacing
Item {
Layout.preferredHeight: Kirigami.Units.gridUnit / 3
Layout.columnSpan: 2
}
Kirigami.Heading {
Layout.columnSpan: 2
// Layout.rowSpacing: Kirigami.Units.gridUnit * 4
text: i18n("Time Display")
level: 3
}
Controls.Label {
text: i18n("Use 24-hour clock:")
Layout.fillWidth: true
}
Kirigami.Heading {
Layout.bottomMargin: Kirigami.Units.gridUnit * 0.5
text: i18n("Time Display")
level: 3
}
Kirigami.BasicListItem {
label: i18n("Use 24-hour clock:")
icon: "clock"
Controls.Switch {
id: twentyFourSwitch
checked: kcm.twentyFour
Layout.alignment : Qt.AlignRight
onClicked : {
kcm.twentyFour = checked
print(kcm.timeZone);
}
}
}
Controls.Label {
id: timeZoneLabel
text: i18n("Timezone:")
Layout.fillWidth: true
}
Controls.Button {
Kirigami.BasicListItem {
label: "Timezone:"
Controls.ToolButton {
id: timeZoneButton
text: kcm.timeZone
onClicked: timeZonePickerDialog.open()
}
}
Item {
height: Kirigami.Units.gridUnit
}
Kirigami.Heading {
Layout.columnSpan: 2
// Layout.rowSpacing: Kirigami.Units.gridUnit * 4
text: i18n("Set Time and Date")
level: 3
}
Controls.Label {
id: ntpLabel
text: i18n("Set time automatically:")
Layout.fillWidth: true
}
Kirigami.Heading {
Layout.topMargin: Kirigami.Units.gridUnit
Layout.bottomMargin: Kirigami.Units.gridUnit * 0.5
text: i18n("Set Time and Date")
level: 3
}
Kirigami.BasicListItem {
label: i18n("Set time automatically:")
Controls.Switch {
id: ntpCheckBox
Layout.alignment : Qt.AlignRight
checked: kcm.useNtp
onClicked: {
kcm.useNtp = checked;
......@@ -121,113 +83,136 @@ Item {
}
}
}
Kirigami.Heading {
Layout.columnSpan: 2
// Layout.rowSpacing: Kirigami.Units.gridUnit * 4
text: i18n("Set Time")
level: 4
}
Kirigami.BasicListItem {
label: i18n("Time")
icon: "clock"
Controls.ToolButton {
text: {
var date = new Date(kcm.currentTime);
return date.toTimeString()
}
onClicked: timePickerDialog.open()
}
}
TimePicker {
id: timePicker
enabled: !ntpCheckBox.checked
twentyFour: twentyFourSwitch.checked
Kirigami.BasicListItem {
label: i18n("Date")
icon: "office-calendar"