parent
1d86a963ab
commit
a9dabe5df9
|
@ -46,94 +46,98 @@ StatusModal {
|
|||
}
|
||||
}
|
||||
|
||||
contentItem: Column {
|
||||
width: popup.width
|
||||
property alias searchBox: searchBox
|
||||
contentItem: Item {
|
||||
Column {
|
||||
id: contentItem
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
property alias searchBox: searchBox
|
||||
|
||||
Item {
|
||||
height: 8
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
StatusInput {
|
||||
id: searchBox
|
||||
input.placeholderText: qsTr("Search for communities or topics")
|
||||
input.icon.name: "search"
|
||||
}
|
||||
|
||||
StatusModalDivider { topPadding: 8 }
|
||||
|
||||
ScrollView {
|
||||
width: parent.width
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
topPadding: 8
|
||||
bottomPadding: 8
|
||||
height: 400
|
||||
clip: true
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
model: communitiesDelegateModel
|
||||
spacing: 4
|
||||
clip: true
|
||||
id: communitiesList
|
||||
|
||||
section.property: "name"
|
||||
section.criteria: ViewSection.FirstCharacter
|
||||
section.delegate: Column {
|
||||
|
||||
StatusBaseText {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 16
|
||||
text: section.toUpperCase()
|
||||
font.pixelSize: 15
|
||||
font.weight: Font.Medium
|
||||
color: Theme.palette.directColor1
|
||||
}
|
||||
|
||||
StatusModalDivider {
|
||||
bottomPadding: 8
|
||||
}
|
||||
}
|
||||
Item {
|
||||
height: 8
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
DelegateModelGeneralized {
|
||||
id: communitiesDelegateModel
|
||||
lessThan: [
|
||||
function(left, right) {
|
||||
return left.name.toLowerCase() < right.name.toLowerCase()
|
||||
}
|
||||
]
|
||||
StatusInput {
|
||||
id: searchBox
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
input.placeholderText: qsTr("Search for communities or topics")
|
||||
input.icon.name: "search"
|
||||
}
|
||||
|
||||
model: popup.communitiesList
|
||||
delegate: StatusListItem {
|
||||
visible: {
|
||||
if (!searchBox.input.text) {
|
||||
return true
|
||||
}
|
||||
const lowerCaseSearchStr = searchBox.input.text.toLowerCase()
|
||||
return model.name.toLowerCase().includes(lowerCaseSearchStr) || model.description.toLowerCase().includes(lowerCaseSearchStr)
|
||||
}
|
||||
height: visible ? implicitHeight : 0
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
title: model.name
|
||||
subTitle: model.description
|
||||
//% "%1 members"
|
||||
tertiaryTitle: qsTrId("-1-members").arg(model.members.count)
|
||||
statusListItemTitle.font.weight: Font.Bold
|
||||
statusListItemTitle.font.pixelSize: 17
|
||||
image.source: model.image
|
||||
icon.isLetterIdenticon: !model.image
|
||||
icon.background.color: model.color || Theme.palette.primaryColor1
|
||||
StatusModalDivider { topPadding: 8 }
|
||||
|
||||
sensor.onClicked: {
|
||||
if (model.joined && model.isMember) {
|
||||
popup.setActiveCommunity(model.id);
|
||||
} else {
|
||||
popup.setObservedCommunity(model.id);
|
||||
Global.openPopup(communityDetailPopup)
|
||||
ScrollView {
|
||||
width: parent.width
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
topPadding: 8
|
||||
bottomPadding: 8
|
||||
height: 400
|
||||
clip: true
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
model: communitiesDelegateModel
|
||||
spacing: 4
|
||||
clip: true
|
||||
id: communitiesList
|
||||
|
||||
section.property: "name"
|
||||
section.criteria: ViewSection.FirstCharacter
|
||||
section.delegate: Column {
|
||||
|
||||
StatusBaseText {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 16
|
||||
text: section.toUpperCase()
|
||||
font.pixelSize: 15
|
||||
font.weight: Font.Medium
|
||||
color: Theme.palette.directColor1
|
||||
}
|
||||
|
||||
StatusModalDivider {
|
||||
bottomPadding: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateModelGeneralized {
|
||||
id: communitiesDelegateModel
|
||||
lessThan: [
|
||||
function(left, right) {
|
||||
return left.name.toLowerCase() < right.name.toLowerCase()
|
||||
}
|
||||
]
|
||||
|
||||
model: popup.communitiesList
|
||||
delegate: StatusListItem {
|
||||
visible: {
|
||||
if (!searchBox.input.text) {
|
||||
return true
|
||||
}
|
||||
const lowerCaseSearchStr = searchBox.input.text.toLowerCase()
|
||||
return model.name.toLowerCase().includes(lowerCaseSearchStr) || model.description.toLowerCase().includes(lowerCaseSearchStr)
|
||||
}
|
||||
height: visible ? implicitHeight : 0
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
title: model.name
|
||||
subTitle: model.description
|
||||
//% "%1 members"
|
||||
tertiaryTitle: qsTrId("-1-members").arg(model.members.count)
|
||||
statusListItemTitle.font.weight: Font.Bold
|
||||
statusListItemTitle.font.pixelSize: 17
|
||||
image.source: model.image
|
||||
icon.isLetterIdenticon: !model.image
|
||||
icon.background.color: model.color || Theme.palette.primaryColor1
|
||||
|
||||
sensor.onClicked: {
|
||||
if (model.joined && model.isMember) {
|
||||
popup.setActiveCommunity(model.id);
|
||||
} else {
|
||||
popup.setObservedCommunity(model.id);
|
||||
Global.openPopup(communityDetailPopup)
|
||||
}
|
||||
popup.close()
|
||||
}
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,58 +80,60 @@ StatusModal {
|
|||
}
|
||||
}
|
||||
|
||||
contentItem: Column {
|
||||
id: content
|
||||
width: root.width
|
||||
spacing: d.contentSpacing
|
||||
contentItem: Item {
|
||||
Column {
|
||||
id: content
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: d.contentSpacing
|
||||
|
||||
StatusInput {
|
||||
id: chatKeyInput
|
||||
StatusInput {
|
||||
id: chatKeyInput
|
||||
|
||||
input.placeholderText: qsTr("Enter chat key here")
|
||||
input.text: input.edit.focus? d.realChatKey : d.elidedChatKey
|
||||
input.rightComponent: {
|
||||
if(d.showPasteButton)
|
||||
return pasteButtonComponent
|
||||
else if(d.showChatKeyValidationIndicator)
|
||||
return chatKeyValidationIndicator
|
||||
else
|
||||
return null
|
||||
}
|
||||
input.onTextChanged: {
|
||||
if(input.edit.focus)
|
||||
{
|
||||
d.realChatKey = text
|
||||
input.placeholderText: qsTr("Enter chat key here")
|
||||
input.text: input.edit.focus? d.realChatKey : d.elidedChatKey
|
||||
input.rightComponent: {
|
||||
if(d.showPasteButton)
|
||||
return pasteButtonComponent
|
||||
else if(d.showChatKeyValidationIndicator)
|
||||
return chatKeyValidationIndicator
|
||||
else
|
||||
return null
|
||||
}
|
||||
input.onTextChanged: {
|
||||
if(input.edit.focus)
|
||||
{
|
||||
d.realChatKey = text
|
||||
|
||||
if(d.realChatKey === "") {
|
||||
d.showPasteButton = true
|
||||
d.showChatKeyValidationIndicator = false
|
||||
if(d.realChatKey === "") {
|
||||
d.showPasteButton = true
|
||||
d.showChatKeyValidationIndicator = false
|
||||
}
|
||||
|
||||
if (text.length < d.minChatKeyLength) {
|
||||
d.validChatKey = false
|
||||
return
|
||||
}
|
||||
|
||||
Qt.callLater(d.lookupContact, text);
|
||||
}
|
||||
|
||||
if (text.length < d.minChatKeyLength) {
|
||||
d.validChatKey = false
|
||||
return
|
||||
}
|
||||
|
||||
Qt.callLater(d.lookupContact, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StatusInput {
|
||||
id: messageInput
|
||||
charLimit: d.maxMsgLength
|
||||
StatusInput {
|
||||
id: messageInput
|
||||
charLimit: d.maxMsgLength
|
||||
|
||||
input.placeholderText: qsTr("Say who you are / why you want to become a contact...")
|
||||
input.multiline: true
|
||||
input.implicitHeight: d.msgHeight
|
||||
input.verticalAlignment: TextEdit.AlignTop
|
||||
input.placeholderText: qsTr("Say who you are / why you want to become a contact...")
|
||||
input.multiline: true
|
||||
input.implicitHeight: d.msgHeight
|
||||
input.verticalAlignment: TextEdit.AlignTop
|
||||
|
||||
validators: [StatusMinLengthValidator {
|
||||
minLength: d.minMsgLength
|
||||
errorMessage: Utils.getErrorMessage(messageInput.errors, qsTr("who are you"))
|
||||
}]
|
||||
validationMode: StatusInput.ValidationMode.Always
|
||||
validators: [StatusMinLengthValidator {
|
||||
minLength: d.minMsgLength
|
||||
errorMessage: Utils.getErrorMessage(messageInput.errors, qsTr("who are you"))
|
||||
}]
|
||||
validationMode: StatusInput.ValidationMode.Always
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue