[partition] Don't show erase button for inactive RAID.

This commit is contained in:
Caio Carvalho 2018-08-13 12:26:00 -03:00
parent 7fd0ad5795
commit b5a2a5bbdd

View File

@ -48,6 +48,7 @@
#include <kpmcore/core/device.h>
#include <kpmcore/core/partition.h>
#include <kpmcore/core/softwareraid.h>
#include <QBoxLayout>
#include <QButtonGroup>
@ -1182,6 +1183,11 @@ ChoicePage::setupActions()
bool atLeastOneCanBeResized = false;
bool atLeastOneCanBeReplaced = false;
bool atLeastOneIsMounted = false; // Suppress 'erase' if so
bool isInactiveRAID = false;
if ( currentDevice->type() == Device::Type::SoftwareRAID_Device &&
static_cast< SoftwareRAID* >(currentDevice)->status() == SoftwareRAID::Status::Inactive )
isInactiveRAID = true;
for ( auto it = PartitionIterator::begin( currentDevice );
it != PartitionIterator::end( currentDevice ); ++it )
@ -1305,7 +1311,7 @@ ChoicePage::setupActions()
else
force_uncheck( m_grp, m_alongsideButton );
if ( !atLeastOneIsMounted )
if ( !atLeastOneIsMounted && !isInactiveRAID )
m_eraseButton->show(); // None mounted
else
force_uncheck( m_grp, m_eraseButton );