- Allow adding plain addresses (for security, the label will be blank)
This commit is contained in:
parent
ebd567c712
commit
6b6f3a67c8
|
@ -2617,6 +2617,16 @@ class MyForm(QtGui.QMainWindow):
|
||||||
# no matching contact
|
# no matching contact
|
||||||
self.ui.comboboxFindLabel.setCurrentIndex(0) # set the label to ""
|
self.ui.comboboxFindLabel.setCurrentIndex(0) # set the label to ""
|
||||||
self.ui.comboboxFindAddress.setEditText(text) # otherwise you will lose the text on enter
|
self.ui.comboboxFindAddress.setEditText(text) # otherwise you will lose the text on enter
|
||||||
|
# but maybe the address is valid?
|
||||||
|
# random address for testing: BM-2DAArASbJckBdn3HvTt7kHAbPA5tGxc2R1
|
||||||
|
status, a, b, c = decodeAddress(str(text))
|
||||||
|
if status == 'success':
|
||||||
|
# valid address
|
||||||
|
print _translate("MainWindow", "Address is valid.")
|
||||||
|
self.on_addRecipient_submit()
|
||||||
|
else:
|
||||||
|
# not valid
|
||||||
|
print 'sorry, invalid address'
|
||||||
return QtGui.QComboBox.keyPressEvent(self.ui.comboboxFindAddress, event)
|
return QtGui.QComboBox.keyPressEvent(self.ui.comboboxFindAddress, event)
|
||||||
|
|
||||||
def on_addRecipient_submit(self):
|
def on_addRecipient_submit(self):
|
||||||
|
@ -2625,7 +2635,15 @@ class MyForm(QtGui.QMainWindow):
|
||||||
labelText = self.ui.comboboxFindLabel.currentText()
|
labelText = self.ui.comboboxFindLabel.currentText()
|
||||||
addressIndex = self.ui.comboboxFindAddress.currentIndex()
|
addressIndex = self.ui.comboboxFindAddress.currentIndex()
|
||||||
addressText = self.ui.comboboxFindAddress.currentText()
|
addressText = self.ui.comboboxFindAddress.currentText()
|
||||||
if (labelIndex == addressIndex) & (self.ui.comboboxFindLabel.itemText(index) == labelText) & (self.ui.comboboxFindAddress.itemText(index) == addressText):
|
status, a, b, c = decodeAddress(str(addressText))
|
||||||
|
if ((labelIndex == addressIndex) & (self.ui.comboboxFindLabel.itemText(index) == labelText) & (self.ui.comboboxFindAddress.itemText(index) == addressText)):
|
||||||
|
pass
|
||||||
|
elif ((labelIndex <= 0) & (status == 'success')):
|
||||||
|
labelText = _translate("MainWindow", "--unknown Address--")
|
||||||
|
index = -1
|
||||||
|
else:
|
||||||
|
print 'how did you get here?!'
|
||||||
|
return
|
||||||
addToBottom = False
|
addToBottom = False
|
||||||
rowIndex = self.ui.tableWidgetRecipients.rowCount()-1 if addToBottom else 1
|
rowIndex = self.ui.tableWidgetRecipients.rowCount()-1 if addToBottom else 1
|
||||||
self.ui.tableWidgetRecipients.insertRow(rowIndex)
|
self.ui.tableWidgetRecipients.insertRow(rowIndex)
|
||||||
|
@ -2643,9 +2661,6 @@ class MyForm(QtGui.QMainWindow):
|
||||||
# jump to the first item
|
# jump to the first item
|
||||||
self.ui.comboboxFindAddress.setCurrentIndex(0)
|
self.ui.comboboxFindAddress.setCurrentIndex(0)
|
||||||
self.ui.comboboxFindLabel.setCurrentIndex(0)
|
self.ui.comboboxFindLabel.setCurrentIndex(0)
|
||||||
else:
|
|
||||||
print 'how did you get here?!'
|
|
||||||
return
|
|
||||||
|
|
||||||
# Group of functions for the Address Book dialog box
|
# Group of functions for the Address Book dialog box
|
||||||
def on_action_AddressBookNew(self):
|
def on_action_AddressBookNew(self):
|
||||||
|
|
Reference in New Issue
Block a user