[partition] Don't offer /boot if EFI wants something else

- Don't leave /boot in the list always; EFI might be configured
  for /boot/efi on this system
- While here, apply coding style.
This commit is contained in:
Adriaan de Groot 2021-06-18 22:20:11 +02:00
parent 6936915dd6
commit 60f8a7c5fb

View file

@ -23,11 +23,15 @@
QStringList QStringList
standardMountPoints() standardMountPoints()
{ {
QStringList mountPoints { "/", "/boot", "/home", "/opt", "/srv", "/usr", "/var" }; QStringList mountPoints { "/", "/home", "/opt", "/srv", "/usr", "/var" };
if ( PartUtils::isEfiSystem() ) if ( PartUtils::isEfiSystem() )
{ {
mountPoints << Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString(); mountPoints << Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString();
} }
else
{
mountPoints << QStringLiteral( "/boot" );
}
mountPoints.removeDuplicates(); mountPoints.removeDuplicates();
mountPoints.sort(); mountPoints.sort();
return mountPoints; return mountPoints;
@ -68,11 +72,13 @@ setSelectedMountPoint( QComboBox& combo, const QString& selected )
else else
{ {
for ( int i = 0; i < combo.count(); ++i ) for ( int i = 0; i < combo.count(); ++i )
{
if ( selected == combo.itemText( i ) ) if ( selected == combo.itemText( i ) )
{ {
combo.setCurrentIndex( i ); combo.setCurrentIndex( i );
return; return;
} }
}
combo.addItem( selected ); combo.addItem( selected );
combo.setCurrentIndex( combo.count() - 1 ); combo.setCurrentIndex( combo.count() - 1 );
} }
@ -85,10 +91,12 @@ flagsFromList( const QListWidget& list )
PartitionTable::Flags flags; PartitionTable::Flags flags;
for ( int i = 0; i < list.count(); i++ ) for ( int i = 0; i < list.count(); i++ )
{
if ( list.item( i )->checkState() == Qt::Checked ) if ( list.item( i )->checkState() == Qt::Checked )
{ {
flags |= static_cast< PartitionTable::Flag >( list.item( i )->data( Qt::UserRole ).toInt() ); flags |= static_cast< PartitionTable::Flag >( list.item( i )->data( Qt::UserRole ).toInt() );
} }
}
return flags; return flags;
} }