Commit 5c2655cc authored by Karel Slaný's avatar Karel Slaný Committed by Martin Straka

Fixed cleaning of e-gov service list after QML page has been closed.

parent 93f31062
......@@ -46,7 +46,7 @@ Component {
Component.onDestruction: {
statusBar.visible = false
gov.deleteGovServices()
// gov.clearGovServices()
}
GovServiceListModel {
......
......@@ -52,38 +52,16 @@ GovWrapper::GovWrapper(IsdsWrapper *isds, QObject *parent)
initGovServices();
}
/*!
* @brief Deallocate held services.
*/
static
void clearServiceMap(QMap<QString, Gov::Service *> &map)
{
foreach (Gov::Service *gs, map.values()) {
delete gs;
}
map.clear();
}
GovWrapper::~GovWrapper(void)
{
clearServiceMap(m_govServices);
}
void GovWrapper::deleteGovServices(void)
{
debugFuncCall();
QStringList keys = m_govServices.keys();
foreach (const QString &key, keys) {
delete m_govServices.take(key);
}
clearGovServices();
}
void GovWrapper::initGovServices(void)
{
debugFuncCall();
clearServiceMap(m_govServices);
clearGovServices();
Gov::Service *gs;
......@@ -228,6 +206,16 @@ void GovWrapper::initGovServices(void)
}
}
void GovWrapper::clearGovServices(void)
{
debugFuncCall();
foreach (Gov::Service *gs, m_govServices.values()) {
delete gs;
}
m_govServices.clear();
}
void GovWrapper::loadServicesToModel(const QVariant &srvcModelVariant) const
{
debugFuncCall();
......
......@@ -54,15 +54,15 @@ public:
~GovWrapper(void);
/*!
* @brief Remove all Gov services from map and delete their objects.
* @brief Init all Gov services and insert to map.
*/
Q_INVOKABLE
void deleteGovServices(void);
void initGovServices(void);
/*!
* @brief Init all Gov services and insert to map.
* @brief Remove all Gov services from map and delete their objects.
*/
void initGovServices(void);
Q_INVOKABLE
void clearGovServices(void);
/*!
* @brief Load Gov services into QML.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment