From 0cf566145778e255280fd5b5ecf0d21a58a7d11e Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 8 Apr 2015 21:43:06 -0300 Subject: [PATCH] Fix some UI problems deleting backups and sessions in DataRecoveryView --- src/app/ui/data_recovery_view.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app/ui/data_recovery_view.cpp b/src/app/ui/data_recovery_view.cpp index 812919ee5..61670b7ad 100644 --- a/src/app/ui/data_recovery_view.cpp +++ b/src/app/ui/data_recovery_view.cpp @@ -84,6 +84,8 @@ protected: } void onDelete() { + Widget* parent = getParent(); + if (m_backup) { // Delete one backup if (Alert::show(PACKAGE @@ -95,7 +97,6 @@ protected: Widget* parent = getParent(); parent->removeChild(this); - View::getView(parent)->updateView(); deferDelete(); } else { @@ -115,6 +116,9 @@ protected: m_session->removeFromDisk(); Regenerate(); } + + parent->layout(); + View::getView(parent)->updateView(); } private: @@ -144,10 +148,16 @@ DataRecoveryView::~DataRecoveryView() void DataRecoveryView::fillList() { - for (auto child : m_listBox.getChildren()) + WidgetsList children = m_listBox.getChildren(); + for (auto child : children) { + m_listBox.removeChild(child); child->deferDelete(); + } for (auto& session : m_dataRecovery->sessions()) { + if (session->isEmpty()) + continue; + Item* item = new Item(session.get(), nullptr); item->Regenerate.connect(&DataRecoveryView::fillList, this); m_listBox.addChild(item);