@ -40,8 +40,9 @@
// Qt
# include <QComboBox>
# include <QDir>
# include <QSet>
# include <QListWidgetItem>
# include <QPushButton>
# include <QSet>
static QSet < FileSystem : : Type > s_unmountableFS (
{
@ -52,12 +53,13 @@ static QSet< FileSystem::Type > s_unmountableFS(
FileSystem : : Lvm2_PV
} ) ;
CreatePartitionDialog : : CreatePartitionDialog ( Device * device , PartitionNode * parentPartition , QWidget * parentWidget )
CreatePartitionDialog : : CreatePartitionDialog ( Device * device , PartitionNode * parentPartition , const QStringList & usedMountPoints , QWidget * parentWidget )
: QDialog ( parentWidget )
, m_ui ( new Ui_CreatePartitionDialog )
, m_partitionSizeController ( new PartitionSizeController ( this ) )
, m_device ( device )
, m_parent ( parentPartition )
, m_usedMountPoints ( usedMountPoints )
{
m_ui - > setupUi ( this ) ;
m_ui - > encryptWidget - > setText ( tr ( " En&crypt " ) ) ;
@ -101,6 +103,8 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
connect ( m_ui - > fsComboBox , SIGNAL ( activated ( int ) ) , SLOT ( updateMountPointUi ( ) ) ) ;
connect ( m_ui - > extendedRadioButton , SIGNAL ( toggled ( bool ) ) , SLOT ( updateMountPointUi ( ) ) ) ;
connect ( m_ui - > mountPointComboBox , & QComboBox : : currentTextChanged , this , & CreatePartitionDialog : : checkMountPointSelection ) ;
// Select a default
m_ui - > fsComboBox - > setCurrentIndex ( defaultFsIndex ) ;
updateMountPointUi ( ) ;
@ -252,6 +256,18 @@ CreatePartitionDialog::updateMountPointUi()
m_ui - > mountPointComboBox - > setCurrentText ( QString ( ) ) ;
}
void
CreatePartitionDialog : : checkMountPointSelection ( const QString & selection )
{
if ( m_usedMountPoints . contains ( selection ) ) {
m_ui - > labelMountPoint - > setText ( " Mountpoint already used. Please select another one. " ) ;
m_ui - > buttonBox - > button ( QDialogButtonBox : : Ok ) - > setEnabled ( false ) ;
} else {
m_ui - > labelMountPoint - > setText ( QString ( ) ) ;
m_ui - > buttonBox - > button ( QDialogButtonBox : : Ok ) - > setEnabled ( true ) ;
}
}
void
CreatePartitionDialog : : initPartResizerWidget ( Partition * partition )
{