forked from blue/squawk
some work towards encryption
This commit is contained in:
parent
297e08ba41
commit
a7d1a28f29
21 changed files with 129 additions and 81 deletions
|
@ -36,6 +36,10 @@ Models::Contact::Contact(const Account* acc, const QString& p_jid ,const QMap<QS
|
|||
itr = data.find("trust");
|
||||
if (itr != data.end())
|
||||
setTrust(itr.value().value<Shared::TrustSummary>());
|
||||
|
||||
itr = data.find("encryption");
|
||||
if (itr != data.end())
|
||||
setEncryption(itr.value().value<Shared::EncryptionProtocol>());
|
||||
}
|
||||
|
||||
Models::Contact::~Contact() {}
|
||||
|
@ -71,7 +75,7 @@ void Models::Contact::setStatus(const QString& p_state) {
|
|||
}
|
||||
|
||||
int Models::Contact::columnCount() const {
|
||||
return 9;
|
||||
return 10;
|
||||
}
|
||||
|
||||
QVariant Models::Contact::data(int column) const {
|
||||
|
@ -94,6 +98,8 @@ QVariant Models::Contact::data(int column) const {
|
|||
return getAvatarPath();
|
||||
case 8:
|
||||
return QVariant::fromValue(getTrust());
|
||||
case 9:
|
||||
return QVariant::fromValue(getEncryption());
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -115,6 +121,8 @@ void Models::Contact::update(const QString& field, const QVariant& value) {
|
|||
setState(value.toUInt());
|
||||
} else if (field == "trust") {
|
||||
setTrust(value.value<Shared::TrustSummary>());
|
||||
} else if (field == "encryption") {
|
||||
setEncryption(value.value<Shared::EncryptionProtocol>());
|
||||
} else {
|
||||
Element::update(field, value);
|
||||
}
|
||||
|
@ -254,3 +262,18 @@ bool Models::Contact::hasKeys(Shared::EncryptionProtocol protocol) const {
|
|||
return trust.hasKeys(protocol);
|
||||
}
|
||||
|
||||
void Models::Contact::setEncryption(Shared::EncryptionProtocol p_enc) {
|
||||
if (encryption != p_enc) {
|
||||
encryption = p_enc;
|
||||
changed(9);
|
||||
}
|
||||
}
|
||||
|
||||
void Models::Contact::setEncryption(unsigned int p_enc) {
|
||||
setEncryption(Shared::Global::fromInt<Shared::EncryptionProtocol>(p_enc));
|
||||
}
|
||||
|
||||
Shared::EncryptionProtocol Models::Contact::getEncryption() const {
|
||||
return encryption;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
|
||||
Shared::Availability getAvailability() const;
|
||||
Shared::SubscriptionState getState() const;
|
||||
Shared::EncryptionProtocol getEncryption() const;
|
||||
|
||||
QIcon getStatusIcon(bool big = false) const;
|
||||
|
||||
|
@ -78,6 +79,8 @@ protected:
|
|||
void setState(unsigned int p_state);
|
||||
void setStatus(const QString& p_state);
|
||||
void setTrust(const Shared::TrustSummary& p_trust);
|
||||
void setEncryption(Shared::EncryptionProtocol p_enc);
|
||||
void setEncryption(unsigned int p_enc);
|
||||
|
||||
private:
|
||||
Shared::Availability availability;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue