fix: adapt StatusMemeberListItem usages to renamed properties

This commit is contained in:
Patryk Osmaczko 2022-06-12 16:25:17 +02:00 committed by osmaczko
parent 33a3ee3d6e
commit b816643e2d
5 changed files with 77 additions and 106 deletions

View File

@ -394,13 +394,13 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
StatusMemberListItem { StatusMemberListItem {
nickName: "This is an example" nickName: "This is an example"
userName: "annabelle" userName: "annabelle"
chatKey: "0x043a7ed0e8752236a4688563652fd0296453cef00a5dcddbe252dc74f72cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486b443ed1012cf04" pubKey: "0x043a7ed0e8752236a4688563652fd0296453cef00a5dcddbe252dc74f72cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486b443ed1012cf04"
trustIndicator: StatusContactVerificationIcons.TrustedType.Verified isVerified: true
isMutualContact: true isContact: true
image.source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/ image.source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/
nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC" nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
image.isIdenticon: true image.isIdenticon: true
isOnline: true status: 1 // FIXME: use enum
ringSettings.ringSpecModel: ringSettings.ringSpecModel:
ListModel { ListModel {
ListElement {colorId: 13; segmentLength: 5} ListElement {colorId: 13; segmentLength: 5}
@ -416,27 +416,25 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
StatusMemberListItem { StatusMemberListItem {
nickName: "carmen.eth" nickName: "carmen.eth"
isOnline: false isUntrustworthy: true
trustIndicator: StatusContactVerificationIcons.TrustedType.Untrustworthy
} }
StatusMemberListItem { StatusMemberListItem {
nickName: "very-long-annoying-nickname.eth" nickName: "very-long-annoying-nickname.eth"
isOnline: false isUntrustworthy: true
trustIndicator: StatusContactVerificationIcons.TrustedType.Untrustworthy
} }
StatusMemberListItem { StatusMemberListItem {
nickName: "This girl I know from work" nickName: "This girl I know from work"
userName: "annabelle" userName: "annabelle"
isOnline: true status: 1 // FIXME: use enum
} }
StatusMemberListItem { StatusMemberListItem {
nickName: "Mark Cuban" nickName: "Mark Cuban"
userName: "annabelle" userName: "annabelle"
chatKey: "0x043a7ed0e8752236a4688563652fd0296453cef00a5dcddbe252dc74f72cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486b443ed1012cf04" pubKey: "0x043a7ed0e8752236a4688563652fd0296453cef00a5dcddbe252dc74f72cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486b443ed1012cf04"
isMutualContact: true isContact: true
image.source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/ image.source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/
nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC" nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
image.isIdenticon: true image.isIdenticon: true
@ -444,8 +442,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
StatusMemberListItem { StatusMemberListItem {
nickName: "admin.guy" nickName: "admin.guy"
isOnline: false
isAdmin: true isAdmin: true
trustIndicator: StatusContactVerificationIcons.TrustedType.Untrustworthy isUntrustworthy: true
} }
} }

View File

@ -36,7 +36,7 @@ Page {
var index = -1; var index = -1;
if (!!contactsModel) { if (!!contactsModel) {
for (var i = 0; i < contactsModel.count; i++) { for (var i = 0; i < contactsModel.count; i++) {
if (contactsModel.get(i).publicId === pubKey) { if (contactsModel.get(i).pubKey === pubKey) {
index = i; index = i;
} }
} }

View File

@ -267,15 +267,15 @@ StatusAppThreePanelLayout {
model: Models.membersListModel model: Models.membersListModel
delegate: StatusMemberListItem { delegate: StatusMemberListItem {
implicitWidth: parent.width implicitWidth: parent.width
nickName: model.nickName nickName: model.localNickname
userName: model.name userName: model.displayName
chatKey: model.publicId pubKey: model.pubKey
trustIndicator: model.trustIndicator isVerified: model.isVerified
isMutualContact: model.isMutualContact isUntrustworthy: model.isUntrustworthy
isContact: model.isContact
image.source: model.icon image.source: model.icon
image.isIdenticon: model.isIdenticon image.isIdenticon: false
isOnline: model.onlineStatus status: model.onlineStatus
ringSettings.ringSpecModel: model.ringSpecModel
} }
} }
} }

View File

@ -843,73 +843,50 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
property var membersListModel: ListModel { property var membersListModel: ListModel {
id: membersList id: membersList
ListElement { ListElement {
nickName: "This is an example" localNickname: "This is an example"
name: "Maria" displayName: "Maria"
publicId: "0x043a7ed0e8752236a4688563652fd0296453cef00a5dcddbe252dc74f72cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486b443ed1012cf04" pubKey: "0x043a7ed0e8752236a4688563652fd0296453cef00a5dcddbe252dc74f72cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486b443ed1012cf04"
trustIndicator: StatusContactVerificationIcons.TrustedType.Verified isVerified: true
isMutualContact: true isUntrustworthy: false
onlineStatus: true isContact: true
onlineStatus: 1
icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/ icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/
nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC" nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
isIdenticon: true
isAdmin: false isAdmin: false
ringSpecModel: [ ListElement {colorId: 13; segmentLength: 5},
ListElement {colorId: 31; segmentLength: 5},
ListElement {colorId: 10; segmentLength: 1},
ListElement {colorId: 2; segmentLength: 5},
ListElement {colorId: 26; segmentLength: 2},
ListElement {colorId: 19; segmentLength: 4},
ListElement {colorId: 28; segmentLength: 3} ]
} }
ListElement { ListElement {
nickName: "" localNickname: ""
name: "carmen.eth" displayName: "carmen.eth"
publicId: "0x043a7ed78362567894688563652fd0296453cef00a5dcddbe252dc74f72cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486b443ed1012cf04" pubKey: "0x043a7ed78362567894688563652fd0296453cef00a5dcddbe252dc74f72cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486b443ed1012cf04"
trustIndicator: StatusContactVerificationIcons.TrustedType.Untrustworthy isVerified: false
isMutualContact: false isUntrustworthy: true
onlineStatus: false isContact: false
onlineStatus: 0
icon: "" icon: ""
isAdmin: false isAdmin: false
isIdenticon: false
} }
ListElement { ListElement {
nickName: "This girl I know from work" localNickname: "This girl I know from work"
name: "annabelle" displayName: "annabelle"
publicId: "0x043a7ed0e8752236a4688563652fd0296453cef00a5dcddbe252dc74f72cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486dsfkjghyu2cf04" pubKey: "0x043a7ed0e8752236a4688563652fd0296453cef00a5dcddbe252dc74f72cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486dsfkjghyu2cf04"
trustIndicator: StatusContactVerificationIcons.TrustedType.None isVerified: false
isMutualContact: false isUntrustworthy: false
onlineStatus: true isContact: false
onlineStatus: 1
isAdmin: false isAdmin: false
icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAiElEQVR4nOzXUQpAQBRGYWQvLNAyLJDV8C5qpiGnv/M9al5Ot27X0IUwhMYQGkNoDKGJCRlLH67bftx9X+ap/+P9VcxEDK icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAiElEQVR4nOzXUQpAQBRGYWQvLNAyLJDV8C5qpiGnv/M9al5Ot27X0IUwhMYQGkNoDKGJCRlLH67bftx9X+ap/+P9VcxEDK
ExhKZ4a9Uq3TZviZmIITSG0DRvlqcbqVbrlouZiCE0htD4h0hjCI0hNN5aNIbQGKKPxEzEEBpDaAyhMYTmDAAA//+gYCErzmCpCQAAAABJRU5ErkJggg==" ExhKZ4a9Uq3TZviZmIITSG0DRvlqcbqVbrlouZiCE0htD4h0hjCI0hNN5aNIbQGKKPxEzEEBpDaAyhMYTmDAAA//+gYCErzmCpCQAAAABJRU5ErkJggg=="
isIdenticon: true
ringSpecModel: [ ListElement {colorId: 11; segmentLength: 1},
ListElement {colorId: 23; segmentLength: 5},
ListElement {colorId: 23; segmentLength: 5},
ListElement {colorId: 10; segmentLength: 4},
ListElement {colorId: 15; segmentLength: 3},
ListElement {colorId: 26; segmentLength: 2},
ListElement {colorId: 29; segmentLength: 5} ]
} }
ListElement { ListElement {
nickName: "Mark Cuban" localNickname: "Mark Cuban"
name: "mark.eth" displayName: "mark.eth"
publicId: "0x043a7ed0e8752236a4688563652fd0296453cef00a5dcddbe252dc79872cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486b443ed1012cf04" pubKey: "0x043a7ed0e8752236a4688563652fd0296453cef00a5dcddbe252dc79872cc1caa97a2b65e4a1a52d9c30a84c9966beaaaf6b333d659cbdd2e486b443ed1012cf04"
trustIndicator: StatusContactVerificationIcons.TrustedType.Untrustworthy isVerified: false
isMutualContact: true isUntrustworthy: true
onlineStatus: false isContact: true
onlineStatus: 0
icon: "" icon: ""
isIdenticon: false
isAdmin: false isAdmin: false
ringSpecModel: [ ListElement {colorId: 0; segmentLength: 1},
ListElement {colorId: 28; segmentLength: 1},
ListElement {colorId: 31; segmentLength: 1},
ListElement {colorId: 22; segmentLength: 4},
ListElement {colorId: 28; segmentLength: 3},
ListElement {colorId: 27; segmentLength: 5},
ListElement {colorId: 7; segmentLength: 5},
ListElement {colorId: 13; segmentLength: 1},
ListElement {colorId: 25; segmentLength: 4}]
} }
} }

View File

@ -26,24 +26,21 @@ import StatusQ.Controls 0.1
anchors.centerIn: parent anchors.centerIn: parent
namesModel: ListModel { namesModel: ListModel {
ListElement { ListElement {
publicId: "0x0" pubKey: "0x0"
name: "Maria" name: "Maria"
icon: "" icon: ""
isIdenticon: false
onlineStatus: 3 onlineStatus: 3
} }
ListElement { ListElement {
publicId: "0x1" pubKey: "0x1"
name: "James" name: "James"
icon: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg" icon: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg"
isIdenticon: false
onlineStatus: 1 onlineStatus: 1
} }
ListElement { ListElement {
publicId: "0x2" pubKey: "0x2"
name: "Paul" name: "Paul"
icon: "" icon: ""
isIdenticon: false
onlineStatus: 2 onlineStatus: 2
} }
} }
@ -154,11 +151,11 @@ Item {
This function is used to insert a new tag. This function is used to insert a new tag.
*/ */
function insertTag(name, id, isReadonly, tagIcon) { function insertTag(name, id, isReadonly, tagIcon) {
if (!find(namesModel, function(item) { return item.publicId === id }) && namesModel.count < root.nameCountLimit) { if (!find(namesModel, function(item) { return item.pubKey === id }) && namesModel.count < root.nameCountLimit) {
if(orderByReadonly && isReadonly) if(orderByReadonly && isReadonly)
namesModel.insert(0, {"name": name, "publicId": id, "isReadonly": !!isReadonly, "tagIcon": tagIcon ? tagIcon : ""}); namesModel.insert(0, {"name": name, "pubKey": id, "isReadonly": !!isReadonly, "tagIcon": tagIcon ? tagIcon : ""});
else else
namesModel.insert(namesModel.count, {"name": name, "publicId": id, "isReadonly": !!isReadonly, "tagIcon": tagIcon ? tagIcon : ""}); namesModel.insert(namesModel.count, {"name": name, "pubKey": id, "isReadonly": !!isReadonly, "tagIcon": tagIcon ? tagIcon : ""});
addMember(id); addMember(id);
edit.clear(); edit.clear();
} }
@ -173,16 +170,16 @@ Item {
if (text !== "") { if (text !== "") {
for (var i = 0; i < inputModel.count; i++ ) { for (var i = 0; i < inputModel.count; i++ ) {
var entry = inputModel.get(i); var entry = inputModel.get(i);
if (entry.name.toLowerCase().includes(text.toLowerCase()) && if (entry.displayName.toLowerCase().includes(text.toLowerCase()) &&
!find(namesModel, function(item) { return item.name === entry.name })) { !find(namesModel, function(item) { return item.name === entry.displayName })) {
sortedList.append({"publicId": entry.publicId, sortedList.append({"pubKey": entry.pubKey,
"name": entry.name, "displayName": entry.displayName,
"nickName": entry.nickName, "localNickname": entry.localNickname,
"trustIndicator": entry.trustIndicator, "isVerified": entry.isVerified,
"isMutualContact": entry.isMutualContact, "isUntrustworthy": entry.isUntrustworthy,
"isContact": entry.isMutualContact,
"ringSpecModel": entry.ringSpecModel, "ringSpecModel": entry.ringSpecModel,
"icon": entry.icon, "icon": entry.icon,
"isIdenticon": entry.isIdenticon,
"onlineStatus": entry.onlineStatus, "onlineStatus": entry.onlineStatus,
"tagIcon": entry.tagIcon ? entry.tagIcon : "", "tagIcon": entry.tagIcon ? entry.tagIcon : "",
"isReadonly": !!entry.isReadonly}); "isReadonly": !!entry.isReadonly});
@ -284,7 +281,7 @@ Item {
icon: model.tagIcon icon: model.tagIcon
onClicked: { onClicked: {
removeMember(model.publicId); removeMember(model.pubKey);
namesModel.remove(index, 1); namesModel.remove(index, 1);
} }
} }
@ -307,12 +304,12 @@ Item {
if ((event.key === Qt.Key_Backspace || event.key === Qt.Key_Escape) if ((event.key === Qt.Key_Backspace || event.key === Qt.Key_Escape)
&& getText(cursorPosition, (cursorPosition-1)) === "" && getText(cursorPosition, (cursorPosition-1)) === ""
&& (namesList.count-1) >= 0) { && (namesList.count-1) >= 0) {
removeMember(namesModel.get(namesList.count-1).publicId); removeMember(namesModel.get(namesList.count-1).pubKey);
namesModel.remove((namesList.count-1), 1); namesModel.remove((namesList.count-1), 1);
} }
if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && (sortedList.count > 0)) { if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && (sortedList.count > 0)) {
root.insertTag(sortedList.get(userListView.currentIndex).name, root.insertTag(sortedList.get(userListView.currentIndex).name,
sortedList.get(userListView.currentIndex).publicId, sortedList.get(userListView.currentIndex).pubKey,
sortedList.get(userListView.currentIndex).isReadonly, sortedList.get(userListView.currentIndex).isReadonly,
sortedList.get(userListView.currentIndex).tagIcon); sortedList.get(userListView.currentIndex).tagIcon);
} }
@ -401,27 +398,27 @@ Item {
height: visible ? 64 : 0 height: visible ? 64 : 0
visible: { visible: {
for (let i = 0; i < namesModel.count; i++) { for (let i = 0; i < namesModel.count; i++) {
if (namesModel.get(i).publicId === model.publicId) { if (namesModel.get(i).pubKey === model.pubKey) {
return false return false
} }
} }
return true return true
} }
nickName: model.nickName nickName: model.localNickname
userName: model.name userName: model.displayName
pubKey: root.compressedKeyGetter(model.publicId) pubKey: root.compressedKeyGetter(model.pubKey)
isVerified: false // FIXME isVerified: model.isVerified
isUntrustworthy: false // FIXME isUntrustworthy: model.isUntrustworthy
isContact: model.isMutualContact isContact: model.isContact
image.source: model.icon image.source: model.icon
image.isIdenticon: model.isIdenticon image.isIdenticon: false
icon.color: Theme.palette.userCustomizationColors[root.colorIdForPubkeyGetter(model.publicId)] icon.color: Theme.palette.userCustomizationColors[root.colorIdForPubkeyGetter(model.pubKey)]
status: model.onlineStatus status: model.onlineStatus
statusListItemIcon.badge.border.color: sensor.containsMouse ? Theme.palette.baseColor2 : Theme.palette.baseColor4 statusListItemIcon.badge.border.color: sensor.containsMouse ? Theme.palette.baseColor2 : Theme.palette.baseColor4
ringSettings.ringSpecModel: root.ringSpecModelGetter(publicId) ringSettings.ringSpecModel: root.ringSpecModelGetter(model.pubKey)
color: (sensor.containsMouse || highlighted) ? Theme.palette.baseColor2 : "transparent" color: (sensor.containsMouse || highlighted) ? Theme.palette.baseColor2 : "transparent"
onClicked: { onClicked: {
root.insertTag(model.name, model.publicId, model.isAdmin, model.isAdmin ? "crown" : ""); root.insertTag(model.displayName, model.pubKey, model.isAdmin, model.isAdmin ? "crown" : "");
} }
} }
} }