From 7fd0ad57956f55176df610e91617eda1676f84e7 Mon Sep 17 00:00:00 2001 From: Caio Carvalho Date: Mon, 13 Aug 2018 09:51:35 -0300 Subject: [PATCH 1/3] [partition] Disabling partition buttons for inactive RAID. --- src/modules/partition/gui/PartitionPage.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/modules/partition/gui/PartitionPage.cpp b/src/modules/partition/gui/PartitionPage.cpp index 994adc3e8..f23eecd6e 100644 --- a/src/modules/partition/gui/PartitionPage.cpp +++ b/src/modules/partition/gui/PartitionPage.cpp @@ -4,6 +4,7 @@ * Copyright 2015-2016, Teo Mrnjavac * Copyright 2018, Adriaan de Groot * Copyright 2018, Andrius Štikonas + * Copyright 2018, Caio Jordão Carvalho * * 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 #include +#include #include #include @@ -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; From b5a2a5bbdd8020fd4f9663c02a5382ea9d74a4ef Mon Sep 17 00:00:00 2001 From: Caio Carvalho Date: Mon, 13 Aug 2018 12:26:00 -0300 Subject: [PATCH 2/3] [partition] Don't show erase button for inactive RAID. --- src/modules/partition/gui/ChoicePage.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index bef6e4966..17f0a95ea 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -48,6 +48,7 @@ #include #include +#include #include #include @@ -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 ); From 01a972c6ea6704c1c2f0f252f7ff4c2296029e07 Mon Sep 17 00:00:00 2001 From: Caio Carvalho Date: Mon, 13 Aug 2018 13:05:41 -0300 Subject: [PATCH 3/3] [partition] Fixing LVM LV name line edit visibility. --- src/modules/partition/gui/CreatePartitionDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/partition/gui/CreatePartitionDialog.cpp b/src/modules/partition/gui/CreatePartitionDialog.cpp index 0e7602c08..7823d743d 100644 --- a/src/modules/partition/gui/CreatePartitionDialog.cpp +++ b/src/modules/partition/gui/CreatePartitionDialog.cpp @@ -72,7 +72,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par m_ui->encryptWidget->setText( tr( "En&crypt" ) ); m_ui->encryptWidget->hide(); - if (m_device->type() == Device::Type::Disk_Device) { + if (m_device->type() != Device::Type::LVM_Device) { m_ui->lvNameLabel->hide(); m_ui->lvNameLineEdit->hide(); }