mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 06:45:45 +02:00
swarmdetails: add "Contact details" option in members list
This allow to easily get URI + QRCode Change-Id: If986b42e46c074971c7467de4d7446d2c8d3a865 GitLab: #955
This commit is contained in:
parent
334f794490
commit
b82842876c
5 changed files with 46 additions and 3 deletions
|
@ -86,6 +86,23 @@ ContextMenuAutoLoader {
|
|||
MessagesAdapter.removeConversationMember(conversationId, participantUri)
|
||||
}
|
||||
}
|
||||
},
|
||||
GeneralMenuItem {
|
||||
id: contactDetails
|
||||
|
||||
itemName: JamiStrings.contactDetails
|
||||
iconSource: JamiResources.person_24dp_svg
|
||||
onClicked: {
|
||||
viewCoordinator.presentDialog(
|
||||
appWindow,
|
||||
"mainview/components/UserProfile.qml",
|
||||
{
|
||||
aliasText: UtilsAdapter.getBestNameForUri(CurrentAccount.id, participantUri),
|
||||
registeredNameText: UtilsAdapter.getBestIdForUri(CurrentAccount.id, participantUri),
|
||||
idText: participantUri,
|
||||
convId: UtilsAdapter.getConvIdForUri(CurrentAccount.id, participantUri)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -56,15 +56,16 @@ BaseModalDialog {
|
|||
rowSpacing: 16
|
||||
columnSpacing: 24
|
||||
|
||||
ConversationAvatar {
|
||||
Avatar {
|
||||
id: contactImage
|
||||
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Layout.preferredWidth: preferredImgSize
|
||||
Layout.preferredHeight: preferredImgSize
|
||||
|
||||
imageId: convId
|
||||
imageId: convId !== "" ? convId : idText
|
||||
showPresenceIndicator: false
|
||||
mode: convId !== "" ? Avatar.Mode.Conversation : Avatar.Mode.Contact
|
||||
}
|
||||
|
||||
// Visible when user alias is not empty and not equal to id.
|
||||
|
@ -193,7 +194,7 @@ BaseModalDialog {
|
|||
|
||||
source: convId !== "" ?
|
||||
"image://qrImage/contact_" + convId :
|
||||
""
|
||||
"image://qrImage/contact_" + idText
|
||||
}
|
||||
|
||||
MaterialButton {
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
// For contact_xxx, xxx is "" initially
|
||||
try {
|
||||
const auto& convInfo = lrcInstance_->getConversationFromConvUid(list[1]);
|
||||
if (convInfo.uid.isEmpty())
|
||||
return {QrType::Contact, list[1]};
|
||||
if (convInfo.mode == conversation::Mode::ONE_TO_ONE
|
||||
|| convInfo.mode == conversation::Mode::NON_SWARM) {
|
||||
auto peerUri = lrcInstance_->getCurrentAccountInfo()
|
||||
|
|
|
@ -194,6 +194,27 @@ UtilsAdapter::getBestNameForUri(const QString& accountId, const QString& uri)
|
|||
return lrcInstance_->getAccountInfo(accountId).contactModel->bestNameForContact(uri);
|
||||
}
|
||||
|
||||
QString
|
||||
UtilsAdapter::getBestIdForUri(const QString& accountId, const QString& uri)
|
||||
{
|
||||
return lrcInstance_->getAccountInfo(accountId).contactModel->bestIdForContact(uri);
|
||||
}
|
||||
|
||||
QString
|
||||
UtilsAdapter::getConvIdForUri(const QString& accountId, const QString& uri)
|
||||
{
|
||||
try {
|
||||
auto* convModel = lrcInstance_->getAccountInfo(accountId).conversationModel.get();
|
||||
auto convInfo = convModel->getConversationForPeerUri(uri);
|
||||
if (!convInfo)
|
||||
return {};
|
||||
return convInfo->get().uid;
|
||||
} catch (const std::out_of_range& e) {
|
||||
qDebug() << e.what();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
const QString
|
||||
UtilsAdapter::getPeerUri(const QString& accountId, const QString& uid)
|
||||
{
|
||||
|
|
|
@ -92,6 +92,8 @@ public:
|
|||
Q_INVOKABLE void setConversationFilter(const QString& filter);
|
||||
Q_INVOKABLE const QString getBestName(const QString& accountId, const QString& uid);
|
||||
Q_INVOKABLE QString getBestNameForUri(const QString& accountId, const QString& uri);
|
||||
Q_INVOKABLE QString getBestIdForUri(const QString& accountId, const QString& uri);
|
||||
Q_INVOKABLE QString getConvIdForUri(const QString& accountId, const QString& uri);
|
||||
Q_INVOKABLE const QString getPeerUri(const QString& accountId, const QString& uid);
|
||||
Q_INVOKABLE QString getBestId(const QString& accountId);
|
||||
Q_INVOKABLE const QString getBestId(const QString& accountId, const QString& uid);
|
||||
|
|
Loading…
Add table
Reference in a new issue