Fix a broken QRegularExpression in LVM VG name validator.

This commit is contained in:
Andrius Štikonas 2017-10-06 23:13:08 +01:00
parent 38d9c72466
commit eb6478aa49
2 changed files with 6 additions and 3 deletions

View File

@ -725,10 +725,10 @@ void MainWindow::scanDevices()
deviceScanner().start();
}
void MainWindow::on_m_DeviceScanner_progress(const QString& device_node, int percent)
void MainWindow::on_m_DeviceScanner_progress(const QString& deviceNode, int percent)
{
scanProgressDialog().setProgress(percent);
scanProgressDialog().setDeviceName(device_node);
scanProgressDialog().setDeviceName(deviceNode);
}
void MainWindow::on_m_DeviceScanner_finished()

View File

@ -75,7 +75,10 @@ VolumeGroupDialog::~VolumeGroupDialog()
void VolumeGroupDialog::setupDialog()
{
QRegularExpression re(QStringLiteral("[\\w-.+]+"));
/* LVM Volume group name can consists of: letters numbers _ . - +
* It cannot start with underscore _ and must not be equal to . or .. or any entry in /dev/
* QLineEdit accepts QValidator::Intermediate, so we just disable . at the beginning */
QRegularExpression re(QStringLiteral(R"(^(?!_|.)[\w\-.+]+)"));
QRegularExpressionValidator *validator = new QRegularExpressionValidator(re, this);
dialogWidget().vgName().setValidator(validator);
dialogWidget().vgName().setText(targetName());