diff --git a/src/modules/partition/core/BootLoaderModel.cpp b/src/modules/partition/core/BootLoaderModel.cpp index e13f44e81..556cfdb52 100644 --- a/src/modules/partition/core/BootLoaderModel.cpp +++ b/src/modules/partition/core/BootLoaderModel.cpp @@ -129,3 +129,18 @@ BootLoaderModel::data( const QModelIndex& index, int role ) const return QStandardItemModel::data( index, role ); } + +void +BootLoaderModel::swapDevice( Device* oldDevice, Device* newDevice ) +{ + Q_ASSERT( oldDevice ); + Q_ASSERT( newDevice ); + Q_ASSERT( oldDevice->deviceNode() == newDevice->deviceNode() ); + + int indexOfOldDevice = m_devices.indexOf( oldDevice ); + if ( indexOfOldDevice < 0 ) + return; + + m_devices[ indexOfOldDevice ] = newDevice; +} + diff --git a/src/modules/partition/core/BootLoaderModel.h b/src/modules/partition/core/BootLoaderModel.h index 27684e326..04f0b63a3 100644 --- a/src/modules/partition/core/BootLoaderModel.h +++ b/src/modules/partition/core/BootLoaderModel.h @@ -51,6 +51,8 @@ public: QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override; + void swapDevice( Device* oldDevice, Device* newDevice ); + private: QList< Device* > m_devices;