Disable newPartitionTableButton for LVM device.

This commit is contained in:
Chantara Tith 2016-09-05 16:05:16 +07:00 committed by Andrius Štikonas
parent 652ffaedd5
commit 2a785bdf89

View File

@ -119,7 +119,7 @@ PartitionPage::~PartitionPage()
void void
PartitionPage::updateButtons() PartitionPage::updateButtons()
{ {
bool create = false, edit = false, del = false; bool create = false, createTable = false, edit = false, del = false;
QModelIndex index = m_ui->partitionTreeView->currentIndex(); QModelIndex index = m_ui->partitionTreeView->currentIndex();
if ( index.isValid() ) if ( index.isValid() )
@ -141,11 +141,18 @@ PartitionPage::updateButtons()
edit = !isFree && !isExtended; edit = !isFree && !isExtended;
del = !isFree; del = !isFree;
} }
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::LVM_Device )
createTable = true;
}
m_ui->createButton->setEnabled( create ); m_ui->createButton->setEnabled( create );
m_ui->editButton->setEnabled( edit ); m_ui->editButton->setEnabled( edit );
m_ui->deleteButton->setEnabled( del ); m_ui->deleteButton->setEnabled( del );
m_ui->newPartitionTableButton->setEnabled( createTable );
m_ui->newPartitionTableButton->setEnabled( m_ui->deviceComboBox->currentIndex() >= 0 );
} }
void void