From 78f30db6e972cf8b27702c1a12226639f3bae9ba Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Fri, 14 Mar 2014 16:34:23 +0000 Subject: [PATCH] fixed: Bug #3886 - Alias is allowed to match screen name --- src/gui/src/ScreenSettingsDialog.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gui/src/ScreenSettingsDialog.cpp b/src/gui/src/ScreenSettingsDialog.cpp index 3665b5ba..70dcbd79 100644 --- a/src/gui/src/ScreenSettingsDialog.cpp +++ b/src/gui/src/ScreenSettingsDialog.cpp @@ -63,7 +63,10 @@ void ScreenSettingsDialog::accept() { if (m_pLineEditName->text().isEmpty()) { - QMessageBox::warning(this, tr("Screen name is empty"), tr("The name for a screen can not be empty. Please fill in a name or cancel the dialog.")); + QMessageBox::warning( + this, tr("Screen name is empty"), + tr("The screen name cannot be empty. " + "Please either fill in a name or cancel the dialog.")); return; } @@ -72,7 +75,18 @@ void ScreenSettingsDialog::accept() m_pScreen->setName(m_pLineEditName->text()); for (int i = 0; i < m_pListAliases->count(); i++) - m_pScreen->addAlias(m_pListAliases->item(i)->text()); + { + QString alias(m_pListAliases->item(i)->text()); + if (alias == m_pLineEditName->text()) + { + QMessageBox::warning( + this, tr("Screen name matches alias"), + tr("The screen name cannot be the same as an alias. " + "Please either remove the alias or change the screen name.")); + return; + } + m_pScreen->addAlias(alias); + } m_pScreen->setModifier(Screen::Shift, m_pComboBoxShift->currentIndex()); m_pScreen->setModifier(Screen::Ctrl, m_pComboBoxCtrl->currentIndex());