Commit 0ba19ff0 authored by hjk's avatar hjk
Browse files

profile: use a clone() method, as the copy is not exact



Change-Id: I02667ed57ce68702d8be5cac24614f3b9d713ded
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 59417df9
......@@ -97,20 +97,22 @@ Profile::Profile() :
setIconPath(QLatin1String(":///DESKTOP///"));
}
Profile::Profile(const Profile &other) :
d(new Internal::ProfilePrivate)
Profile::~Profile()
{
d->m_displayName = QCoreApplication::translate("ProjectExplorer::Profile", "Clone of %1").arg(other.d->m_displayName);
d->m_autodetected = false;
d->m_data = other.d->m_data;
d->m_isValid = other.d->m_isValid;
d->m_icon = other.d->m_icon;
d->m_iconPath = other.d->m_iconPath;
delete d;
}
Profile::~Profile()
Profile *Profile::clone() const
{
delete d;
Profile *p = new Profile;
p->d->m_displayName = QCoreApplication::translate("ProjectExplorer::Profile", "Clone of %1")
.arg(d->m_displayName);
p->d->m_autodetected = false;
p->d->m_data = d->m_data;
p->d->m_isValid = d->m_isValid;
p->d->m_icon = d->m_icon;
p->d->m_iconPath = d->m_iconPath;
return p;
}
bool Profile::isValid() const
......
......@@ -59,7 +59,6 @@ class PROJECTEXPLORER_EXPORT Profile
{
public:
Profile();
Profile(const Profile &other);
~Profile();
bool isValid() const;
......@@ -85,8 +84,13 @@ public:
void addToEnvironment(Utils::Environment &env) const;
QString toHtml();
Profile *clone() const;
private:
// Unimplemented.
Profile(const Profile &other);
void operator=(const Profile &other);
void setAutoDetected(bool detected);
void setId(const Core::Id &id);
void setValid(bool valid);
......
......@@ -189,11 +189,11 @@ void ProfileOptionsPage::addNewProfile()
void ProfileOptionsPage::cloneProfile()
{
Profile *clone = m_model->profile(currentIndex());
if (!clone)
Profile *current = m_model->profile(currentIndex());
if (!current)
return;
Profile *p = new Profile(*clone);
Profile *p = current->clone();
m_model->markForAddition(p);
......
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