void PartitionPage::onCreateClicked() { QModelIndex index = m_ui->partitionTreeView->currentIndex(); Q_ASSERT( index.isValid() ); const PartitionModel* model = static_cast< const PartitionModel* >( index.model() ); Partition* partition = model->partitionForIndex( index ); Q_ASSERT( partition ); if ( !checkCanCreate( model->device() ) ) return; CreatePartitionDialog dlg( model->device(), partition->parent(), nullptr, getCurrentUsedMountpoints(), this ); dlg.initFromFreeSpace( partition ); if ( dlg.exec() == QDialog::Accepted ) { Partition* newPart = dlg.createPartition(); m_core->createPartition( model->device(), newPart, dlg.newFlags() ); } }
void PartitionPage::editExistingPartition( Device* device, Partition* partition ) { QStringList mountPoints = getCurrentUsedMountpoints(); mountPoints.removeOne( PartitionInfo::mountPoint( partition ) ); QPointer<EditExistingPartitionDialog> dlg = new EditExistingPartitionDialog( device, partition, mountPoints, this ); if ( dlg->exec() == QDialog::Accepted ) dlg->applyChanges( m_core ); delete dlg; }
void PartitionPage::updatePartitionToCreate( Device* device, Partition* partition ) { QStringList mountPoints = getCurrentUsedMountpoints(); mountPoints.removeOne( PartitionInfo::mountPoint( partition ) ); QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( device, partition->parent(), mountPoints, this ); dlg->initFromPartitionToCreate( partition ); if ( dlg->exec() == QDialog::Accepted ) { Partition* newPartition = dlg->createPartition(); m_core->deletePartition( device, partition ); m_core->createPartition( device, newPartition, dlg->newFlags() ); } delete dlg; }
void PartitionPage::onCreateClicked() { QModelIndex index = m_ui->partitionTreeView->currentIndex(); Q_ASSERT( index.isValid() ); const PartitionModel* model = static_cast< const PartitionModel* >( index.model() ); Partition* partition = model->partitionForIndex( index ); Q_ASSERT( partition ); QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( model->device(), partition->parent(), getCurrentUsedMountpoints(), this ); dlg->initFromFreeSpace( partition ); if ( dlg->exec() == QDialog::Accepted ) { Partition* newPart = dlg->createPartition(); m_core->createPartition( model->device(), newPart, dlg->newFlags() ); } delete dlg; }