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 downloadRequested(url url, var tags)
 | 
				
			||||||
    signal downloadStarted()
 | 
					    signal downloadStarted()
 | 
				
			||||||
    signal fileInfo(url name, var tags)
 | 
					    signal fileInfo(url name, var tags)
 | 
				
			||||||
 | 
					    signal shareButtonClicked(url url)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    KRun {
 | 
					    KRun {
 | 
				
			||||||
        id: runner
 | 
					        id: runner
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Clipboard {
 | 
				
			||||||
 | 
					        id: clipboard
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    onDownloadFinished: {
 | 
					    onDownloadFinished: {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        grid.opacity = 1
 | 
					        grid.opacity = 1
 | 
				
			||||||
| 
						 | 
					@ -64,6 +68,10 @@ Rectangle {
 | 
				
			||||||
        runningIndicator.running = true
 | 
					        runningIndicator.running = true
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    onShareButtonClicked: {
 | 
				
			||||||
 | 
					        clipboard.content = url;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    BusyIndicator {
 | 
					    BusyIndicator {
 | 
				
			||||||
        id: runningIndicator
 | 
					        id: runningIndicator
 | 
				
			||||||
        z: 1
 | 
					        z: 1
 | 
				
			||||||
| 
						 | 
					@ -121,8 +129,6 @@ Rectangle {
 | 
				
			||||||
                        height: parent.height
 | 
					                        height: parent.height
 | 
				
			||||||
                        width: parent.width
 | 
					                        width: parent.width
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                        hoverEnabled: true
 | 
					                        hoverEnabled: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        onClicked: {
 | 
					                        onClicked: {
 | 
				
			||||||
| 
						 | 
					@ -137,11 +143,13 @@ Rectangle {
 | 
				
			||||||
                        onEntered: {
 | 
					                        onEntered: {
 | 
				
			||||||
                            viewButton.opacity = 1
 | 
					                            viewButton.opacity = 1
 | 
				
			||||||
                            downloadButton.opacity = 1
 | 
					                            downloadButton.opacity = 1
 | 
				
			||||||
 | 
					                            shareButton.opacity = 1
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        onExited: {
 | 
					                        onExited: {
 | 
				
			||||||
                            viewButton.opacity = 0
 | 
					                            viewButton.opacity = 0
 | 
				
			||||||
                            downloadButton.opacity = 0
 | 
					                            downloadButton.opacity = 0
 | 
				
			||||||
 | 
					                            shareButton.opacity = 0
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        Button {
 | 
					                        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 {
 | 
					                Text {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue