Changed: Delete and create shortcuts, see #279

This commit is contained in:
kervala 2016-07-25 18:36:03 +02:00
parent 3d2c4d3f83
commit 645491d417

View file

@ -234,6 +234,9 @@ void COperationDialog::updateAddRemoveComponents()
// remove profiles that still exist // remove profiles that still exist
profilesToDelete.removeAll(profile.id); profilesToDelete.removeAll(profile.id);
// delete all shortcuts, they'll be recreated later
profile.deleteShortcuts();
} }
// update components to remove // update components to remove
@ -256,10 +259,9 @@ void COperationDialog::processUpdateProfilesNextStep()
{ {
updateAddRemoveComponents(); updateAddRemoveComponents();
} }
// TODO: check all servers are downloaded // TODO: check all servers are downloaded
// TODO: delete profiles directories that are not used anymore // TODO: delete profiles directories that are not used anymore
// TODO: create shortcuts
if (!m_removeComponents.profiles.isEmpty()) if (!m_removeComponents.profiles.isEmpty())
{ {
@ -275,9 +277,10 @@ void COperationDialog::processUpdateProfilesNextStep()
return; return;
} }
CConfigFile *config = CConfigFile::getInstance();
if (!m_addComponents.servers.isEmpty()) if (!m_addComponents.servers.isEmpty())
{ {
CConfigFile *config = CConfigFile::getInstance();
const CServer &defaultServer = config->getServer(); const CServer &defaultServer = config->getServer();
// servers files to download/update // servers files to download/update
@ -334,6 +337,12 @@ void COperationDialog::processUpdateProfilesNextStep()
} }
} }
// recreate shortcuts
foreach(const CProfile &profile, config->getProfiles())
{
profile.createShortcuts();
}
updateAddRemoveEntry(); updateAddRemoveEntry();
} }
@ -1010,6 +1019,17 @@ void COperationDialog::deleteComponentsServers()
return; return;
} }
} }
// delete all links to clients
for (int i = 0; i < config->getProfilesCount(); ++i)
{
const CProfile &profile = config->getProfile(i);
if (profile.server == serverId)
{
profile.deleteShortcuts();
}
}
} }
emit success(m_removeComponents.servers.size()); emit success(m_removeComponents.servers.size());
@ -1072,7 +1092,7 @@ void COperationDialog::deleteComponentsProfiles()
} }
} }
// TODO: delete links profile.deleteShortcuts();
// delete profile // delete profile
config->removeProfile(profileId); config->removeProfile(profileId);