forked from blue/squawk
showing the button for encryption if there is at least one omemo key, trust summary update calculations
This commit is contained in:
parent
4f295fee3c
commit
69d797fe51
9 changed files with 134 additions and 39 deletions
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "chat.h"
|
||||
#include "ui_conversation.h"
|
||||
|
||||
Chat::Chat(Models::Account* acc, Models::Contact* p_contact, QWidget* parent):
|
||||
Conversation(false, acc, p_contact, p_contact->getJid(), "", parent),
|
||||
|
@ -28,14 +29,14 @@ Chat::Chat(Models::Account* acc, Models::Contact* p_contact, QWidget* parent):
|
|||
setAvatar(p_contact->getAvatarPath());
|
||||
|
||||
connect(contact, &Models::Contact::childChanged, this, &Chat::onContactChanged);
|
||||
if (p_contact->hasKeys(Shared::EncryptionProtocol::omemo2))
|
||||
m_ui->encryptionButton->setVisible(true);
|
||||
}
|
||||
|
||||
Chat::~Chat()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void Chat::onContactChanged(Models::Item* item, int row, int col)
|
||||
{
|
||||
void Chat::onContactChanged(Models::Item* item, int row, int col) {
|
||||
if (item == contact) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
|
@ -50,19 +51,20 @@ void Chat::onContactChanged(Models::Item* item, int row, int col)
|
|||
case 7:
|
||||
setAvatar(contact->getAvatarPath());
|
||||
break;
|
||||
case 8:
|
||||
m_ui->encryptionButton->setVisible(contact->hasKeys(Shared::EncryptionProtocol::omemo2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Chat::updateState()
|
||||
{
|
||||
void Chat::updateState() {
|
||||
Shared::Availability av = contact->getAvailability();
|
||||
statusIcon->setPixmap(Shared::availabilityIcon(av, true).pixmap(40));
|
||||
statusIcon->setToolTip(Shared::Global::getName(av));
|
||||
}
|
||||
|
||||
Shared::Message Chat::createMessage() const
|
||||
{
|
||||
Shared::Message Chat::createMessage() const {
|
||||
Shared::Message msg = Conversation::createMessage();
|
||||
msg.setType(Shared::Message::chat);
|
||||
msg.setFrom(account->getFullJid());
|
||||
|
@ -71,14 +73,12 @@ Shared::Message Chat::createMessage() const
|
|||
return msg;
|
||||
}
|
||||
|
||||
void Chat::onMessage(const Shared::Message& data)
|
||||
{
|
||||
void Chat::onMessage(const Shared::Message& data){
|
||||
Conversation::onMessage(data);
|
||||
|
||||
if (!data.getOutgoing()) {
|
||||
const QString& res = data.getPenPalResource();
|
||||
if (res.size() > 0) {
|
||||
if (res.size() > 0)
|
||||
setPalResource(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue