236 """ |
236 """ |
237 Private slot called to add a new allowed host. |
237 Private slot called to add a new allowed host. |
238 """ |
238 """ |
239 allowedHost, ok = QInputDialog.getText( |
239 allowedHost, ok = QInputDialog.getText( |
240 None, |
240 None, |
241 self.trUtf8("Add allowed host"), |
241 self.tr("Add allowed host"), |
242 self.trUtf8("Enter the IP address of an allowed host"), |
242 self.tr("Enter the IP address of an allowed host"), |
243 QLineEdit.Normal) |
243 QLineEdit.Normal) |
244 if ok and allowedHost: |
244 if ok and allowedHost: |
245 if QHostAddress(allowedHost).protocol() in \ |
245 if QHostAddress(allowedHost).protocol() in \ |
246 [QAbstractSocket.IPv4Protocol, QAbstractSocket.IPv6Protocol]: |
246 [QAbstractSocket.IPv4Protocol, QAbstractSocket.IPv6Protocol]: |
247 self.allowedHostsList.addItem(allowedHost) |
247 self.allowedHostsList.addItem(allowedHost) |
248 else: |
248 else: |
249 E5MessageBox.critical( |
249 E5MessageBox.critical( |
250 self, |
250 self, |
251 self.trUtf8("Add allowed host"), |
251 self.tr("Add allowed host"), |
252 self.trUtf8( |
252 self.tr( |
253 """<p>The entered address <b>{0}</b> is not""" |
253 """<p>The entered address <b>{0}</b> is not""" |
254 """ a valid IP v4 or IP v6 address.""" |
254 """ a valid IP v4 or IP v6 address.""" |
255 """ Aborting...</p>""") |
255 """ Aborting...</p>""") |
256 .format(allowedHost)) |
256 .format(allowedHost)) |
257 |
257 |
268 Private slot called to edit an allowed host. |
268 Private slot called to edit an allowed host. |
269 """ |
269 """ |
270 allowedHost = self.allowedHostsList.currentItem().text() |
270 allowedHost = self.allowedHostsList.currentItem().text() |
271 allowedHost, ok = QInputDialog.getText( |
271 allowedHost, ok = QInputDialog.getText( |
272 None, |
272 None, |
273 self.trUtf8("Edit allowed host"), |
273 self.tr("Edit allowed host"), |
274 self.trUtf8("Enter the IP address of an allowed host"), |
274 self.tr("Enter the IP address of an allowed host"), |
275 QLineEdit.Normal, |
275 QLineEdit.Normal, |
276 allowedHost) |
276 allowedHost) |
277 if ok and allowedHost: |
277 if ok and allowedHost: |
278 if QHostAddress(allowedHost).protocol() in \ |
278 if QHostAddress(allowedHost).protocol() in \ |
279 [QAbstractSocket.IPv4Protocol, QAbstractSocket.IPv6Protocol]: |
279 [QAbstractSocket.IPv4Protocol, QAbstractSocket.IPv6Protocol]: |
280 self.allowedHostsList.currentItem().setText(allowedHost) |
280 self.allowedHostsList.currentItem().setText(allowedHost) |
281 else: |
281 else: |
282 E5MessageBox.critical( |
282 E5MessageBox.critical( |
283 self, |
283 self, |
284 self.trUtf8("Edit allowed host"), |
284 self.tr("Edit allowed host"), |
285 self.trUtf8( |
285 self.tr( |
286 """<p>The entered address <b>{0}</b> is not""" |
286 """<p>The entered address <b>{0}</b> is not""" |
287 """ a valid IP v4 or IP v6 address.""" |
287 """ a valid IP v4 or IP v6 address.""" |
288 """ Aborting...</p>""") |
288 """ Aborting...</p>""") |
289 .format(allowedHost)) |
289 .format(allowedHost)) |
290 |
290 |