diff --git a/src/mobileappconnector.ui b/src/mobileappconnector.ui
index ff5fe53..a2db0a4 100644
--- a/src/mobileappconnector.ui
+++ b/src/mobileappconnector.ui
@@ -43,16 +43,6 @@
QR Code
- -
-
-
- Connection URI String
-
-
- Qt::AlignCenter
-
-
-
-
diff --git a/src/websockets.cpp b/src/websockets.cpp
index 48183b8..253922b 100644
--- a/src/websockets.cpp
+++ b/src/websockets.cpp
@@ -95,6 +95,26 @@ void AppDataServer::connectAppDialog(QWidget* parent) {
ui->setupUi(&d);
Settings::saveRestore(&d);
+ updateUIWithNewQRCode();
+ updateConnectedUI();
+
+ QObject::connect(ui->btnDisconnect, &QPushButton::clicked, [=] () {
+ QSettings().setValue("mobileapp/connectedname", "");
+ saveNewSecret("");
+
+ updateConnectedUI();
+ });
+
+
+ d.exec();
+
+ // Cleanup
+ tempSecret = "";
+ delete ui;
+ ui = nullptr;
+}
+
+void AppDataServer::updateUIWithNewQRCode() {
// Get the address of the localhost
auto addrList = QNetworkInterface::allAddresses();
@@ -124,25 +144,7 @@ void AppDataServer::connectAppDialog(QWidget* parent) {
QString codeStr = uri + "," + secretStr;
- ui->lblConnStr->setText(codeStr);
ui->qrcode->setQrcodeString(codeStr);
-
- updateConnectedUI();
-
- QObject::connect(ui->btnDisconnect, &QPushButton::clicked, [=] () {
- QSettings().setValue("mobileapp/connectedname", "");
- saveNewSecret("");
-
- updateConnectedUI();
- });
-
-
- d.exec();
-
- // Cleanup
- tempSecret = "";
- delete ui;
- ui = nullptr;
}
void AppDataServer::updateConnectedUI() {
@@ -337,7 +339,11 @@ void AppDataServer::processMessage(QString message, MainWindow* mainWindow, QWeb
// If the Connection UI is showing, we have to update the UI as well
if (ui != nullptr) {
+ // Update the connected phone information
updateConnectedUI();
+
+ // Update with a new QR Code for safety, so this secret isn't used by anyone else
+ updateUIWithNewQRCode();
}
}
}
diff --git a/src/websockets.h b/src/websockets.h
index 13d0c86..9dce130 100644
--- a/src/websockets.h
+++ b/src/websockets.h
@@ -42,6 +42,7 @@ class AppDataServer {
public:
static void connectAppDialog(QWidget* parent);
static void updateConnectedUI();
+ static void updateUIWithNewQRCode();
static void processSendTx(QJsonObject sendTx, MainWindow* mainwindow, QWebSocket* pClient);
static void processMessage(QString message, MainWindow* mainWindow, QWebSocket* pClient);