From 5775560759a149a56f94fcdf9dee6b10f7bfb2d0 Mon Sep 17 00:00:00 2001 From: Chantara Tith Date: Mon, 8 Aug 2016 10:15:53 +0700 Subject: [PATCH] When creating new LV, disable OK button if the LV name already exists. --- src/gui/newdialog.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/newdialog.cpp b/src/gui/newdialog.cpp index 07e913c..e0abddd 100644 --- a/src/gui/newdialog.cpp +++ b/src/gui/newdialog.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -254,9 +255,11 @@ void NewDialog::slotPasswordStatusChanged() void NewDialog::onLVNameChanged(const QString& newName) { - //TODO: validate lvName partition().setPartitionPath(device().deviceNode() + QStringLiteral("/") + newName.trimmed()); - if (dialogWidget().lvName().isVisible() && dialogWidget().lvName().text().isEmpty()) { + if ((dialogWidget().lvName().isVisible() && + dialogWidget().lvName().text().isEmpty()) || + (device().type() == Device::LVM_Device && + dynamic_cast(device()).lvPathList().contains(partition().partitionPath())) ) { m_IsValidLVName = false; } else { m_IsValidLVName = true;