diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml
index 1fdff8ed..68948452 100644
--- a/resources/qml/MessageInput.qml
+++ b/resources/qml/MessageInput.qml
@@ -18,6 +18,8 @@ Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: row.implicitHeight
Layout.minimumHeight: 40
+ property bool showAllButtons: width > 450 || (messageInput.length == 0 && !messageInput.inputMethodComposing)
+
Component {
id: placeCallDialog
@@ -35,7 +37,7 @@ Rectangle {
spacing: 0
ImageButton {
- visible: CallManager.callsSupported
+ visible: CallManager.callsSupported && showAllButtons
opacity: CallManager.haveCallInvite ? 0.3 : 1
Layout.alignment: Qt.AlignBottom
hoverEnabled: true
@@ -61,6 +63,7 @@ Rectangle {
}
ImageButton {
+ visible: showAllButtons
Layout.alignment: Qt.AlignBottom
hoverEnabled: true
width: 22
@@ -134,6 +137,7 @@ Rectangle {
padding: 0
topPadding: 8
bottomPadding: 8
+ leftPadding: inputBar.showAllButtons? 0 : 8
focus: true
onTextChanged: {
if (room)
@@ -387,6 +391,7 @@ Rectangle {
ImageButton {
id: stickerButton
+ visible: showAllButtons
Layout.alignment: Qt.AlignRight | Qt.AlignBottom
Layout.margins: 8
@@ -437,6 +442,7 @@ Rectangle {
ToolTip.visible: hovered
ToolTip.text: qsTr("Send")
onClicked: {
+ messageInput.append(messageInput.preeditText)
room.input.send();
}
}
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index a717cb31..55860ad6 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -7,6 +7,7 @@ import "./components"
import "./delegates"
import "./emoji"
import "./ui"
+import "./dialogs"
import Qt.labs.platform 1.1 as Platform
import QtQuick 2.15
import QtQuick.Controls 2.15
@@ -585,6 +586,21 @@ Item {
open();
}
+ Component {
+ id: removeReason
+ InputDialog {
+ id: removeReasonDialog
+
+ property string eventId
+
+ title: qsTr("Reason for removal")
+ prompt: qsTr("Enter reason for removal or hit enter for no reason:")
+ onAccepted: function(text) {
+ room.redactEvent(eventId, text);
+ }
+ }
+ }
+
Platform.MenuItem {
visible: messageContextMenu.text
enabled: visible
@@ -665,7 +681,13 @@ Item {
Platform.MenuItem {
visible: (room ? room.permissions.canRedact() : false) || messageContextMenu.isSender
text: qsTr("Remo&ve message")
- onTriggered: room.redactEvent(messageContextMenu.eventId)
+ onTriggered: function() {
+ var dialog = removeReason.createObject(timelineRoot);
+ dialog.eventId = messageContextMenu.eventId;
+ dialog.show();
+ dialog.forceActiveFocus();
+ timelineRoot.destroyOnClose(dialog);
+ }
}
Platform.MenuItem {
diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml
index 14e6770b..c8c05a3e 100644
--- a/resources/qml/Root.qml
+++ b/resources/qml/Root.qml
@@ -222,7 +222,8 @@ Pane {
}
function destroyOnClose(obj) {
- obj.closing.connect(() => obj.destroy());
+ if (obj.closing != undefined) obj.closing.connect(() => obj.destroy());
+ else if (obj.closed != undefined) obj.closed.connect(() => obj.destroy());
}
function destroyOnClosed(obj) {
diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml
index 77eed1b0..32149cc8 100644
--- a/resources/qml/TopBar.qml
+++ b/resources/qml/TopBar.qml
@@ -134,22 +134,30 @@ Pane {
text: roomTopic
}
- EncryptionIndicator {
+ AbstractButton {
Layout.column: 3
Layout.row: 0
Layout.rowSpan: 2
Layout.preferredHeight: Nheko.avatarSize - Nheko.paddingMedium
Layout.preferredWidth: Nheko.avatarSize - Nheko.paddingMedium
- sourceSize.height: Layout.preferredHeight * Screen.devicePixelRatio
- sourceSize.width: Layout.preferredWidth * Screen.devicePixelRatio
- visible: isEncrypted
- encrypted: isEncrypted
- trust: trustlevel
+
+ contentItem: EncryptionIndicator {
+ sourceSize.height: parent.Layout.preferredHeight * Screen.devicePixelRatio
+ sourceSize.width: parent.Layout.preferredWidth * Screen.devicePixelRatio
+ visible: isEncrypted
+ encrypted: isEncrypted
+ trust: trustlevel
+ enabled: false
+ }
+
+ background: null
+
+ ToolTip.delay: Nheko.tooltipDelay
ToolTip.text: {
- if (!encrypted)
+ if (!isEncrypted)
return qsTr("This room is not encrypted!");
- switch (trust) {
+ switch (trustlevel) {
case Crypto.Verified:
return qsTr("This room contains only verified devices.");
case Crypto.TOFU:
@@ -158,6 +166,9 @@ Pane {
return qsTr("This room contains unverified devices!");
}
}
+ ToolTip.visible: hovered
+
+ onClicked: TimelineManager.openRoomMembers(room)
}
ImageButton {
diff --git a/resources/qml/components/FlatButton.qml b/resources/qml/components/FlatButton.qml
index 72184d28..2c9ea061 100644
--- a/resources/qml/components/FlatButton.qml
+++ b/resources/qml/components/FlatButton.qml
@@ -6,6 +6,7 @@
import QtGraphicalEffects 1.12
import QtQuick 2.9
import QtQuick.Controls 2.5
+import QtQuick.Layouts 1.2
import im.nheko 1.0
// FIXME(Nico): Don't use hardcoded colors.
@@ -16,6 +17,8 @@ Button {
implicitWidth: Math.ceil(control.contentItem.implicitWidth + control.contentItem.implicitHeight)
hoverEnabled: true
+ property string iconImage: ""
+
DropShadow {
anchors.fill: control.background
horizontalOffset: 3
@@ -27,16 +30,30 @@ Button {
source: control.background
}
- contentItem: Text {
- text: control.text
- //font: control.font
- font.capitalization: Font.AllUppercase
- font.pointSize: Math.ceil(fontMetrics.font.pointSize * 1.5)
- //font.capitalization: Font.AllUppercase
- color: Nheko.colors.light
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- elide: Text.ElideRight
+ contentItem: RowLayout {
+ spacing: 0
+ anchors.centerIn: parent
+ Image {
+ Layout.leftMargin: Nheko.paddingMedium
+ Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
+ Layout.preferredHeight: fontMetrics.font.pixelSize * 1.5
+ Layout.preferredWidth: fontMetrics.font.pixelSize * 1.5
+ visible: !!iconImage
+ source: iconImage
+ }
+
+ Text {
+ Layout.alignment: Qt.AlignHCenter
+ text: control.text
+ //font: control.font
+ font.capitalization: Font.AllUppercase
+ font.pointSize: Math.ceil(fontMetrics.font.pointSize * 1.5)
+ //font.capitalization: Font.AllUppercase
+ color: Nheko.colors.light
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ }
}
background: Rectangle {
diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index f26bc5aa..f5756390 100644
--- a/resources/qml/delegates/Reply.qml
+++ b/resources/qml/delegates/Reply.qml
@@ -65,7 +65,7 @@ Item {
TapHandler {
acceptedButtons: Qt.LeftButton
onSingleTapped: {
- let link = reply.child.linkAt(eventPoint.position.x, eventPoint.position.y - userName_.implicitHeight);
+ let link = reply.child.linkAt != undefined && reply.child.linkAt(eventPoint.position.x, eventPoint.position.y - userName_.implicitHeight);
if (link) {
Nheko.openLink(link)
} else {
diff --git a/resources/qml/dialogs/InputDialog.qml b/resources/qml/dialogs/InputDialog.qml
index cf1474dc..a674c3fb 100644
--- a/resources/qml/dialogs/InputDialog.qml
+++ b/resources/qml/dialogs/InputDialog.qml
@@ -21,6 +21,10 @@ ApplicationWindow {
width: 350
height: fontMetrics.lineSpacing * 7
+ function forceActiveFocus() {
+ statusInput.forceActiveFocus();
+ }
+
Shortcut {
sequence: StandardKey.Cancel
onActivated: dbb.rejected()
diff --git a/resources/qml/dialogs/RoomSettings.qml b/resources/qml/dialogs/RoomSettings.qml
index 442010fd..44051610 100644
--- a/resources/qml/dialogs/RoomSettings.qml
+++ b/resources/qml/dialogs/RoomSettings.qml
@@ -17,8 +17,10 @@ ApplicationWindow {
property var roomSettings
- minimumWidth: 450
- minimumHeight: 680
+ minimumWidth: 340
+ minimumHeight: 450
+ width: 450
+ height: 680
palette: Nheko.colors
color: Nheko.colors.window
modality: Qt.NonModal
@@ -29,119 +31,134 @@ ApplicationWindow {
sequence: StandardKey.Cancel
onActivated: roomSettingsDialog.close()
}
-
- ColumnLayout {
- id: contentLayout1
-
+ ScrollHelper {
+ flickable: flickable
+ anchors.fill: flickable
+ }
+ Flickable {
+ id: flickable
+ boundsBehavior: Flickable.StopAtBounds
anchors.fill: parent
- anchors.margins: Nheko.paddingMedium
- spacing: Nheko.paddingMedium
+ clip: true
+ flickableDirection: Flickable.VerticalFlick
+ contentWidth: roomSettingsDialog.width
+ contentHeight: contentLayout1.height
+ ColumnLayout {
+ id: contentLayout1
+ width: parent.width
+ spacing: Nheko.paddingMedium
- Avatar {
- url: roomSettings.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
- roomid: roomSettings.roomId
- displayName: roomSettings.roomName
- height: 130
- width: 130
- Layout.alignment: Qt.AlignHCenter
- onClicked: {
- if (roomSettings.canChangeAvatar)
- roomSettings.updateAvatar();
+ Avatar {
+ Layout.topMargin: Nheko.paddingMedium
+ url: roomSettings.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
+ roomid: roomSettings.roomId
+ displayName: roomSettings.roomName
+ height: 130
+ width: 130
+ Layout.alignment: Qt.AlignHCenter
+ onClicked: {
+ if (roomSettings.canChangeAvatar)
+ roomSettings.updateAvatar();
+ }
}
- }
- Spinner {
- Layout.alignment: Qt.AlignHCenter
- visible: roomSettings.isLoading
- foreground: Nheko.colors.mid
- running: roomSettings.isLoading
- }
-
- Text {
- id: errorText
-
- color: "red"
- visible: opacity > 0
- opacity: 0
- Layout.alignment: Qt.AlignHCenter
- }
-
- SequentialAnimation {
- id: hideErrorAnimation
+ Spinner {
+ Layout.alignment: Qt.AlignHCenter
+ visible: roomSettings.isLoading
+ foreground: Nheko.colors.mid
+ running: roomSettings.isLoading
+ }
- running: false
+ Text {
+ id: errorText
- PauseAnimation {
- duration: 4000
+ color: "red"
+ visible: opacity > 0
+ opacity: 0
+ Layout.alignment: Qt.AlignHCenter
+ wrapMode: Text.Wrap // somehow still doesn't wrap
+ Layout.fillWidth: true
}
- NumberAnimation {
- target: errorText
- property: 'opacity'
- to: 0
- duration: 1000
- }
+ SequentialAnimation {
+ id: hideErrorAnimation
- }
+ running: false
- Connections {
- target: roomSettings
- function onDisplayError(errorMessage) {
- errorText.text = errorMessage;
- errorText.opacity = 1;
- hideErrorAnimation.restart();
- }
- }
+ PauseAnimation {
+ duration: 4000
+ }
- ColumnLayout {
- Layout.alignment: Qt.AlignHCenter
+ NumberAnimation {
+ target: errorText
+ property: 'opacity'
+ to: 0
+ duration: 1000
+ }
- MatrixText {
- text: roomSettings.roomName
- font.pixelSize: fontMetrics.font.pixelSize * 2
- Layout.fillWidth: true
- horizontalAlignment: TextEdit.AlignHCenter
}
- MatrixText {
- text: qsTr("%n member(s)", "", roomSettings.memberCount)
- Layout.alignment: Qt.AlignHCenter
-
- TapHandler {
- onSingleTapped: TimelineManager.openRoomMembers(Rooms.getRoomById(roomSettings.roomId))
+ Connections {
+ target: roomSettings
+ function onDisplayError(errorMessage) {
+ errorText.text = errorMessage;
+ errorText.opacity = 1;
+ hideErrorAnimation.restart();
}
-
- CursorShape {
- cursorShape: Qt.PointingHandCursor
- anchors.fill: parent
+ }
+ Label {
+ text: roomSettings.roomName
+ Layout.alignment: Qt.AlignHCenter
+ font.pixelSize: fontMetrics.font.pixelSize * 2
+ Layout.fillWidth: true
+ horizontalAlignment: TextEdit.AlignHCenter
+ color: Nheko.colors.text
+ wrapMode: Text.Wrap
+ textFormat: Text.RichText
}
- }
+ Label {
+ text: qsTr("%n member(s)", "", roomSettings.memberCount)
+ Layout.alignment: Qt.AlignHCenter
+ color: Nheko.colors.text
- }
+ TapHandler {
+ onSingleTapped: TimelineManager.openRoomMembers(Rooms.getRoomById(roomSettings.roomId))
+ }
- ImageButton {
- Layout.alignment: Qt.AlignHCenter
- image: ":/icons/icons/ui/edit.svg"
- visible: roomSettings.canChangeNameAndTopic
- onClicked: roomSettings.openEditModal()
- }
+ CursorShape {
+ cursorShape: Qt.PointingHandCursor
+ anchors.fill: parent
+ }
- ScrollView {
- Layout.fillHeight: true
- Layout.alignment: Qt.AlignHCenter
- Layout.fillWidth: true
- Layout.leftMargin: Nheko.paddingLarge
- Layout.rightMargin: Nheko.paddingLarge
+ }
+
+ ImageButton {
+ Layout.alignment: Qt.AlignHCenter
+ image: ":/icons/icons/ui/edit.svg"
+ visible: roomSettings.canChangeNameAndTopic
+ onClicked: roomSettings.openEditModal()
+ }
TextArea {
+ id: roomTopic
+ property bool cut: implicitHeight > 100
+ property bool showMore
+ clip: true
+ Layout.maximumHeight: showMore? Number.POSITIVE_INFINITY : 100
+ Layout.preferredHeight: implicitHeight
+ Layout.alignment: Qt.AlignHCenter
+ Layout.fillWidth: true
+ Layout.leftMargin: Nheko.paddingLarge
+ Layout.rightMargin: Nheko.paddingLarge
+
text: TimelineManager.escapeEmoji(roomSettings.roomTopic)
wrapMode: TextEdit.WordWrap
textFormat: TextEdit.RichText
readOnly: true
background: null
- selectByMouse: true
+ selectByMouse: !Settings.mobileMode
color: Nheko.colors.text
horizontalAlignment: TextEdit.AlignHCenter
onLinkActivated: Nheko.openLink(link)
@@ -152,171 +169,222 @@ ApplicationWindow {
}
}
-
- }
-
- GridLayout {
- columns: 2
- rowSpacing: Nheko.paddingMedium
-
- MatrixText {
- text: qsTr("SETTINGS")
- font.bold: true
- }
-
Item {
- Layout.fillWidth: true
+ Layout.alignment: Qt.AlignHCenter
+ id: showMorePlaceholder
+ Layout.preferredHeight: showMoreButton.height
+ Layout.preferredWidth: showMoreButton.width
+ visible: roomTopic.cut
}
- MatrixText {
- text: qsTr("Notifications")
+ GridLayout {
+ columns: 2
+ rowSpacing: Nheko.paddingMedium
+ Layout.margins: Nheko.paddingMedium
Layout.fillWidth: true
- }
- ComboBox {
- model: [qsTr("Muted"), qsTr("Mentions only"), qsTr("All messages")]
- currentIndex: roomSettings.notifications
- onActivated: {
- roomSettings.changeNotifications(index);
+ Label {
+ text: qsTr("SETTINGS")
+ font.bold: true
+ color: Nheko.colors.text
}
- Layout.fillWidth: true
- }
- MatrixText {
- text: qsTr("Room access")
- Layout.fillWidth: true
- }
+ Item {
+ Layout.fillWidth: true
+ }
- ComboBox {
- enabled: roomSettings.canChangeJoinRules
- model: {
- let opts = [qsTr("Anyone and guests"), qsTr("Anyone"), qsTr("Invited users")];
- if (roomSettings.supportsKnocking)
- opts.push(qsTr("By knocking"));
+ Label {
+ text: qsTr("Notifications")
+ Layout.fillWidth: true
+ color: Nheko.colors.text
+ }
- if (roomSettings.supportsRestricted)
- opts.push(qsTr("Restricted by membership in other rooms"));
+ ComboBox {
+ model: [qsTr("Muted"), qsTr("Mentions only"), qsTr("All messages")]
+ currentIndex: roomSettings.notifications
+ onActivated: {
+ roomSettings.changeNotifications(index);
+ }
+ Layout.fillWidth: true
+ WheelHandler{} // suppress scrolling changing values
+ }
- return opts;
+ Label {
+ text: qsTr("Room access")
+ Layout.fillWidth: true
+ color: Nheko.colors.text
}
- currentIndex: roomSettings.accessJoinRules
- onActivated: {
- roomSettings.changeAccessRules(index);
+
+ ComboBox {
+ enabled: roomSettings.canChangeJoinRules
+ model: {
+ let opts = [qsTr("Anyone and guests"), qsTr("Anyone"), qsTr("Invited users")];
+ if (roomSettings.supportsKnocking)
+ opts.push(qsTr("By knocking"));
+
+ if (roomSettings.supportsRestricted)
+ opts.push(qsTr("Restricted by membership in other rooms"));
+
+ return opts;
+ }
+ currentIndex: roomSettings.accessJoinRules
+ onActivated: {
+ roomSettings.changeAccessRules(index);
+ }
+ Layout.fillWidth: true
+ WheelHandler{} // suppress scrolling changing values
}
- Layout.fillWidth: true
- }
- MatrixText {
- text: qsTr("Encryption")
- }
+ Label {
+ text: qsTr("Encryption")
+ color: Nheko.colors.text
+ }
- ToggleButton {
- id: encryptionToggle
+ ToggleButton {
+ id: encryptionToggle
- checked: roomSettings.isEncryptionEnabled
- onCheckedChanged: {
- if (roomSettings.isEncryptionEnabled) {
- checked = true;
- return ;
+ checked: roomSettings.isEncryptionEnabled
+ onCheckedChanged: {
+ if (roomSettings.isEncryptionEnabled) {
+ checked = true;
+ return ;
+ }
+ confirmEncryptionDialog.open();
}
- confirmEncryptionDialog.open();
+ Layout.alignment: Qt.AlignRight
}
- Layout.alignment: Qt.AlignRight
- }
- Platform.MessageDialog {
- id: confirmEncryptionDialog
+ Platform.MessageDialog {
+ id: confirmEncryptionDialog
- title: qsTr("End-to-End Encryption")
- text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br>
- Please take note that it can't be disabled afterwards.")
- modality: Qt.NonModal
- onAccepted: {
- if (roomSettings.isEncryptionEnabled)
- return ;
+ title: qsTr("End-to-End Encryption")
+ text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br>
+ Please take note that it can't be disabled afterwards.")
+ modality: Qt.NonModal
+ onAccepted: {
+ if (roomSettings.isEncryptionEnabled)
+ return ;
- roomSettings.enableEncryption();
+ roomSettings.enableEncryption();
+ }
+ onRejected: {
+ encryptionToggle.checked = false;
+ }
+ buttons: Platform.MessageDialog.Ok | Platform.MessageDialog.Cancel
}
- onRejected: {
- encryptionToggle.checked = false;
+
+ Label {
+ text: qsTr("Sticker & Emote Settings")
+ color: Nheko.colors.text
}
- buttons: Platform.MessageDialog.Ok | Platform.MessageDialog.Cancel
- }
- MatrixText {
- text: qsTr("Sticker & Emote Settings")
- }
+ Button {
+ text: qsTr("Change")
+ ToolTip.text: qsTr("Change what packs are enabled, remove packs or create new ones")
+ onClicked: TimelineManager.openImagePackSettings(roomSettings.roomId)
+ Layout.alignment: Qt.AlignRight
+ }
- Button {
- text: qsTr("Change")
- ToolTip.text: qsTr("Change what packs are enabled, remove packs or create new ones")
- onClicked: TimelineManager.openImagePackSettings(roomSettings.roomId)
- Layout.alignment: Qt.AlignRight
- }
+ Label {
+ text: qsTr("Hidden events")
+ color: Nheko.colors.text
+ }
- MatrixText {
- text: qsTr("Hidden events")
- }
+ HiddenEventsDialog {
+ id: hiddenEventsDialog
+ roomid: roomSettings.roomId
+ roomName: roomSettings.roomName
+ }
- HiddenEventsDialog {
- id: hiddenEventsDialog
- roomid: roomSettings.roomId
- roomName: roomSettings.roomName
- }
+ Button {
+ text: qsTr("Configure")
+ ToolTip.text: qsTr("Select events to hide in this room")
+ onClicked: hiddenEventsDialog.show()
+ Layout.alignment: Qt.AlignRight
+ }
- Button {
- text: qsTr("Configure")
- ToolTip.text: qsTr("Select events to hide in this room")
- onClicked: hiddenEventsDialog.show()
- Layout.alignment: Qt.AlignRight
- }
+ Item {
+ // for adding extra space between sections
+ Layout.fillWidth: true
+ }
- Item {
- // for adding extra space between sections
- Layout.fillWidth: true
- }
+ Item {
+ // for adding extra space between sections
+ Layout.fillWidth: true
+ }
- Item {
- // for adding extra space between sections
- Layout.fillWidth: true
- }
+ Label {
+ text: qsTr("INFO")
+ font.bold: true
+ color: Nheko.colors.text
+ }
- MatrixText {
- text: qsTr("INFO")
- font.bold: true
- }
+ Item {
+ Layout.fillWidth: true
+ }
- Item {
- Layout.fillWidth: true
- }
+ Label {
+ text: qsTr("Internal ID")
+ color: Nheko.colors.text
+ }
- MatrixText {
- text: qsTr("Internal ID")
- }
+ AbstractButton { // AbstractButton does not allow setting text color
+ Layout.alignment: Qt.AlignRight
+ Layout.fillWidth: true
+ Layout.preferredHeight: idLabel.height
+ Label { // TextEdit does not trigger onClicked
+ id: idLabel
+ text: roomSettings.roomId
+ font.pixelSize: Math.floor(fontMetrics.font.pixelSize * 0.8)
+ color: Nheko.colors.text
+ width: parent.width
+ horizontalAlignment: Text.AlignRight
+ wrapMode: Text.WrapAnywhere
+ ToolTip.text: qsTr("Copied to clipboard")
+ ToolTip.visible: toolTipTimer.running
+ }
+ TextEdit{ // label does not allow selection
+ id: textEdit
+ visible: false
+ text: roomSettings.roomId
+ }
+ onClicked: {
+ textEdit.selectAll()
+ textEdit.copy()
+ toolTipTimer.start()
+ }
+ Timer {
+ id: toolTipTimer
+ }
+ }
- MatrixText {
- text: roomSettings.roomId
- font.pixelSize: Math.floor(fontMetrics.font.pixelSize * 0.8)
- Layout.alignment: Qt.AlignRight
- }
+ Label {
+ text: qsTr("Room Version")
+ color: Nheko.colors.text
+ }
- MatrixText {
- text: qsTr("Room Version")
- }
+ Label {
+ text: roomSettings.roomVersion
+ font.pixelSize: fontMetrics.font.pixelSize
+ Layout.alignment: Qt.AlignRight
+ color: Nheko.colors.text
+ }
- MatrixText {
- text: roomSettings.roomVersion
- font.pixelSize: fontMetrics.font.pixelSize
- Layout.alignment: Qt.AlignRight
}
-
}
-
- DialogButtonBox {
- Layout.fillWidth: true
- standardButtons: DialogButtonBox.Ok
- onAccepted: close()
+ }
+ Button {
+ id: showMoreButton
+ anchors.horizontalCenter: flickable.horizontalCenter
+ y: Math.min(showMorePlaceholder.y+contentLayout1.y-flickable.contentY,flickable.height-height)
+ visible: roomTopic.cut
+ text: roomTopic.showMore? "show less" : "show more"
+ onClicked: {roomTopic.showMore = !roomTopic.showMore
+ console.log(flickable.visibleArea)
}
-
+ }
+ footer: DialogButtonBox {
+ standardButtons: DialogButtonBox.Ok
+ onAccepted: close()
}
}
diff --git a/resources/qml/pages/LoginPage.qml b/resources/qml/pages/LoginPage.qml
index 4d3a52b3..87234a22 100644
--- a/resources/qml/pages/LoginPage.qml
+++ b/resources/qml/pages/LoginPage.qml
@@ -61,7 +61,7 @@ Item {
onEditingFinished: login.mxid = text
ToolTip.text: qsTr("Your login name. A mxid should start with @ followed by the user id. After the user id you need to include your server name after a :.\nYou can also put your homeserver address there, if your server doesn't support .well-known lookup.\nExample: @user:server.my\nIf Nheko fails to discover your homeserver, it will show you a field to enter the server manually.")
- Keys.forwardTo: [pwBtn, ssoBtn]
+ Keys.forwardTo: [pwBtn, ssoRepeater]
}
@@ -89,7 +89,7 @@ Item {
echoMode: TextInput.Password
ToolTip.text: qsTr("Your password.")
visible: login.passwordSupported
- Keys.forwardTo: [pwBtn, ssoBtn]
+ Keys.forwardTo: [pwBtn, ssoRepeater]
}
MatrixTextField {
@@ -98,7 +98,7 @@ Item {
label: qsTr("Device name")
placeholderText: login.initialDeviceName()
ToolTip.text: qsTr("A name for this device, which will be shown to others, when verifying your devices. If none is provided a default is used.")
- Keys.forwardTo: [pwBtn, ssoBtn]
+ Keys.forwardTo: [pwBtn, ssoRepeater]
}
MatrixTextField {
@@ -112,7 +112,7 @@ Item {
text: login.homeserver
onEditingFinished: login.homeserver = text
ToolTip.text: qsTr("The address that can be used to contact you homeservers client API.\nExample: https://server.my:8787")
- Keys.forwardTo: [pwBtn, ssoBtn]
+ Keys.forwardTo: [pwBtn, ssoRepeater]
}
Item {
@@ -150,21 +150,28 @@ Item {
Keys.onReturnPressed: pwBtn.pwLogin()
Keys.enabled: pwBtn.enabled && login.passwordSupported
}
- FlatButton {
- id: ssoBtn
- visible: login.ssoSupported
- enabled: login.homeserverValid && matrixIdLabel.text == login.mxid && login.homeserver == hsLabel.text
- Layout.alignment: Qt.AlignHCenter
- text: qsTr("SSO LOGIN")
- function ssoLogin() {
- login.onLoginButtonClicked(Login.SSO, matrixIdLabel.text, passwordLabel.text, deviceNameLabel.text)
+
+ Repeater {
+ id: ssoRepeater
+
+ model: login.identityProviders
+
+ delegate: FlatButton {
+ id: ssoBtn
+ visible: login.ssoSupported
+ enabled: login.homeserverValid && matrixIdLabel.text == login.mxid && login.homeserver == hsLabel.text
+ Layout.alignment: Qt.AlignHCenter
+ text: modelData.name
+ iconImage: modelData.avatarUrl.replace("mxc://", "image://MxcImage/")
+ function ssoLogin() {
+ login.onLoginButtonClicked(Login.SSO, matrixIdLabel.text, modelData.id, deviceNameLabel.text)
+ }
+ onClicked: ssoBtn.ssoLogin()
+ Keys.onEnterPressed: ssoBtn.ssoLogin()
+ Keys.onReturnPressed: ssoBtn.ssoLogin()
+ Keys.enabled: ssoBtn.enabled && !login.passwordSupported
}
- onClicked: ssoBtn.ssoLogin()
- Keys.onEnterPressed: ssoBtn.ssoLogin()
- Keys.onReturnPressed: ssoBtn.ssoLogin()
- Keys.enabled: ssoBtn.enabled && !login.passwordSupported
}
-
}
}
|