From e84efecb67990e608af12a61907b5e196315f7df Mon Sep 17 00:00:00 2001 From: mailchuck Date: Sun, 1 Nov 2015 11:08:41 +0100 Subject: [PATCH] getCurrentFolder should return None on unavailable I think None is better than False. --- src/bitmessageqt/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index fdec6f3f..ec7e7239 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -1017,7 +1017,7 @@ class MyForm(QtGui.QMainWindow): xAddress = "fromaddress" else: xAddress = "toaddress" - if folder != False: + if folder is not None: sqlStatement = ''' SELECT folder, msgid, toaddress, fromaddress, subject, received, read FROM inbox WHERE ''' + xAddress + '''=? AND folder=? AND %s LIKE ? @@ -2352,7 +2352,7 @@ class MyForm(QtGui.QMainWindow): inbox = self.getAccountMessagelist(acct) treeWidget = self.getAccountTreeWidget(acct) self.propagateUnreadCount(acct.address) - if (self.getCurrentFolder(treeWidget) != "inbox" and self.getCurrentFolder(treeWidget) != False) or self.getCurrentAccount(treeWidget) != acct.address: + if (self.getCurrentFolder(treeWidget) != "inbox" and self.getCurrentFolder(treeWidget) is not None) or self.getCurrentAccount(treeWidget) != acct.address: # Ubuntu should notify of new message irespective of whether it's in current message list or not self.ubuntuMessagingMenuUpdate(True, None, acct.toLabel) return @@ -3532,8 +3532,7 @@ class MyForm(QtGui.QMainWindow): if currentItem and hasattr(currentItem, 'folderName'): return currentItem.folderName else: - # TODO need debug msg? - return False + return None def setCurrentItemColor(self, color): treeWidget = self.getCurrentTreeWidget() @@ -3699,7 +3698,7 @@ class MyForm(QtGui.QMainWindow): tableWidget = self.getCurrentMessagelist() if tableWidget: currentFolder = self.getCurrentFolder() - if currentFolder == False: + if currentFolder is None: pass if currentFolder == 'sent': self.on_context_menuSent(point)