"Send message to this chan" item in chan context menu (closes #1445)

This commit is contained in:
Dmitri Bogomolov 2019-03-20 18:36:32 +02:00
parent 37489cf7fe
commit 71e4c29419
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -304,6 +304,9 @@ class MyForm(settingsmixin.SMainWindow):
_translate( _translate(
"MainWindow", "Copy address to clipboard"), "MainWindow", "Copy address to clipboard"),
self.on_action_Clipboard) self.on_action_Clipboard)
self.actionSend = self.ui.addressContextMenuToolbar.addAction(
_translate("MainWindow", "Send message to this chan"),
self.on_action_Send)
self.actionSpecialAddressBehavior = self.ui.addressContextMenuToolbar.addAction( self.actionSpecialAddressBehavior = self.ui.addressContextMenuToolbar.addAction(
_translate( _translate(
"MainWindow", "Special address behavior..."), "MainWindow", "Special address behavior..."),
@ -1872,7 +1875,7 @@ class MyForm(settingsmixin.SMainWindow):
def click_pushButtonClear(self): def click_pushButtonClear(self):
self.ui.lineEditSubject.setText("") self.ui.lineEditSubject.setText("")
self.ui.lineEditTo.setText("") self.ui.lineEditTo.setText("")
self.ui.textEditMessage.setText("") self.ui.textEditMessage.reset()
self.ui.comboBoxSendFrom.setCurrentIndex(0) self.ui.comboBoxSendFrom.setCurrentIndex(0)
def click_pushButtonSend(self): def click_pushButtonSend(self):
@ -2085,10 +2088,7 @@ class MyForm(settingsmixin.SMainWindow):
toAddress, toLabel, fromAddress, subject, message, ackdata) toAddress, toLabel, fromAddress, subject, message, ackdata)
queues.workerQueue.put(('sendmessage', toAddress)) queues.workerQueue.put(('sendmessage', toAddress))
self.ui.comboBoxSendFrom.setCurrentIndex(0) self.click_pushButtonClear()
self.ui.lineEditTo.setText('')
self.ui.lineEditSubject.setText('')
self.ui.textEditMessage.reset()
if self.replyFromTab is not None: if self.replyFromTab is not None:
self.ui.tabWidget.setCurrentIndex(self.replyFromTab) self.ui.tabWidget.setCurrentIndex(self.replyFromTab)
self.replyFromTab = None self.replyFromTab = None
@ -2609,6 +2609,13 @@ class MyForm(settingsmixin.SMainWindow):
except: except:
pass pass
def on_action_Send(self):
self.click_pushButtonClear()
self.ui.lineEditTo.setText(self.getCurrentAccount())
self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send)
)
def on_action_SpecialAddressBehaviorDialog(self): def on_action_SpecialAddressBehaviorDialog(self):
dialogs.SpecialAddressBehaviorDialog(self, BMConfigParser()) dialogs.SpecialAddressBehaviorDialog(self, BMConfigParser())
@ -3953,6 +3960,7 @@ class MyForm(settingsmixin.SMainWindow):
else: else:
self.popMenu.addAction(self.actionEnable) self.popMenu.addAction(self.actionEnable)
self.popMenu.addAction(self.actionSetAvatar) self.popMenu.addAction(self.actionSetAvatar)
self.popMenu.addAction(self.actionSend)
self.popMenu.addSeparator() self.popMenu.addSeparator()
# preloaded gui.menu plugins with prefix 'address' # preloaded gui.menu plugins with prefix 'address'
for plugin in self.menu_plugins['address']: for plugin in self.menu_plugins['address']: