diff --git a/src/app/drivemanager.cpp b/src/app/drivemanager.cpp index b53cade3..6e218263 100644 --- a/src/app/drivemanager.cpp +++ b/src/app/drivemanager.cpp @@ -241,6 +241,13 @@ Progress *Drive::progress() const return m_progress; } +void Drive::updateDrive(const QString &name, uint64_t size, bool containsLive) +{ + m_name = name; + m_size = size; + setRestoreStatus(containsLive ? CONTAINS_LIVE : CLEAN); +} + QString Drive::name() const { return QString("%1 (%2)").arg(m_name).arg(readableSize()); diff --git a/src/app/drivemanager.h b/src/app/drivemanager.h index 4a89ad90..4e1d396c 100644 --- a/src/app/drivemanager.h +++ b/src/app/drivemanager.h @@ -162,6 +162,8 @@ class Drive : public QObject Progress *progress() const; + virtual void updateDrive(const QString &name, uint64_t size, bool containsLive = false); + virtual QString name() const; virtual QString readableSize() const; virtual qreal size() const; diff --git a/src/app/linuxdrivemanager.cpp b/src/app/linuxdrivemanager.cpp index b0fdc73e..b67c1ecd 100644 --- a/src/app/linuxdrivemanager.cpp +++ b/src/app/linuxdrivemanager.cpp @@ -88,11 +88,11 @@ QDBusObjectPath LinuxDriveProvider::handleObject(const QDBusObjectPath &object_p mDebug() << this->metaObject()->className() << "New drive" << driveId.path() << "-" << name << "(" << size << "bytes;" << (isValid ? "removable;" : "nonremovable;") << connectionBus << ")"; if (isValid) { - // TODO find out why do I do this if (m_drives.contains(object_path)) { - LinuxDrive *tmp = m_drives[object_path]; - emit DriveProvider::driveRemoved(tmp); + m_drives[object_path]->updateDrive(name, size, isoLayout); + return object_path; } + LinuxDrive *d = new LinuxDrive(this, object_path.path(), name, size, isoLayout); m_drives[object_path] = d; emit DriveProvider::driveConnected(d);