@ -52,7 +52,6 @@ static QSet< FileSystem::Type > s_unmountableFS( { FileSystem::Unformatted,
CreatePartitionDialog : : CreatePartitionDialog ( Device * device ,
PartitionNode * parentPartition ,
Partition * partition ,
const QStringList & usedMountPoints ,
QWidget * parentWidget )
: QDialog ( parentWidget )
@ -81,9 +80,6 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device,
m_ui - > lvNameLineEdit - > setValidator ( validator ) ;
}
standardMountPoints ( * ( m_ui - > mountPointComboBox ) ,
partition ? PartitionInfo : : mountPoint ( partition ) : QString ( ) ) ;
if ( device - > partitionTable ( ) - > type ( ) = = PartitionTable : : msdos
| | device - > partitionTable ( ) - > type ( ) = = PartitionTable : : msdos_sectorbased )
{
@ -132,13 +128,48 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device,
// Select a default
m_ui - > fsComboBox - > setCurrentIndex ( defaultFsIndex ) ;
updateMountPointUi ( ) ;
checkMountPointSelection ( ) ;
}
CreatePartitionDialog : : CreatePartitionDialog ( Device * device ,
const FreeSpace & freeSpacePartition ,
const QStringList & usedMountPoints ,
QWidget * parentWidget )
: CreatePartitionDialog ( device , freeSpacePartition . p - > parent ( ) , usedMountPoints , parentWidget )
{
standardMountPoints ( * ( m_ui - > mountPointComboBox ) , QString ( ) ) ;
setFlagList ( * ( m_ui - > m_listFlags ) ,
static_cast < PartitionTable : : Flags > ( ~ PartitionTable : : Flags : : Int ( 0 ) ) ,
partition ? PartitionInfo : : flags ( partition ) : PartitionTable : : Flags ( ) ) ;
PartitionTable : : Flags ( ) ) ;
initPartResizerWidget ( freeSpacePartition . p ) ;
}
// Checks the initial selection.
checkMountPointSelection ( ) ;
CreatePartitionDialog : : CreatePartitionDialog ( Device * device ,
const FreshPartition & existingNewPartition ,
const QStringList & usedMountPoints ,
QWidget * parentWidget )
: CreatePartitionDialog ( device , existingNewPartition . p - > parent ( ) , usedMountPoints , parentWidget )
{
standardMountPoints ( * ( m_ui - > mountPointComboBox ) ,
PartitionInfo : : mountPoint ( existingNewPartition . p ) ) ;
setFlagList ( * ( m_ui - > m_listFlags ) ,
static_cast < PartitionTable : : Flags > ( ~ PartitionTable : : Flags : : Int ( 0 ) ) ,
PartitionInfo : : flags ( existingNewPartition . p ) ) ;
const bool isExtended = existingNewPartition . p - > roles ( ) . has ( PartitionRole : : Extended ) ;
if ( isExtended )
{
cDebug ( ) < < " Editing extended partitions is not supported. " ;
return ;
}
initPartResizerWidget ( existingNewPartition . p ) ;
FileSystem : : Type fsType = existingNewPartition . p - > fileSystem ( ) . type ( ) ;
m_ui - > fsComboBox - > setCurrentText ( FileSystem : : nameForType ( fsType ) ) ;
setSelectedMountPoint ( m_ui - > mountPointComboBox , PartitionInfo : : mountPoint ( existingNewPartition . p ) ) ;
updateMountPointUi ( ) ;
}
CreatePartitionDialog : : ~ CreatePartitionDialog ( ) { }
@ -288,34 +319,3 @@ CreatePartitionDialog::initPartResizerWidget( Partition* partition )
m_partitionSizeController - > setPartResizerWidget ( m_ui - > partResizerWidget ) ;
m_partitionSizeController - > setSpinBox ( m_ui - > sizeSpinBox ) ;
}
void
CreatePartitionDialog : : initFromFreeSpace ( Partition * freeSpacePartition )
{
initPartResizerWidget ( freeSpacePartition ) ;
}
void
CreatePartitionDialog : : initFromPartitionToCreate ( Partition * partition )
{
Q_ASSERT ( partition ) ;
bool isExtended = partition - > roles ( ) . has ( PartitionRole : : Extended ) ;
Q_ASSERT ( ! isExtended ) ;
if ( isExtended )
{
cDebug ( ) < < " Editing extended partitions is not supported for now " ;
return ;
}
initPartResizerWidget ( partition ) ;
// File System
FileSystem : : Type fsType = partition - > fileSystem ( ) . type ( ) ;
m_ui - > fsComboBox - > setCurrentText ( FileSystem : : nameForType ( fsType ) ) ;
// Mount point
setSelectedMountPoint ( m_ui - > mountPointComboBox , PartitionInfo : : mountPoint ( partition ) ) ;
updateMountPointUi ( ) ;
}