diff --git a/src/app/qml/ManualUserDialog.qml b/src/app/qml/ManualUserDialog.qml index 54a4f2e3f..54410a740 100644 --- a/src/app/qml/ManualUserDialog.qml +++ b/src/app/qml/ManualUserDialog.qml @@ -21,7 +21,7 @@ Kirigami.Dialog { /** * @brief Thrown when a user is selected. */ - signal userSelected + signal userSelected(string userId) title: i18nc("@title", "User ID") @@ -38,7 +38,7 @@ Kirigami.Dialog { text: i18n("OK") icon.name: "dialog-ok" onTriggered: { - root.connection.requestDirectChat(userIdText.text); + root.userSelected(userIdText.text) root.accept(); } } diff --git a/src/app/qml/UserSearchPage.qml b/src/app/qml/UserSearchPage.qml index 155ae1bd3..bea027af4 100644 --- a/src/app/qml/UserSearchPage.qml +++ b/src/app/qml/UserSearchPage.qml @@ -106,6 +106,9 @@ SearchPage { dialog.accepted.connect(() => { root.closeDialog(); }); + dialog.userSelected.connect(userId => { + root.connection.requestDirectChat(userId); + }); dialog.open(); } } diff --git a/src/libneochat/qml/InviteUserPage.qml b/src/libneochat/qml/InviteUserPage.qml index adbaecdf7..35f3c4fe3 100644 --- a/src/libneochat/qml/InviteUserPage.qml +++ b/src/libneochat/qml/InviteUserPage.qml @@ -23,6 +23,8 @@ SearchPage { searchFieldPlaceholder: i18nc("@info:placeholder", "Find a user…") noResultPlaceholderMessage: i18nc("@info:placeholder", "No users found") + noSearchPlaceholderMessage: i18nc("@placeholder", "Enter text to start searching for users") + headerTrailing: QQC2.Button { icon.name: "list-add" display: QQC2.Button.IconOnly @@ -37,6 +39,15 @@ SearchPage { onClicked: root.room.inviteToRoom(root.model.searchText); } + noSearchHelpfulAction: noResultHelpfulAction + + noResultHelpfulAction: Kirigami.Action { + icon.name: "list-add-user" + text: i18nc("@action:button", "Enter a User ID") + onTriggered: _private.openManualUserDialog() + tooltip: text + } + model: UserDirectoryListModel { id: userDictListModel @@ -87,4 +98,26 @@ SearchPage { } } } + + Component { + id: manualUserDialog + ManualUserDialog {} + } + + QtObject { + id: _private + function openManualUserDialog(): void { + let dialog = manualUserDialog.createObject(this, { + connection: root.connection + }); + dialog.parent = root.Window.window.overlay; + dialog.accepted.connect(() => { + root.closeDialog(); + }); + dialog.userSelected.connect(userId => { + root.room.inviteToRoom(userId) + }); + dialog.open(); + } + } }