Completer unicode fixes

This commit is contained in:
mailchuck 2016-04-29 11:43:40 +02:00 committed by Peter Surda
parent 46edb72b4f
commit 58481afda2
2 changed files with 7 additions and 7 deletions

View File

@ -1895,13 +1895,13 @@ class MyForm(settingsmixin.SMainWindow):
completerList = []
for address in sorted(oldRows, key = lambda x: oldRows[x][2], reverse = True):
if address in newRows:
completerList.append(newRows[address][0] + " <" + address + ">")
completerList.append(unicode(newRows[address][0], encoding="UTF-8") + " <" + address + ">")
newRows.pop(address)
else:
self.ui.tableWidgetAddressBook.removeRow(oldRows[address][2])
for address in newRows:
addRow(address, newRows[address][0], newRows[address][1])
completerList.append(newRows[address][0] + " <" + address + ">")
completerList.append(unicode(newRows[address][0], encoding="UTF-8") + " <" + address + ">")
# sort
self.ui.tableWidgetAddressBook.sortByColumn(0, Qt.AscendingOrder)
@ -3187,8 +3187,8 @@ class MyForm(settingsmixin.SMainWindow):
if self.ui.lineEditTo.text() == '':
self.ui.lineEditTo.setText(stringToAdd)
else:
self.ui.lineEditTo.setText(str(
self.ui.lineEditTo.text()) + '; ' + stringToAdd)
self.ui.lineEditTo.setText(unicode(
self.ui.lineEditTo.text().toUtf8(), encoding="UTF-8") + '; ' + stringToAdd)
if listOfSelectedRows == {}:
self.statusBar().showMessage(_translate(
"MainWindow", "No addresses selected."))

View File

@ -491,7 +491,7 @@ class AddressBookCompleter(QtGui.QCompleter):
def splitPath(self, path):
stringList = []
text = unicode(path.toUtf8())
text = unicode(path.toUtf8(), encoding="UTF-8")
splitIndex = rfind(text[0:self.widget().cursorPosition()], ";") + 1
str = text[splitIndex:self.widget().cursorPosition()]
str = rstrip(lstrip(str))
@ -499,8 +499,8 @@ class AddressBookCompleter(QtGui.QCompleter):
return stringList
def pathFromIndex(self, index):
autoString = unicode(index.data(QtCore.Qt.EditRole).toString())
text = unicode(self.widget().text().toUtf8())
autoString = unicode(index.data(QtCore.Qt.EditRole).toString().toUtf8(), encoding="UTF-8")
text = unicode(self.widget().text().toUtf8(), encoding="UTF-8")
# If cursor position was saved, restore it, else save it
if self.cursorPos != -1: