Skip to content

Commit

Permalink
Namecoin: Set default domain in DNS dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRand committed Dec 12, 2019
1 parent f67fa3a commit 05c0e0d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions electrum_nmc/electrum/gui/qt/configure_dns_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def __init__(self, value, parent):
for domain in subdomains:
self.add_domain(domain)

# Default to base domain
self.ui.comboDomain.setCurrentIndex(0)

self.ui.comboDomain.activated.connect(self.domain_changed)

self.ui.listDNSRecords.setModel(QStandardItemModel(self))
Expand Down Expand Up @@ -138,18 +141,21 @@ def add_domain(self, domain):

# Duplicate of existing domain.
if domain == domain_at_index:
combo.setCurrentIndex(index)
return

# "Add Subdomain" item is always at the end.
if domain_at_index == _(self.__class__.TEXT_ADD_SUBDOMAIN):
combo.insertItem(index, domain)
combo.setCurrentIndex(index)
return

domain_at_index_reverse = domain_at_index.split(".")[::-1]

# We've found the right place to insert it.
if domain_reverse < domain_at_index_reverse:
combo.insertItem(index, domain)
combo.setCurrentIndex(index)
return

def domain_changed(self, index):
Expand Down

0 comments on commit 05c0e0d

Please sign in to comment.