1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2025-02-21 22:06:57 +00:00

Add copy button for repository URLs/paths. Fixes #409

This commit is contained in:
samuel-w 2020-06-22 03:09:20 -05:00 committed by GitHub
parent 87083c1004
commit c554875a36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -143,6 +143,16 @@
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QToolButton" name="copyURLbutton">
<property name="toolTip">
<string>Copy repo URL to clipboard</string>
</property>
<property name="autoRaise">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">

View file

@ -28,6 +28,7 @@ def __init__(self, parent=None):
self.set_repos()
self.repoSelector.currentIndexChanged.connect(self.repo_select_action)
self.repoRemoveToolbutton.clicked.connect(self.repo_unlink_action)
self.copyURLbutton.clicked.connect(self.copy_URL_action)
# note: it is hard to describe these algorithms with attributes like low/medium/high
# compression or speed on a unified scale. this is not 1-dimensional and also depends
@ -61,6 +62,7 @@ def __init__(self, parent=None):
def set_icons(self):
self.repoRemoveToolbutton.setIcon(get_colored_icon('unlink'))
self.sshKeyToClipboardButton.setIcon(get_colored_icon('copy'))
self.copyURLbutton.setIcon(get_colored_icon('copy'))
def set_repos(self):
count = self.repoSelector.count()
@ -207,3 +209,8 @@ def repo_unlink_action(self):
self.repo_changed.emit()
self.init_repo_stats()
def copy_URL_action(self):
if self.repoSelector.currentIndex() > 2:
URL = self.repoSelector.currentText()
QApplication.clipboard().setText(URL)