diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2022-05-13 01:08:44 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2022-05-23 18:21:28 +0000 |
commit | 9db911ae124bf32e42d4c20fb6ad8d404ff37292 (patch) | |
tree | bbcafcc1217f33c5f64efdddcec9b01a55102164 /src/libs/ssh | |
parent | 10ad238c165e744606a2e1e70b4942741a5a5b35 (diff) | |
download | qt-creator-9db911ae124bf32e42d4c20fb6ad8d404ff37292.tar.gz |
Get rid of Ssh lib
Move the rest to ProjectExplorer plugin.
Change-Id: Id2f022359e7e01728779228ea1f7f0b05a81c8e4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/libs/ssh')
-rw-r--r-- | src/libs/ssh/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/libs/ssh/ssh.qbs | 28 | ||||
-rw-r--r-- | src/libs/ssh/ssh_global.h | 42 | ||||
-rw-r--r-- | src/libs/ssh/sshparameters.cpp | 222 | ||||
-rw-r--r-- | src/libs/ssh/sshparameters.h | 92 | ||||
-rw-r--r-- | src/libs/ssh/sshsettings.cpp | 207 | ||||
-rw-r--r-- | src/libs/ssh/sshsettings.h | 68 |
7 files changed, 0 insertions, 666 deletions
diff --git a/src/libs/ssh/CMakeLists.txt b/src/libs/ssh/CMakeLists.txt deleted file mode 100644 index 87564923cf..0000000000 --- a/src/libs/ssh/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_qtc_library(QtcSsh - DEPENDS Qt5::Core Qt5::Network Qt5::Widgets Utils - SOURCES - ssh_global.h - sshparameters.cpp sshparameters.h - sshsettings.cpp sshsettings.h -) diff --git a/src/libs/ssh/ssh.qbs b/src/libs/ssh/ssh.qbs deleted file mode 100644 index 716434774f..0000000000 --- a/src/libs/ssh/ssh.qbs +++ /dev/null @@ -1,28 +0,0 @@ -import qbs 1.0 - -Project { - name: "QtcSsh" - - QtcLibrary { - cpp.defines: { - var defines = base; - defines.push("QTCSSH_LIBRARY"); - if (project.withAutotests && !defines.contains("WITH_TESTS")) - defines.push("WITH_TESTS"); - return defines; - } - cpp.enableExceptions: true - - Depends { name: "Qt"; submodules: ["widgets", "network" ] } - Depends { name: "Utils" } - - files: [ - "sshparameters.cpp", - "sshparameters.h", - "sshsettings.cpp", - "sshsettings.h", - ] - - Export { Depends { name: "Qt.network" } } - } -} diff --git a/src/libs/ssh/ssh_global.h b/src/libs/ssh/ssh_global.h deleted file mode 100644 index 0449e664e7..0000000000 --- a/src/libs/ssh/ssh_global.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include <QtGlobal> - -#if defined(QTCSSH_LIBRARY) -# define QSSH_EXPORT Q_DECL_EXPORT -#elif defined(QTCSSH_STATIC_LIBRARY) -# define QSSH_EXPORT -#else -# define QSSH_EXPORT Q_DECL_IMPORT -#endif - -#ifdef WITH_TESTS -# define QSSH_AUTOTEST_EXPORT QSSH_EXPORT -#else -# define QSSH_AUTOTEST_EXPORT -#endif diff --git a/src/libs/ssh/sshparameters.cpp b/src/libs/ssh/sshparameters.cpp deleted file mode 100644 index d1e26f938e..0000000000 --- a/src/libs/ssh/sshparameters.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2022 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "sshparameters.h" - -#include "sshsettings.h" - -#include <utils/environment.h> -#include <utils/fileutils.h> -#include <utils/hostosinfo.h> -#include <utils/qtcassert.h> -#include <utils/qtcprocess.h> - -#include <QDebug> - -#include <memory> - -using namespace Utils; - -namespace QSsh { - -SshParameters::SshParameters() -{ - url.setPort(0); -} - -QStringList SshParameters::connectionOptions(const FilePath &binary) const -{ - QString hostKeyCheckingString; - switch (hostKeyCheckingMode) { - case SshHostKeyCheckingNone: - case SshHostKeyCheckingAllowNoMatch: - // There is "accept-new" as well, but only since 7.6. - hostKeyCheckingString = "no"; - break; - case SshHostKeyCheckingStrict: - hostKeyCheckingString = "yes"; - break; - } - - QStringList args{"-o", "StrictHostKeyChecking=" + hostKeyCheckingString, - "-o", "Port=" + QString::number(port())}; - - if (!userName().isEmpty()) - args.append({"-o", "User=" + userName()}); - - const bool keyOnly = authenticationType == - SshParameters::AuthenticationTypeSpecificKey; - if (keyOnly) { - args << "-o" << "IdentitiesOnly=yes"; - args << "-i" << privateKeyFile.path(); - } - if (keyOnly || SshSettings::askpassFilePath().isEmpty()) - args << "-o" << "BatchMode=yes"; - - bool useTimeout = timeout != 0; - if (useTimeout && HostOsInfo::isWindowsHost() - && binary.toString().toLower().contains("/system32/")) { - useTimeout = false; - } - if (useTimeout) - args << "-o" << ("ConnectTimeout=" + QString::number(timeout)); - - return args; -} - -bool SshParameters::setupSshEnvironment(QtcProcess *process) -{ - Environment env = process->controlEnvironment(); - if (env.size() == 0) - env = Environment::systemEnvironment(); - const bool hasDisplay = env.hasKey("DISPLAY") && (env.value("DISPLAY") != QString(":0")); - if (SshSettings::askpassFilePath().exists()) { - env.set("SSH_ASKPASS", SshSettings::askpassFilePath().toUserOutput()); - - // OpenSSH only uses the askpass program if DISPLAY is set, regardless of the platform. - if (!env.hasKey("DISPLAY")) - env.set("DISPLAY", ":0"); - } - process->setEnvironment(env); - - // Otherwise, ssh will ignore SSH_ASKPASS and read from /dev/tty directly. - process->setDisableUnixTerminal(); - return hasDisplay; -} - - -static inline bool equals(const SshParameters &p1, const SshParameters &p2) -{ - return p1.url == p2.url - && p1.authenticationType == p2.authenticationType - && p1.privateKeyFile == p2.privateKeyFile - && p1.hostKeyCheckingMode == p2.hostKeyCheckingMode - && p1.x11DisplayName == p2.x11DisplayName - && p1.timeout == p2.timeout; -} - -bool operator==(const SshParameters &p1, const SshParameters &p2) -{ - return equals(p1, p2); -} - -bool operator!=(const SshParameters &p1, const SshParameters &p2) -{ - return !equals(p1, p2); -} - -#ifdef WITH_TESTS -namespace SshTest { -const QString getHostFromEnvironment() -{ - const QString host = QString::fromLocal8Bit(qgetenv("QTC_SSH_TEST_HOST")); - if (host.isEmpty() && qEnvironmentVariableIsSet("QTC_SSH_TEST_DEFAULTS")) - return QString("127.0.0.1"); - return host; -} - -quint16 getPortFromEnvironment() -{ - const int port = qEnvironmentVariableIntValue("QTC_SSH_TEST_PORT"); - return port != 0 ? quint16(port) : 22; -} - -const QString getUserFromEnvironment() -{ - return QString::fromLocal8Bit(qgetenv("QTC_SSH_TEST_USER")); -} - -const QString getKeyFileFromEnvironment() -{ - const FilePath defaultKeyFile = FileUtils::homePath() / ".ssh/id_rsa"; - const QString keyFile = QString::fromLocal8Bit(qgetenv("QTC_SSH_TEST_KEYFILE")); - if (keyFile.isEmpty()) { - if (qEnvironmentVariableIsSet("QTC_SSH_TEST_DEFAULTS")) - return defaultKeyFile.toString(); - } - return keyFile; -} - -const QString userAtHost() -{ - QString userMidFix = getUserFromEnvironment(); - if (!userMidFix.isEmpty()) - userMidFix.append('@'); - return userMidFix + getHostFromEnvironment(); -} - -SshParameters getParameters() -{ - SshParameters params; - if (!qEnvironmentVariableIsSet("QTC_SSH_TEST_DEFAULTS")) { - params.setUserName(getUserFromEnvironment()); - params.privateKeyFile = FilePath::fromUserInput(getKeyFileFromEnvironment()); - } - params.setHost(getHostFromEnvironment()); - params.setPort(getPortFromEnvironment()); - params.timeout = 10; - params.authenticationType = !params.privateKeyFile.isEmpty() - ? QSsh::SshParameters::AuthenticationTypeSpecificKey - : QSsh::SshParameters::AuthenticationTypeAll; - return params; -} - -bool checkParameters(const QSsh::SshParameters ¶ms) -{ - if (qEnvironmentVariableIsSet("QTC_SSH_TEST_DEFAULTS")) - return true; - if (params.host().isEmpty()) { - qWarning("No hostname provided. Set QTC_SSH_TEST_HOST."); - return false; - } - if (params.userName().isEmpty()) - qWarning("No user name provided - test may fail with empty default. Set QTC_SSH_TEST_USER."); - if (params.privateKeyFile.isEmpty()) { - qWarning("No key file provided. Set QTC_SSH_TEST_KEYFILE."); - return false; - } - return true; -} - -void printSetupHelp() -{ - qInfo() << "\n\n" - "In order to run this test properly it requires some setup (example for fedora):\n" - "1. Run a server on the host to connect to:\n" - " systemctl start sshd\n" - "2. Create your own ssh key (needed only once). For fedora it needs ecdsa type:\n" - " ssh-keygen -t ecdsa\n" - "3. Make your public key known to the server (needed only once):\n" - " ssh-copy-id -i [full path to your public key] [user@host]\n" - "4. Set the env variables before executing test:\n" - " QTC_SSH_TEST_HOST=127.0.0.1\n" - " QTC_SSH_TEST_KEYFILE=[full path to your private key]\n" - " QTC_SSH_TEST_USER=[your user name]\n"; -} - -} // namespace SshTest -#endif - -} // namespace QSsh diff --git a/src/libs/ssh/sshparameters.h b/src/libs/ssh/sshparameters.h deleted file mode 100644 index 6631bb6683..0000000000 --- a/src/libs/ssh/sshparameters.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2022 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "ssh_global.h" - -#include <utils/filepath.h> - -#include <QUrl> - -namespace Utils { class QtcProcess; } - -namespace QSsh { - -enum SshHostKeyCheckingMode { - SshHostKeyCheckingNone, - SshHostKeyCheckingStrict, - SshHostKeyCheckingAllowNoMatch, -}; - -class QSSH_EXPORT SshParameters -{ -public: - enum AuthenticationType { - AuthenticationTypeAll, - AuthenticationTypeSpecificKey, - }; - - SshParameters(); - - QString host() const { return url.host(); } - quint16 port() const { return url.port(); } - QString userName() const { return url.userName(); } - QString userAtHost() const { return userName().isEmpty() ? host() : userName() + '@' + host(); } - void setHost(const QString &host) { url.setHost(host); } - void setPort(int port) { url.setPort(port); } - void setUserName(const QString &name) { url.setUserName(name); } - - QStringList connectionOptions(const Utils::FilePath &binary) const; - - QUrl url; - Utils::FilePath privateKeyFile; - QString x11DisplayName; - int timeout = 0; // In seconds. - AuthenticationType authenticationType = AuthenticationTypeAll; - SshHostKeyCheckingMode hostKeyCheckingMode = SshHostKeyCheckingAllowNoMatch; - - static bool setupSshEnvironment(Utils::QtcProcess *process); -}; - -QSSH_EXPORT bool operator==(const SshParameters &p1, const SshParameters &p2); -QSSH_EXPORT bool operator!=(const SshParameters &p1, const SshParameters &p2); - -#ifdef WITH_TESTS -namespace SshTest { -const QString QSSH_EXPORT getHostFromEnvironment(); -quint16 QSSH_EXPORT getPortFromEnvironment(); -const QString QSSH_EXPORT getUserFromEnvironment(); -const QString QSSH_EXPORT getKeyFileFromEnvironment(); -const QSSH_EXPORT QString userAtHost(); -SshParameters QSSH_EXPORT getParameters(); -bool QSSH_EXPORT checkParameters(const SshParameters ¶ms); -void QSSH_EXPORT printSetupHelp(); -} // namespace SshTest -#endif - -} // namespace QSsh - -Q_DECLARE_METATYPE(QSsh::SshParameters::AuthenticationType) diff --git a/src/libs/ssh/sshsettings.cpp b/src/libs/ssh/sshsettings.cpp deleted file mode 100644 index 571ca5c1af..0000000000 --- a/src/libs/ssh/sshsettings.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "sshsettings.h" - -#include <utils/environment.h> -#include <utils/hostosinfo.h> - -#include <QReadWriteLock> -#include <QSettings> - -using namespace Utils; - -namespace QSsh { -namespace Internal { - -struct SshSettings -{ - bool useConnectionSharing = !HostOsInfo::isWindowsHost(); - int connectionSharingTimeOutInMinutes = 10; - FilePath sshFilePath; - FilePath sftpFilePath; - FilePath askpassFilePath; - FilePath keygenFilePath; - QSsh::SshSettings::SearchPathRetriever searchPathRetriever = [] { return FilePaths(); }; - QReadWriteLock lock; -}; - -} // namespace Internal - -Q_GLOBAL_STATIC(QSsh::Internal::SshSettings, sshSettings) - - -class AccessSettingsGroup -{ -public: - AccessSettingsGroup(QSettings *settings) : m_settings(settings) - { - settings->beginGroup("SshSettings"); - } - ~AccessSettingsGroup() { m_settings->endGroup(); } -private: - QSettings * const m_settings; -}; - -static QString connectionSharingKey() { return QString("UseConnectionSharing"); } -static QString connectionSharingTimeoutKey() { return QString("ConnectionSharingTimeout"); } -static QString sshFilePathKey() { return QString("SshFilePath"); } -static QString sftpFilePathKey() { return QString("SftpFilePath"); } -static QString askPassFilePathKey() { return QString("AskpassFilePath"); } -static QString keygenFilePathKey() { return QString("KeygenFilePath"); } - -void SshSettings::loadSettings(QSettings *settings) -{ - QWriteLocker locker(&sshSettings->lock); - AccessSettingsGroup g(settings); - QVariant value = settings->value(connectionSharingKey()); - if (value.isValid() && !HostOsInfo::isWindowsHost()) - sshSettings->useConnectionSharing = value.toBool(); - value = settings->value(connectionSharingTimeoutKey()); - if (value.isValid()) - sshSettings->connectionSharingTimeOutInMinutes = value.toInt(); - sshSettings->sshFilePath = FilePath::fromString(settings->value(sshFilePathKey()).toString()); - sshSettings->sftpFilePath = FilePath::fromString(settings->value(sftpFilePathKey()).toString()); - sshSettings->askpassFilePath = FilePath::fromString( - settings->value(askPassFilePathKey()).toString()); - sshSettings->keygenFilePath = FilePath::fromString( - settings->value(keygenFilePathKey()).toString()); -} - -void SshSettings::storeSettings(QSettings *settings) -{ - QReadLocker locker(&sshSettings->lock); - AccessSettingsGroup g(settings); - settings->setValue(connectionSharingKey(), sshSettings->useConnectionSharing); - settings->setValue(connectionSharingTimeoutKey(), - sshSettings->connectionSharingTimeOutInMinutes); - settings->setValue(sshFilePathKey(), sshSettings->sshFilePath.toString()); - settings->setValue(sftpFilePathKey(), sshSettings->sftpFilePath.toString()); - settings->setValue(askPassFilePathKey(), sshSettings->askpassFilePath.toString()); - settings->setValue(keygenFilePathKey(), sshSettings->keygenFilePath.toString()); -} - -void SshSettings::setConnectionSharingEnabled(bool share) -{ - QWriteLocker locker(&sshSettings->lock); - sshSettings->useConnectionSharing = share; -} -bool SshSettings::connectionSharingEnabled() -{ - QReadLocker locker(&sshSettings->lock); - return sshSettings->useConnectionSharing; -} - -void SshSettings::setConnectionSharingTimeout(int timeInMinutes) -{ - QWriteLocker locker(&sshSettings->lock); - sshSettings->connectionSharingTimeOutInMinutes = timeInMinutes; -} -int SshSettings::connectionSharingTimeout() -{ - QReadLocker locker(&sshSettings->lock); - return sshSettings->connectionSharingTimeOutInMinutes; -} - -// Keep read locker locked while calling this method -static FilePath filePathValue(const FilePath &value, const QStringList &candidateFileNames) -{ - if (!value.isEmpty()) - return value; - const QList<FilePath> additionalSearchPaths = sshSettings->searchPathRetriever(); - for (const QString &candidate : candidateFileNames) { - const FilePath filePath = Environment::systemEnvironment() - .searchInPath(candidate, additionalSearchPaths); - if (!filePath.isEmpty()) - return filePath; - } - return FilePath(); -} - -// Keep read locker locked while calling this method -static FilePath filePathValue(const FilePath &value, const QString &candidateFileName) -{ - return filePathValue(value, QStringList(candidateFileName)); -} - -void SshSettings::setSshFilePath(const FilePath &ssh) -{ - QWriteLocker locker(&sshSettings->lock); - sshSettings->sshFilePath = ssh; -} - -FilePath SshSettings::sshFilePath() -{ - QReadLocker locker(&sshSettings->lock); - return filePathValue(sshSettings->sshFilePath, "ssh"); -} - -void SshSettings::setSftpFilePath(const FilePath &sftp) -{ - QWriteLocker locker(&sshSettings->lock); - sshSettings->sftpFilePath = sftp; -} - -FilePath SshSettings::sftpFilePath() -{ - QReadLocker locker(&sshSettings->lock); - return filePathValue(sshSettings->sftpFilePath, "sftp"); -} - -void SshSettings::setAskpassFilePath(const FilePath &askPass) -{ - QWriteLocker locker(&sshSettings->lock); - sshSettings->askpassFilePath = askPass; -} - -FilePath SshSettings::askpassFilePath() -{ - QReadLocker locker(&sshSettings->lock); - FilePath candidate; - candidate = sshSettings->askpassFilePath; - if (candidate.isEmpty()) - candidate = FilePath::fromString(Environment::systemEnvironment().value("SSH_ASKPASS")); - return filePathValue(candidate, QStringList{"qtc-askpass", "ssh-askpass"}); -} - -void SshSettings::setKeygenFilePath(const FilePath &keygen) -{ - QWriteLocker locker(&sshSettings->lock); - sshSettings->keygenFilePath = keygen; -} - -FilePath SshSettings::keygenFilePath() -{ - QReadLocker locker(&sshSettings->lock); - return filePathValue(sshSettings->keygenFilePath, "ssh-keygen"); -} - -void SshSettings::setExtraSearchPathRetriever(const SearchPathRetriever &pathRetriever) -{ - QWriteLocker locker(&sshSettings->lock); - sshSettings->searchPathRetriever = pathRetriever; -} - -} // namespace QSsh diff --git a/src/libs/ssh/sshsettings.h b/src/libs/ssh/sshsettings.h deleted file mode 100644 index 1b7c458464..0000000000 --- a/src/libs/ssh/sshsettings.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "ssh_global.h" - -#include <utils/fileutils.h> - -#include <functional> - -QT_BEGIN_NAMESPACE -class QSettings; -QT_END_NAMESPACE - -namespace QSsh { - -class QSSH_EXPORT SshSettings -{ -public: - static void loadSettings(QSettings *settings); - static void storeSettings(QSettings *settings); - - static void setConnectionSharingEnabled(bool share); - static bool connectionSharingEnabled(); - - static void setConnectionSharingTimeout(int timeInMinutes); - static int connectionSharingTimeout(); - - static void setSshFilePath(const Utils::FilePath &ssh); - static Utils::FilePath sshFilePath(); - - static void setSftpFilePath(const Utils::FilePath &sftp); - static Utils::FilePath sftpFilePath(); - - static void setAskpassFilePath(const Utils::FilePath &askPass); - static Utils::FilePath askpassFilePath(); - - static void setKeygenFilePath(const Utils::FilePath &keygen); - static Utils::FilePath keygenFilePath(); - - using SearchPathRetriever = std::function<Utils::FilePaths()>; - static void setExtraSearchPathRetriever(const SearchPathRetriever &pathRetriever); -}; - -} // namespace QSsh |