Commit 497b41e0 authored by LNJ's avatar LNJ 💬

automatically close other sheets

parent bb9878ca
Pipeline #4407 failed with stages
in 1 minute and 41 seconds
......@@ -61,7 +61,9 @@ Kirigami.ScrollablePage {
left: Kirigami.Action {
text: qsTr("Create new group")
iconName: "resource-group-new"
onTriggered: triggerSheet(createChannelSheet)
onTriggered: {
triggerSheet(createChannelSheet)
}
}
main: Kirigami.Action {
text: qsTr("Add new contact")
......@@ -76,10 +78,25 @@ Kirigami.ScrollablePage {
}
function triggerSheet(sheet) {
if (sheet.sheetOpen)
if (sheet.sheetOpen) {
sheet.close()
else
} else {
sheet.open()
var sheetsToBeClosed = [
addContactSheet,
removeContactSheet,
joinChannelSheet,
createChannelSheet
]
for (var i = 0; i < sheetsToBeClosed.length; i++) {
var currentSheet = sheetsToBeClosed[i]
if (currentSheet !== sheet) {
if (currentSheet.sheetOpen)
currentSheet.close()
}
}
}
}
ListView {
......
......@@ -106,8 +106,8 @@ Kirigami.OverlaySheet {
Controls.Button {
text: qsTr("Cancel")
onClicked: {
clearInput()
close()
clearInput()
}
Layout.fillWidth: true
}
......@@ -118,10 +118,10 @@ Kirigami.OverlaySheet {
// groupName must not be empty
enabled: isPublic.checked ? groupName.length : true
onClicked: {
print(groupName.text + "@" + mixService.textAt(mixService.currentIndex))
kaidan.createChannel("group.messaging.one", groupName.text)
clearInput()
kaidan.createChannel(mixService.textAt(mixService.currentIndex),
groupName.text)
close()
clearInput()
}
Layout.fillWidth: true
}
......
......@@ -76,8 +76,8 @@ Kirigami.OverlaySheet {
Controls.Button {
text: qsTr("Cancel")
onClicked: {
clearInput()
close()
clearInput()
}
Layout.fillWidth: true
}
......@@ -104,8 +104,8 @@ Kirigami.OverlaySheet {
}
function channelJoined() {
clearInput()
close()
clearInput()
}
// TODO: signals
......
......@@ -76,7 +76,7 @@ Kirigami.SwipeListItem {
}
TextAvatar {
visible: avatarImagePath == ""
visible: avatarImagePath === ""
anchors.fill: parent
width: height
id: textAvatar
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment