Changed: Backup old profiles to compare with updated ones

This commit is contained in:
kervala 2016-06-12 13:52:28 +02:00
parent a2d9be979d
commit 9c6369b833
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(); return getServer();
} }
void CConfigFile::backupProfiles()
{
m_backupProfiles = m_profiles;
}
int CConfigFile::getProfilesCount() const int CConfigFile::getProfilesCount() const
{ {
return m_profiles.size(); return m_profiles.size();

View file

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

View file

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