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

View File

@ -9,6 +9,11 @@ import StatusQ.Components 0.1
import "../../layouts" 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 { StackLayout {
id: root id: root
@ -18,6 +23,8 @@ StackLayout {
property color color property color color
property bool editable: false property bool editable: false
property bool owned: 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) signal edited(Item item) // item containing edited fields (name, description, image, color)
@ -120,10 +127,14 @@ StackLayout {
title: qsTr("Edit Community") title: qsTr("Edit Community")
content: CommunityEditSettingsPanel { content: CommunityEditSettingsPanel {
id: communityEditSettingsPanel
name: root.name name: root.name
description: root.description description: root.description
color: root.color color: root.color
image: root.image image: root.image
isCommunityHistoryArchiveSupportEnabled: root.isCommunityHistoryArchiveSupportEnabled
historyArchiveSupportToggle: root.historyArchiveSupportToggle
Component.onCompleted: { Component.onCompleted: {
editCommunityPage.dirty = editCommunityPage.dirty =
@ -131,7 +142,8 @@ StackLayout {
return root.name != name || return root.name != name ||
root.description != description || root.description != description ||
root.image != image || root.image != image ||
root.color != color root.color != color ||
root.historyArchiveSupportToggle !== historyArchiveSupportToggle
}) })
} }
} }

View File

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