mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 09:55:37 -04:00
[partition] Unmap mount-point special strings
- Reverse "(no mount point)" to the empty string - Provide convenience pointer-taking function
This commit is contained in:
parent
a4997c4be8
commit
a49c39bb53
4 changed files with 24 additions and 8 deletions
|
@ -242,7 +242,7 @@ CreatePartitionDialog::createPartition()
|
||||||
partition->setPartitionPath(m_device->deviceNode() + QStringLiteral("/") + m_ui->lvNameLineEdit->text().trimmed());
|
partition->setPartitionPath(m_device->deviceNode() + QStringLiteral("/") + m_ui->lvNameLineEdit->text().trimmed());
|
||||||
}
|
}
|
||||||
|
|
||||||
PartitionInfo::setMountPoint( partition, m_ui->mountPointComboBox->currentText() );
|
PartitionInfo::setMountPoint( partition, selectedMountPoint( m_ui->mountPointComboBox ) );
|
||||||
PartitionInfo::setFormat( partition, true );
|
PartitionInfo::setFormat( partition, true );
|
||||||
|
|
||||||
return partition;
|
return partition;
|
||||||
|
@ -279,9 +279,7 @@ CreatePartitionDialog::updateMountPointUi()
|
||||||
void
|
void
|
||||||
CreatePartitionDialog::checkMountPointSelection()
|
CreatePartitionDialog::checkMountPointSelection()
|
||||||
{
|
{
|
||||||
const QString& selection = m_ui->mountPointComboBox->currentText();
|
if ( m_usedMountPoints.contains( selectedMountPoint( m_ui->mountPointComboBox ) ) )
|
||||||
|
|
||||||
if ( m_usedMountPoints.contains( selection ) )
|
|
||||||
{
|
{
|
||||||
m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) );
|
m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) );
|
||||||
m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
|
m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
|
||||||
|
|
|
@ -154,7 +154,7 @@ EditExistingPartitionDialog::setupFlagsList()
|
||||||
void
|
void
|
||||||
EditExistingPartitionDialog::applyChanges( PartitionCoreModule* core )
|
EditExistingPartitionDialog::applyChanges( PartitionCoreModule* core )
|
||||||
{
|
{
|
||||||
PartitionInfo::setMountPoint( m_partition, m_ui->mountPointComboBox->currentText() );
|
PartitionInfo::setMountPoint( m_partition, selectedMountPoint(m_ui->mountPointComboBox) );
|
||||||
|
|
||||||
qint64 newFirstSector = m_partitionSizeController->firstSector();
|
qint64 newFirstSector = m_partitionSizeController->firstSector();
|
||||||
qint64 newLastSector = m_partitionSizeController->lastSector();
|
qint64 newLastSector = m_partitionSizeController->lastSector();
|
||||||
|
@ -294,9 +294,7 @@ EditExistingPartitionDialog::updateMountPointPicker()
|
||||||
void
|
void
|
||||||
EditExistingPartitionDialog::checkMountPointSelection()
|
EditExistingPartitionDialog::checkMountPointSelection()
|
||||||
{
|
{
|
||||||
const QString& selection = m_ui->mountPointComboBox->currentText();
|
if ( m_usedMountPoints.contains( selectedMountPoint( m_ui->mountPointComboBox ) ) )
|
||||||
|
|
||||||
if ( m_usedMountPoints.contains( selection ) )
|
|
||||||
{
|
{
|
||||||
m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) );
|
m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) );
|
||||||
m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
|
m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
|
@ -55,3 +56,12 @@ standardMountPoints(QComboBox& combo, const QString& selected)
|
||||||
else
|
else
|
||||||
combo.setCurrentText( selected );
|
combo.setCurrentText( selected );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
selectedMountPoint(QComboBox& combo)
|
||||||
|
{
|
||||||
|
cDebug() << "Selected mount point" << combo.currentIndex() << combo.currentText();
|
||||||
|
if ( combo.currentIndex() == 0 )
|
||||||
|
return QString();
|
||||||
|
return combo.currentText();
|
||||||
|
}
|
||||||
|
|
|
@ -44,4 +44,14 @@ void standardMountPoints( QComboBox& );
|
||||||
*/
|
*/
|
||||||
void standardMountPoints( QComboBox&, const QString& selected );
|
void standardMountPoints( QComboBox&, const QString& selected );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mount point selected in the combo box (which should
|
||||||
|
* have been set up with standardMountPoints(), above); this
|
||||||
|
* will map the topmost item (i.e. "(no mount point)") back
|
||||||
|
* to blank, to allow easy detection of no-mount-selected.
|
||||||
|
*/
|
||||||
|
QString selectedMountPoint( QComboBox& combo );
|
||||||
|
static inline QString selectedMountPoint(QComboBox* combo) { return selectedMountPoint(*combo); }
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue