Allow creating an SSH key when bootstrapping Vorta

Fixes #1579
This commit is contained in:
Théophile Bastian 2023-02-08 12:56:01 +01:00 committed by Manu
parent ffafcee05c
commit 1b27b9b499
1 changed files with 9 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import os
from pathlib import PurePath from pathlib import PurePath
from PyQt5 import QtCore, uic from PyQt5 import QtCore, uic
from PyQt5.QtCore import QMimeData, QUrl from PyQt5.QtCore import QMimeData, QUrl
from PyQt5.QtWidgets import QApplication, QMenu, QMessageBox from PyQt5.QtWidgets import QApplication, QLayout, QMenu, QMessageBox
from vorta.store.models import ArchiveModel, BackupProfileMixin, RepoModel from vorta.store.models import ArchiveModel, BackupProfileMixin, RepoModel
from vorta.utils import borg_compat, get_asset, get_private_keys, pretty_bytes from vorta.utils import borg_compat, get_asset, get_private_keys, pretty_bytes
from .repo_add_dialog import AddRepoWindow, ExistingRepoWindow from .repo_add_dialog import AddRepoWindow, ExistingRepoWindow
@ -111,10 +111,12 @@ class RepoTab(RepoBase, RepoUI, BackupProfileMixin):
# set labels # set labels
repo: RepoModel = self.profile().repo repo: RepoModel = self.profile().repo
if repo is not None: if repo is not None:
self.frameRepoSettings.setEnabled(True)
# remove *unset* item # remove *unset* item
self.repoSelector.removeItem(self.repoSelector.findData(None)) self.repoSelector.removeItem(self.repoSelector.findData(None))
# Start with every element enabled, then disable SSH-related if relevant
for child in self.frameRepoSettings.children():
child.setEnabled(True)
# local repo doesn't use ssh # local repo doesn't use ssh
ssh_enabled = repo.is_remote_repo() ssh_enabled = repo.is_remote_repo()
# self.bAddSSHKey.setEnabled(ssh_enabled) # self.bAddSSHKey.setEnabled(ssh_enabled)
@ -147,7 +149,11 @@ class RepoTab(RepoBase, RepoUI, BackupProfileMixin):
self.repoEncryption.setText(str(repo.encryption)) self.repoEncryption.setText(str(repo.encryption))
else: else:
# Compression and SSH key are only valid entries for a repo # Compression and SSH key are only valid entries for a repo
self.frameRepoSettings.setEnabled(False) # Yet Add SSH key button must be enabled for bootstrapping
for child in self.frameRepoSettings.children():
if not isinstance(child, QLayout):
child.setEnabled(False)
self.bAddSSHKey.setEnabled(True)
# unset stats # unset stats
self.sizeCompressed.setText(na) self.sizeCompressed.setText(na)