[partition] Disabling partition buttons for inactive RAID.

This commit is contained in:
Caio Carvalho 2018-08-13 09:51:35 -03:00
parent 81ea5f5249
commit 7fd0ad5795

View File

@ -4,6 +4,7 @@
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2018, Adriaan de Groot <groot@kde.org>
* Copyright 2018, Andrius Štikonas <andrius@stikonas.eu>
* Copyright 2018, Caio Jordão Carvalho <caiojcarvalho@gmail.com>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -47,6 +48,7 @@
// KPMcore
#include <kpmcore/core/device.h>
#include <kpmcore/core/partition.h>
#include <kpmcore/core/softwareraid.h>
#include <kpmcore/ops/deactivatevolumegroupoperation.h>
#include <kpmcore/ops/removevolumegroupoperation.h>
@ -146,6 +148,7 @@ PartitionPage::updateButtons()
bool isInVG = m_core->isInVG( partition );
create = isFree;
// Keep it simple for now: do not support editing extended partitions as
// it does not work with our current edit implementation which is
// actually remove + add. This would not work with extended partitions
@ -160,8 +163,17 @@ PartitionPage::updateButtons()
if ( m_ui->deviceComboBox->currentIndex() >= 0 )
{
QModelIndex deviceIndex = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 );
if ( m_core->deviceModel()->deviceForIndex( deviceIndex )->type() != Device::Type::LVM_Device )
auto device = m_core->deviceModel()->deviceForIndex( deviceIndex );
if ( device->type() != Device::Type::LVM_Device )
{
createTable = true;
if ( device->type() == Device::Type::SoftwareRAID_Device &&
static_cast< SoftwareRAID* >(device)->status() == SoftwareRAID::Status::Inactive ) {
createTable = false;
create = false;
}
}
else
{
currentDeviceIsVG = true;