summaryrefslogtreecommitdiff
path: root/packages/qtnx/files/keychooser.patch
blob: 5fed725c871373214914a4c4f0c53cdfb0eb779c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
Index: qtnx-0.9/qtnxwindow.cpp
===================================================================
--- qtnx-0.9.orig/qtnxwindow.cpp	2008-10-14 10:43:03.000000000 +0200
+++ qtnx-0.9/qtnxwindow.cpp	2008-10-14 10:43:03.000000000 +0200
@@ -304,6 +304,7 @@
 void QtNXWindow::startConnect()
 {
     string key = "";
+    string publicKey = "/usr/share/qtnx/id.key";
 
     if (ui_lg.session->currentText() == tr("Create new session")) {
         QMessageBox::critical(this, tr("Unconfigured"),
@@ -345,11 +346,14 @@
     else if (ui_lg.link->currentText() == tr("LAN"))
         session.linkType = "lan";
 
-    if (!config.key.empty()) {
-        key = config.key;
+    if (!config.publicKey.empty()) {
+        publicKey = config.publicKey;
         session.key = "supplied";
     } else
+    {
         session.key = "default";
+	publicKey = "/usr/share/qtnx/id.key";
+    }
 
     if (config.sessionType == "unix-application")
         session.customCommand = config.customCommand;
@@ -365,13 +369,12 @@
 
     m_NXClient->setDepth(getDepth());
 
-    QString keyPath = "/usr/share/qtnx/id.key";
 
 #ifdef Q_WS_MAC
-    keyPath = binaryPath + "/id.key";
+    publicKey = binaryPath + "/id.key";
 #endif
 
-    m_NXClient->invokeNXSSH(keyPath.toStdString(), config.serverHost, config.encryption, "",
+    m_NXClient->invokeNXSSH(publicKey, config.serverHost, config.encryption, "",
             config.serverPort);
 
     processProbe->start(30);
Index: qtnx-0.9/qtnxsettings.cpp
===================================================================
--- qtnx-0.9.orig/qtnxsettings.cpp	2008-10-14 10:43:03.000000000 +0200
+++ qtnx-0.9/qtnxsettings.cpp	2008-10-14 10:43:03.000000000 +0200
@@ -17,6 +17,7 @@
 
 #include <QFile>
 #include <QDir>
+#include <QFileDialog>
 
 #include "qtnxsettings.h"
 
@@ -82,7 +83,7 @@
         ui_sd.hostname->setText(QString::fromStdString(config.serverHost));
         ui_sd.port->setValue(config.serverPort);
 
-        if (config.key.empty())
+        if (config.publicKey.empty())
             ui_sd.defaultKey->setChecked(true);
         else {
             ui_sd.defaultKey->setChecked(false);
@@ -221,7 +222,7 @@
 void QtNXSettings::keyChanged(int state)
 {
     if (state == Qt::Checked) {
-        config.key = "";
+        config.publicKey = "";
         ui_sd.setAuthKeyButton->setEnabled(false);
     } else
         ui_sd.setAuthKeyButton->setEnabled(true);
@@ -265,15 +266,11 @@
 
 void QtNXSettings::authKeyPressed()
 {
-    keyDialog = 0;
-    delete keyDialog;
-    keyDialog = new QDialog(this);
-    ui_kd.setupUi(keyDialog);
-    keyDialog->show();
-    QTextDocument *doc_key = new QTextDocument(QString::fromStdString(config.key));
-    ui_kd.key->setDocument(doc_key);
-
-    connect(keyDialog, SIGNAL(accepted()), this, SLOT(keyDialogAccept()));
+	QString publicKey = QFileDialog::getOpenFileName(this,
+							 tr("Open File"),
+			                                 ".qtnx",
+							 tr("Keyfiles (*.key )"));
+	config.publicKey = publicKey.toStdString();
 }
 
 void QtNXSettings::keyDialogAccept()
Index: qtnx-0.9/nxwritexml.cpp
===================================================================
--- qtnx-0.9.orig/nxwritexml.cpp	2008-10-14 10:43:03.000000000 +0200
+++ qtnx-0.9/nxwritexml.cpp	2008-10-14 10:43:03.000000000 +0200
@@ -123,6 +123,10 @@
         escape(QString::fromStdString(sessionData.key)) <<
         "\"></option>\n";
 
+    xml << "<option key=\"Public Authentication Key\" value=\"" <<
+        escape(QString::fromStdString(sessionData.publicKey)) <<
+        "\"></option>\n";
+
     if (sessionData.encryption == true)
         xml << "<option key=\"Use SSL Tunnelling\" value=\"True\">" <<
             "</option>\n";
Index: qtnx-0.9/nxparsexml.cpp
===================================================================
--- qtnx-0.9.orig/nxparsexml.cpp	2008-10-14 10:43:03.000000000 +0200
+++ qtnx-0.9/nxparsexml.cpp	2008-10-14 10:43:03.000000000 +0200
@@ -119,6 +119,10 @@
         sessionData->key = attributes.value("value").toStdString();
     }
 
+    if (attributes.value("key") == "Public Authentication Key") {
+        sessionData->publicKey = attributes.value("value").toStdString();
+    }
+
     if (attributes.value("key") == "Use SSL Tunnelling") {
         if (attributes.value("value") == "True")
             sessionData->encryption = true;