diff --git a/imports/Spectral/Dialog/LoginDialog.qml b/imports/Spectral/Dialog/LoginDialog.qml index 199cbf53b..b531ebc08 100644 --- a/imports/Spectral/Dialog/LoginDialog.qml +++ b/imports/Spectral/Dialog/LoginDialog.qml @@ -44,12 +44,22 @@ Dialog { placeholderText: "Password" echoMode: TextInput.Password + onAccepted: deviceNameField.forceActiveFocus() + } + + AutoTextField { + Layout.fillWidth: true + + id: deviceNameField + + placeholderText: "Device Name" + onAccepted: root.accept() } } function doLogin() { - spectralController.loginWithCredentials(serverField.text, usernameField.text, passwordField.text) + spectralController.loginWithCredentials(serverField.text, usernameField.text, passwordField.text, deviceNameField.text) } onClosed: destroy() diff --git a/src/controller.cpp b/src/controller.cpp index 66ee53ace..1569261a1 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -64,12 +64,14 @@ inline QString accessTokenFileName(const AccountSettings& account) { void Controller::loginWithCredentials(QString serverAddr, QString user, - QString pass) { + QString pass, + QString deviceName) { if (!user.isEmpty() && !pass.isEmpty()) { - QString deviceName = "Spectral " + QSysInfo::machineHostName() + " " + - QSysInfo::productType() + " " + - QSysInfo::productVersion() + " " + - QSysInfo::currentCpuArchitecture(); + if (deviceName.isEmpty()) { + deviceName = "Spectral " + QSysInfo::machineHostName() + " " + + QSysInfo::productType() + " " + QSysInfo::productVersion() + + " " + QSysInfo::currentCpuArchitecture(); + } QUrl serverUrl(serverAddr); diff --git a/src/controller.h b/src/controller.h index ee9bee5ec..49c92c5d3 100644 --- a/src/controller.h +++ b/src/controller.h @@ -31,8 +31,7 @@ class Controller : public QObject { explicit Controller(QObject* parent = nullptr); ~Controller(); - // All the Q_INVOKABLEs. - Q_INVOKABLE void loginWithCredentials(QString, QString, QString); + Q_INVOKABLE void loginWithCredentials(QString, QString, QString, QString); QVector connections() { return m_connections; }