mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 18:05:36 -04:00
Add flags setting support when creating a partition.
This commit is contained in:
parent
b83e91b951
commit
ada0a080fc
3 changed files with 66 additions and 5 deletions
|
@ -39,6 +39,7 @@
|
|||
#include <QComboBox>
|
||||
#include <QDir>
|
||||
#include <QSet>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
static QSet< FileSystem::Type > s_unmountableFS(
|
||||
{
|
||||
|
@ -83,11 +84,46 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
|||
// Connections
|
||||
connect( m_ui->fsComboBox, SIGNAL( activated( int ) ), SLOT( updateMountPointUi() ) );
|
||||
connect( m_ui->extendedRadioButton, SIGNAL( toggled( bool ) ), SLOT( updateMountPointUi() ) );
|
||||
|
||||
setupFlagsList();
|
||||
}
|
||||
|
||||
CreatePartitionDialog::~CreatePartitionDialog()
|
||||
{}
|
||||
|
||||
|
||||
PartitionTable::Flags
|
||||
CreatePartitionDialog::newFlags() const
|
||||
{
|
||||
PartitionTable::Flags flags;
|
||||
|
||||
for ( int i = 0; i < m_ui->m_listFlags->count(); i++ )
|
||||
if ( m_ui->m_listFlags->item( i )->checkState() == Qt::Checked )
|
||||
flags |= static_cast< PartitionTable::Flag >(
|
||||
m_ui->m_listFlags->item( i )->data( Qt::UserRole ).toInt() );
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CreatePartitionDialog::setupFlagsList()
|
||||
{
|
||||
int f = 1;
|
||||
QString s;
|
||||
while ( !( s = PartitionTable::flagName( static_cast< PartitionTable::Flag >( f ) ) ).isEmpty() )
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem( s );
|
||||
m_ui->m_listFlags->addItem( item );
|
||||
item->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled );
|
||||
item->setData( Qt::UserRole, f );
|
||||
item->setCheckState( Qt::Unchecked );
|
||||
|
||||
f <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CreatePartitionDialog::initMbrPartitionTypeUi()
|
||||
{
|
||||
|
@ -145,10 +181,11 @@ CreatePartitionDialog::createPartition()
|
|||
m_parent,
|
||||
*m_device,
|
||||
m_role,
|
||||
fsType, first, last );
|
||||
fsType, first, last, newFlags() );
|
||||
|
||||
PartitionInfo::setMountPoint( partition, m_ui->mountPointComboBox->currentText() );
|
||||
PartitionInfo::setFormat( partition, true );
|
||||
|
||||
return partition;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue