an idea how to manage info object better
This commit is contained in:
parent
ec362cef55
commit
6f32e99593
12 changed files with 390 additions and 63 deletions
|
@ -45,17 +45,19 @@ UI::Info::~Info() {
|
|||
|
||||
void UI::Info::setData(const Shared::Info& info) {
|
||||
bool editable = false;
|
||||
switch (info.type) {
|
||||
switch (info.getType()) {
|
||||
case Shared::EntryType::ownAccount:
|
||||
editable = true;
|
||||
[[fallthrough]];
|
||||
case Shared::EntryType::contact: {
|
||||
QDateTime receivingTime = info.vcard.getReceivingTime();
|
||||
const Shared::VCard card = info.getVCardRef();
|
||||
QDateTime receivingTime = card.getReceivingTime();
|
||||
m_ui->receivingTimeLabel->show();
|
||||
m_ui->receivingTimeLabel->setText(tr("Received %1 at %2").arg(receivingTime.date().toString()).arg(receivingTime.time().toString()));
|
||||
initializeContactGeneral(jid, info.vcard, editable);
|
||||
initializeContactContacts(jid, info.vcard, editable);
|
||||
initializeDescription(info.vcard.getDescription(), editable);
|
||||
type = info.type;
|
||||
initializeContactGeneral(jid, card, editable);
|
||||
initializeContactContacts(jid, card, editable);
|
||||
initializeDescription(card.getDescription(), editable);
|
||||
type = info.getType();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -99,11 +101,13 @@ void UI::Info::initializeButtonBox() {
|
|||
|
||||
void UI::Info::onButtonBoxAccepted() {
|
||||
if (type == Shared::EntryType::ownAccount) {
|
||||
Shared::Info info;
|
||||
contactGeneral->fillVCard(info.vcard);
|
||||
contactContacts->fillVCard(info.vcard);
|
||||
info.vcard.setDescription(description->description());
|
||||
Shared::Info info(jid, Shared::EntryType::ownAccount);
|
||||
Shared::VCard& card = info.getVCardRef();
|
||||
contactGeneral->fillVCard(card);
|
||||
contactContacts->fillVCard(card);
|
||||
card.setDescription(description->description());
|
||||
emit saveInfo(info);
|
||||
emit close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue