summaryrefslogtreecommitdiffstats
path: root/examples/knx/knxeditor/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/knx/knxeditor/mainwindow.cpp')
-rw-r--r--examples/knx/knxeditor/mainwindow.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/knx/knxeditor/mainwindow.cpp b/examples/knx/knxeditor/mainwindow.cpp
index 17200ef..a06abd5 100644
--- a/examples/knx/knxeditor/mainwindow.cpp
+++ b/examples/knx/knxeditor/mainwindow.cpp
@@ -52,8 +52,11 @@
#include "ui_mainwindow.h"
#include <QElapsedTimer>
+#include <QFileDialog>
+#include <QInputDialog>
#include <QNetworkInterface>
#include <QStandardItem>
+#include <QStandardPaths>
Ui::MainWindow *MainWindow::s_ui { nullptr };
@@ -274,6 +277,34 @@ void MainWindow::on_radioButtonTCP_toggled(bool checked)
ui->tunnelingFeatures->setTcpEnable(checked);
}
+void MainWindow::on_actionEtsKeyringImport_triggered()
+{
+ auto fileName = QFileDialog::getOpenFileName(this, tr("Import keyring file"),
+ QStandardPaths::standardLocations(QStandardPaths::DesktopLocation).value(0),
+ tr("KNX keyring file (*.knxkeys)"));
+
+ if (fileName.isEmpty())
+ return;
+
+ bool ok;
+ auto password = QInputDialog::getText(this, tr("Import keyring file"),
+ tr("Keyring file password:"), QLineEdit::Normal, {}, &ok);
+ if (!ok || password.isEmpty())
+ return;
+
+ auto mgmtConfigs = QKnxNetIpSecureConfiguration::fromKeyring(QKnxNetIpSecureConfiguration
+ ::Type::DeviceManagement, fileName, password.toUtf8(), true);
+ ui->deviceManagement->onKeyringChanged(mgmtConfigs);
+
+ for (auto &config : mgmtConfigs)
+ config.setIndividualAddress({});
+
+ auto tunnelConfigs = QKnxNetIpSecureConfiguration::fromKeyring(QKnxNetIpSecureConfiguration
+ ::Type::Tunneling, fileName, password.toUtf8(), true);
+ ui->tunneling->onKeyringChanged(mgmtConfigs + tunnelConfigs);
+ ui->tunnelingFeatures->onKeyringChanged(mgmtConfigs + tunnelConfigs);
+}
+
void MainWindow::fillLocalIpBox()
{
auto firstItem = new QStandardItem(tr("Interface: IP address --Select One--"));