From 73971d045d166e5b21c48f497e140e791513d785 Mon Sep 17 00:00:00 2001 From: Dmitry Degtyarev Date: Thu, 28 May 2020 15:21:53 +0400 Subject: [PATCH] remove duplicate load_attributes() call remove load_attributes() call in load_row add load_attributes() call to load_and_add_row --- src/ad_interface.cpp | 7 +++---- src/ad_model.cpp | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ad_interface.cpp b/src/ad_interface.cpp index a7a421c7..bd61d5a0 100644 --- a/src/ad_interface.cpp +++ b/src/ad_interface.cpp @@ -382,11 +382,10 @@ bool set_attribute(const QString &dn, const QString &attribute, const QString &v } if (result == AD_SUCCESS) { - emit ad_interface.set_attribute_complete(dn, attribute, old_value, value); - - // TODO: there's a duplicate load_attributes in ad_model's on_set_attribute_complete() - // Make it so that there's only one call, preferrably here + // Reload attributes to get new value load_attributes(dn); + + emit ad_interface.set_attribute_complete(dn, attribute, old_value, value); return true; } else { diff --git a/src/ad_model.cpp b/src/ad_model.cpp index 309b6632..8bfed56a 100644 --- a/src/ad_model.cpp +++ b/src/ad_model.cpp @@ -72,7 +72,6 @@ bool AdModel::dropMimeData(const QMimeData *data, Qt::DropAction, int row, int c } void load_row(QList row, const QString &dn) { - load_attributes(dn); QMap> attributes = get_attributes(dn); // TODO: get rid of "if (x.contains(y))" @@ -166,6 +165,9 @@ void load_and_add_row(QStandardItem *parent, const QString &dn) { row.push_back(new QStandardItem()); } + // Load attributes since this is the first time this entry is loaded + load_attributes(dn); + load_row(row, dn); // Set fetch flag because row is new and can be fetched