From 72ff342d6325cab42cc3d8401b4fac5b2f7eff3b Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Thu, 12 Apr 2018 01:44:51 +0200 Subject: GH-2053 basics of the servers.dat management --- application/widgets/PageContainer.cpp | 15 ++++++++++++--- application/widgets/PageContainer.h | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'application/widgets') diff --git a/application/widgets/PageContainer.cpp b/application/widgets/PageContainer.cpp index 98de57e8..c8c2b57a 100644 --- a/application/widgets/PageContainer.cpp +++ b/application/widgets/PageContainer.cpp @@ -218,10 +218,9 @@ void PageContainer::currentChanged(const QModelIndex ¤t) bool PageContainer::prepareToClose() { - for (auto page : m_model->pages()) + if(!saveAll()) { - if (!page->apply()) - return false; + return false; } if (m_currentPage) { @@ -229,3 +228,13 @@ bool PageContainer::prepareToClose() } return true; } + +bool PageContainer::saveAll() +{ + for (auto page : m_model->pages()) + { + if (!page->apply()) + return false; + } + return true; +} diff --git a/application/widgets/PageContainer.h b/application/widgets/PageContainer.h index ea9f8ce1..a05e74c4 100644 --- a/application/widgets/PageContainer.h +++ b/application/widgets/PageContainer.h @@ -46,6 +46,7 @@ public: * @return true if everything can be saved, false if there is something that requires attention */ bool prepareToClose(); + bool saveAll(); /* request close - used by individual pages */ bool requestClose() override -- cgit