diff --git a/resources/qml/dialogs/CreateDirect.qml b/resources/qml/dialogs/CreateDirect.qml
index 3ae0b72d..85768cad 100644
--- a/resources/qml/dialogs/CreateDirect.qml
+++ b/resources/qml/dialogs/CreateDirect.qml
@@ -15,36 +15,26 @@ ApplicationWindow {
id: createDirectRoot
title: qsTr("Create Direct Chat")
property var profile
- property bool otherUserHasE2ee: profile? dMod.count > 0 : true
- minimumHeight: layout.implicitHeight+2*layout.anchors.margins+footer.height
- minimumWidth: footer.width
+ property bool otherUserHasE2ee: profile? profile.deviceList.rowCount() > 0 : true
+ minimumHeight: layout.implicitHeight + footer.implicitHeight + Nheko.paddingLarge*2
+ minimumWidth: Math.max(footer.implicitWidth, layout.implicitWidth)
+ modality: Qt.NonModal
+ flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
+
+ onVisibilityChanged: {
+ userID.forceActiveFocus();
+ }
Shortcut {
sequence: StandardKey.Cancel
- onActivated: roomDirectoryWindow.close()
- }
- DelegateModel {
- id: dMod
- model: profile? profile.deviceList : undefined
+ onActivated: createDirectRoot.close()
}
ColumnLayout {
id: layout
anchors.fill: parent
- anchors.margins: Nheko.paddingSmall
- MatrixTextField {
- id: userID
- property bool isValidMxid: text.match("@.+?:.{3,}")
- Layout.fillWidth: true
- focus: true
- placeholderText: qsTr("Name")
- onTextChanged: {
- if(isValidMxid) {
- profile = TimelineManager.getGlobalUserProfile(text);
- } else
- profile = null;
- }
- }
+ anchors.margins: Nheko.paddingLarge
+ spacing: userID.height/4
GridLayout {
Layout.fillWidth: true
@@ -58,7 +48,7 @@ ApplicationWindow {
Layout.preferredWidth: Nheko.avatarSize
Layout.preferredHeight: Nheko.avatarSize
Layout.alignment: Qt.AlignLeft
- userid: profile? profile.mxid : ""
+ userid: profile? profile.userid : ""
url: profile? profile.avatarUrl.replace("mxc://", "image://MxcImage/") : null
displayName: profile? profile.displayName : ""
enabled: false
@@ -77,6 +67,22 @@ ApplicationWindow {
font.pointSize: fontMetrics.font.pointSize * 0.9
}
}
+
+ MatrixTextField {
+ id: userID
+ property bool isValidMxid: text.match("@.+?:.{3,}")
+ Layout.fillWidth: true
+ focus: true
+ label: qsTr("User to invite")
+ placeholderText: qsTr("@user:server.tld")
+ onTextChanged: {
+ if(isValidMxid) {
+ profile = TimelineManager.getGlobalUserProfile(text);
+ } else
+ profile = null;
+ }
+ }
+
RowLayout {
Layout.fillWidth: true
Label {
@@ -91,6 +97,8 @@ ApplicationWindow {
checked: otherUserHasE2ee
}
}
+
+ Item {Layout.fillHeight: true}
}
footer: DialogButtonBox {
standardButtons: DialogButtonBox.Cancel
@@ -101,7 +109,7 @@ ApplicationWindow {
}
onRejected: createDirectRoot.close();
onAccepted: {
- profile.startChat()
+ profile.startChat(encryption.checked)
createDirectRoot.close()
}
}
diff --git a/resources/qml/dialogs/CreateRoom.qml b/resources/qml/dialogs/CreateRoom.qml
index c000642d..5d224885 100644
--- a/resources/qml/dialogs/CreateRoom.qml
+++ b/resources/qml/dialogs/CreateRoom.qml
@@ -13,8 +13,15 @@ import im.nheko 1.0
ApplicationWindow {
id: createRoomRoot
title: qsTr("Create Room")
- minimumWidth: rootLayout.implicitWidth+2*rootLayout.anchors.margins
+ minimumWidth: Math.max(rootLayout.implicitWidth+2*rootLayout.anchors.margins, footer.implicitWidth + Nheko.paddingLarge)
minimumHeight: rootLayout.implicitHeight+footer.implicitHeight+2*rootLayout.anchors.margins
+ modality: Qt.NonModal
+ flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
+
+ onVisibilityChanged: {
+ newRoomName.forceActiveFocus();
+ }
+
Shortcut {
sequence: StandardKey.Cancel
onActivated: createRoomRoot.close()
@@ -22,15 +29,18 @@ ApplicationWindow {
GridLayout {
id: rootLayout
anchors.fill: parent
- anchors.margins: Nheko.paddingSmall
+ anchors.margins: Nheko.paddingLarge
columns: 2
+ rowSpacing: Nheko.paddingMedium
+
MatrixTextField {
id: newRoomName
Layout.columnSpan: 2
Layout.fillWidth: true
focus: true
- placeholderText: qsTr("Name")
+ label: qsTr("Name")
+ placeholderText: qsTr("No name")
}
MatrixTextField {
id: newRoomTopic
@@ -38,8 +48,14 @@ ApplicationWindow {
Layout.fillWidth: true
focus: true
- placeholderText: qsTr("Topic")
+ label: qsTr("Topic")
+ placeholderText: qsTr("No topic")
}
+
+ Item {
+ Layout.preferredHeight: newRoomName.height / 2
+ }
+
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
@@ -63,20 +79,20 @@ ApplicationWindow {
Label {
Layout.preferredWidth: implicitWidth
Layout.alignment: Qt.AlignLeft
- text: qsTr("Private")
+ text: qsTr("Public")
color: Nheko.colors.text
HoverHandler {
id: privateHover
}
ToolTip.visible: privateHover.hovered
- ToolTip.text: qsTr("Only invited users can join the room")
+ ToolTip.text: qsTr("Public rooms can be joined by anyone, private rooms need explicit invites.")
ToolTip.delay: Nheko.tooltipDelay
}
ToggleButton {
Layout.alignment: Qt.AlignRight
Layout.preferredWidth: implicitWidth
- id: isPrivate
- checked: true
+ id: isPublic
+ checked: false
}
Label {
Layout.preferredWidth: implicitWidth
@@ -95,7 +111,7 @@ ApplicationWindow {
Layout.preferredWidth: implicitWidth
id: isTrusted
checked: false
- enabled: isPrivate.checked
+ enabled: !isPublic.checked
}
Label {
Layout.preferredWidth: implicitWidth
@@ -115,6 +131,8 @@ ApplicationWindow {
id: isEncrypted
checked: false
}
+
+ Item {Layout.fillHeight: true}
}
footer: DialogButtonBox {
standardButtons: DialogButtonBox.Cancel
@@ -123,6 +141,17 @@ ApplicationWindow {
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
}
onRejected: createRoomRoot.close();
- //onAccepted: createRoom(newRoomName.text, newRoomTopic.text, newRoomAlias.text, newRoomVisibility.index, newRoomPreset.index)
+ onAccepted: {
+ var preset = 0;
+
+ if (isPublic.checked) {
+ preset = 1;
+ }
+ else {
+ preset = isTrusted.checked ? 2 : 0;
+ }
+ Nheko.createRoom(newRoomName.text, newRoomTopic.text, newRoomAlias.text, isEncrypted.checked, preset)
+ createRoomRoot.close();
+ }
}
}
|