firewall: Warn earlier and improve message on empty service name for TCP/UDP

Fixes QubesOS/qubes-issues#2093
This commit is contained in:
Marek Marczykowski-Górecki 2016-06-21 02:05:21 +02:00
parent 00caebda95
commit 49c209d077
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -88,6 +88,14 @@ class NewFwRuleDlg (QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
self.populate_combos()
self.serviceComboBox.setInsertPolicy(QComboBox.InsertAtTop)
def accept(self):
if self.tcp_radio.isChecked() or self.udp_radio.isChecked():
if len(self.serviceComboBox.currentText()) == 0:
msg = QMessageBox()
msg.warning(self, "Firewall rule",
"You need to fill service name/port for TCP/UDP rule")
return
QDialog.accept(self)
def populate_combos(self):
example_addresses = [