diff --git a/src/python/models/items.py b/src/python/models/items.py index 70144b0a..92e50f50 100644 --- a/src/python/models/items.py +++ b/src/python/models/items.py @@ -130,7 +130,7 @@ class Upload(ModelItem): def __lt__(self, other: "Upload") -> bool: - # TODO + # Sort from newest upload to oldest. return self.start_date > other.start_date diff --git a/src/qml/Chat/ChatSplitView.qml b/src/qml/Chat/ChatSplitView.qml index be73537e..4b08feba 100644 --- a/src/qml/Chat/ChatSplitView.qml +++ b/src/qml/Chat/ChatSplitView.qml @@ -27,6 +27,11 @@ HSplitView { UploadsBar { Layout.fillWidth: true + Layout.minimumHeight: implicitHeight + Layout.preferredHeight: implicitHeight * uploadsCount + Layout.maximumHeight: chatSplitView.height / 6 + + Behavior on Layout.preferredHeight { HNumberAnimation {} } } InviteBanner { diff --git a/src/qml/Chat/Composer.qml b/src/qml/Chat/Composer.qml index f2f06d84..9c644c3b 100644 --- a/src/qml/Chat/Composer.qml +++ b/src/qml/Chat/Composer.qml @@ -215,8 +215,7 @@ Rectangle { HFileDialogOpener { dialog.title: qsTr("Select files to upload") - onFileChanged: { - if (! file) return + onFilePicked: { let path = Qt.resolvedUrl(file).replace(/^file:/, "") let args = [chatPage.roomId, path] py.callClientCoro(chatPage.userId, "send_file", args) diff --git a/src/qml/Chat/UploadsBar.qml b/src/qml/Chat/UploadsBar.qml index 4fb2f546..a94640b8 100644 --- a/src/qml/Chat/UploadsBar.qml +++ b/src/qml/Chat/UploadsBar.qml @@ -9,21 +9,22 @@ Rectangle { implicitHeight: firstDelegate ? firstDelegate.height : 0 color: theme.chat.typingMembers.background opacity: implicitHeight ? 1 : 0 + clip: true property int delegateHeight: 0 - property int maxShownDelegates: 1 readonly property var firstDelegate: uploadsList.contentItem.visibleChildren[0] + readonly property alias uploadsCount: uploadsList.count + Behavior on implicitHeight { HNumberAnimation {} } HListView { id: uploadsList - enableFlicking: false - width: parent.width + anchors.fill: parent model: HListModel { keyField: "uuid" @@ -33,7 +34,6 @@ Rectangle { delegate: HColumnLayout { id: delegate width: uploadsList.width - Component.onCompleted: Utils.debug(delegate) HRowLayout { HLabel { diff --git a/src/qml/Dialogs/ExportKeys.qml b/src/qml/Dialogs/ExportKeys.qml index 2c489a01..0ea34e42 100644 --- a/src/qml/Dialogs/ExportKeys.qml +++ b/src/qml/Dialogs/ExportKeys.qml @@ -6,7 +6,7 @@ HFileDialogOpener { fill: false dialog.title: qsTr("Save decryption keys file as...") dialog.fileMode: FileDialog.SaveFile - onFileChanged: { + onFilePicked: { exportPasswordPopup.file = file exportPasswordPopup.open() } diff --git a/src/qml/Dialogs/HFileDialogOpener.qml b/src/qml/Dialogs/HFileDialogOpener.qml index 4cb0b9eb..16161b6b 100644 --- a/src/qml/Dialogs/HFileDialogOpener.qml +++ b/src/qml/Dialogs/HFileDialogOpener.qml @@ -5,6 +5,10 @@ Item { id: opener anchors.fill: fill ? parent : undefined + + signal filePicked() + + property bool fill: true property alias dialog: fileDialog @@ -17,6 +21,7 @@ Item { enum FileType { All, Images } property int fileType: HFileDialogOpener.FileType.All + TapHandler { enabled: fill; onTapped: fileDialog.open() } FileDialog { @@ -56,7 +61,11 @@ Item { opener.selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile)) opener.file = Qt.binding(() => Qt.resolvedUrl(file)) } - onAccepted: { opener.selectedFile = currentFile, opener.file = file } + onAccepted: { + opener.selectedFile = currentFile + opener.file = file + opener.filePicked(file) + } onRejected: { selectedFile = ""; file = ""} } } diff --git a/src/qml/Dialogs/ImportKeys.qml b/src/qml/Dialogs/ImportKeys.qml index fe103b81..04553402 100644 --- a/src/qml/Dialogs/ImportKeys.qml +++ b/src/qml/Dialogs/ImportKeys.qml @@ -5,7 +5,7 @@ import "../Popups" HFileDialogOpener { fill: false dialog.title: qsTr("Select a decryption keys file to import") - onFileChanged: { + onFilePicked: { importPasswordPopup.file = file importPasswordPopup.open() }