Warning, /rolisteam/rolisteam/src/libraries/qml_views/InstantMessaging/AddChatRoomDialog.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.15
0002 import QtQuick.Controls 2.15
0003 import QtQuick.Layouts 1.15
0004 
0005 Popup {
0006     id: root
0007     property alias model: contactList.model
0008     property alias all: everyone.checked
0009     property alias title: title.text
0010     property var recipiants: []
0011     property bool emptyRecipiants: true
0012 
0013     signal chatRoomAdded()
0014     width: frame.implicitWidth
0015     height: frame.implicitHeight
0016     padding: 0
0017 
0018     Frame {
0019         id: frame
0020         ColumnLayout {
0021             id: layout
0022             anchors.fill: parent
0023             RowLayout {
0024                 Layout.fillWidth: true
0025                 Label {
0026                     text: qsTr("Title")
0027                 }
0028                 TextField {
0029                     id: title
0030                 }
0031             }
0032             RowLayout {
0033                 Layout.fillWidth: true
0034                 Label{
0035                     text: qsTr("Everybody")
0036                 }
0037                 Switch {
0038                     id: everyone
0039                     checked: true
0040                 }
0041             }
0042             Frame {
0043                 id: userlist
0044                 Layout.fillWidth: true
0045                 enabled: !everyone.checked
0046                 ColumnLayout {
0047                     anchors.fill: parent
0048                     Repeater {
0049                         id: contactList
0050                         RowLayout {
0051                             Layout.fillWidth: true
0052                             Image {
0053                                 source: "image://avatar/%1".arg(model.uuid)
0054                                 fillMode: Image.PreserveAspectFit
0055                                 sourceSize.width: 50
0056                                 sourceSize.height: 50
0057                                 opacity: everyone.checked ? 0.5 : 1.0
0058                             }
0059                             Label {
0060                                 text: model.name
0061                                 Layout.fillWidth: true
0062                             }
0063                             Switch {
0064                                 enabled: !everyone.checked
0065                                 onCheckedChanged: {
0066                                     if(checked)
0067                                     {
0068                                         root.recipiants.push(model.uuid)
0069                                     }
0070                                     else
0071                                     {
0072                                         root.recipiants.splice(root.recipiants.indexOf(model.uuid),1)
0073                                     }
0074                                    root.emptyRecipiants = (root.recipiants.length == 0)
0075                                 }
0076                             }
0077                         }
0078                     }
0079                 }
0080             }
0081 
0082             Button {
0083                 //: translator please, Keep it short.
0084                 text: qsTr("Add Chatroom")
0085                 Layout.alignment: Qt.AlignRight
0086                 enabled: title.text.length > 0 && (everyone.checked || !root.emptyRecipiants )
0087                 onClicked: {
0088                     root.chatRoomAdded()
0089                     root.close()
0090                 }
0091             }
0092         }
0093     }
0094 }