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