some refactoring, some improvements
This commit is contained in:
parent
be466fbad1
commit
e31ef78e71
13 changed files with 188 additions and 147 deletions
|
@ -32,10 +32,7 @@ Chat::Chat(Models::Account* acc, Models::Contact* p_contact, QWidget* parent):
|
|||
|
||||
connect(contact, &Models::Contact::childChanged, this, &Chat::onContactChanged);
|
||||
#ifdef WITH_OMEMO
|
||||
if (p_contact->hasKeys(Shared::EncryptionProtocol::omemo2)) {
|
||||
m_ui->encryptionButton->setVisible(true);
|
||||
updateEncryptionState();
|
||||
}
|
||||
updateEncryptionState();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -59,9 +56,7 @@ void Chat::onContactChanged(Models::Item* item, int row, int col) {
|
|||
setAvatar(contact->getAvatarPath());
|
||||
break;
|
||||
#ifdef WITH_OMEMO
|
||||
case 8:
|
||||
m_ui->encryptionButton->setVisible(contact->hasKeys(Shared::EncryptionProtocol::omemo2));
|
||||
break;
|
||||
case 8: //[fallthrough]
|
||||
case 9:
|
||||
updateEncryptionState();
|
||||
break;
|
||||
|
@ -77,11 +72,16 @@ void Chat::updateState() {
|
|||
}
|
||||
|
||||
void Chat::updateEncryptionState() {
|
||||
m_ui->encryptionButton->setEnabled(true);
|
||||
if (contact->getEncryption() == Shared::EncryptionProtocol::omemo2)
|
||||
m_ui->encryptionButton->setIcon(Shared::icon("lock"));
|
||||
else
|
||||
m_ui->encryptionButton->setIcon(Shared::icon("unlock"));
|
||||
if (contact->hasKeys(Shared::EncryptionProtocol::omemo2)) {
|
||||
m_ui->encryptionButton->setVisible(true);
|
||||
m_ui->encryptionButton->setEnabled(true);
|
||||
if (contact->getEncryption() == Shared::EncryptionProtocol::omemo2)
|
||||
m_ui->encryptionButton->setIcon(Shared::icon("lock"));
|
||||
else
|
||||
m_ui->encryptionButton->setIcon(Shared::icon("unlock"));
|
||||
} else {
|
||||
m_ui->encryptionButton->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue