diff --git a/qml/form/RoomForm.qml b/qml/form/RoomForm.qml index 2ffc236..cc623db 100644 --- a/qml/form/RoomForm.qml +++ b/qml/form/RoomForm.qml @@ -366,9 +366,10 @@ Item { ToolTip.visible: currentRoom && currentRoom.hasUsersTyping ToolTip.text: currentRoom ? currentRoom.usersTyping : "" - Shortcut { - sequence: "Ctrl+Return" - onActivated: { + Keys.onReturnPressed: { + if (event.modifiers & Qt.ShiftModifier) { + inputField.insert(inputField.cursorPosition, "\n") + } else { inputField.postMessage(inputField.text) inputField.text = "" } diff --git a/qml/main.qml b/qml/main.qml index 1325faf..19497f2 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -40,7 +40,8 @@ ApplicationWindow { } onHideWindow: window.hide() onErrorOccured: { - errorLabel.text = error + errorDialog.error = error + errorDialog.detail = detail errorDialog.open() } } @@ -51,14 +52,16 @@ ApplicationWindow { } Dialog { + property string error + property string detail + x: (window.width - width) / 2 y: (window.height - height) / 2 id: errorDialog - title: "Error" - contentItem: Label { - id: errorLabel - } + + title: error + " Error" + contentItem: Label { text: errorDialog.detail } } Component { diff --git a/src/controller.cpp b/src/controller.cpp index 6f32de9..f008085 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -74,7 +74,7 @@ void Controller::loginWithCredentials(QString serverAddr, QString user, addConnection(m_connection); }); connect(m_connection, &Connection::loginError, [=] (QString error, QByteArray detail) { - emit errorOccured(error); + emit errorOccured("Login", error); }); } } @@ -161,7 +161,7 @@ bool Controller::saveAccessToken(const AccountSettings& account, auto fileDir = QFileInfo(accountTokenFile).dir(); if (!((fileDir.exists() || fileDir.mkpath(".")) && accountTokenFile.open(QFile::WriteOnly))) { - emit errorOccured("Cannot save access token."); + emit errorOccured("Token", "Cannot save access token."); } else { accountTokenFile.write(accessToken); return true; diff --git a/src/controller.h b/src/controller.h index 29136d2..e7df9ba 100644 --- a/src/controller.h +++ b/src/controller.h @@ -66,7 +66,7 @@ class Controller : public QObject { signals: void busyChanged(); - void errorOccured(QString error); + void errorOccured(QString error, QString detail); void showWindow(); void hideWindow(); void connectionAdded(Connection* conn);