From dacb8f2a946282f1caa63e48cf1e4804df5ef5c8 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Fri, 18 Mar 2016 12:26:41 +0100 Subject: [PATCH] Make sure we don't hide actions based on osprober. --- src/modules/partition/gui/ChoicePage.cpp | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 51c55e39c..5ab46e2f2 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -986,6 +986,19 @@ ChoicePage::setupActions() } } + bool atLeastOneCanBeReplaced = false; + + for ( auto it = PartitionIterator::begin( currentDevice ); + it != PartitionIterator::end( currentDevice ); ++it ) + { + if ( PartUtils::canBeReplaced( *it ) ) + { + atLeastOneCanBeReplaced = true; + break; + } + } + + if ( osproberEntriesForCurrentDevice.count() == 0 ) { CALAMARES_RETRANSLATE( @@ -997,6 +1010,16 @@ ChoicePage::setupActions() m_eraseButton->setText( tr( "Erase disk
" "This will delete all data " "currently present on the selected storage device." ) ); + + m_alongsideButton->setText( tr( "Install alongside
" + "The installer will shrink a partition to make room for %1." ) + .arg( Calamares::Branding::instance()-> + string( Calamares::Branding::ShortVersionedName ) ) ); + + m_replaceButton->setText( tr( "Replace a partition
" + "Replaces a partition with %1." ) + .arg( Calamares::Branding::instance()-> + string( Calamares::Branding::ShortVersionedName ) ) ); ) m_replaceButton->hide(); @@ -1109,6 +1132,26 @@ ChoicePage::setupActions() } } + if ( atLeastOneCanBeReplaced ) + m_replaceButton->show(); + else + { + m_replaceButton->hide(); + m_grp->setExclusive( false ); + m_replaceButton->buttonWidget()->setChecked( false ); + m_grp->setExclusive( true ); + } + + if ( atLeastOneCanBeResized ) + m_alongsideButton->show(); + else + { + m_alongsideButton->hide(); + m_grp->setExclusive( false ); + m_alongsideButton->buttonWidget()->setChecked( false ); + m_grp->setExclusive( true ); + } + bool isEfi = QDir( "/sys/firmware/efi/efivars" ).exists(); bool efiSystemPartitionFound = !m_core->efiSystemPartitions().isEmpty();