Changed: Backup old profiles to compare with updated ones

This commit is contained in:
kervala 2016-06-12 13:52:28 +02:00
parent 3c538a551c
commit 22773a6dd6
3 changed files with 10 additions and 0 deletions

View file

@ -258,6 +258,11 @@ const CServer& CConfigFile::getServer(const QString &id) const
return getServer();
}
void CConfigFile::backupProfiles()
{
m_backupProfiles = m_profiles;
}
int CConfigFile::getProfilesCount() const
{
return m_profiles.size();

View file

@ -118,6 +118,9 @@ public:
CProfiles getProfiles() const { return m_profiles; }
void setProfiles(const CProfiles &profiles) { m_profiles = profiles; }
CProfiles getBackupProfiles() const { return m_backupProfiles; }
void backupProfiles();
int getProfilesCount() const;
CProfile getProfile(int i = -1) const;
void setProfile(int i, const CProfile &profile);
@ -193,6 +196,7 @@ private:
CServers m_servers;
CProfiles m_profiles;
CProfiles m_backupProfiles;
QString m_installationDirectory;
QString m_srcDirectory;

View file

@ -57,6 +57,7 @@ bool CProfilesModel::removeRows(int row, int count, const QModelIndex &parent)
bool CProfilesModel::save() const
{
CConfigFile::getInstance()->backupProfiles();
CConfigFile::getInstance()->setProfiles(m_profiles);
CConfigFile::getInstance()->save();