diff --git a/src/qml/danbooruimageview.qml b/src/qml/danbooruimageview.qml index 527630f..d4a619a 100644 --- a/src/qml/danbooruimageview.qml +++ b/src/qml/danbooruimageview.qml @@ -42,12 +42,16 @@ Rectangle { signal downloadRequested(url url, var tags) signal downloadStarted() signal fileInfo(url name, var tags) - + signal shareButtonClicked(url url) KRun { id: runner } + Clipboard { + id: clipboard + } + onDownloadFinished: { grid.opacity = 1 @@ -64,6 +68,10 @@ Rectangle { runningIndicator.running = true } + onShareButtonClicked: { + clipboard.content = url; + } + BusyIndicator { id: runningIndicator z: 1 @@ -121,8 +129,6 @@ Rectangle { height: parent.height width: parent.width -// - hoverEnabled: true onClicked: { @@ -137,11 +143,13 @@ Rectangle { onEntered: { viewButton.opacity = 1 downloadButton.opacity = 1 + shareButton.opacity = 1 } onExited: { viewButton.opacity = 0 downloadButton.opacity = 0 + shareButton.opacity = 0 } Button { @@ -198,6 +206,35 @@ Rectangle { } } } + + Button { + id: shareButton + iconName: "edit-copy" + tooltip: i18n("Copy link to clipboard") + visible: opacity > 0 + opacity: 0 + anchors.top: parent.top + anchors.right: parent.right + anchors.topMargin: (pixItem.height - pixItem.paintedHeight) / 2 + anchors.rightMargin: (pixItem.width - pixItem.paintedWidth) / 2 + + height: pixItem.height * 0.15 + width: pixItem.height * 0.15 + z: 1 + + onClicked: { + rootObj.shareButtonClicked(fileUrl) + } + + Behavior on opacity { + NumberAnimation { + duration: 200 + } + + } + + } + } } Text {