Retranslate context menus after language switch #756

Merged
digital-dreamer merged 1 commits from retranslate-context-menus into master 2014-12-29 06:19:01 +01:00
Showing only changes of commit c1784bb533 - Show all commits

View File

@ -233,7 +233,7 @@ class MyForm(QtGui.QMainWindow):
QtCore.QObject.connect(self.ui.actionHelp, QtCore.SIGNAL(
"triggered()"), self.click_actionHelp)
def init_inbox_popup_menu(self):
def init_inbox_popup_menu(self, connectSignal=True):
# Popup menu for the Inbox tab
self.ui.inboxContextMenuToolbar = QtGui.QToolBar()
# Actions
@ -259,6 +259,7 @@ class MyForm(QtGui.QMainWindow):
"MainWindow", "Mark Unread"), self.on_action_InboxMarkUnread)
self.ui.tableWidgetInbox.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
if connectSignal:
self.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'),
self.on_context_menuInbox)
@ -272,7 +273,7 @@ class MyForm(QtGui.QMainWindow):
self.popMenuInbox.addAction(self.actionSaveMessageAs)
self.popMenuInbox.addAction(self.actionTrashInboxMessage)
def init_identities_popup_menu(self):
def init_identities_popup_menu(self, connectSignal=True):
# Popup menu for the Your Identities tab
self.ui.addressContextMenuToolbar = QtGui.QToolBar()
# Actions
@ -298,6 +299,7 @@ class MyForm(QtGui.QMainWindow):
self.on_action_SpecialAddressBehaviorDialog)
self.ui.tableWidgetYourIdentities.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
if connectSignal:
self.connect(self.ui.tableWidgetYourIdentities, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'),
self.on_context_menuYourIdentities)
@ -311,7 +313,7 @@ class MyForm(QtGui.QMainWindow):
self.popMenu.addAction(self.actionSetAvatar)
self.popMenu.addAction(self.actionSpecialAddressBehavior)
def init_addressbook_popup_menu(self):
def init_addressbook_popup_menu(self, connectSignal=True):
# Popup menu for the Address Book page
self.ui.addressBookContextMenuToolbar = QtGui.QToolBar()
# Actions
@ -339,6 +341,7 @@ class MyForm(QtGui.QMainWindow):
"MainWindow", "Delete"), self.on_action_AddressBookDelete)
self.ui.tableWidgetAddressBook.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
if connectSignal:
self.connect(self.ui.tableWidgetAddressBook, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'),
self.on_context_menuAddressBook)
@ -351,7 +354,7 @@ class MyForm(QtGui.QMainWindow):
self.popMenuAddressBook.addAction(self.actionAddressBookNew)
self.popMenuAddressBook.addAction(self.actionAddressBookDelete)
def init_subscriptions_popup_menu(self):
def init_subscriptions_popup_menu(self, connectSignal=True):
# Popup menu for the Subscriptions page
self.ui.subscriptionsContextMenuToolbar = QtGui.QToolBar()
# Actions
@ -374,6 +377,7 @@ class MyForm(QtGui.QMainWindow):
self.on_action_SubscriptionsSetAvatar)
self.ui.tableWidgetSubscriptions.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
if connectSignal:
self.connect(self.ui.tableWidgetSubscriptions, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'),
self.on_context_menuSubscriptions)
@ -387,7 +391,7 @@ class MyForm(QtGui.QMainWindow):
self.popMenuSubscriptions.addSeparator()
self.popMenuSubscriptions.addAction(self.actionsubscriptionsClipboard)
def init_sent_popup_menu(self):
def init_sent_popup_menu(self, connectSignal=True):
# Popup menu for the Sent page
self.ui.sentContextMenuToolbar = QtGui.QToolBar()
# Actions
@ -403,6 +407,7 @@ class MyForm(QtGui.QMainWindow):
"MainWindow", "Force send"), self.on_action_ForceSend)
self.ui.tableWidgetSent.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
if connectSignal:
self.connect(self.ui.tableWidgetSent, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'),
self.on_context_menuSent)
@ -410,7 +415,7 @@ class MyForm(QtGui.QMainWindow):
# self.popMenuSent.addAction( self.actionSentClipboard )
# self.popMenuSent.addAction( self.actionTrashSentMessage )
def init_blacklist_popup_menu(self):
def init_blacklist_popup_menu(self, connectSignal=True):
# Popup menu for the Blacklist page
self.ui.blacklistContextMenuToolbar = QtGui.QToolBar()
# Actions
@ -436,6 +441,7 @@ class MyForm(QtGui.QMainWindow):
self.on_action_BlacklistSetAvatar)
self.ui.tableWidgetBlacklist.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
if connectSignal:
self.connect(self.ui.tableWidgetBlacklist, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'),
self.on_context_menuBlacklist)
@ -1436,6 +1442,12 @@ class MyForm(QtGui.QMainWindow):
def changeEvent(self, event):
if event.type() == QtCore.QEvent.LanguageChange:
self.ui.retranslateUi(self)
self.init_inbox_popup_menu(False)
self.init_identities_popup_menu(False)
self.init_addressbook_popup_menu(False)
self.init_subscriptions_popup_menu(False)
self.init_sent_popup_menu(False)
self.init_blacklist_popup_menu(False)
if event.type() == QtCore.QEvent.WindowStateChange:
if self.windowState() & QtCore.Qt.WindowMinimized:
self.actionShow.setChecked(False)