summaryrefslogtreecommitdiff
path: root/src/tools/qtc-askpass
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-12-18 17:47:51 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2018-12-19 15:18:37 +0000
commitb958b9b66921bea8a3bc430cbebe3473469b341b (patch)
treed5e7fb1454dae880c51f6c6b3cbb29312de23812 /src/tools/qtc-askpass
parent8331b98dbb2911fa7d5cac71fbf62cfdba4145fe (diff)
downloadqt-creator-b958b9b66921bea8a3bc430cbebe3473469b341b.tar.gz
SSH: Add ssh-askpass implementation
There is no standard implementation for the ssh-askpass tool on any platform, so we currently can't find one on our own. In particular, this means that the RemoteLinux device test will always fail for a newly added device, which is not acceptable. So we just add our own askpass implementation and point the SSH settings to it. Change-Id: I7ca18725e63f591ef9defdf13768a21cc3de4a54 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/tools/qtc-askpass')
-rw-r--r--src/tools/qtc-askpass/qtc-askpass-main.cpp47
-rw-r--r--src/tools/qtc-askpass/qtc-askpass.pro5
-rw-r--r--src/tools/qtc-askpass/qtc-askpass.qbs9
3 files changed, 61 insertions, 0 deletions
diff --git a/src/tools/qtc-askpass/qtc-askpass-main.cpp b/src/tools/qtc-askpass/qtc-askpass-main.cpp
new file mode 100644
index 0000000000..3e527bc3ad
--- /dev/null
+++ b/src/tools/qtc-askpass/qtc-askpass-main.cpp
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** 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 <QApplication>
+#include <QInputDialog>
+#include <QTimer>
+#include <iostream>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QTimer::singleShot(0, [] {
+ QInputDialog dlg;
+ const QStringList appArgs = qApp->arguments();
+ QString labelText = QCoreApplication::translate("qtc-askpass",
+ "Password required for SSH login.");
+ if (appArgs.count() > 1)
+ labelText.append('\n').append(appArgs.at(1));
+ dlg.setLabelText(labelText);
+ dlg.setTextEchoMode(QLineEdit::Password);
+ if (dlg.exec() == QDialog::Accepted)
+ std::cout << qPrintable(dlg.textValue()) << std::endl;
+ });
+ return app.exec();
+}
diff --git a/src/tools/qtc-askpass/qtc-askpass.pro b/src/tools/qtc-askpass/qtc-askpass.pro
new file mode 100644
index 0000000000..e0d61eba18
--- /dev/null
+++ b/src/tools/qtc-askpass/qtc-askpass.pro
@@ -0,0 +1,5 @@
+include(../../qtcreatortool.pri)
+
+TARGET = qtc-askpass
+
+SOURCES = qtc-askpass-main.cpp
diff --git a/src/tools/qtc-askpass/qtc-askpass.qbs b/src/tools/qtc-askpass/qtc-askpass.qbs
new file mode 100644
index 0000000000..c8e61e741a
--- /dev/null
+++ b/src/tools/qtc-askpass/qtc-askpass.qbs
@@ -0,0 +1,9 @@
+import qbs
+
+QtcTool {
+ name: "qtc-askpass"
+ Depends { name: "Qt.widgets" }
+ files: [
+ "qtc-askpass-main.cpp",
+ ]
+}