mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Use ItemDelegate in RoomList instead of a Rectangle with handlers
fixes #683 relates to #571
This commit is contained in:
parent
1a163f49e2
commit
1e22274d8c
9 changed files with 1895 additions and 498 deletions
|
@ -114,10 +114,10 @@ Page {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: ItemDelegate {
|
||||||
id: roomItem
|
id: roomItem
|
||||||
|
|
||||||
property color background: Nheko.colors.window
|
property color backgroundColor: Nheko.colors.window
|
||||||
property color importantText: Nheko.colors.text
|
property color importantText: Nheko.colors.text
|
||||||
property color unimportantText: Nheko.colors.buttonText
|
property color unimportantText: Nheko.colors.buttonText
|
||||||
property color bubbleBackground: Nheko.colors.highlight
|
property color bubbleBackground: Nheko.colors.highlight
|
||||||
|
@ -136,20 +136,31 @@ Page {
|
||||||
required property bool isDirect
|
required property bool isDirect
|
||||||
required property string directChatOtherUserId
|
required property string directChatOtherUserId
|
||||||
|
|
||||||
color: background
|
|
||||||
height: avatarSize + 2 * Nheko.paddingMedium
|
height: avatarSize + 2 * Nheko.paddingMedium
|
||||||
width: ListView.view.width
|
width: ListView.view.width
|
||||||
state: "normal"
|
state: "normal"
|
||||||
ToolTip.visible: hovered.hovered && collapsed
|
ToolTip.visible: hovered && collapsed
|
||||||
ToolTip.text: roomName
|
ToolTip.text: roomName
|
||||||
|
onClicked: {
|
||||||
|
console.log("tapped " + roomId);
|
||||||
|
if (!Rooms.currentRoom || Rooms.currentRoom.roomId !== roomId)
|
||||||
|
Rooms.setCurrentRoom(roomId);
|
||||||
|
else
|
||||||
|
Rooms.resetCurrentRoom();
|
||||||
|
}
|
||||||
|
onPressAndHold: {
|
||||||
|
if (!isInvite)
|
||||||
|
roomContextMenu.show(roomId, tags);
|
||||||
|
|
||||||
|
}
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "highlight"
|
name: "highlight"
|
||||||
when: hovered.hovered && !((Rooms.currentRoom && roomId == Rooms.currentRoom.roomId) || Rooms.currentRoomPreview.roomid == roomId)
|
when: roomItem.hovered && !((Rooms.currentRoom && roomId == Rooms.currentRoom.roomId) || Rooms.currentRoomPreview.roomid == roomId)
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: roomItem
|
target: roomItem
|
||||||
background: Nheko.colors.dark
|
backgroundColor: Nheko.colors.dark
|
||||||
importantText: Nheko.colors.brightText
|
importantText: Nheko.colors.brightText
|
||||||
unimportantText: Nheko.colors.brightText
|
unimportantText: Nheko.colors.brightText
|
||||||
bubbleBackground: Nheko.colors.highlight
|
bubbleBackground: Nheko.colors.highlight
|
||||||
|
@ -163,7 +174,7 @@ Page {
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: roomItem
|
target: roomItem
|
||||||
background: Nheko.colors.highlight
|
backgroundColor: Nheko.colors.highlight
|
||||||
importantText: Nheko.colors.highlightedText
|
importantText: Nheko.colors.highlightedText
|
||||||
unimportantText: Nheko.colors.highlightedText
|
unimportantText: Nheko.colors.highlightedText
|
||||||
bubbleBackground: Nheko.colors.highlightedText
|
bubbleBackground: Nheko.colors.highlightedText
|
||||||
|
@ -189,28 +200,6 @@ Page {
|
||||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
|
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
|
||||||
}
|
}
|
||||||
|
|
||||||
TapHandler {
|
|
||||||
margin: -Nheko.paddingSmall
|
|
||||||
onSingleTapped: {
|
|
||||||
console.log("tapped "+roomId);
|
|
||||||
if (!Rooms.currentRoom || Rooms.currentRoom.roomId !== roomId)
|
|
||||||
Rooms.setCurrentRoom(roomId);
|
|
||||||
else
|
|
||||||
Rooms.resetCurrentRoom();
|
|
||||||
}
|
|
||||||
onLongPressed: {
|
|
||||||
if (!isInvite)
|
|
||||||
roomContextMenu.show(roomId, tags);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HoverHandler {
|
|
||||||
id: hovered
|
|
||||||
|
|
||||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
@ -362,6 +351,10 @@ Page {
|
||||||
visible: hasUnreadMessages
|
visible: hasUnreadMessages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
color: backgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -505,24 +498,28 @@ Page {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: unverifiedStuffBubble
|
id: unverifiedStuffBubble
|
||||||
color: Qt.lighter(Nheko.theme.orange, verifyButtonHovered.hovered ? 1.2 : 1.0)
|
|
||||||
|
color: Qt.lighter(Nheko.theme.orange, verifyButtonHovered.hovered ? 1.2 : 1)
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: explanation.height + Nheko.paddingMedium * 2
|
implicitHeight: explanation.height + Nheko.paddingMedium * 2
|
||||||
visible: SelfVerificationStatus.status != SelfVerificationStatus.AllVerified
|
visible: SelfVerificationStatus.status != SelfVerificationStatus.AllVerified
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: unverifiedStuffBubbleContainer
|
id: unverifiedStuffBubbleContainer
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: explanation.height + Nheko.paddingMedium * 2
|
height: explanation.height + Nheko.paddingMedium * 2
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: explanation
|
id: explanation
|
||||||
|
|
||||||
Layout.margins: Nheko.paddingMedium
|
Layout.margins: Nheko.paddingMedium
|
||||||
Layout.rightMargin: Nheko.paddingSmall
|
Layout.rightMargin: Nheko.paddingSmall
|
||||||
color: Nheko.colors.buttonText
|
color: Nheko.colors.buttonText
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: switch(SelfVerificationStatus.status) {
|
text: {
|
||||||
|
switch (SelfVerificationStatus.status) {
|
||||||
case SelfVerificationStatus.NoMasterKey:
|
case SelfVerificationStatus.NoMasterKey:
|
||||||
//: Cross-signing setup has not run yet.
|
//: Cross-signing setup has not run yet.
|
||||||
return qsTr("Encryption not set up");
|
return qsTr("Encryption not set up");
|
||||||
|
@ -533,7 +530,8 @@ Page {
|
||||||
//: There are unverified devices signed in to this account.
|
//: There are unverified devices signed in to this account.
|
||||||
return qsTr("Please verify your other devices");
|
return qsTr("Please verify your other devices");
|
||||||
default:
|
default:
|
||||||
return ""
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
|
@ -558,8 +556,8 @@ Page {
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
id: verifyButtonHovered
|
id: verifyButtonHovered
|
||||||
enabled: !closeUnverifiedBubble.hovered
|
|
||||||
|
|
||||||
|
enabled: !closeUnverifiedBubble.hovered
|
||||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
|
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,13 +565,13 @@ Page {
|
||||||
enabled: !closeUnverifiedBubble.hovered
|
enabled: !closeUnverifiedBubble.hovered
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
onSingleTapped: {
|
onSingleTapped: {
|
||||||
if (SelfVerificationStatus.status == SelfVerificationStatus.UnverifiedDevices) {
|
if (SelfVerificationStatus.status == SelfVerificationStatus.UnverifiedDevices)
|
||||||
SelfVerificationStatus.verifyUnverifiedDevices();
|
SelfVerificationStatus.verifyUnverifiedDevices();
|
||||||
} else {
|
else
|
||||||
SelfVerificationStatus.statusChanged();
|
SelfVerificationStatus.statusChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -116,6 +116,7 @@ Page {
|
||||||
|
|
||||||
LogoutDialog {
|
LogoutDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
@ -123,6 +124,7 @@ Page {
|
||||||
|
|
||||||
JoinRoomDialog {
|
JoinRoomDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
@ -130,6 +132,7 @@ Page {
|
||||||
|
|
||||||
LeaveRoomDialog {
|
LeaveRoomDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
|
@ -296,28 +299,31 @@ Page {
|
||||||
|
|
||||||
buttons: Platform.MessageDialog.Ok
|
buttons: Platform.MessageDialog.Ok
|
||||||
text: qsTr("Wait for the confirmation link to arrive, then continue.")
|
text: qsTr("Wait for the confirmation link to arrive, then continue.")
|
||||||
|
|
||||||
onAccepted: UIA.continue3pidReceived()
|
onAccepted: UIA.continue3pidReceived()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onPassword() {
|
function onPassword() {
|
||||||
console.log("UIA: password needed");
|
console.log("UIA: password needed");
|
||||||
uiaPassPrompt.show();
|
uiaPassPrompt.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEmail() {
|
function onEmail() {
|
||||||
uiaEmailPrompt.show();
|
uiaEmailPrompt.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPhoneNumber() {
|
function onPhoneNumber() {
|
||||||
uiaPhoneNumberPrompt.show();
|
uiaPhoneNumberPrompt.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPrompt3pidToken() {
|
function onPrompt3pidToken() {
|
||||||
uiaTokenPrompt.show();
|
uiaTokenPrompt.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onConfirm3pidToken() {
|
function onConfirm3pidToken() {
|
||||||
uiaConfirmationLinkDialog.open();
|
uiaConfirmationLinkDialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onError(msg) {
|
function onError(msg) {
|
||||||
uiaErrorDialog.text = msg;
|
uiaErrorDialog.text = msg;
|
||||||
uiaErrorDialog.open();
|
uiaErrorDialog.open();
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import "./components/"
|
||||||
import Qt.labs.platform 1.1 as P
|
import Qt.labs.platform 1.1 as P
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
import "./components/"
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
visible: false
|
visible: false
|
||||||
|
@ -208,7 +208,6 @@ Item {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
border.color: Nheko.theme.separator
|
border.color: Nheko.theme.separator
|
||||||
|
@ -258,30 +257,32 @@ Item {
|
||||||
verifyMasterKey.close();
|
verifyMasterKey.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatButton {
|
FlatButton {
|
||||||
visible: SelfVerificationStatus.hasSSSS
|
visible: SelfVerificationStatus.hasSSSS
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text: qsTr("enter passphrase")
|
text: qsTr("enter passphrase")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
SelfVerificationStatus.verifyMasterKeyWithPassphrase()
|
SelfVerificationStatus.verifyMasterKeyWithPassphrase();
|
||||||
verifyMasterKey.close();
|
verifyMasterKey.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onStatusChanged() {
|
function onStatusChanged() {
|
||||||
console.log("STATUS CHANGED: " + SelfVerificationStatus.status);
|
console.log("STATUS CHANGED: " + SelfVerificationStatus.status);
|
||||||
if (SelfVerificationStatus.status == SelfVerificationStatus.NoMasterKey)
|
if (SelfVerificationStatus.status == SelfVerificationStatus.NoMasterKey) {
|
||||||
bootstrapCrosssigning.open();
|
bootstrapCrosssigning.open();
|
||||||
else if (SelfVerificationStatus.status == SelfVerificationStatus.UnverifiedMasterKey)
|
} else if (SelfVerificationStatus.status == SelfVerificationStatus.UnverifiedMasterKey) {
|
||||||
verifyMasterKey.open();
|
verifyMasterKey.open();
|
||||||
else {
|
} else {
|
||||||
bootstrapCrosssigning.close();
|
bootstrapCrosssigning.close();
|
||||||
verifyMasterKey.close();
|
verifyMasterKey.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onShowRecoveryKey(key) {
|
function onShowRecoveryKey(key) {
|
||||||
|
|
|
@ -9,6 +9,9 @@ import QtQuick.Layouts 1.3
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
|
default property alias inner: scroll.data
|
||||||
|
property int useableWidth: scroll.width - scroll.ScrollBar.vertical.width
|
||||||
|
|
||||||
parent: Overlay.overlay
|
parent: Overlay.overlay
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
height: (Math.floor(parent.height / 2) - Nheko.paddingLarge) * 2
|
height: (Math.floor(parent.height / 2) - Nheko.paddingLarge) * 2
|
||||||
|
@ -17,10 +20,6 @@ Dialog {
|
||||||
modal: true
|
modal: true
|
||||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||||
closePolicy: Popup.NoAutoClose
|
closePolicy: Popup.NoAutoClose
|
||||||
|
|
||||||
default property alias inner: scroll.data
|
|
||||||
property int useableWidth: scroll.width - scroll.ScrollBar.vertical.width
|
|
||||||
|
|
||||||
contentChildren: [
|
contentChildren: [
|
||||||
ScrollView {
|
ScrollView {
|
||||||
id: scroll
|
id: scroll
|
||||||
|
|
|
@ -45,6 +45,7 @@ ApplicationWindow {
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if (input.text.match("#.+?:.{3,}"))
|
if (input.text.match("#.+?:.{3,}"))
|
||||||
dbb.accepted();
|
dbb.accepted();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +72,7 @@ ApplicationWindow {
|
||||||
text: "Cancel"
|
text: "Cancel"
|
||||||
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
|
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import Qt.labs.platform 1.1
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import Qt.labs.platform 1.1
|
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import Qt.labs.platform 1.1
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import Qt.labs.platform 1.1
|
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -327,14 +327,17 @@ ApplicationWindow {
|
||||||
onClicked: profile.signOutDevice(deviceId)
|
onClicked: profile.signOutDevice(deviceId)
|
||||||
visible: profile.isSelf
|
visible: profile.isSelf
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: deviceNameRow
|
id: deviceNameRow
|
||||||
|
|
||||||
property bool isEditingAllowed
|
property bool isEditingAllowed
|
||||||
|
|
||||||
TextInput {
|
TextInput {
|
||||||
id: deviceNameField
|
id: deviceNameField
|
||||||
|
|
||||||
readOnly: !deviceNameRow.isEditingAllowed
|
readOnly: !deviceNameRow.isEditingAllowed
|
||||||
text: deviceName
|
text: deviceName
|
||||||
color: Nheko.colors.text
|
color: Nheko.colors.text
|
||||||
|
@ -373,7 +376,7 @@ ApplicationWindow {
|
||||||
Layout.alignment: Qt.AlignLeft
|
Layout.alignment: Qt.AlignLeft
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
color: Nheko.colors.text
|
color: Nheko.colors.text
|
||||||
text: qsTr("Last seen %1 from %2").arg(new Date(lastTs).toLocaleString(Locale.ShortFormat)).arg(lastIp?lastIp:"???")
|
text: qsTr("Last seen %1 from %2").arg(new Date(lastTs).toLocaleString(Locale.ShortFormat)).arg(lastIp ? lastIp : "???")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -409,8 +412,6 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: DialogButtonBox {
|
footer: DialogButtonBox {
|
||||||
|
|
Loading…
Reference in a new issue