summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-04-23 20:55:28 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-04-23 20:55:28 +0200
commit6a03615413ef90e378df80fa1e3bc4ef031d5ea6 (patch)
treec577c21e1c3cda9f7c50a9545c7a57720de762b9 /resources
parentTranslated using Weblate (Ukrainian) (diff)
downloadnheko-6a03615413ef90e378df80fa1e3bc4ef031d5ea6.tar.xz
Copy image to clipboard
Fixes #599
Diffstat (limited to 'resources')
-rw-r--r--resources/icons/ui/copy.svg1
-rw-r--r--resources/qml/dialogs/ImageOverlay.qml36
-rw-r--r--resources/res.qrc1
3 files changed, 38 insertions, 0 deletions
diff --git a/resources/icons/ui/copy.svg b/resources/icons/ui/copy.svg
new file mode 100644
index 00000000..ae358603
--- /dev/null
+++ b/resources/icons/ui/copy.svg
@@ -0,0 +1 @@
+<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5.503 4.627 5.5 6.75v10.504a3.25 3.25 0 0 0 3.25 3.25h8.616a2.251 2.251 0 0 1-2.122 1.5H8.75A4.75 4.75 0 0 1 4 17.254V6.75c0-.98.627-1.815 1.503-2.123ZM17.75 2A2.25 2.25 0 0 1 20 4.25v13a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-13A2.25 2.25 0 0 1 8.75 2h9Zm0 1.5h-9a.75.75 0 0 0-.75.75v13c0 .414.336.75.75.75h9a.75.75 0 0 0 .75-.75v-13a.75.75 0 0 0-.75-.75Z" fill="#212121"/></svg>
\ No newline at end of file
diff --git a/resources/qml/dialogs/ImageOverlay.qml b/resources/qml/dialogs/ImageOverlay.qml
index 6f56e79a..fa874529 100644
--- a/resources/qml/dialogs/ImageOverlay.qml
+++ b/resources/qml/dialogs/ImageOverlay.qml
@@ -29,6 +29,17 @@ Window {
         onActivated: imageOverlay.close()
     }
 
+    Shortcut {
+        sequence: StandardKey.Copy
+        onActivated: {
+            if (room) {
+                room.copyMedia(eventId);
+            } else {
+                TimelineManager.copyImage(url);
+            }
+        }
+    }
+
     TapHandler {
         onSingleTapped: imageOverlay.close();
     }
@@ -111,10 +122,33 @@ Window {
             height: 48
             width: 48
             hoverEnabled: true
+            image: ":/icons/icons/ui/copy.svg"
+
+            //ToolTip.visible: hovered
+            //ToolTip.delay: Nheko.tooltipDelay
+            //ToolTip.text: qsTr("Copy to clipboard")
+
+            onClicked: {
+                imageOverlay.hide();
+                if (room) {
+                    room.copyMedia(eventId);
+                } else {
+                    TimelineManager.copyImage(url);
+                }
+                imageOverlay.close();
+            }
+        }
+
+        ImageButton {
+            height: 48
+            width: 48
+            hoverEnabled: true
             image: ":/icons/icons/ui/download.svg"
+
             //ToolTip.visible: hovered
             //ToolTip.delay: Nheko.tooltipDelay
             //ToolTip.text: qsTr("Download")
+
             onClicked: {
                 imageOverlay.hide();
                 if (room) {
@@ -130,9 +164,11 @@ Window {
             width: 48
             hoverEnabled: true
             image: ":/icons/icons/ui/dismiss.svg"
+
             //ToolTip.visible: hovered
             //ToolTip.delay: Nheko.tooltipDelay
             //ToolTip.text: qsTr("Close")
+            
             onClicked: imageOverlay.close()
         }
     }
diff --git a/resources/res.qrc b/resources/res.qrc
index 3f1b2b65..412cdb83 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -9,6 +9,7 @@
         <file>icons/ui/checkmark.svg</file>
         <file>icons/ui/clock.svg</file>
         <file>icons/ui/collapsed.svg</file>
+        <file>icons/ui/copy.svg</file>
         <file>icons/ui/delete.svg</file>
         <file>icons/ui/dismiss.svg</file>
         <file>icons/ui/dismiss_edit.svg</file>