From 5e0d168db60b448b0e027f23f24de17e97882e6d Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Thu, 31 Jan 2019 18:23:43 +0200 Subject: [PATCH] Do not show context menu on 'sent' folder because the 'sent' table have no column 'read' --- src/bitmessageqt/__init__.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 06082696..101097ed 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2656,15 +2656,13 @@ class MyForm(settingsmixin.SMainWindow): tableWidget.item(i, 3).setFont(font) markread = sqlExecuteChunked( - "UPDATE %s SET read = 1 WHERE %s IN({0}) AND read=0" % ( - ('sent', 'ackdata') if self.getCurrentFolder() == 'sent' - else ('inbox', 'msgid') - ), idCount, *msgids + "UPDATE inbox SET read = 1 WHERE msgid IN({0}) AND read=0", + idCount, *msgids ) if markread > 0: self.propagateUnreadCount() - # addressAtCurrentRow, self.getCurrentFolder(), None, 0) + # addressAtCurrentRow, self.getCurrentFolder(), None, 0) def click_NewAddressDialog(self): dialogs.NewAddressDialog(self) @@ -3459,11 +3457,14 @@ class MyForm(settingsmixin.SMainWindow): for plugin in self.menu_plugins['address']: self.popMenuSubscriptions.addAction(plugin) self.popMenuSubscriptions.addSeparator() - self.popMenuSubscriptions.addAction(self.actionMarkAllRead) + if self.getCurrentFolder() != 'sent': + self.popMenuSubscriptions.addAction(self.actionMarkAllRead) + if self.popMenuSubscriptions.isEmpty(): + return self.popMenuSubscriptions.exec_( self.ui.treeWidgetSubscriptions.mapToGlobal(point)) - def widgetConvert (self, widget): + def widgetConvert(self, widget): if widget == self.ui.tableWidgetInbox: return self.ui.treeWidgetYourIdentities elif widget == self.ui.tableWidgetInboxSubscriptions: @@ -3874,8 +3875,10 @@ class MyForm(settingsmixin.SMainWindow): for plugin in self.menu_plugins['address']: self.popMenuYourIdentities.addAction(plugin) self.popMenuYourIdentities.addSeparator() - self.popMenuYourIdentities.addAction(self.actionMarkAllRead) - + if self.getCurrentFolder() != 'sent': + self.popMenuYourIdentities.addAction(self.actionMarkAllRead) + if self.popMenuYourIdentities.isEmpty(): + return self.popMenuYourIdentities.exec_( self.ui.treeWidgetYourIdentities.mapToGlobal(point)) @@ -3899,7 +3902,10 @@ class MyForm(settingsmixin.SMainWindow): for plugin in self.menu_plugins['address']: self.popMenu.addAction(plugin) self.popMenu.addSeparator() - self.popMenu.addAction(self.actionMarkAllRead) + if self.getCurrentFolder() != 'sent': + self.popMenu.addAction(self.actionMarkAllRead) + if self.popMenu.isEmpty(): + return self.popMenu.exec_( self.ui.treeWidgetChans.mapToGlobal(point))