populate from field feature implementation

This commit is contained in:
bikash617 2013-12-01 13:23:34 +04:00
parent 34ca45160d
commit 6d197e97b1

View File

@ -2548,6 +2548,11 @@ class MyForm(QtGui.QMainWindow):
currentInboxRow = self.ui.tableWidgetInbox.currentRow() currentInboxRow = self.ui.tableWidgetInbox.currentRow()
toAddressAtCurrentInboxRow = str(self.ui.tableWidgetInbox.item( toAddressAtCurrentInboxRow = str(self.ui.tableWidgetInbox.item(
currentInboxRow, 0).data(Qt.UserRole).toPyObject()) currentInboxRow, 0).data(Qt.UserRole).toPyObject())
toAddressAtCurrentInboxRow_label = str(self.ui.tableWidgetInbox.item(
currentInboxRow, 0).text())
fromAddressAtCurrentInboxRow = str(self.ui.tableWidgetInbox.item( fromAddressAtCurrentInboxRow = str(self.ui.tableWidgetInbox.item(
currentInboxRow, 1).data(Qt.UserRole).toPyObject()) currentInboxRow, 1).data(Qt.UserRole).toPyObject())
msgid = str(self.ui.tableWidgetInbox.item( msgid = str(self.ui.tableWidgetInbox.item(
@ -2578,8 +2583,27 @@ class MyForm(QtGui.QMainWindow):
if shared.safeConfigGetBoolean(toAddressAtCurrentInboxRow, 'chan'): if shared.safeConfigGetBoolean(toAddressAtCurrentInboxRow, 'chan'):
print 'original sent to a chan. Setting the to address in the reply to the chan address.' print 'original sent to a chan. Setting the to address in the reply to the chan address.'
self.ui.lineEditTo.setText(str(toAddressAtCurrentInboxRow)) self.ui.lineEditTo.setText(str(toAddressAtCurrentInboxRow))
self.ui.comboBoxSendFrom.setCurrentIndex(0)
AllItems = [str(self.ui.comboBoxSendFrom.itemText(i)) for i in range(self.ui.comboBoxSendFrom.count())]
AllItems_address = [str(self.ui.comboBoxSendFrom.itemData(i).toPyObject()) for i in range(self.ui.comboBoxSendFrom.count())]
isPresent_Label = False
for item in AllItems:
if toAddressAtCurrentInboxRow_label == item:
isPresent_Label = True
break;
if(isPresent_Label == True):
currentIndex = AllItems.index(toAddressAtCurrentInboxRow_label)
self.ui.comboBoxSendFrom.setCurrentIndex(currentIndex)
else:
currentIndex = AllItems_address.index(toAddressAtCurrentInboxRow)
self.ui.comboBoxSendFrom.setCurrentIndex(currentIndex)
#self.ui.comboBoxSendFrom.setCurrentIndex(0)
self.ui.textEditMessage.setText('\n\n------------------------------------------------------\n' + unicode(messageAtCurrentInboxRow, 'utf-8)')) self.ui.textEditMessage.setText('\n\n------------------------------------------------------\n' + unicode(messageAtCurrentInboxRow, 'utf-8)'))
if self.ui.tableWidgetInbox.item(currentInboxRow, 2).text()[0:3] in ['Re:', 'RE:']: if self.ui.tableWidgetInbox.item(currentInboxRow, 2).text()[0:3] in ['Re:', 'RE:']:
self.ui.lineEditSubject.setText( self.ui.lineEditSubject.setText(