|
|
@ -170,79 +170,6 @@ class Plugin(BasePlugin): |
|
|
|
|
|
|
|
return bool(d.exec_()) |
|
|
|
|
|
|
|
def openalias_contact_dialog(self): |
|
|
|
'''Previous version using a get contact button from settings, currently unused.''' |
|
|
|
d = QDialog(self.win) |
|
|
|
vbox = QVBoxLayout(d) |
|
|
|
vbox.addWidget(QLabel(_('Openalias Contact') + ':')) |
|
|
|
|
|
|
|
grid = QGridLayout() |
|
|
|
line1 = QLineEdit() |
|
|
|
grid.addWidget(QLabel(_("URL")), 1, 0) |
|
|
|
grid.addWidget(line1, 1, 1) |
|
|
|
|
|
|
|
vbox.addLayout(grid) |
|
|
|
vbox.addLayout(Buttons(CancelButton(d), OkButton(d))) |
|
|
|
|
|
|
|
if not d.exec_(): |
|
|
|
return |
|
|
|
|
|
|
|
url = str(line1.text()) |
|
|
|
|
|
|
|
url = url.replace('@', '.') |
|
|
|
|
|
|
|
if not '.' in url: |
|
|
|
QMessageBox.warning(self.win, _('Error'), _('Invalid URL'), _('OK')) |
|
|
|
return |
|
|
|
|
|
|
|
data = self.resolve(url) |
|
|
|
|
|
|
|
if not data: |
|
|
|
return |
|
|
|
|
|
|
|
(address, name) = data |
|
|
|
|
|
|
|
if not self.validate_dnssec(url): |
|
|
|
msgBox = QMessageBox() |
|
|
|
msgBox.setText(_('WARNING: the address ' + address + ' could not be validated via an additional security check, DNSSEC, and thus may not be correct.')) |
|
|
|
msgBox.setInformativeText("Do you wish to continue?") |
|
|
|
msgBox.setStandardButtons(QMessageBox.Cancel | QMessageBox.Ok) |
|
|
|
msgBox.setDefaultButton(QMessageBox.Cancel) |
|
|
|
reply = msgBox.exec_() |
|
|
|
if reply != QMessageBox.Ok: |
|
|
|
return |
|
|
|
|
|
|
|
d2 = QDialog(self.win) |
|
|
|
vbox2 = QVBoxLayout(d2) |
|
|
|
grid2 = QGridLayout() |
|
|
|
grid2.addWidget(QLabel(url), 1, 1) |
|
|
|
if name: |
|
|
|
grid2.addWidget(QLabel('Name: '), 2, 0) |
|
|
|
grid2.addWidget(QLabel(name), 2, 1) |
|
|
|
|
|
|
|
grid2.addWidget(QLabel('Address: '), 4, 0) |
|
|
|
grid2.addWidget(QLabel(address), 4, 1) |
|
|
|
|
|
|
|
vbox2.addLayout(grid2) |
|
|
|
vbox2.addLayout(Buttons(CancelButton(d2), OkButton(d2))) |
|
|
|
|
|
|
|
if not d2.exec_(): |
|
|
|
return |
|
|
|
|
|
|
|
self.win.wallet.add_contact(address) |
|
|
|
|
|
|
|
try: |
|
|
|
label = url + " (" + name + ")" |
|
|
|
except Exception: |
|
|
|
pass |
|
|
|
|
|
|
|
if label: |
|
|
|
self.win.wallet.set_label(address, label) |
|
|
|
|
|
|
|
self.win.update_contacts_tab() |
|
|
|
self.win.update_history_tab() |
|
|
|
self.win.update_completions() |
|
|
|
self.win.tabs.setCurrentIndex(3) |
|
|
|
|
|
|
|
def resolve(self, url): |
|
|
|
'''Resolve OpenAlias address using url.''' |
|
|
|