Skip to content
Snippets Groups Projects
Commit 3f1b5e31 authored by Vitaly Fanaskov's avatar Vitaly Fanaskov
Browse files

Plugin is able to store/restore settings

parent 4f435677
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,8 @@
#include "ui/usagestatisticpage.h"
#include "common/settings.h"
namespace UsageStatistic {
namespace Internal {
......@@ -100,6 +102,8 @@ bool UsageStatisticPlugin::delayedInitialize()
createUsageStatisticPage();
restoreSettings();
return true;
}
......@@ -120,7 +124,22 @@ ExtensionSystem::IPlugin::ShutdownFlag UsageStatisticPlugin::aboutToShutdown()
void UsageStatisticPlugin::createUsageStatisticPage()
{
m_optionsPage = std::make_unique<UsageStatisticPage>(m_provider);
m_usageStatisticPage = std::make_unique<UsageStatisticPage>(m_provider);
connect(m_usageStatisticPage.get(), &UsageStatisticPage::settingsChanged,
this, &UsageStatisticPlugin::storeSettings);
}
void UsageStatisticPlugin::storeSettings()
{
if (auto settings = Core::ICore::settings())
Settings::store(*settings, *m_provider);
}
void UsageStatisticPlugin::restoreSettings()
{
if (auto settings = Core::ICore::settings())
Settings::restore(*settings, *m_provider);
}
} // namespace Internal
......
......@@ -29,10 +29,12 @@ public:
private:
void createUsageStatisticPage();
void storeSettings();
void restoreSettings();
private:
std::shared_ptr<KUserFeedback::Provider> m_provider;
std::unique_ptr<UsageStatisticPage> m_optionsPage;
std::unique_ptr<UsageStatisticPage> m_usageStatisticPage;
};
} // namespace Internal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment