Update volumeDialog ok button status as the used and total size changes.

This commit is contained in:
Chantara Tith 2016-07-16 04:29:34 +07:00 committed by Andrius Štikonas
parent e6834393ae
commit 2917317619
2 changed files with 10 additions and 1 deletions

View File

@ -104,7 +104,7 @@ void VolumeDialog::setupConstraints()
void VolumeDialog::updateOkButtonStatus()
{
bool enable = true;
bool enable = isLegeSize();
if (dialogWidget().vgName().text().isEmpty()) {
enable = false;
@ -152,6 +152,10 @@ void VolumeDialog::updateSizeInfos()
dialogWidget().totalUsedSize().setText(Capacity::formatByteSize(totalUsedSize));
dialogWidget().totalSectors().setText(QString::number(totalSectors));
dialogWidget().totalLV().setText(QString::number(totalLV));
//Probably a bad design for updating state here; the state should be changed inside the update button function.
m_IsLegalSize = totalSize > totalUsedSize;
updateOkButtonStatus();
}
void VolumeDialog::updatePartitionList()

View File

@ -75,6 +75,10 @@ protected:
return m_TargetPVList;
}
bool isLegeSize() const {
return m_IsLegalSize;
}
protected:
virtual void onPartitionListChanged();
@ -82,6 +86,7 @@ protected:
VolumeWidget* m_DialogWidget;
QString& m_TargetName;
QStringList& m_TargetPVList;
bool m_IsLegalSize;
QDialogButtonBox* dialogButtonBox;
QPushButton* okButton;