mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-11 06:47:01 +00:00
feat: show nickname if there is one in the mentions
This commit is contained in:
parent
6f3749d787
commit
d49be78417
@ -8,6 +8,7 @@ type
|
|||||||
Address = UserRole + 3,
|
Address = UserRole + 3,
|
||||||
EnsName = UserRole + 4,
|
EnsName = UserRole + 4,
|
||||||
EnsVerified = UserRole + 5
|
EnsVerified = UserRole + 5
|
||||||
|
LocalNickname = UserRole + 6
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type SuggestionsList* = ref object of QAbstractListModel
|
type SuggestionsList* = ref object of QAbstractListModel
|
||||||
@ -25,7 +26,7 @@ QtObject:
|
|||||||
result.setup
|
result.setup
|
||||||
|
|
||||||
proc rowData(self: SuggestionsList, index: int, column: string): string {.slot.} =
|
proc rowData(self: SuggestionsList, index: int, column: string): string {.slot.} =
|
||||||
if (index >= self.suggestions.len - 1):
|
if (index >= self.suggestions.len):
|
||||||
return
|
return
|
||||||
let suggestion = self.suggestions[index]
|
let suggestion = self.suggestions[index]
|
||||||
case column:
|
case column:
|
||||||
@ -33,6 +34,7 @@ QtObject:
|
|||||||
of "ensName": result = suggestion.ensName
|
of "ensName": result = suggestion.ensName
|
||||||
of "address": result = suggestion.address
|
of "address": result = suggestion.address
|
||||||
of "identicon": result = suggestion.identicon
|
of "identicon": result = suggestion.identicon
|
||||||
|
of "localNickname": result = suggestion.localNickname
|
||||||
|
|
||||||
method rowCount(self: SuggestionsList, index: QModelIndex = nil): int =
|
method rowCount(self: SuggestionsList, index: QModelIndex = nil): int =
|
||||||
return self.suggestions.len
|
return self.suggestions.len
|
||||||
@ -50,12 +52,14 @@ QtObject:
|
|||||||
of SuggestionRoles.Address: result = newQVariant(suggestion.address)
|
of SuggestionRoles.Address: result = newQVariant(suggestion.address)
|
||||||
of SuggestionRoles.EnsName: result = newQVariant(suggestion.ensName)
|
of SuggestionRoles.EnsName: result = newQVariant(suggestion.ensName)
|
||||||
of SuggestionRoles.EnsVerified: result = newQVariant(suggestion.ensVerified)
|
of SuggestionRoles.EnsVerified: result = newQVariant(suggestion.ensVerified)
|
||||||
|
of SuggestionRoles.LocalNickname: result = newQVariant(suggestion.localNickname)
|
||||||
|
|
||||||
method roleNames(self: SuggestionsList): Table[int, string] =
|
method roleNames(self: SuggestionsList): Table[int, string] =
|
||||||
{ SuggestionRoles.Alias.int:"alias",
|
{ SuggestionRoles.Alias.int:"alias",
|
||||||
SuggestionRoles.Identicon.int:"identicon",
|
SuggestionRoles.Identicon.int:"identicon",
|
||||||
SuggestionRoles.Address.int:"address",
|
SuggestionRoles.Address.int:"address",
|
||||||
SuggestionRoles.EnsName.int:"ensName",
|
SuggestionRoles.EnsName.int:"ensName",
|
||||||
|
SuggestionRoles.LocalNickname.int:"localNickname",
|
||||||
SuggestionRoles.EnsVerified.int:"ensVerified" }.toTable
|
SuggestionRoles.EnsVerified.int:"ensVerified" }.toTable
|
||||||
|
|
||||||
proc addSuggestionToList*(self: SuggestionsList, profile: Profile) =
|
proc addSuggestionToList*(self: SuggestionsList, profile: Profile) =
|
||||||
|
@ -164,13 +164,15 @@ StackLayout {
|
|||||||
onActiveChannelChanged: {
|
onActiveChannelChanged: {
|
||||||
chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
|
chatInput.textInput.forceActiveFocus(Qt.MouseFocusReason)
|
||||||
suggestions.clear()
|
suggestions.clear()
|
||||||
for (let i = 0; i < chatsModel.suggestionList.rowCount(); i++) {
|
const len = chatsModel.suggestionList.rowCount()
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
suggestions.append({
|
suggestions.append({
|
||||||
alias: chatsModel.suggestionList.rowData(i, "alias"),
|
alias: chatsModel.suggestionList.rowData(i, "alias"),
|
||||||
ensName: chatsModel.suggestionList.rowData(i, "ensName"),
|
ensName: chatsModel.suggestionList.rowData(i, "ensName"),
|
||||||
address: chatsModel.suggestionList.rowData(i, "address"),
|
address: chatsModel.suggestionList.rowData(i, "address"),
|
||||||
identicon: chatsModel.suggestionList.rowData(i, "identicon"),
|
identicon: chatsModel.suggestionList.rowData(i, "identicon"),
|
||||||
ensVerified: chatsModel.suggestionList.rowData(i, "ensVerified")
|
ensVerified: chatsModel.suggestionList.rowData(i, "ensVerified"),
|
||||||
|
localNickname: chatsModel.suggestionList.rowData(i, "localNickname")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ Rectangle {
|
|||||||
width: messageInput.width
|
width: messageInput.width
|
||||||
filter: messageInputField.text
|
filter: messageInputField.text
|
||||||
cursorPosition: messageInputField.cursorPosition
|
cursorPosition: messageInputField.cursorPosition
|
||||||
property: "ensName, alias"
|
property: "ensName, localNickname, alias"
|
||||||
onItemSelected: function (item, lastAtPosition, lastCursorPosition) {
|
onItemSelected: function (item, lastAtPosition, lastCursorPosition) {
|
||||||
let hasEmoji = Emoji.hasEmoji(messageInputField.text)
|
let hasEmoji = Emoji.hasEmoji(messageInputField.text)
|
||||||
let currentText = hasEmoji ?
|
let currentText = hasEmoji ?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user