Added an option to reply on own messages i.e. send update
This commit is contained in:
parent
7e1ee815b9
commit
d1c601e7ae
|
@ -117,6 +117,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
REPLY_TYPE_SENDER = 0
|
REPLY_TYPE_SENDER = 0
|
||||||
REPLY_TYPE_CHAN = 1
|
REPLY_TYPE_CHAN = 1
|
||||||
|
REPLY_TYPE_UPD = 2
|
||||||
|
|
||||||
def init_file_menu(self):
|
def init_file_menu(self):
|
||||||
QtCore.QObject.connect(self.ui.actionExit, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.ui.actionExit, QtCore.SIGNAL(
|
||||||
|
@ -381,6 +382,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.actionForceSend = self.ui.sentContextMenuToolbar.addAction(
|
self.actionForceSend = self.ui.sentContextMenuToolbar.addAction(
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow", "Force send"), self.on_action_ForceSend)
|
"MainWindow", "Force send"), self.on_action_ForceSend)
|
||||||
|
self.actionSentReply = self.ui.sentContextMenuToolbar.addAction(
|
||||||
|
_translate("MainWindow", "Send update"),
|
||||||
|
self.on_action_SentReply)
|
||||||
# self.popMenuSent = QtGui.QMenu( self )
|
# self.popMenuSent = QtGui.QMenu( self )
|
||||||
# self.popMenuSent.addAction( self.actionSentClipboard )
|
# self.popMenuSent.addAction( self.actionSentClipboard )
|
||||||
# self.popMenuSent.addAction( self.actionTrashSentMessage )
|
# self.popMenuSent.addAction( self.actionTrashSentMessage )
|
||||||
|
@ -2996,48 +3000,71 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def on_action_InboxReplyChan(self):
|
def on_action_InboxReplyChan(self):
|
||||||
self.on_action_InboxReply(self.REPLY_TYPE_CHAN)
|
self.on_action_InboxReply(self.REPLY_TYPE_CHAN)
|
||||||
|
|
||||||
def on_action_InboxReply(self, replyType = None):
|
def on_action_SentReply(self):
|
||||||
|
self.on_action_InboxReply(self.REPLY_TYPE_UPD)
|
||||||
|
|
||||||
|
def on_action_InboxReply(self, reply_type=None):
|
||||||
tableWidget = self.getCurrentMessagelist()
|
tableWidget = self.getCurrentMessagelist()
|
||||||
if not tableWidget:
|
if not tableWidget:
|
||||||
return
|
return
|
||||||
|
|
||||||
if replyType is None:
|
if reply_type is None:
|
||||||
replyType = self.REPLY_TYPE_SENDER
|
reply_type = self.REPLY_TYPE_SENDER
|
||||||
|
|
||||||
# save this to return back after reply is done
|
# save this to return back after reply is done
|
||||||
self.replyFromTab = self.ui.tabWidget.currentIndex()
|
self.replyFromTab = self.ui.tabWidget.currentIndex()
|
||||||
|
|
||||||
|
column_to = 1 if reply_type == self.REPLY_TYPE_UPD else 0
|
||||||
|
column_from = 0 if reply_type == self.REPLY_TYPE_UPD else 1
|
||||||
|
|
||||||
currentInboxRow = tableWidget.currentRow()
|
currentInboxRow = tableWidget.currentRow()
|
||||||
toAddressAtCurrentInboxRow = tableWidget.item(
|
toAddressAtCurrentInboxRow = tableWidget.item(
|
||||||
currentInboxRow, 0).address
|
currentInboxRow, column_to).address
|
||||||
acct = accountClass(toAddressAtCurrentInboxRow)
|
acct = accountClass(toAddressAtCurrentInboxRow)
|
||||||
fromAddressAtCurrentInboxRow = tableWidget.item(
|
fromAddressAtCurrentInboxRow = tableWidget.item(
|
||||||
currentInboxRow, 1).address
|
currentInboxRow, column_from).address
|
||||||
msgid = str(tableWidget.item(
|
msgid = str(tableWidget.item(
|
||||||
currentInboxRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
currentInboxRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''select message from inbox where msgid=?''', msgid)
|
"SELECT message FROM inbox WHERE msgid=?", msgid
|
||||||
|
) or sqlQuery("SELECT message FROM sent WHERE ackdata=?", msgid)
|
||||||
if queryreturn != []:
|
if queryreturn != []:
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
messageAtCurrentInboxRow, = row
|
messageAtCurrentInboxRow, = row
|
||||||
acct.parseMessage(toAddressAtCurrentInboxRow, fromAddressAtCurrentInboxRow, tableWidget.item(currentInboxRow, 2).subject, messageAtCurrentInboxRow)
|
acct.parseMessage(
|
||||||
|
toAddressAtCurrentInboxRow, fromAddressAtCurrentInboxRow,
|
||||||
|
tableWidget.item(currentInboxRow, 2).subject,
|
||||||
|
messageAtCurrentInboxRow)
|
||||||
widget = {
|
widget = {
|
||||||
'subject': self.ui.lineEditSubject,
|
'subject': self.ui.lineEditSubject,
|
||||||
'from': self.ui.comboBoxSendFrom,
|
'from': self.ui.comboBoxSendFrom,
|
||||||
'message': self.ui.textEditMessage
|
'message': self.ui.textEditMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
if toAddressAtCurrentInboxRow == str_broadcast_subscribers:
|
if toAddressAtCurrentInboxRow == str_broadcast_subscribers:
|
||||||
self.ui.tabWidgetSend.setCurrentIndex(
|
self.ui.tabWidgetSend.setCurrentIndex(
|
||||||
self.ui.tabWidgetSend.indexOf(self.ui.sendDirect)
|
self.ui.tabWidgetSend.indexOf(self.ui.sendDirect)
|
||||||
)
|
)
|
||||||
# toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
|
# toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
|
||||||
elif not BMConfigParser().has_section(toAddressAtCurrentInboxRow):
|
elif not BMConfigParser().has_section(toAddressAtCurrentInboxRow):
|
||||||
QtGui.QMessageBox.information(self, _translate("MainWindow", "Address is gone"), _translate(
|
QtGui.QMessageBox.information(
|
||||||
"MainWindow", "Bitmessage cannot find your address %1. Perhaps you removed it?").arg(toAddressAtCurrentInboxRow), QtGui.QMessageBox.Ok)
|
self, _translate("MainWindow", "Address is gone"),
|
||||||
elif not BMConfigParser().getboolean(toAddressAtCurrentInboxRow, 'enabled'):
|
_translate(
|
||||||
QtGui.QMessageBox.information(self, _translate("MainWindow", "Address disabled"), _translate(
|
"MainWindow",
|
||||||
"MainWindow", "Error: The address from which you are trying to send is disabled. You\'ll have to enable it on the \'Your Identities\' tab before using it."), QtGui.QMessageBox.Ok)
|
"Bitmessage cannot find your address %1. Perhaps you"
|
||||||
|
" removed it?"
|
||||||
|
).arg(toAddressAtCurrentInboxRow), QtGui.QMessageBox.Ok)
|
||||||
|
elif not BMConfigParser().getboolean(
|
||||||
|
toAddressAtCurrentInboxRow, 'enabled'):
|
||||||
|
QtGui.QMessageBox.information(
|
||||||
|
self, _translate("MainWindow", "Address disabled"),
|
||||||
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Error: The address from which you are trying to send"
|
||||||
|
" is disabled. You\'ll have to enable it on the"
|
||||||
|
" \'Your Identities\' tab before using it."
|
||||||
|
), QtGui.QMessageBox.Ok)
|
||||||
else:
|
else:
|
||||||
self.setBroadcastEnablementDependingOnWhetherThisIsAMailingListAddress(toAddressAtCurrentInboxRow)
|
self.setBroadcastEnablementDependingOnWhetherThisIsAMailingListAddress(toAddressAtCurrentInboxRow)
|
||||||
broadcast_tab_index = self.ui.tabWidgetSend.indexOf(
|
broadcast_tab_index = self.ui.tabWidgetSend.indexOf(
|
||||||
|
@ -3051,28 +3078,44 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
}
|
}
|
||||||
self.ui.tabWidgetSend.setCurrentIndex(broadcast_tab_index)
|
self.ui.tabWidgetSend.setCurrentIndex(broadcast_tab_index)
|
||||||
toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
|
toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
|
||||||
if fromAddressAtCurrentInboxRow == tableWidget.item(currentInboxRow, 1).label or (
|
if fromAddressAtCurrentInboxRow == \
|
||||||
isinstance(acct, GatewayAccount) and fromAddressAtCurrentInboxRow == acct.relayAddress):
|
tableWidget.item(currentInboxRow, column_from).label or (
|
||||||
|
isinstance(acct, GatewayAccount) and
|
||||||
|
fromAddressAtCurrentInboxRow == acct.relayAddress):
|
||||||
self.ui.lineEditTo.setText(str(acct.fromAddress))
|
self.ui.lineEditTo.setText(str(acct.fromAddress))
|
||||||
else:
|
else:
|
||||||
self.ui.lineEditTo.setText(tableWidget.item(currentInboxRow, 1).label + " <" + str(acct.fromAddress) + ">")
|
self.ui.lineEditTo.setText(
|
||||||
|
tableWidget.item(currentInboxRow, column_from).label +
|
||||||
# If the previous message was to a chan then we should send our reply to the chan rather than to the particular person who sent the message.
|
" <" + str(acct.fromAddress) + ">"
|
||||||
if acct.type == AccountMixin.CHAN and replyType == self.REPLY_TYPE_CHAN:
|
)
|
||||||
logger.debug('original sent to a chan. Setting the to address in the reply to the chan address.')
|
|
||||||
if toAddressAtCurrentInboxRow == tableWidget.item(currentInboxRow, 0).label:
|
# If the previous message was to a chan then we should send our
|
||||||
|
# reply to the chan rather than to the particular person who sent
|
||||||
|
# the message.
|
||||||
|
if acct.type == AccountMixin.CHAN and reply_type == self.REPLY_TYPE_CHAN:
|
||||||
|
logger.debug(
|
||||||
|
'Original sent to a chan. Setting the to address in the'
|
||||||
|
' reply to the chan address.')
|
||||||
|
if toAddressAtCurrentInboxRow == \
|
||||||
|
tableWidget.item(currentInboxRow, column_to).label:
|
||||||
self.ui.lineEditTo.setText(str(toAddressAtCurrentInboxRow))
|
self.ui.lineEditTo.setText(str(toAddressAtCurrentInboxRow))
|
||||||
else:
|
else:
|
||||||
self.ui.lineEditTo.setText(tableWidget.item(currentInboxRow, 0).label + " <" + str(acct.toAddress) + ">")
|
self.ui.lineEditTo.setText(
|
||||||
|
tableWidget.item(currentInboxRow, column_to).label +
|
||||||
|
" <" + str(acct.toAddress) + ">"
|
||||||
|
)
|
||||||
|
|
||||||
self.setSendFromComboBox(toAddressAtCurrentInboxRow)
|
self.setSendFromComboBox(toAddressAtCurrentInboxRow)
|
||||||
|
|
||||||
quotedText = self.quoted_text(unicode(messageAtCurrentInboxRow, 'utf-8', 'replace'))
|
quotedText = self.quoted_text(
|
||||||
|
unicode(messageAtCurrentInboxRow, 'utf-8', 'replace'))
|
||||||
widget['message'].setPlainText(quotedText)
|
widget['message'].setPlainText(quotedText)
|
||||||
if acct.subject[0:3] in ['Re:', 'RE:']:
|
if acct.subject[0:3] in ['Re:', 'RE:']:
|
||||||
widget['subject'].setText(tableWidget.item(currentInboxRow, 2).label)
|
widget['subject'].setText(
|
||||||
|
tableWidget.item(currentInboxRow, 2).label)
|
||||||
else:
|
else:
|
||||||
widget['subject'].setText('Re: ' + tableWidget.item(currentInboxRow, 2).label)
|
widget['subject'].setText(
|
||||||
|
'Re: ' + tableWidget.item(currentInboxRow, 2).label)
|
||||||
self.ui.tabWidget.setCurrentIndex(
|
self.ui.tabWidget.setCurrentIndex(
|
||||||
self.ui.tabWidget.indexOf(self.ui.send)
|
self.ui.tabWidget.indexOf(self.ui.send)
|
||||||
)
|
)
|
||||||
|
@ -3949,6 +3992,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.popMenuSent = QtGui.QMenu(self)
|
self.popMenuSent = QtGui.QMenu(self)
|
||||||
self.popMenuSent.addAction(self.actionSentClipboard)
|
self.popMenuSent.addAction(self.actionSentClipboard)
|
||||||
self.popMenuSent.addAction(self.actionTrashSentMessage)
|
self.popMenuSent.addAction(self.actionTrashSentMessage)
|
||||||
|
self.popMenuSent.addAction(self.actionSentReply)
|
||||||
|
|
||||||
# Check to see if this item is toodifficult and display an additional
|
# Check to see if this item is toodifficult and display an additional
|
||||||
# menu option (Force Send) if it is.
|
# menu option (Force Send) if it is.
|
||||||
|
|
Reference in New Issue
Block a user