forked from qt-creator/qt-creator
RemoteLinux: Simplify PublicKeyDeploymentDialog
Change-Id: Iae53f4c3948176f0bc5df11d2cc24b33c113d774 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1029,7 +1029,7 @@ LinuxDevice::LinuxDevice()
|
||||
setSshParameters(sshParams);
|
||||
|
||||
addDeviceAction({Tr::tr("Deploy Public Key..."), [](const IDevice::Ptr &device) {
|
||||
if (auto d = Internal::PublicKeyDeploymentDialog::createDialog(device, Core::ICore::dialogParent())) {
|
||||
if (auto d = Internal::PublicKeyDeploymentDialog::createDialog(device)) {
|
||||
d->exec();
|
||||
delete d;
|
||||
}
|
||||
|
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "remotelinuxtr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
#include <projectexplorer/devicesupport/sshparameters.h>
|
||||
#include <projectexplorer/devicesupport/sshsettings.h>
|
||||
@@ -27,8 +29,7 @@ public:
|
||||
bool m_done;
|
||||
};
|
||||
|
||||
PublicKeyDeploymentDialog *PublicKeyDeploymentDialog::createDialog(
|
||||
const DeviceConstRef &device, QWidget *parent) // TODO: Use Core::ICore::dialogParent()
|
||||
PublicKeyDeploymentDialog *PublicKeyDeploymentDialog::createDialog(const DeviceConstRef &device)
|
||||
{
|
||||
const FilePath dir = device.sshParameters().privateKeyFile.parentDir();
|
||||
const FilePath publicKeyFileName = FileUtils::getOpenFilePath(
|
||||
@@ -36,14 +37,12 @@ PublicKeyDeploymentDialog *PublicKeyDeploymentDialog::createDialog(
|
||||
Tr::tr("Public Key Files (*.pub);;All Files (*)"));
|
||||
if (publicKeyFileName.isEmpty())
|
||||
return nullptr;
|
||||
return new PublicKeyDeploymentDialog(device, publicKeyFileName, parent);
|
||||
return new PublicKeyDeploymentDialog(device, publicKeyFileName);
|
||||
}
|
||||
|
||||
PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(
|
||||
const DeviceConstRef &device,
|
||||
const FilePath &publicKeyFileName,
|
||||
QWidget *parent)
|
||||
: QProgressDialog(parent), d(new PublicKeyDeploymentDialogPrivate)
|
||||
PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const DeviceConstRef &device,
|
||||
const FilePath &publicKeyFileName)
|
||||
: QProgressDialog(Core::ICore::dialogParent()), d(new PublicKeyDeploymentDialogPrivate)
|
||||
{
|
||||
setAutoReset(false);
|
||||
setAutoClose(false);
|
||||
|
@@ -21,12 +21,10 @@ class PublicKeyDeploymentDialog : public QProgressDialog
|
||||
Q_OBJECT
|
||||
public:
|
||||
// Asks for public key and returns null if the file dialog is canceled.
|
||||
static PublicKeyDeploymentDialog *createDialog(const ProjectExplorer::DeviceConstRef &device,
|
||||
QWidget *parent = nullptr);
|
||||
static PublicKeyDeploymentDialog *createDialog(const ProjectExplorer::DeviceConstRef &device);
|
||||
|
||||
PublicKeyDeploymentDialog(const ProjectExplorer::DeviceConstRef &device,
|
||||
const Utils::FilePath &publicKeyFileName,
|
||||
QWidget *parent = nullptr);
|
||||
const Utils::FilePath &publicKeyFileName);
|
||||
|
||||
~PublicKeyDeploymentDialog() override;
|
||||
|
||||
|
@@ -111,7 +111,7 @@ public:
|
||||
auto const deployButton = new QPushButton(Tr::tr("Deploy Public Key"), this);
|
||||
connect(deployButton, &QPushButton::clicked, this, [this] {
|
||||
Internal::PublicKeyDeploymentDialog dlg(
|
||||
m_device, m_keyFileChooser.filePath().stringAppended(".pub"), this);
|
||||
m_device, m_keyFileChooser.filePath().stringAppended(".pub"));
|
||||
m_iconLabel.setPixmap((dlg.exec() == QDialog::Accepted ? Icons::OK : Icons::BROKEN).pixmap());
|
||||
});
|
||||
auto const createButton = new QPushButton(Tr::tr("Create New Key Pair"), this);
|
||||
|
Reference in New Issue
Block a user