beginning of keys setting

This commit is contained in:
Blue 2023-11-16 21:08:40 -03:00
parent 75554c7451
commit 8f5325b291
Signed by: blue
GPG Key ID: 9B203B252A63EE38
11 changed files with 385 additions and 323 deletions

View File

@ -806,6 +806,14 @@ void Core::Account::updateInfo(const Shared::Info& info) {
//TODO switch case of what kind of entity this info update is about //TODO switch case of what kind of entity this info update is about
//right now it could be only about myself //right now it could be only about myself
vh->uploadVCard(info.getVCardRef()); vh->uploadVCard(info.getVCardRef());
const std::list<Shared::KeyInfo>& keys = info.getActiveKeysRef();
for (const Shared::KeyInfo& info : keys) {
qDebug() << "An attempt to save key: ";
qDebug() << "id:" << info.id;
qDebug() << "label:" << info.label;
qDebug() << "current device:" << info.currentDevice;
qDebug() << "... but it's not implemented yet, ignoring";
}
} }
QString Core::Account::getAvatarPath() const { QString Core::Account::getAvatarPath() const {

View File

@ -67,11 +67,9 @@
#include "handlers/omemohandler.h" #include "handlers/omemohandler.h"
#endif #endif
namespace Core namespace Core {
{
class Account : public QObject class Account : public QObject {
{
Q_OBJECT Q_OBJECT
friend class MessageHandler; friend class MessageHandler;
friend class RosterHandler; friend class RosterHandler;

View File

@ -41,8 +41,6 @@
#include <core/delayManager/manager.h> #include <core/delayManager/manager.h>
namespace Core { namespace Core {
class Account; class Account;
class RosterHandler : public QObject { class RosterHandler : public QObject {

View File

@ -1,353 +1,384 @@
// Squawk messenger. /*
// Copyright (C) 2019 Yury Gubich <blue@macaw.me> * Squawk messenger.
// * Copyright (C) 2019 Yury Gubich <blue@macaw.me>
// This program is free software: you can redistribute it and/or modify *
// it under the terms of the GNU General Public License as published by * This program is free software: you can redistribute it and/or modify
// the Free Software Foundation, either version 3 of the License, or * it under the terms of the GNU General Public License as published by
// (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// This program is distributed in the hope that it will be useful, *
// but WITHOUT ANY WARRANTY; without even the implied warranty of * This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU General Public License for more details. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// You should have received a copy of the GNU General Public License *
// along with this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "info.h" #include "info.h"
Shared::Info::Info(const QString& addr, EntryType tp): Shared::Info::Info(const QString &addr, EntryType tp):
type(tp), type(tp),
address(addr), address(addr),
vcard(nullptr), vcard(nullptr),
activeKeys(nullptr), activeKeys(nullptr),
inactiveKeys(nullptr) inactiveKeys(nullptr) {
{
switch (type) { switch (type) {
case EntryType::none: case EntryType::none:
break; break;
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
vcard = new VCard(); vcard = new VCard();
activeKeys = new std::list<KeyInfo>(); activeKeys = new std::list<KeyInfo>();
inactiveKeys = new std::list<KeyInfo>(); inactiveKeys = new std::list<KeyInfo>();
break; break;
default: default:
throw 352; throw 352;
} }
} }
Shared::Info::Info(): Shared::Info::Info():
type(EntryType::none), type(EntryType::none),
address(""), address(""),
vcard(nullptr), vcard(nullptr),
activeKeys(nullptr), activeKeys(nullptr),
inactiveKeys(nullptr) inactiveKeys(nullptr) {}
{}
Shared::Info::Info(const Shared::Info& other): Shared::Info::Info(const Shared::Info &other):
type(other.type), type(other.type),
address(other.address), address(other.address),
vcard(nullptr), vcard(nullptr),
activeKeys(nullptr), activeKeys(nullptr),
inactiveKeys(nullptr) inactiveKeys(nullptr) {
{
switch (type) { switch (type) {
case EntryType::none: case EntryType::none:
break; break;
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
vcard = new VCard(other.getVCardRef()); vcard = new VCard(other.getVCardRef());
activeKeys = new std::list<KeyInfo>(other.getActiveKeysRef()); activeKeys = new std::list<KeyInfo>(other.getActiveKeysRef());
inactiveKeys = new std::list<KeyInfo>(other.getInactiveKeysRef()); inactiveKeys = new std::list<KeyInfo>(other.getInactiveKeysRef());
break; break;
default: default:
throw 353; throw 353;
} }
} }
Shared::Info::Info(Info &&other):
type(other.type),
address(other.address),
vcard(other.vcard),
activeKeys(other.activeKeys),
inactiveKeys(other.inactiveKeys) {
other.type = EntryType::none;
}
Shared::Info &Shared::Info::operator=(Info &&other) {
type = other.type;
address = other.address;
vcard = other.vcard;
activeKeys = other.activeKeys;
inactiveKeys = other.inactiveKeys;
other.type = EntryType::none;
return *this;
}
Shared::Info &Shared::Info::operator=(const Info &other) {
type = other.type;
address = other.address;
switch (type) {
case EntryType::none:
break;
case EntryType::contact:
case EntryType::ownAccount:
vcard = new VCard(other.getVCardRef());
activeKeys = new std::list<KeyInfo>(other.getActiveKeysRef());
inactiveKeys = new std::list<KeyInfo>(other.getInactiveKeysRef());
break;
default:
throw 351;
}
return *this;
}
Shared::Info::~Info() { Shared::Info::~Info() {
turnIntoNone(); turnIntoNone();
} }
void Shared::Info::turnIntoNone() { void Shared::Info::turnIntoNone() {
switch (type) { switch (type) {
case EntryType::none: case EntryType::none:
break; break;
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
delete vcard; delete vcard;
vcard = nullptr; vcard = nullptr;
delete activeKeys; delete activeKeys;
activeKeys = nullptr; activeKeys = nullptr;
delete inactiveKeys; delete inactiveKeys;
inactiveKeys = nullptr; inactiveKeys = nullptr;
break; break;
default: default:
break; break;
} }
type = EntryType::none; type = EntryType::none;
} }
void Shared::Info::turnIntoContact( void Shared::Info::turnIntoContact(
const Shared::VCard& crd, const Shared::VCard &crd, const std::list<KeyInfo> &aks, const std::list<KeyInfo> &iaks
const std::list<KeyInfo>& aks,
const std::list<KeyInfo>& iaks
) { ) {
switch (type) { switch (type) {
case EntryType::none: case EntryType::none:
vcard = new VCard(crd); vcard = new VCard(crd);
activeKeys = new std::list<KeyInfo>(aks); activeKeys = new std::list<KeyInfo>(aks);
inactiveKeys = new std::list<KeyInfo>(iaks); inactiveKeys = new std::list<KeyInfo>(iaks);
break; break;
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
*vcard = crd; *vcard = crd;
*activeKeys = aks; *activeKeys = aks;
*inactiveKeys = iaks; *inactiveKeys = iaks;
break; break;
default: default:
break; break;
} }
type = EntryType::contact; type = EntryType::contact;
} }
void Shared::Info::turnIntoContact( void Shared::Info::turnIntoContact(Shared::VCard *crd, std::list<KeyInfo> *aks, std::list<KeyInfo> *iaks) {
Shared::VCard* crd,
std::list<KeyInfo>* aks,
std::list<KeyInfo>* iaks
) {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
delete vcard; delete vcard;
delete activeKeys; delete activeKeys;
delete inactiveKeys; delete inactiveKeys;
[[fallthrough]]; [[fallthrough]];
case EntryType::none: case EntryType::none:
vcard = crd; vcard = crd;
activeKeys = aks; activeKeys = aks;
inactiveKeys = iaks; inactiveKeys = iaks;
break; break;
default: default:
break; break;
} }
type = EntryType::contact; type = EntryType::contact;
} }
void Shared::Info::turnIntoOwnAccount( void Shared::Info::turnIntoOwnAccount(
const Shared::VCard& crd, const Shared::VCard &crd, const std::list<KeyInfo> &aks, const std::list<KeyInfo> &iaks
const std::list<KeyInfo>& aks,
const std::list<KeyInfo>& iaks
) {
switch (type) {
case EntryType::none:
vcard = new VCard(crd);
activeKeys = new std::list<KeyInfo>(aks);
inactiveKeys = new std::list<KeyInfo>(iaks);
break;
case EntryType::contact:
case EntryType::ownAccount:
*vcard = crd;
*activeKeys = aks;
*inactiveKeys = iaks;
break;
default:
break;
}
type = EntryType::ownAccount;
}
void Shared::Info::turnIntoOwnAccount(
Shared::VCard* crd,
std::list<KeyInfo>* aks,
std::list<KeyInfo>* iaks
) { ) {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::none:
case EntryType::ownAccount: vcard = new VCard(crd);
delete vcard; activeKeys = new std::list<KeyInfo>(aks);
delete activeKeys; inactiveKeys = new std::list<KeyInfo>(iaks);
delete inactiveKeys; break;
[[fallthrough]]; case EntryType::contact:
case EntryType::none: case EntryType::ownAccount:
vcard = crd; *vcard = crd;
activeKeys = aks; *activeKeys = aks;
inactiveKeys = iaks; *inactiveKeys = iaks;
break; break;
default: default:
break; break;
} }
type = EntryType::ownAccount; type = EntryType::ownAccount;
} }
void Shared::Info::setAddress(const QString& addr) { void Shared::Info::turnIntoOwnAccount(Shared::VCard *crd, std::list<KeyInfo> *aks, std::list<KeyInfo> *iaks) {
address = addr;} switch (type) {
case EntryType::contact:
case EntryType::ownAccount:
delete vcard;
delete activeKeys;
delete inactiveKeys;
[[fallthrough]];
case EntryType::none:
vcard = crd;
activeKeys = aks;
inactiveKeys = iaks;
break;
default:
break;
}
type = EntryType::ownAccount;
}
void Shared::Info::setAddress(const QString &addr) {
address = addr;
}
QString Shared::Info::getAddress() const { QString Shared::Info::getAddress() const {
return address;} return address;
}
const QString& Shared::Info::getAddressRef() const { const QString &Shared::Info::getAddressRef() const {
return address;} return address;
}
Shared::EntryType Shared::Info::getType() const { Shared::EntryType Shared::Info::getType() const {
return type;} return type;
}
std::list<Shared::KeyInfo> & Shared::Info::getActiveKeysRef() { std::list<Shared::KeyInfo> &Shared::Info::getActiveKeysRef() {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return *activeKeys; return *activeKeys;
break; break;
default: default:
throw 354; throw 354;
} }
} }
const std::list<Shared::KeyInfo> & Shared::Info::getActiveKeysRef() const { const std::list<Shared::KeyInfo> &Shared::Info::getActiveKeysRef() const {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return *activeKeys; return *activeKeys;
break; break;
default: default:
throw 355; throw 355;
} }
} }
std::list<Shared::KeyInfo>* Shared::Info::getActiveKeys() { std::list<Shared::KeyInfo> *Shared::Info::getActiveKeys() {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return activeKeys; return activeKeys;
break; break;
default: default:
throw 356; throw 356;
} }
} }
const std::list<Shared::KeyInfo>* Shared::Info::getActiveKeys() const { const std::list<Shared::KeyInfo> *Shared::Info::getActiveKeys() const {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return activeKeys; return activeKeys;
break; break;
default: default:
throw 357; throw 357;
} }
} }
std::list<Shared::KeyInfo> & Shared::Info::getInactiveKeysRef() { std::list<Shared::KeyInfo> &Shared::Info::getInactiveKeysRef() {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return *inactiveKeys; return *inactiveKeys;
break; break;
default: default:
throw 358; throw 358;
} }
} }
const std::list<Shared::KeyInfo> & Shared::Info::getInactiveKeysRef() const { const std::list<Shared::KeyInfo> &Shared::Info::getInactiveKeysRef() const {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return *inactiveKeys; return *inactiveKeys;
break; break;
default: default:
throw 359; throw 359;
} }
} }
std::list<Shared::KeyInfo>* Shared::Info::getInactiveKeys() { std::list<Shared::KeyInfo> *Shared::Info::getInactiveKeys() {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return inactiveKeys; return inactiveKeys;
break; break;
default: default:
throw 360; throw 360;
} }
} }
const std::list<Shared::KeyInfo>* Shared::Info::getInactiveKeys() const { const std::list<Shared::KeyInfo> *Shared::Info::getInactiveKeys() const {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return inactiveKeys; return inactiveKeys;
break; break;
default: default:
throw 361; throw 361;
} }
} }
const Shared::VCard & Shared::Info::getVCardRef() const { const Shared::VCard &Shared::Info::getVCardRef() const {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return *vcard; return *vcard;
break; break;
default: default:
throw 362; throw 362;
} }
} }
Shared::VCard & Shared::Info::getVCardRef() { Shared::VCard &Shared::Info::getVCardRef() {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return *vcard; return *vcard;
break; break;
default: default:
throw 363; throw 363;
} }
} }
const Shared::VCard * Shared::Info::getVCard() const { const Shared::VCard *Shared::Info::getVCard() const {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return vcard; return vcard;
break; break;
default: default:
throw 364; throw 364;
} }
} }
Shared::VCard * Shared::Info::getVCard() { Shared::VCard *Shared::Info::getVCard() {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
return vcard; return vcard;
break; break;
default: default:
throw 365; throw 365;
} }
} }
void Shared::Info::setActiveKeys(std::list<KeyInfo>* keys) { void Shared::Info::setActiveKeys(std::list<KeyInfo> *keys) {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
activeKeys = keys; activeKeys = keys;
break; break;
default: default:
throw 366; throw 366;
} }
} }
void Shared::Info::setVCard(Shared::VCard* card) { void Shared::Info::setVCard(Shared::VCard *card) {
switch (type) { switch (type) {
case EntryType::contact: case EntryType::contact:
case EntryType::ownAccount: case EntryType::ownAccount:
vcard = card; vcard = card;
break; break;
default: default:
throw 367; throw 367;
} }
} }

