Add a "do not install boot loader" value to the boot loader picker.

main
Teo Mrnjavac 10 years ago
parent 8c537daadc
commit 881bf67d22

@ -66,6 +66,9 @@ BootLoaderModel::createMbrItems()
void void
BootLoaderModel::update() BootLoaderModel::update()
{ {
clear();
createMbrItems();
QString partitionText; QString partitionText;
Partition* partition = PMUtils::findPartitionByMountPoint( m_devices, "/boot" ); Partition* partition = PMUtils::findPartitionByMountPoint( m_devices, "/boot" );
if ( partition ) if ( partition )
@ -86,9 +89,9 @@ BootLoaderModel::update()
{ {
if ( lastIsPartition ) if ( lastIsPartition )
takeRow( rowCount() - 1 ); takeRow( rowCount() - 1 );
return;
} }
else
{
QString mountPoint = PartitionInfo::mountPoint( partition ); QString mountPoint = PartitionInfo::mountPoint( partition );
if ( lastIsPartition ) if ( lastIsPartition )
{ {
@ -101,6 +104,12 @@ BootLoaderModel::update()
createBootLoaderItem( partitionText, PartitionInfo::mountPoint( partition ), true ) createBootLoaderItem( partitionText, PartitionInfo::mountPoint( partition ), true )
); );
} }
// Create "don't install bootloader" item
appendRow(
createBootLoaderItem( tr( "Do not install a boot loader" ), QString(), false )
);
}
} }
@ -108,9 +117,14 @@ QVariant
BootLoaderModel::data( const QModelIndex& index, int role ) const BootLoaderModel::data( const QModelIndex& index, int role ) const
{ {
if ( role == Qt::DisplayRole ) if ( role == Qt::DisplayRole )
{
if ( QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString().isEmpty() )
return QStandardItemModel::data( index, Qt::DisplayRole ).toString();
return tr( "%1 (%2)" ) return tr( "%1 (%2)" )
.arg( QStandardItemModel::data( index, Qt::DisplayRole ).toString() ) .arg( QStandardItemModel::data( index, Qt::DisplayRole ).toString() )
.arg( QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString() ); .arg( QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString() );
}
return QStandardItemModel::data( index, role ); return QStandardItemModel::data( index, role );
} }

@ -157,10 +157,17 @@ FillGlobalStorageJob::exec()
{ {
Calamares::GlobalStorage* storage = Calamares::JobQueue::instance()->globalStorage(); Calamares::GlobalStorage* storage = Calamares::JobQueue::instance()->globalStorage();
storage->insert( "partitions", createPartitionList() ); storage->insert( "partitions", createPartitionList() );
if ( !m_bootLoaderPath.isEmpty() )
{
QVariant var = createBootLoaderMap(); QVariant var = createBootLoaderMap();
if ( !var.isValid() ) if ( !var.isValid() )
return Calamares::JobResult::error( tr( "Failed to find path for boot loader" ) ); cDebug() << "Failed to find path for boot loader";
storage->insert( "bootLoader", var ); storage->insert( "bootLoader", var );
}
else
{
storage->insert( "bootLoader", QVariant() );
}
return Calamares::JobResult::ok(); return Calamares::JobResult::ok();
} }

Loading…
Cancel
Save