Compare commits

...

3 Commits

Author SHA1 Message Date
Carl Schwan
8177c1f1bc Port About page to FormCard 2023-08-22 22:03:35 +00:00
Carl Schwan
80171748d8 Port more MobileForm to FormCard
- DevTools
- Network settings
- Push notification
- Permissions
2023-08-22 22:03:35 +00:00
Carl Schwan
6aa2e586de Port to form card 2023-08-22 22:03:35 +00:00
12 changed files with 1104 additions and 1126 deletions

View File

@@ -26,8 +26,7 @@ QVariant StateModel::data(const QModelIndex &index, int role) const
int StateModel::rowCount(const QModelIndex &parent) const int StateModel::rowCount(const QModelIndex &parent) const
{ {
Q_UNUSED(parent); return !m_room || parent.isValid() ? 0 : m_room->currentState().events().size();
return m_room->currentState().events().size();
} }
NeoChatRoom *StateModel::room() const NeoChatRoom *StateModel::room() const
@@ -37,8 +36,12 @@ NeoChatRoom *StateModel::room() const
void StateModel::setRoom(NeoChatRoom *room) void StateModel::setRoom(NeoChatRoom *room)
{ {
if (m_room == room) {
return;
}
m_room = room; m_room = room;
Q_EMIT roomChanged(); Q_EMIT roomChanged();
beginResetModel(); beginResetModel();
m_stateEvents.clear(); m_stateEvents.clear();
m_stateEvents = m_room->currentState().events().keys(); m_stateEvents = m_room->currentState().events().keys();

View File

@@ -6,28 +6,36 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.kitemmodels 1.0 import org.kde.kitemmodels 1.0
import org.kde.neochat 1.0 import org.kde.neochat 1.0
ColumnLayout { FormCard.FormCardPage {
MobileForm.FormCard { id: root
Layout.fillWidth: true
contentItem: ColumnLayout { required property var room
spacing: 0
MobileForm.FormComboBoxDelegate { FormCard.FormCard {
Layout.topMargin: Kirigami.Units.gridUnit
FormCard.FormComboBoxDelegate {
id: roomChooser
text: i18n("Room") text: i18n("Room")
textRole: "displayName" textRole: "displayName"
valueRole: "id" valueRole: "roomId"
model: RoomListModel { model: RoomListModel {
id: roomListModel id: roomListModel
connection: Controller.activeConnection connection: Controller.activeConnection
} }
Component.onCompleted: currentIndex = indexOfValue(room.id)
onCurrentValueChanged: room = roomListModel.roomByAliasOrId(currentValue) onCurrentValueChanged: room = roomListModel.roomByAliasOrId(currentValue)
Component.onCompleted: currentIndex = indexOfValue(room.id)
} }
MobileForm.FormCheckDelegate {
FormCard.FormDelegateSeparator { above: showRoomMember }
FormCard.FormCheckDelegate {
id: showRoomMember
text: i18n("Show m.room.member events") text: i18n("Show m.room.member events")
checked: true checked: true
onToggled: { onToggled: {
@@ -38,25 +46,34 @@ ColumnLayout {
} }
} }
} }
MobileForm.FormCheckDelegate {
FormCard.FormDelegateSeparator { above: roomAccoutnDataVisibleCheck; below: showRoomMember }
FormCard.FormCheckDelegate {
id: roomAccoutnDataVisibleCheck id: roomAccoutnDataVisibleCheck
text: i18n("Show room account data") text: i18n("Show room account data")
checked: false checked: false
} }
FormCard.FormDelegateSeparator { below: roomAccoutnDataVisibleCheck }
FormCard.FormTextDelegate {
text: i18n("Room id")
description: room.id
} }
} }
MobileForm.FormCard {
Layout.fillWidth: true FormCard.FormHeader {
title: i18n("Room Account Data for %1", room.displayName)
visible: roomAccoutnDataVisibleCheck.checked visible: roomAccoutnDataVisibleCheck.checked
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Room Account Data for %1 - %2", room.displayName, room.id)
} }
FormCard.FormCard {
visible: roomAccoutnDataVisibleCheck.checked
Repeater { Repeater {
model: room.accountDataEventTypes model: room.accountDataEventTypes
delegate: MobileForm.FormTextDelegate { delegate: FormCard.FormTextDelegate {
text: modelData text: modelData
onClicked: applicationWindow().pageStack.pushDialogLayer("qrc:/MessageSourceSheet.qml", { onClicked: applicationWindow().pageStack.pushDialogLayer("qrc:/MessageSourceSheet.qml", {
"sourceText": room.roomAcountDataJson(text) "sourceText": room.roomAcountDataJson(text)
@@ -67,20 +84,19 @@ ColumnLayout {
} }
} }
} }
}
MobileForm.FormCard { FormCard.FormHeader {
Layout.fillWidth: true
Layout.fillHeight: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
id: stateEventListHeader id: stateEventListHeader
title: i18n("Room State for %1", room.displayName) title: i18n("Room State for %1", room.displayName)
subtitle: room.id
} }
FormCard.FormCard {
Layout.fillHeight: true
QQC2.ScrollView { QQC2.ScrollView {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.maximumHeight: Kirigami.Units.gridUnit * 20
// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890) // HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
@@ -93,11 +109,11 @@ ColumnLayout {
id: stateEventFilterModel id: stateEventFilterModel
sourceModel: StateModel { sourceModel: StateModel {
id: stateModel id: stateModel
room: devtoolsPage.room room: root.room
} }
} }
delegate: MobileForm.FormTextDelegate { delegate: FormCard.FormTextDelegate {
text: model.type text: model.type
description: model.stateKey description: model.stateKey
onClicked: applicationWindow().pageStack.pushDialogLayer('qrc:/MessageSourceSheet.qml', { onClicked: applicationWindow().pageStack.pushDialogLayer('qrc:/MessageSourceSheet.qml', {
@@ -110,5 +126,4 @@ ColumnLayout {
} }
} }
} }
}
} }

View File

@@ -6,48 +6,44 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.kitemmodels 1.0 import org.kde.kitemmodels 1.0
import org.kde.neochat 1.0 import org.kde.neochat 1.0
ColumnLayout { FormCard.FormCardPage {
MobileForm.FormCard { id: root
Layout.fillWidth: true
contentItem: ColumnLayout { FormCard.FormHeader {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Server Capabilities") title: i18n("Server Capabilities")
} }
MobileForm.FormTextDelegate {
FormCard.FormCard {
FormCard.FormTextDelegate {
text: i18n("Can change password") text: i18n("Can change password")
description: Controller.activeConnection.canChangePassword description: Controller.activeConnection.canChangePassword
} }
} }
}
MobileForm.FormCard { FormCard.FormHeader {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Default Room Version") title: i18n("Default Room Version")
} }
MobileForm.FormTextDelegate {
FormCard.FormCard {
FormCard.FormTextDelegate {
text: Controller.activeConnection.defaultRoomVersion text: Controller.activeConnection.defaultRoomVersion
} }
} }
}
MobileForm.FormCard { FormCard.FormHeader {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Available Room Versions") title: i18n("Available Room Versions")
} }
FormCard.FormCard {
Repeater { Repeater {
model: Controller.getSupportedRoomVersions(room.connection) model: Controller.getSupportedRoomVersions(room.connection)
delegate: MobileForm.FormTextDelegate { delegate: FormCard.FormTextDelegate {
text: modelData.id text: modelData.id
contentItem.children: QQC2.Label { contentItem.children: QQC2.Label {
text: modelData.status text: modelData.status
@@ -56,8 +52,4 @@ ColumnLayout {
} }
} }
} }
}
Item {
Layout.fillHeight: true
}
} }

View File

@@ -2,41 +2,34 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.kirigamiaddons.settings 1.0 as KirigamiSettings
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.Page { KirigamiSettings.CategorizedSettings {
id: devtoolsPage id: root
property NeoChatRoom room property NeoChatRoom room
title: i18n("Developer Tools") actions: [
KirigamiSettings.SettingAction {
leftPadding: 0 actionName: "roomData"
rightPadding: 0 text: i18n("Room Data")
icon.name: "datatype"
header: QQC2.TabBar { page: "qrc:/RoomData.qml"
id: tabBar initialProperties: {
return {
QQC2.TabButton { room: root.room
text: qsTr("Room Data")
}
QQC2.TabButton {
text: qsTr("Server Info")
} }
} }
},
StackLayout { KirigamiSettings.SettingAction {
id: swipeView actionName: "serverData"
anchors.fill: parent text: i18n("Server Info")
icon.name: "network-server-symbolic"
currentIndex: tabBar.currentIndex page: "qrc:/ServerData.qml"
RoomData {}
ServerData {}
} }
]
} }

View File

@@ -6,42 +6,36 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.kirigamiaddons.delegates 1.0 as Delegates import org.kde.kirigamiaddons.delegates 1.0 as Delegates
import org.kde.kirigamiaddons.labs.components 1.0 as KirigamiComponents import org.kde.kirigamiaddons.labs.components 1.0 as KirigamiComponents
import org.kde.kitemmodels 1.0 import org.kde.kitemmodels 1.0
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.ScrollablePage { FormCard.FormCardPage {
id: root id: root
property NeoChatRoom room property NeoChatRoom room
title: i18nc('@title:window', 'Permissions') title: i18nc("@title:window", "Permissions")
topPadding: 0
leftPadding: 0
rightPadding: 0
UserListModel { readonly property UserListModel userListModel: UserListModel {
id: userListModel id: userListModel
room: root.room room: root.room
} }
ListModel { readonly property ListModel powerLevelModel: ListModel {
id: powerLevelModel id: powerLevelModel
} }
ColumnLayout { FormCard.FormHeader {
spacing: 0
MobileForm.FormHeader {
Layout.fillWidth: true
title: i18n("Privileged Users") title: i18n("Privileged Users")
} }
MobileForm.FormCard {
FormCard.FormCard {
Layout.fillWidth: true Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
Repeater { Repeater {
model: KSortFilterProxyModel { model: KSortFilterProxyModel {
sourceModel: userListModel sourceModel: userListModel
@@ -52,7 +46,7 @@ Kirigami.ScrollablePage {
return powerLevelRole > 0; return powerLevelRole > 0;
} }
} }
delegate: MobileForm.FormTextDelegate { delegate: FormCard.FormTextDelegate {
text: name text: name
description: userId description: userId
contentItem.children: RowLayout { contentItem.children: RowLayout {
@@ -64,7 +58,7 @@ Kirigami.ScrollablePage {
} }
QQC2.ComboBox { QQC2.ComboBox {
focusPolicy: Qt.NoFocus // provided by parent focusPolicy: Qt.NoFocus // provided by parent
model: powerLevelModel model: root.powerLevelModel
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
visible: room.canSendState("m.room.power_levels") visible: room.canSendState("m.room.power_levels")
@@ -74,10 +68,10 @@ Kirigami.ScrollablePage {
* translated strings. Done here because the model needs to be filled * translated strings. Done here because the model needs to be filled
* before the first delegate sets it's current index. * before the first delegate sets it's current index.
*/ */
if (powerLevelModel.count == 0) { if (root.powerLevelModel.count == 0) {
powerLevelModel.append({"text": i18n("Member (0)"), "powerLevel": 0}); root.powerLevelModel.append({"text": i18n("Member (0)"), "powerLevel": 0});
powerLevelModel.append({"text": i18n("Moderator (50)"), "powerLevel": 50}); root.powerLevelModel.append({"text": i18n("Moderator (50)"), "powerLevel": 50});
powerLevelModel.append({"text": i18n("Admin (100)"), "powerLevel": 100}); root.powerLevelModel.append({"text": i18n("Admin (100)"), "powerLevel": 100});
} }
currentIndex = indexOfValue(powerLevel) currentIndex = indexOfValue(powerLevel)
} }
@@ -88,8 +82,8 @@ Kirigami.ScrollablePage {
} }
} }
} }
MobileForm.FormDelegateSeparator { below: userListSearchCard } FormCard.FormDelegateSeparator { below: userListSearchCard }
MobileForm.AbstractFormDelegate { FormCard.AbstractFormDelegate {
id: userListSearchCard id: userListSearchCard
Layout.fillWidth: true Layout.fillWidth: true
visible: room.canSendState("m.room.power_levels") visible: room.canSendState("m.room.power_levels")
@@ -234,213 +228,217 @@ Kirigami.ScrollablePage {
} }
} }
} }
}
MobileForm.FormHeader { FormCard.FormHeader {
Layout.fillWidth: true
visible: room.canSendState("m.room.power_levels") visible: room.canSendState("m.room.power_levels")
title: i18n("Default permissions") title: i18n("Default permissions")
} }
MobileForm.FormCard {
Layout.fillWidth: true FormCard.FormCard {
visible: room.canSendState("m.room.power_levels") visible: room.canSendState("m.room.power_levels")
contentItem: ColumnLayout {
spacing: 0 FormCard.FormComboBoxDelegate {
MobileForm.FormComboBoxDelegate {
text: i18n("Default user power level") text: i18n("Default user power level")
description: i18n("This is power level for all new users when joining the room") description: i18n("This is power level for all new users when joining the room")
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.defaultUserPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.defaultUserPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.defaultUserPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.defaultUserPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate {
FormCard.FormDelegateSeparator {}
FormCard.FormComboBoxDelegate {
text: i18n("Default power level to set the room state") text: i18n("Default power level to set the room state")
description: i18n("This is used for all state events that do not have their own entry here") description: i18n("This is used for all state events that do not have their own entry here")
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.statePowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.statePowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.statePowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.statePowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate {
FormCard.FormDelegateSeparator {}
FormCard.FormComboBoxDelegate {
text: i18n("Default power level to send messages") text: i18n("Default power level to send messages")
description: i18n("This is used for all message events that do not have their own entry here") description: i18n("This is used for all message events that do not have their own entry here")
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.defaultEventPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.defaultEventPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.defaultEventPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.defaultEventPowerLevel = currentValue
} }
} }
}
MobileForm.FormHeader { FormCard.FormHeader {
Layout.fillWidth: true
visible: room.canSendState("m.room.power_levels") visible: room.canSendState("m.room.power_levels")
title: i18n("Basic permissions") title: i18n("Basic permissions")
} }
MobileForm.FormCard {
Layout.fillWidth: true FormCard.FormCard {
visible: room.canSendState("m.room.power_levels") visible: room.canSendState("m.room.power_levels")
contentItem: ColumnLayout {
spacing: 0 FormCard.FormComboBoxDelegate {
MobileForm.FormComboBoxDelegate {
text: i18n("Invite users") text: i18n("Invite users")
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.invitePowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.invitePowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.invitePowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.invitePowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate {
FormCard.FormDelegateSeparator {}
FormCard.FormComboBoxDelegate {
text: i18n("Kick users") text: i18n("Kick users")
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.kickPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.kickPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.kickPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.kickPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate {
FormCard.FormDelegateSeparator {}
FormCard.FormComboBoxDelegate {
text: i18n("Ban users") text: i18n("Ban users")
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.banPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.banPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.banPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.banPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate {
FormCard.FormDelegateSeparator {}
FormCard.FormComboBoxDelegate {
text: i18n("Remove message sent by other users") text: i18n("Remove message sent by other users")
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.redactPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.redactPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.redactPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.redactPowerLevel = currentValue
} }
} }
}
MobileForm.FormHeader { FormCard.FormHeader {
Layout.fillWidth: true
visible: room.canSendState("m.room.power_levels") visible: room.canSendState("m.room.power_levels")
title: i18n("Event permissions") title: i18n("Event permissions")
} }
MobileForm.FormCard {
Layout.fillWidth: true FormCard.FormCard {
visible: room.canSendState("m.room.power_levels") visible: room.canSendState("m.room.power_levels")
contentItem: ColumnLayout {
spacing: 0 FormCard.FormComboBoxDelegate {
MobileForm.FormComboBoxDelegate {
text: i18n("Change user permissions") text: i18n("Change user permissions")
description: "m.room.power_levels" description: "m.room.power_levels"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.powerLevelPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.powerLevelPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.powerLevelPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.powerLevelPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Change the room name") text: i18n("Change the room name")
description: "m.room.name" description: "m.room.name"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.namePowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.namePowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.namePowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.namePowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Change the room avatar") text: i18n("Change the room avatar")
description: "m.room.avatar" description: "m.room.avatar"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: roo.tpowerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.avatarPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.avatarPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.avatarPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.avatarPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Change the room canonical alias") text: i18n("Change the room canonical alias")
description: "m.room.canonical_alias" description: "m.room.canonical_alias"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.canonicalAliasPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.canonicalAliasPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.canonicalAliasPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.canonicalAliasPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Change the room topic") text: i18n("Change the room topic")
description: "m.room.topic" description: "m.room.topic"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.topicPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.topicPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.topicPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.topicPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Enable encryption for the room") text: i18n("Enable encryption for the room")
description: "m.room.encryption" description: "m.room.encryption"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.encryptionPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.encryptionPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.encryptionPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.encryptionPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Change the room history visibility") text: i18n("Change the room history visibility")
description: "m.room.history_visibility" description: "m.room.history_visibility"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.historyVisibilityPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.historyVisibilityPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.historyVisibilityPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.historyVisibilityPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Set pinned events") text: i18n("Set pinned events")
description: "m.room.pinned_events" description: "m.room.pinned_events"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.pinnedEventsPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.pinnedEventsPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.pinnedEventsPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.pinnedEventsPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Upgrade the room") text: i18n("Upgrade the room")
description: "m.room.tombstone" description: "m.room.tombstone"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.tombstonePowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.tombstonePowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.tombstonePowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.tombstonePowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Set the room server access control list (ACL)") text: i18n("Set the room server access control list (ACL)")
description: "m.room.server_acl" description: "m.room.server_acl"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.serverAclPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.serverAclPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.serverAclPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.serverAclPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
visible: room.isSpace visible: room.isSpace
text: i18n("Set the children of this space") text: i18n("Set the children of this space")
description: "m.space.child" description: "m.space.child"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.spaceChildPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.spaceChildPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.spaceChildPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.spaceChildPowerLevel = currentValue
} }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Set the parent space of this room") text: i18n("Set the parent space of this room")
description: "m.space.parent" description: "m.space.parent"
textRole: "text" textRole: "text"
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: root.powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.spaceChildPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.spaceChildPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.spaceParentPowerLevel = currentValue onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.spaceParentPowerLevel = currentValue
} }
} }
}
}
} }

View File

@@ -6,31 +6,24 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.kitemmodels 1.0 import org.kde.kitemmodels 1.0
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.ScrollablePage { FormCard.FormCardPage {
id: root id: root
property NeoChatRoom room property NeoChatRoom room
title: i18nc('@title:window', 'Notifications') title: i18nc('@title:window', 'Notifications')
topPadding: 0
leftPadding: 0 FormCard.FormHeader {
rightPadding: 0
ColumnLayout {
spacing: 0
MobileForm.FormHeader {
Layout.fillWidth: true
title: i18n("Room notifications setting") title: i18n("Room notifications setting")
} }
MobileForm.FormCard {
Layout.fillWidth: true FormCard.FormCard {
contentItem: ColumnLayout { FormCard.FormRadioDelegate {
spacing: 0
MobileForm.FormRadioDelegate {
text: i18n("Follow global setting") text: i18n("Follow global setting")
checked: room.pushNotificationState === PushNotificationState.Default checked: room.pushNotificationState === PushNotificationState.Default
enabled: room.pushNotificationState !== PushNotificationState.Unknown enabled: room.pushNotificationState !== PushNotificationState.Unknown
@@ -38,7 +31,7 @@ Kirigami.ScrollablePage {
room.pushNotificationState = PushNotificationState.Default room.pushNotificationState = PushNotificationState.Default
} }
} }
MobileForm.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18nc("As in 'notify for all messages'","All") text: i18nc("As in 'notify for all messages'","All")
checked: room.pushNotificationState === PushNotificationState.All checked: room.pushNotificationState === PushNotificationState.All
enabled: room.pushNotificationState !== PushNotificationState.Unknown enabled: room.pushNotificationState !== PushNotificationState.Unknown
@@ -46,7 +39,7 @@ Kirigami.ScrollablePage {
room.pushNotificationState = PushNotificationState.All room.pushNotificationState = PushNotificationState.All
} }
} }
MobileForm.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18nc("As in 'notify when the user is mentioned or the message contains a set keyword'","@Mentions and Keywords") text: i18nc("As in 'notify when the user is mentioned or the message contains a set keyword'","@Mentions and Keywords")
checked: room.pushNotificationState === PushNotificationState.MentionKeyword checked: room.pushNotificationState === PushNotificationState.MentionKeyword
enabled: room.pushNotificationState !== PushNotificationState.Unknown enabled: room.pushNotificationState !== PushNotificationState.Unknown
@@ -54,7 +47,7 @@ Kirigami.ScrollablePage {
room.pushNotificationState = PushNotificationState.MentionKeyword room.pushNotificationState = PushNotificationState.MentionKeyword
} }
} }
MobileForm.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18nc("As in 'do not notify for any messages'","Off") text: i18nc("As in 'do not notify for any messages'","Off")
checked: room.pushNotificationState === PushNotificationState.Mute checked: room.pushNotificationState === PushNotificationState.Mute
enabled: room.pushNotificationState !== PushNotificationState.Unknown enabled: room.pushNotificationState !== PushNotificationState.Unknown
@@ -63,17 +56,12 @@ Kirigami.ScrollablePage {
} }
} }
} }
}
MobileForm.FormCard { FormCard.FormHeader {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Keywords") title: i18n("Keywords")
} }
FormCard.FormCard {
Repeater { Repeater {
model: KSortFilterProxyModel { model: KSortFilterProxyModel {
sourceModel: Controller.pushRuleModel sourceModel: Controller.pushRuleModel
@@ -87,7 +75,8 @@ Kirigami.ScrollablePage {
delegate: ruleDelegate delegate: ruleDelegate
} }
MobileForm.AbstractFormDelegate {
FormCard.AbstractFormDelegate {
Layout.fillWidth: true Layout.fillWidth: true
contentItem : RowLayout { contentItem : RowLayout {
@@ -116,7 +105,6 @@ Kirigami.ScrollablePage {
id: addButton id: addButton
text: i18n("Add keyword") text: i18n("Add keyword")
Accessible.name: text
icon.name: "list-add" icon.name: "list-add"
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
enabled: NotificationsManager.keywordNotificationAction !== PushNotificationAction.Unknown enabled: NotificationsManager.keywordNotificationAction !== PushNotificationAction.Unknown
@@ -126,18 +114,15 @@ Kirigami.ScrollablePage {
keywordAddField.text = "" keywordAddField.text = ""
} }
QQC2.ToolTip { QQC2.ToolTip.text: text
text: addButton.text QQC2.ToolTip.visible: hovered
delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
}
}
}
} }
} }
} }
} }
Component { data: Component {
id: ruleDelegate id: ruleDelegate
NotificationRuleItem { NotificationRuleItem {
onDeleteRule: { onDeleteRule: {

View File

@@ -4,10 +4,10 @@
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.neochat 1.0 import org.kde.neochat 1.0
MobileForm.AboutPage { FormCard.AboutPage {
title: i18nc("@title:window", "About NeoChat") title: i18nc("@title:window", "About NeoChat")
aboutData: About aboutData: About
} }

View File

@@ -1,8 +1,8 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com> // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: LGPL-2.0-or-later // SPDX-License-Identifier: LGPL-2.0-or-later
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
MobileForm.AboutKDE { FormCard.AboutKDE {
title: i18nc("@title:window", "About KDE") title: i18nc("@title:window", "About KDE")
} }

View File

@@ -7,27 +7,25 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.kirigamiaddons.labs.components 1.0 as KirigamiComponents import org.kde.kirigamiaddons.components 1.0 as KirigamiComponents
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.ScrollablePage { FormCard.FormCardPage {
id: root
title: i18nc("@title:window", "Appearance") title: i18nc("@title:window", "Appearance")
topPadding: 0
leftPadding: 0 FormCard.FormHeader {
rightPadding: 0
ColumnLayout {
spacing: 0
MobileForm.FormHeader {
Layout.fillWidth: true Layout.fillWidth: true
title: i18n("General theme") title: i18n("General theme")
} }
MobileForm.FormCard {
FormCard.FormCard {
Layout.fillWidth: true Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0 FormCard.AbstractFormDelegate {
MobileForm.AbstractFormDelegate {
id: timelineModeSetting id: timelineModeSetting
Layout.fillWidth: true Layout.fillWidth: true
background: Item {} background: Item {}
@@ -202,9 +200,9 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { below: compactRoomListDelegate } FormCard.FormDelegateSeparator { below: compactRoomListDelegate }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: compactRoomListDelegate id: compactRoomListDelegate
text: i18n("Use compact room list") text: i18n("Use compact room list")
checked: Config.compactRoomList checked: Config.compactRoomList
@@ -214,7 +212,7 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { above: compactRoomListDelegate ; below: colorSchemeDelegate.item ; visible: colorSchemeDelegate.visible } FormCard.FormDelegateSeparator { above: compactRoomListDelegate ; below: colorSchemeDelegate.item ; visible: colorSchemeDelegate.visible }
Loader { Loader {
id: colorSchemeDelegate id: colorSchemeDelegate
@@ -223,14 +221,12 @@ Kirigami.ScrollablePage {
Layout.fillWidth: true Layout.fillWidth: true
} }
} }
}
MobileForm.FormCard { FormCard.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing Layout.topMargin: Kirigami.Units.largeSpacing * 2
Layout.fillWidth: true Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0 FormCard.FormCheckDelegate {
MobileForm.FormCheckDelegate {
id: showFancyEffectsDelegate id: showFancyEffectsDelegate
text: i18n("Show fancy effects in chat") text: i18n("Show fancy effects in chat")
checked: Config.showFancyEffects checked: Config.showFancyEffects
@@ -241,9 +237,9 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { above: showFancyEffectsDelegate ; below: hasWindowSystemDelegate } FormCard.FormDelegateSeparator { above: showFancyEffectsDelegate ; below: hasWindowSystemDelegate }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: hasWindowSystemDelegate id: hasWindowSystemDelegate
visible: Controller.hasWindowSystem visible: Controller.hasWindowSystem
text: i18n("Use transparent chat page") text: i18n("Use transparent chat page")
@@ -255,9 +251,9 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { above: hasWindowSystemDelegate; below: transparencyDelegate } FormCard.FormDelegateSeparator { above: hasWindowSystemDelegate; below: transparencyDelegate }
MobileForm.AbstractFormDelegate { FormCard.AbstractFormDelegate {
id: transparencyDelegate id: transparencyDelegate
Layout.fillWidth: true Layout.fillWidth: true
visible: Controller.hasWindowSystem && Config.blur visible: Controller.hasWindowSystem && Config.blur
@@ -291,9 +287,9 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { above: transparencyDelegate; below: showLocalMessagesOnRightDelegate; visible: transparencyDelegate.visible } FormCard.FormDelegateSeparator { above: transparencyDelegate; below: showLocalMessagesOnRightDelegate; visible: transparencyDelegate.visible }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: showLocalMessagesOnRightDelegate id: showLocalMessagesOnRightDelegate
text: i18n("Show your messages on the right") text: i18n("Show your messages on the right")
checked: Config.showLocalMessagesOnRight checked: Config.showLocalMessagesOnRight
@@ -304,9 +300,9 @@ Kirigami.ScrollablePage {
} }
} }
MobileForm.FormDelegateSeparator { above: showLocalMessagesOnRightDelegate; below: showLinkPreviewDelegate } FormCard.FormDelegateSeparator { above: showLocalMessagesOnRightDelegate; below: showLinkPreviewDelegate }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: showLinkPreviewDelegate id: showLinkPreviewDelegate
text: i18n("Show links preview in the chat messages") text: i18n("Show links preview in the chat messages")
checked: Config.showLinkPreview checked: Config.showLinkPreview
@@ -316,17 +312,16 @@ Kirigami.ScrollablePage {
} }
} }
} }
}
MobileForm.FormHeader { FormCard.FormHeader {
Layout.fillWidth: true Layout.fillWidth: true
title: i18n("Show Avatar") title: i18n("Show Avatar")
} }
MobileForm.FormCard {
FormCard.FormCard {
Layout.fillWidth: true Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0 FormCard.FormCheckDelegate {
MobileForm.FormCheckDelegate {
text: i18n("In chat") text: i18n("In chat")
checked: Config.showAvatarInTimeline checked: Config.showAvatarInTimeline
onToggled: { onToggled: {
@@ -336,7 +331,7 @@ Kirigami.ScrollablePage {
enabled: !Config.isShowAvatarInTimelineImmutable enabled: !Config.isShowAvatarInTimelineImmutable
} }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
text: i18n("In sidebar") text: i18n("In sidebar")
checked: Config.showAvatarInRoomDrawer checked: Config.showAvatarInRoomDrawer
enabled: !Config.isShowAvatarInRoomDrawerImmutable enabled: !Config.isShowAvatarInRoomDrawerImmutable
@@ -346,6 +341,4 @@ Kirigami.ScrollablePage {
} }
} }
} }
}
}
} }

View File

@@ -7,11 +7,11 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.neochat 1.0 import org.kde.neochat 1.0
MobileForm.AbstractFormDelegate { FormCard.AbstractFormDelegate {
id: deviceDelegate id: deviceDelegate
required property string id required property string id

View File

@@ -7,23 +7,17 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.ScrollablePage { FormCard.FormCardPage {
id: root
title: i18n("Devices") title: i18n("Devices")
property alias connection: devicesModel.connection property alias connection: devicesModel.connection
leftPadding: 0
rightPadding: 0
DevicesModel {
id: devicesModel
}
ColumnLayout {
DevicesCard { DevicesCard {
title: i18n("This Device") title: i18n("This Device")
type: DevicesModel.This type: DevicesModel.This
@@ -45,7 +39,7 @@ Kirigami.ScrollablePage {
showVerifyButton: false showVerifyButton: false
} }
MobileForm.AbstractFormDelegate { FormCard.AbstractFormDelegate {
Layout.fillWidth: true Layout.fillWidth: true
visible: Controller.activeConnection && devicesModel.count === 0 // We can assume 0 means loading since there is at least one device visible: Controller.activeConnection && devicesModel.count === 0 // We can assume 0 means loading since there is at least one device
contentItem: Kirigami.LoadingPlaceholder { } contentItem: Kirigami.LoadingPlaceholder { }
@@ -59,28 +53,35 @@ Kirigami.ScrollablePage {
type: Kirigami.MessageType.Information type: Kirigami.MessageType.Information
visible: !Controller.activeConnection visible: !Controller.activeConnection
} }
}
Kirigami.OverlaySheet { data: [
DevicesModel {
id: devicesModel
},
Kirigami.PromptDialog {
id: passwordSheet id: passwordSheet
property string deviceId property string deviceId
parent: applicationWindow().overlay
title: i18n("Remove device") title: i18n("Remove device")
Kirigami.FormLayout { standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
QQC2.TextField {
id: passwordField leftPadding: 0
Kirigami.FormData.label: i18n("Password:") rightPadding: 0
echoMode: TextInput.Password topPadding: 0
} bottomPadding: 0
QQC2.Button {
text: i18n("Confirm") onAccepted: {
onClicked: {
devicesModel.logout(passwordSheet.deviceId, passwordField.text) devicesModel.logout(passwordSheet.deviceId, passwordField.text)
passwordField.text = "" passwordField.text = ""
passwordSheet.close() passwordSheet.close()
} }
FormCard.FormTextFieldDelegate {
id: passwordField
label: i18n("Password:")
echoMode: TextInput.Password
} }
} }
} ]
} }

View File

@@ -6,29 +6,24 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.ScrollablePage { FormCard.FormCardPage {
title: i18nc("@title:window", "General") id: root
property int currentType property int currentType
property bool proxyConfigChanged: false property bool proxyConfigChanged: false
topPadding: 0 title: i18nc("@title:window", "General")
leftPadding: 0
rightPadding: 0 FormCard.FormHeader {
ColumnLayout {
spacing: 0
MobileForm.FormHeader {
Layout.fillWidth: true
title: i18n("Network Proxy") title: i18n("Network Proxy")
} }
MobileForm.FormCard {
Layout.fillWidth: true FormCard.FormCard {
contentItem: ColumnLayout { FormCard.FormRadioDelegate {
spacing: 0
MobileForm.FormRadioDelegate {
text: i18n("System Default") text: i18n("System Default")
checked: currentType === 0 checked: currentType === 0
enabled: !Config.isProxyTypeImmutable enabled: !Config.isProxyTypeImmutable
@@ -36,7 +31,7 @@ Kirigami.ScrollablePage {
currentType = 0 currentType = 0
} }
} }
MobileForm.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18n("HTTP") text: i18n("HTTP")
checked: currentType === 1 checked: currentType === 1
enabled: !Config.isProxyTypeImmutable enabled: !Config.isProxyTypeImmutable
@@ -44,7 +39,7 @@ Kirigami.ScrollablePage {
currentType = 1 currentType = 1
} }
} }
MobileForm.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18n("Socks5") text: i18n("Socks5")
checked: currentType === 2 checked: currentType === 2
enabled: !Config.isProxyTypeImmutable enabled: !Config.isProxyTypeImmutable
@@ -53,17 +48,13 @@ Kirigami.ScrollablePage {
} }
} }
} }
}
MobileForm.FormHeader { FormCard.FormHeader {
Layout.fillWidth: true
title: i18n("Proxy Settings") title: i18n("Proxy Settings")
} }
MobileForm.FormCard {
Layout.fillWidth: true FormCard.FormCard {
contentItem: ColumnLayout { FormCard.FormTextFieldDelegate {
spacing: 0
MobileForm.FormTextFieldDelegate {
id: hostField id: hostField
label: i18n("Host") label: i18n("Host")
text: Config.proxyHost text: Config.proxyHost
@@ -72,7 +63,10 @@ Kirigami.ScrollablePage {
proxyConfigChanged = true proxyConfigChanged = true
} }
} }
MobileForm.FormSpinBoxDelegate {
FormCard.FormDelegateSeparator {}
FormCard.FormSpinBoxDelegate {
id: portField id: portField
label: i18n("Port") label: i18n("Port")
value: Config.proxyPort value: Config.proxyPort
@@ -85,7 +79,10 @@ Kirigami.ScrollablePage {
proxyConfigChanged = true proxyConfigChanged = true
} }
} }
MobileForm.FormTextFieldDelegate {
FormCard.FormDelegateSeparator {}
FormCard.FormTextFieldDelegate {
id: userField id: userField
label: i18n("User") label: i18n("User")
text: Config.proxyUser text: Config.proxyUser
@@ -94,7 +91,10 @@ Kirigami.ScrollablePage {
proxyConfigChanged = true proxyConfigChanged = true
} }
} }
MobileForm.FormTextFieldDelegate {
FormCard.FormDelegateSeparator {}
FormCard.FormTextFieldDelegate {
id: passwordField id: passwordField
label: i18n("Password") label: i18n("Password")
text: Config.proxyPassword text: Config.proxyPassword
@@ -105,8 +105,6 @@ Kirigami.ScrollablePage {
} }
} }
} }
}
}
footer: QQC2.ToolBar { footer: QQC2.ToolBar {
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0