View File

@ -1,21 +1,22 @@
// Squawk messenger. /*
// Copyright (C) 2019 Yury Gubich <blue@macaw.me> * Squawk messenger.
// * Copyright (C) 2019 Yury Gubich <blue@macaw.me>
// This program is free software: you can redistribute it and/or modify *
// it under the terms of the GNU General Public License as published by * This program is free software: you can redistribute it and/or modify
// the Free Software Foundation, either version 3 of the License, or * it under the terms of the GNU General Public License as published by
// (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// This program is distributed in the hope that it will be useful, *
// but WITHOUT ANY WARRANTY; without even the implied warranty of * This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU General Public License for more details. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// You should have received a copy of the GNU General Public License *
// along with this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SHARED_INFO_H #pragma once
#define SHARED_INFO_H
#include "vcard.h" #include "vcard.h"
#include "keyinfo.h" #include "keyinfo.h"
@ -36,7 +37,10 @@ public:
Info(); Info();
Info(const QString& address, EntryType = EntryType::none); Info(const QString& address, EntryType = EntryType::none);
Info(const Info& other); Info(const Info& other);
Info(Info&& other);
virtual ~Info(); virtual ~Info();
Info& operator = (const Info& other);
Info& operator = (Info&& other);
QString getAddress() const; QString getAddress() const;
const QString& getAddressRef() const; const QString& getAddressRef() const;
@ -90,7 +94,4 @@ private:
std::list<KeyInfo>* activeKeys; std::list<KeyInfo>* activeKeys;
std::list<KeyInfo>* inactiveKeys; std::list<KeyInfo>* inactiveKeys;
}; };
} }
#endif // SHARED_INFO_H

