Add a copy to clipboard button (fixes issue #2)
This commit is contained in:
		
					parent
					
						
							
								1397dcc61c
							
						
					
				
			
			
				commit
				
					
						857d34c422
					
				
			
		
					 1 changed files with 40 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue