diff options
author | Stefan Hacker <dd0t@users.sourceforge.net> | 2011-06-09 22:39:29 +0400 |
---|---|---|
committer | Stefan Hacker <dd0t@users.sourceforge.net> | 2011-06-09 22:41:21 +0400 |
commit | c873e08b80c80fa4068077c3c5a67864f9018e2e (patch) | |
tree | 946903b0e27d57b7b2ab967c84e10c13a36b881b /src/mumble/ACLEditor.cpp | |
parent | bc32f8d38394cbede68cfe9768c0146f562ab0bf (diff) |
Prevent user from accepting the channel add/edit dialog when channel names are empty.
Implements patch #3289052 in a leaner way
Diffstat (limited to 'src/mumble/ACLEditor.cpp')
-rw-r--r-- | src/mumble/ACLEditor.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mumble/ACLEditor.cpp b/src/mumble/ACLEditor.cpp index f878c060f..88b16b760 100644 --- a/src/mumble/ACLEditor.cpp +++ b/src/mumble/ACLEditor.cpp @@ -242,11 +242,19 @@ void ACLEditor::accept() { QDialog::reject(); return; } + + if (qleChannelName->text().isEmpty()) { + // Empty channel name + QMessageBox::warning(this, QLatin1String("Mumble"), tr("Channel must have a name"), QMessageBox::Ok); + qleChannelName->setFocus(); + return; + } + // Update channel state if (bAddChannelMode) { g.sh->createChannel(iChannel, qleChannelName->text(), rteChannelDescription->text(), qsbChannelPosition->value(), qcbChannelTemporary->isChecked()); } else { - bool b = false; + bool needs_update = false; updatePasswordACL(); @@ -254,19 +262,19 @@ void ACLEditor::accept() { mpcs.set_channel_id(pChannel->iId); if (pChannel->qsName != qleChannelName->text()) { mpcs.set_name(u8(qleChannelName->text())); - b = true; + needs_update = true; } if (rteChannelDescription->isModified() && (pChannel->qsDesc != rteChannelDescription->text())) { const QString &msg = rteChannelDescription->text(); mpcs.set_description(u8(msg)); - b = true; + needs_update = true; Database::setBlob(sha1(msg), msg.toUtf8()); } if (pChannel->iPosition != qsbChannelPosition->value()) { mpcs.set_position(qsbChannelPosition->value()); - b = true; + needs_update = true; } - if (b) + if (needs_update) g.sh->sendMessage(mpcs); // Update ACL |