View File

@ -1,18 +1,20 @@
// Squawk messenger. /*
// Copyright (C) 2019 Yury Gubich <blue@macaw.me> * Squawk messenger.
// * Copyright (C) 2019 Yury Gubich <blue@macaw.me>
// This program is free software: you can redistribute it and/or modify *
// it under the terms of the GNU General Public License as published by * This program is free software: you can redistribute it and/or modify
// the Free Software Foundation, either version 3 of the License, or * it under the terms of the GNU General Public License as published by
// (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// This program is distributed in the hope that it will be useful, *
// but WITHOUT ANY WARRANTY; without even the implied warranty of * This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU General Public License for more details. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// You should have received a copy of the GNU General Public License *
// along with this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "keys.h" #include "keys.h"
@ -37,18 +39,34 @@ Models::Keys::~Keys() {
delete pair.second; delete pair.second;
} }
std::deque<Shared::KeyInfo> Models::Keys::modifiedKeys() const { std::list<Shared::KeyInfo> Models::Keys::modifiedKeys() const {
std::deque<Shared::KeyInfo> response(modified.size()); std::list<Shared::KeyInfo> response;
for (const std::pair<const int, Shared::KeyInfo*>& pair: modified)
response.push_back(*(pair.second));
int i = 0;
for (const std::pair<const int, Shared::KeyInfo*>& pair: modified) {
response[i] = *(pair.second);
++i;
}
return response; return response;
} }
std::list<Shared::KeyInfo> Models::Keys::finalKeys() const {
std::list<Shared::KeyInfo> result;
finalKeys(result);
return result;
}
void Models::Keys::finalKeys(std::list<Shared::KeyInfo>& out) const {
for (int i = 0; i < rowCount(); ++i)
out.push_back(key(i));
}
const Shared::KeyInfo & Models::Keys::key(unsigned int i) const {
std::map<int, Shared::KeyInfo*>::const_iterator itr = modified.find(i);
if (itr != modified.end())
return*(itr->second);
else
return *(keys[i]);
}
void Models::Keys::addKey(const Shared::KeyInfo& info) { void Models::Keys::addKey(const Shared::KeyInfo& info) {
beginInsertRows(QModelIndex(), keys.size(), keys.size()); beginInsertRows(QModelIndex(), keys.size(), keys.size());
keys.push_back(new Shared::KeyInfo(info)); keys.push_back(new Shared::KeyInfo(info));

View File

@ -1,21 +1,22 @@
// Squawk messenger. /*
// Copyright (C) 2019 Yury Gubich <blue@macaw.me> * Squawk messenger.
// * Copyright (C) 2019 Yury Gubich <blue@macaw.me>
// This program is free software: you can redistribute it and/or modify *
// it under the terms of the GNU General Public License as published by * This program is free software: you can redistribute it and/or modify
// the Free Software Foundation, either version 3 of the License, or * it under the terms of the GNU General Public License as published by
// (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// This program is distributed in the hope that it will be useful, *
// but WITHOUT ANY WARRANTY; without even the implied warranty of * This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU General Public License for more details. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// You should have received a copy of the GNU General Public License *
// along with this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MODELS_KEYS_H #pragma once
#define MODELS_KEYS_H
#include <QAbstractListModel> #include <QAbstractListModel>
@ -23,11 +24,7 @@
namespace Models { namespace Models {
/** class Keys : public QAbstractListModel {
* @todo write docs
*/
class Keys : public QAbstractListModel
{
public: public:
Keys(QObject *parent = nullptr); Keys(QObject *parent = nullptr);
~Keys(); ~Keys();
@ -37,11 +34,14 @@ public:
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override;
const Shared::KeyInfo& key(unsigned int i) const;
QHash<int, QByteArray> roleNames() const override; QHash<int, QByteArray> roleNames() const override;
QModelIndex index(int row, int column, const QModelIndex & parent) const override; QModelIndex index(int row, int column, const QModelIndex & parent) const override;
std::deque<Shared::KeyInfo> modifiedKeys() const; std::list<Shared::KeyInfo> modifiedKeys() const;
std::list<Shared::KeyInfo> finalKeys() const;
void finalKeys(std::list<Shared::KeyInfo>& out) const;
enum Roles { enum Roles {
Label = Qt::UserRole + 1, Label = Qt::UserRole + 1,
@ -64,5 +64,3 @@ private:
}; };
} }
#endif // MODELS_KEYS_H

View File

@ -114,6 +114,9 @@ void UI::Info::onButtonBoxAccepted() {
contactGeneral->fillVCard(card); contactGeneral->fillVCard(card);
contactContacts->fillVCard(card); contactContacts->fillVCard(card);
card.setDescription(description->description()); card.setDescription(description->description());
#ifdef WITH_OMEMO
omemo->fillData(info.getActiveKeysRef());
#endif
emit saveInfo(info); emit saveInfo(info);
emit close(); emit close();
} }
@ -161,7 +164,8 @@ void UI::Info::initializeDescription(const QString& descr, bool editable) {
} }
QString UI::Info::getJid() const { QString UI::Info::getJid() const {
return jid;} return jid;
}
void UI::Info::clear() { void UI::Info::clear() {
if (contactGeneral != nullptr) { if (contactGeneral != nullptr) {

View File

@ -39,8 +39,7 @@
namespace UI { namespace UI {
namespace Ui namespace Ui {
{
class Info; class Info;
} }

View File

@ -88,6 +88,12 @@ void UI::Omemo::setData(const std::list<Shared::KeyInfo>& keys) {
deviceKeyVisibility(deviceKeyModel.rowCount() > 0); deviceKeyVisibility(deviceKeyModel.rowCount() > 0);
} }
void UI::Omemo::fillData(std::list<Shared::KeyInfo>& out) {
deviceKeyModel.finalKeys(out);
keysModel.finalKeys(out);
unusedKeysModel.finalKeys(out);
}
const QString UI::Omemo::title() const { const QString UI::Omemo::title() const {
return m_ui->OMEMOHeading->text(); return m_ui->OMEMOHeading->text();
} }

View File

@ -41,6 +41,7 @@ public:
~Omemo(); ~Omemo();
void setData(const std::list<Shared::KeyInfo>& keys); void setData(const std::list<Shared::KeyInfo>& keys);
void fillData(std::list<Shared::KeyInfo>& out);
const QString title() const; const QString title() const;
private slots: private slots: