diff --git a/TODO.md b/TODO.md
index 6535b6b6..d1f41422 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,5 +1,6 @@
# TODO
+- power control focus
- idlemanager: what if setPresence call fails due to network?
- block power level change when offline
- fix power level control button layout when apply button is loading
@@ -158,7 +159,6 @@
- Add upload keybindings (close failed upload, pause, resume)
- Handle errors when setting an avatar
-- Show confirmation box when picking file to upload or uploading from clipboard
- Show proper progress ring for mxc thumbnails loading
- Sentinel function to report local file paths for already downloaded media,
diff --git a/src/gui/Pages/Chat/Composer/UploadButton.qml b/src/gui/Pages/Chat/Composer/UploadButton.qml
index 00390b66..ce2cb164 100644
--- a/src/gui/Pages/Chat/Composer/UploadButton.qml
+++ b/src/gui/Pages/Chat/Composer/UploadButton.qml
@@ -21,8 +21,14 @@ HButton {
HShortcut {
sequences: window.settings.keys.sendFileFromPathInClipboard
- onActivated: utils.sendFile(
- chat.userId, chat.roomId, Clipboard.text.trim(),
+ onActivated: utils.makePopup(
+ "Popups/ConfirmUploadPopup.qml",
+ {
+ userId: chat.userId,
+ roomId: chat.roomId,
+ roomName: chat.roomInfo.display_name,
+ filePath: Clipboard.text.trim(),
+ },
)
}
diff --git a/src/gui/Popups/ConfirmUploadPopup.qml b/src/gui/Popups/ConfirmUploadPopup.qml
new file mode 100644
index 00000000..523cf53a
--- /dev/null
+++ b/src/gui/Popups/ConfirmUploadPopup.qml
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+
+import QtQuick 2.12
+import QtQuick.Controls 2.12
+import QtQuick.Layouts 1.12
+import "../Base"
+import "../Base/Buttons"
+
+HColumnPopup {
+ id: popup
+
+ property string userId
+ property string roomId
+ property string roomName
+ property string filePath
+
+ readonly property string fileName: filePath.split("/").slice(-1)[0]
+
+
+ page.footer: AutoDirectionLayout {
+ ApplyButton {
+ id: uploadButton
+ text: qsTr("Send")
+ icon.name: "confirm-uploading-file"
+ onClicked: {
+ utils.sendFile(popup.userId, popup.roomId, filePath)
+ popup.close()
+ }
+ }
+
+ CancelButton {
+ id: cancelButton
+ onClicked: popup.close()
+ }
+ }
+
+ onOpened: uploadButton.forceActiveFocus()
+
+ SummaryLabel {
+ text:
+ qsTr("Send %1 to %2?")
+ .arg(utils.htmlColorize(fileName, theme.colors.accentText))
+ .arg(utils.htmlColorize(roomName, theme.colors.accentText))
+
+ textFormat: Text.StyledText
+ }
+
+ HImage {
+ source: popup.filePath
+ fillMode: Image.PreserveAspectFit
+ visible: status !== Image.Error
+
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.preferredHeight:
+ status === Image.Ready ?
+ width / (implicitWidth / implicitHeight) :
+ 0
+
+ Behavior on Layout.preferredHeight { HNumberAnimation {} }
+ }
+}
diff --git a/src/gui/Utils.qml b/src/gui/Utils.qml
index 1de9ab02..2f2d827a 100644
--- a/src/gui/Utils.qml
+++ b/src/gui/Utils.qml
@@ -191,6 +191,11 @@ QtObject {
}
+ function htmlColorize(text, color) {
+ return `${text}`
+ }
+
+
function processedEventText(ev) {
const type = ev.event_type
const unknownMsg = type === "RoomMessageUnknown"
diff --git a/src/icons/thin/confirm-uploading-file.svg b/src/icons/thin/confirm-uploading-file.svg
new file mode 100644
index 00000000..2eed4d1d
--- /dev/null
+++ b/src/icons/thin/confirm-uploading-file.svg
@@ -0,0 +1,3 @@
+