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 # Install the packages, also make it known to the system
add_subdirectory(theme) add_subdirectory(theme)
add_subdirectory(development) add_subdirectory(development)
if (${KF5KDELibs4Support_FOUND}) if (${KF5KDELibs4Support_FOUND})
add_subdirectory(time) add_subdirectory(time)
endif() endif()
#add_subdirectory(locale)
# Web # Web
#install(DIRECTORY web/ DESTINATION ${DATA_INSTALL_DIR}/plasma/packages/org.kde.active.settings.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) #install(FILES web/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME org.kde.active.settings.web.desktop)
#Power # Power
add_subdirectory(powermanagement) add_subdirectory(powermanagement)
#install(DIRECTORY powermanagement/ DESTINATION ${DATA_INSTALL_DIR}/plasma/packages/org.kde.active.settings.powermanagement) # Accounts
#install(FILES powermanagement/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME org.kde.active.settings.powermanagement.desktop)
#Accounts
if (KAccounts_FOUND AND AccountsQt5_FOUND AND SignOnQt5_FOUND) if (KAccounts_FOUND AND AccountsQt5_FOUND AND SignOnQt5_FOUND)
add_subdirectory(accounts) add_subdirectory(accounts)
endif() endif()
...@@ -17,144 +17,98 @@ ...@@ -17,144 +17,98 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 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 QtQuick 2.7
import org.kde.plasma.core 2.0 as PlasmaCore import QtQuick.Layouts 1.11
import org.kde.plasma.components 2.0 as PlasmaComponents import QtQuick.Controls 2.0 as Controls
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.4 as Kirigami
import org.kde.active.settings 2.0 as ActiveSettings import org.kde.active.settings 2.0 as ActiveSettings
import org.kde.kaccounts 1.0 import org.kde.kaccounts 1.0
import org.kde.kcm 1.2
import Ubuntu.OnlineAccounts 0.1 as OA import Ubuntu.OnlineAccounts 0.1 as OA
Item { ScrollViewKCM {
id: kaccountsRoot id: kaccountsRoot
objectName: "kaccountsModule" objectName: "kaccountsModule"
width: 800; height: 500 // Existing accounts
view: ListView {
Layout.fillWidth: true
Layout.fillHeight: true
StackView { model: OA.AccountServiceModel {
id: mainView id: accountsModel
anchors.fill: parent service: "global"
includeDisabled: true
}
initialItem: ColumnLayout { delegate: Kirigami.SwipeListItem {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true
ListView { Controls.Label {
Layout.fillWidth: true text: model.displayName + " (" + providerName + ")"
Layout.fillHeight: true
spacing: units.smallSpacing
model: OA.AccountServiceModel { OA.Account {
id: accountsModel id: account
service: "global" objectHandle: model.accountHandle
includeDisabled: true
} }
}
delegate: RowLayout { actions: [
anchors { Kirigami.Action {
left: parent.left iconName: "bookmark-remove"
right: parent.right onTriggered: {
} account.remove()
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();
}
} }
} }
]
onClicked: {
availableServicesSheet.open()
servicesModel.accountId = model.accountId
} }
}
}
PlasmaComponents.Button { footer: RowLayout {
Layout.fillWidth: true Controls.Button {
text: i18n("Add new Account") Layout.alignment: Qt.AlignRight
onClicked: mainView.push(availableAccounts) text: i18n("Add new Account")
icon.name: "contact-new"
onClicked: {
availableAccountsSheet.open()
} }
} }
} }
Component { Kirigami.OverlaySheet {
id: availableAccounts id: availableAccountsSheet
parent: kaccountsRoot.parent
ColumnLayout { ListView {
RowLayout { Layout.fillWidth: true
PlasmaComponents.Button { Layout.fillHeight: true
text: "<"
onClicked: {
mainView.push(mainView.initialItem);
}
}
PlasmaComponents.Label { model: OA.ProviderModel {}
Layout.fillWidth: true
text: i18n("Available Accounts")
}
}
GridLayout { delegate: Kirigami.BasicListItem {
icon: model.iconName
label: model.displayName
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true
columns: 3
Repeater { onClicked: {
model: OA.ProviderModel {} var job = jobComponent.createObject(kaccountsRoot, { "providerName": providerId })
job.start()
// 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 Component {
Layout.fillHeight: true id: jobComponent
CreateAccount {
ColumnLayout { onFinished: {
anchors.fill: parent availableAccountsSheet.close()
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()
}
}
} }
} }
} }
...@@ -164,44 +118,32 @@ Item { ...@@ -164,44 +118,32 @@ Item {
id: servicesModel id: servicesModel
} }
Component { Kirigami.OverlaySheet {
id: availableServices id: availableServicesSheet
parent: kaccountsRoot.parent
ColumnLayout { ColumnLayout {
RowLayout { Kirigami.Heading {
Layout.maximumHeight: backButton.height Layout.fillWidth: true
PlasmaComponents.Button { text: i18n("Available Services")
id: backButton
text: "<"
onClicked: {
mainView.push(mainView.initialItem);
}
}
PlasmaComponents.Label {
Layout.fillWidth: true
text: i18n("Available Services")
}
} }
ColumnLayout { ColumnLayout {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
spacing: units.smallSpacing spacing: Kirigami.Units.smallSpacing
Repeater { Repeater {
Layout.fillWidth: true
model: servicesModel model: servicesModel
PlasmaComponents.CheckBox { Controls.CheckDelegate {
Layout.fillWidth: true
text: model.serviceName text: model.serviceName
checked: model.enabled checked: model.enabled
} }
} }
} }
Item {
Layout.fillHeight: true
}
} }
} }
} }
...@@ -19,51 +19,30 @@ ...@@ -19,51 +19,30 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.2 import QtQuick 2.7
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.11
import QtQuick.Controls 2.0 as Controls 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 id: develModule
objectName: "develModule" objectName: "develModule"
// ActiveSettings.DevelSettings { ColumnLayout {
// id: settings
// }
GridLayout {
id: formLayout id: formLayout
columns: 2
//rows: 4
columnSpacing: units.gridUnit
rowSpacing: units.gridUnit
anchors { Controls.SwitchDelegate {
fill: parent
margins: units.gridUnit
leftMargin: 0
}
Controls.Label {
id: timeZoneLabel
text: i18n("Allow remote SSH access:")
Layout.fillWidth: true
}
Controls.Switch {
id: ssh id: ssh
text: i18n("Allow remote SSH access:")
checked: kcm.sshEnabled checked: kcm.sshEnabled
Layout.fillWidth: true
onClicked: { onClicked: {
kcm.sshEnabled = checked; kcm.sshEnabled = checked;
// we have to check to se if it failed // we have to check to se if it failed
checked = kcm.sshEnabled; checked = kcm.sshEnabled;
} }
} }
Item {
width: 2
Layout.fillHeight: true
}
} }
} }
...@@ -20,18 +20,18 @@ ...@@ -20,18 +20,18 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 2.0 as Controls import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.11
import org.kde.kirigami 2.1 as Kirigami import org.kde.kirigami 2.1 as Kirigami
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.active.settings 2.0 as ActiveSettings import org.kde.active.settings 2.0 as ActiveSettings
import org.kde.kcm 1.2
Item { SimpleKCM {
id: powermanagementModule id: powermanagementModule
objectName: "powermanagementModule" objectName: "powermanagementModule"
width: 800; height: 500
ActiveSettings.ConfigGroup { ActiveSettings.ConfigGroup {
id: screensaverConfig id: screensaverConfig
file: "kscreensaverrc" file: "kscreensaverrc"
...@@ -98,23 +98,17 @@ Item { ...@@ -98,23 +98,17 @@ Item {
connectedSources: ["PowerDevil"] connectedSources: ["PowerDevil"]
} }
Column { ColumnLayout {
id: mainItem id: mainItem
anchors { spacing: Kirigami.Units.gridUnit * 0.5
fill: parent
margins: units.gridUnit
leftMargin: 0
}
spacing: units.gridUnit / 2
Kirigami.Heading { Kirigami.Heading {
text: i18n("Screen Brightness") text: i18n("Screen Brightness")
level: 3 level: 3
} }
Row { Row {
spacing: units.gridUnit spacing: Kirigami.Units.gridUnit * 0.5
Controls.Label { Controls.Label {
width: screensaverEnabledSwitch.width width: screensaverEnabledSwitch.width
text: i18n("0%") text: i18n("0%")
......
...@@ -22,20 +22,15 @@ import QtQuick.Layouts 1.1 ...@@ -22,20 +22,15 @@ import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0 as Controls import QtQuick.Controls 2.0 as Controls
import org.kde.kirigami 2.1 as Kirigami import org.kde.kirigami 2.1 as Kirigami
import org.kde.kcm 1.0 import org.kde.kcm 1.2
Item { SimpleKCM {
id: timeModule id: themeModule
objectName: "timeModule" objectName: "themeModule"
ColumnLayout { ColumnLayout {
anchors { width: parent.width
left: parent.left spacing: Kirigami.Units.gridUnit * 0.5
top: parent.top
right: parent.right
rightMargin: units.gridUnit
}
spacing: units.gridUnit / 2
Kirigami.Heading { Kirigami.Heading {
text: i18n("Font") text: i18n("Font")
...@@ -44,7 +39,7 @@ Item { ...@@ -44,7 +39,7 @@ Item {
Controls.Slider { Controls.Slider {
id: fontSizeSlider id: fontSizeSlider
Layout.preferredWidth: timeModule.width - units.gridUnit Layout.preferredWidth: parent.width - Kirigami.Units.gridUnit * 2
stepSize: 1.0 stepSize: 1.0
from: 3 from: 3
to: 12 to: 12
...@@ -69,7 +64,7 @@ Item { ...@@ -69,7 +64,7 @@ Item {
delegate: Controls.RadioDelegate { delegate: Controls.RadioDelegate {
Layout.fillWidth: true Layout.fillWidth: true
text: model.display text: model.display
checked: kcm.themeName == model.packageNameRole checked: kcm.themeName === model.packageNameRole
onCheckedChanged: { onCheckedChanged: {
if (checked) { if (checked) {
kcm.themeName = model.packageNameRole; kcm.themeName = model.packageNameRole;
...@@ -78,9 +73,7 @@ Item { ...@@ -78,9 +73,7 @@ Item {
} }
} }
} }
Component.onCompleted: { Component.onCompleted: {
print("KCM.fontSize: " + kcm.fontSize); print("KCM.fontSize: " + kcm.fontSize);
} }
} }
project( kcm_mobile_time ) project(kcm_mobile_time)
#include_directories(../../../../components/settings) #include_directories(../../../../components/settings)
......
...@@ -17,9 +17,7 @@ ...@@ -17,9 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.7
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
// import org.kde.active.settings.time 2.0 // import org.kde.active.settings.time 2.0
......
...@@ -18,100 +18,62 @@ ...@@ -18,100 +18,62 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.2 import QtQuick 2.7
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.3
import QtQuick.Controls 2.3 as Controls 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.kirigami 2.4 as Kirigami
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.active.settings 2.0
import org.kde.kcm 1.0 import org.kde.kcm 1.2
Item { SimpleKCM {
id: timeModule id: timeModule
objectName: "timeModule" objectName: "timeModule"
QQC1.ScrollView { ColumnLayout {
id: scrollView width: parent.width
anchors.fill: parent spacing: 0
id: formLayout
GridLayout { Kirigami.Heading {
id: formLayout Layout.bottomMargin: Kirigami.Units.gridUnit * 0.5
text: i18n("Time Display")
property int gridspacing: Kirigami.Units.gridUnit level: 3
}