Improve InviteUserPage
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,9 @@ SearchPage {
|
||||
dialog.accepted.connect(() => {
|
||||
root.closeDialog();
|
||||
});
|
||||
dialog.userSelected.connect(userId => {
|
||||
root.connection.requestDirectChat(userId);
|
||||
});
|
||||
dialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user