Fix picking same file twice not working
This commit is contained in:
parent
487446046f
commit
de41e859be
|
@ -130,7 +130,7 @@ class Upload(ModelItem):
|
||||||
|
|
||||||
|
|
||||||
def __lt__(self, other: "Upload") -> bool:
|
def __lt__(self, other: "Upload") -> bool:
|
||||||
# TODO
|
# Sort from newest upload to oldest.
|
||||||
return self.start_date > other.start_date
|
return self.start_date > other.start_date
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,11 @@ HSplitView {
|
||||||
|
|
||||||
UploadsBar {
|
UploadsBar {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.minimumHeight: implicitHeight
|
||||||
|
Layout.preferredHeight: implicitHeight * uploadsCount
|
||||||
|
Layout.maximumHeight: chatSplitView.height / 6
|
||||||
|
|
||||||
|
Behavior on Layout.preferredHeight { HNumberAnimation {} }
|
||||||
}
|
}
|
||||||
|
|
||||||
InviteBanner {
|
InviteBanner {
|
||||||
|
|
|
@ -215,8 +215,7 @@ Rectangle {
|
||||||
|
|
||||||
HFileDialogOpener {
|
HFileDialogOpener {
|
||||||
dialog.title: qsTr("Select files to upload")
|
dialog.title: qsTr("Select files to upload")
|
||||||
onFileChanged: {
|
onFilePicked: {
|
||||||
if (! file) return
|
|
||||||
let path = Qt.resolvedUrl(file).replace(/^file:/, "")
|
let path = Qt.resolvedUrl(file).replace(/^file:/, "")
|
||||||
let args = [chatPage.roomId, path]
|
let args = [chatPage.roomId, path]
|
||||||
py.callClientCoro(chatPage.userId, "send_file", args)
|
py.callClientCoro(chatPage.userId, "send_file", args)
|
||||||
|
|
|
@ -9,21 +9,22 @@ Rectangle {
|
||||||
implicitHeight: firstDelegate ? firstDelegate.height : 0
|
implicitHeight: firstDelegate ? firstDelegate.height : 0
|
||||||
color: theme.chat.typingMembers.background
|
color: theme.chat.typingMembers.background
|
||||||
opacity: implicitHeight ? 1 : 0
|
opacity: implicitHeight ? 1 : 0
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
|
||||||
property int delegateHeight: 0
|
property int delegateHeight: 0
|
||||||
property int maxShownDelegates: 1
|
|
||||||
|
|
||||||
readonly property var firstDelegate:
|
readonly property var firstDelegate:
|
||||||
uploadsList.contentItem.visibleChildren[0]
|
uploadsList.contentItem.visibleChildren[0]
|
||||||
|
|
||||||
|
readonly property alias uploadsCount: uploadsList.count
|
||||||
|
|
||||||
|
|
||||||
Behavior on implicitHeight { HNumberAnimation {} }
|
Behavior on implicitHeight { HNumberAnimation {} }
|
||||||
|
|
||||||
HListView {
|
HListView {
|
||||||
id: uploadsList
|
id: uploadsList
|
||||||
enableFlicking: false
|
anchors.fill: parent
|
||||||
width: parent.width
|
|
||||||
|
|
||||||
model: HListModel {
|
model: HListModel {
|
||||||
keyField: "uuid"
|
keyField: "uuid"
|
||||||
|
@ -33,7 +34,6 @@ Rectangle {
|
||||||
delegate: HColumnLayout {
|
delegate: HColumnLayout {
|
||||||
id: delegate
|
id: delegate
|
||||||
width: uploadsList.width
|
width: uploadsList.width
|
||||||
Component.onCompleted: Utils.debug(delegate)
|
|
||||||
|
|
||||||
HRowLayout {
|
HRowLayout {
|
||||||
HLabel {
|
HLabel {
|
||||||
|
|
|
@ -6,7 +6,7 @@ HFileDialogOpener {
|
||||||
fill: false
|
fill: false
|
||||||
dialog.title: qsTr("Save decryption keys file as...")
|
dialog.title: qsTr("Save decryption keys file as...")
|
||||||
dialog.fileMode: FileDialog.SaveFile
|
dialog.fileMode: FileDialog.SaveFile
|
||||||
onFileChanged: {
|
onFilePicked: {
|
||||||
exportPasswordPopup.file = file
|
exportPasswordPopup.file = file
|
||||||
exportPasswordPopup.open()
|
exportPasswordPopup.open()
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,10 @@ Item {
|
||||||
id: opener
|
id: opener
|
||||||
anchors.fill: fill ? parent : undefined
|
anchors.fill: fill ? parent : undefined
|
||||||
|
|
||||||
|
|
||||||
|
signal filePicked()
|
||||||
|
|
||||||
|
|
||||||
property bool fill: true
|
property bool fill: true
|
||||||
|
|
||||||
property alias dialog: fileDialog
|
property alias dialog: fileDialog
|
||||||
|
@ -17,6 +21,7 @@ Item {
|
||||||
enum FileType { All, Images }
|
enum FileType { All, Images }
|
||||||
property int fileType: HFileDialogOpener.FileType.All
|
property int fileType: HFileDialogOpener.FileType.All
|
||||||
|
|
||||||
|
|
||||||
TapHandler { enabled: fill; onTapped: fileDialog.open() }
|
TapHandler { enabled: fill; onTapped: fileDialog.open() }
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
|
@ -56,7 +61,11 @@ Item {
|
||||||
opener.selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile))
|
opener.selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile))
|
||||||
opener.file = Qt.binding(() => Qt.resolvedUrl(file))
|
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 = ""}
|
onRejected: { selectedFile = ""; file = ""}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import "../Popups"
|
||||||
HFileDialogOpener {
|
HFileDialogOpener {
|
||||||
fill: false
|
fill: false
|
||||||
dialog.title: qsTr("Select a decryption keys file to import")
|
dialog.title: qsTr("Select a decryption keys file to import")
|
||||||
onFileChanged: {
|
onFilePicked: {
|
||||||
importPasswordPopup.file = file
|
importPasswordPopup.file = file
|
||||||
importPasswordPopup.open()
|
importPasswordPopup.open()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user