fix(CommunityArchive): add community archive support to the new edit view

This commit is contained in:
Stefan 2022-04-13 22:54:17 +02:00 committed by Stefan Dunca
parent 73fcbc92bc
commit 1bb19ba1de
3 changed files with 20 additions and 10 deletions

View File

@ -28,6 +28,8 @@ Flickable {
readonly property alias imageAy: imageCropperModal.aY
readonly property alias imageBx: imageCropperModal.bX
readonly property alias imageBy: imageCropperModal.bY
property bool isCommunityHistoryArchiveSupportEnabled: false
property alias historyArchiveSupportToggle: historyArchiveSupportToggle.checked
contentWidth: layout.width
contentHeight: layout.height
@ -249,18 +251,11 @@ Flickable {
}
StatusListItem {
title: qsTr("Community history service")
Layout.fillWidth: true
title: qsTr("History Archive Support")
visible: root.isCommunityHistoryArchiveSupportEnabled
sensor.onClicked: {
if (root.isCommunityHistoryArchiveSupportEnabled) {
historyArchiveSupportToggle.checked = !historyArchiveSupportToggle.checked
}
}
components: [
StatusSwitch {
id: historyArchiveSupportToggle

View File

@ -9,6 +9,11 @@ import StatusQ.Components 0.1
import "../../layouts"
/*! TODO: very confusing to be refactored
The "API" properties are just for input purpose to and to track the inital state
that will be used in evaluating the dirty flag. They should not be updated based
on the user input. The final values are accessed through the \c item member of \c edit property
*/
StackLayout {
id: root
@ -18,6 +23,8 @@ StackLayout {
property color color
property bool editable: false
property bool owned: false
property bool isCommunityHistoryArchiveSupportEnabled: false
property bool historyArchiveSupportToggle: false
signal edited(Item item) // item containing edited fields (name, description, image, color)
@ -120,10 +127,14 @@ StackLayout {
title: qsTr("Edit Community")
content: CommunityEditSettingsPanel {
id: communityEditSettingsPanel
name: root.name
description: root.description
color: root.color
image: root.image
isCommunityHistoryArchiveSupportEnabled: root.isCommunityHistoryArchiveSupportEnabled
historyArchiveSupportToggle: root.historyArchiveSupportToggle
Component.onCompleted: {
editCommunityPage.dirty =
@ -131,7 +142,8 @@ StackLayout {
return root.name != name ||
root.description != description ||
root.image != image ||
root.color != color
root.color != color ||
root.historyArchiveSupportToggle !== historyArchiveSupportToggle
})
}
}

View File

@ -119,6 +119,8 @@ StatusAppTwoPanelLayout {
image: root.community.image
color: root.community.color
editable: root.community.amISectionAdmin
isCommunityHistoryArchiveSupportEnabled: root.rootStore.isCommunityHistoryArchiveSupportEnabled
historyArchiveSupportToggle: community.historyArchiveSupportEnabled
onEdited: {
root.chatCommunitySectionModule.editCommunity(
@ -132,6 +134,7 @@ StatusAppTwoPanelLayout {
item.imageBx,
item.imageBy,
root.rootStore.isCommunityHistoryArchiveSupportEnabled,
false /*TODO port the modal implementation*/
)
}
}