From 4765705764d543ccbadc9a569bb03eebfdaa4e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C3=B6=20Barany?= Date: Wed, 11 Sep 2013 12:18:13 +0200 Subject: [PATCH] More informative "message truncated" text that tells users what to do to view the full message. --- src/bitmessageqt/__init__.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 54e10adf..113c53c1 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2718,23 +2718,26 @@ class MyForm(QtGui.QMainWindow): fromAddress = str(self.ui.tableWidgetInbox.item( currentRow, 1).data(Qt.UserRole).toPyObject()) + messageItem = self.ui.tableWidgetInbox.item(currentRow, 2) + messageText = messageItem.data(Qt.UserRole).toPyObject() + if len(messageText) > 30000: + messageText = ( + messageText[:30000] + '\n' + + '--- Display of the remainder of the message ' + + 'truncated because it is too long.\n' + + '--- To see the full message, right-click in the ' + + 'Inbox view and select "View HTML code as formatted ' + + 'text",\n' + + '--- or select "Save message as..." to save it to a ' + + 'file, or select "Reply" and ' + + 'view the full message in the quote.') # If we have received this message from either a broadcast address # or from someone in our address book, display as HTML if decodeAddress(fromAddress)[3] in shared.broadcastSendersForWhichImWatching or shared.isAddressInMyAddressBook(fromAddress): - if len(self.ui.tableWidgetInbox.item(currentRow, 2).data(Qt.UserRole).toPyObject()) < 30000: - self.ui.textEditInboxMessage.setText(self.ui.tableWidgetInbox.item( - currentRow, 2).data(Qt.UserRole).toPyObject()) # Only show the first 30K characters - else: - self.ui.textEditInboxMessage.setText(self.ui.tableWidgetInbox.item(currentRow, 2).data(Qt.UserRole).toPyObject()[ - :30000] + '\n\nDisplay of the remainder of the message truncated because it is too long.') # Only show the first 30K characters + self.ui.textEditInboxMessage.setText(messageText) else: - if len(self.ui.tableWidgetInbox.item(currentRow, 2).data(Qt.UserRole).toPyObject()) < 30000: - self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item( - currentRow, 2).data(Qt.UserRole).toPyObject()) # Only show the first 30K characters - else: - self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(currentRow, 2).data(Qt.UserRole).toPyObject()[ - :30000] + '\n\nDisplay of the remainder of the message truncated because it is too long.') # Only show the first 30K characters - + self.ui.textEditInboxMessage.setPlainText(messageText) + self.ui.tableWidgetInbox.item(currentRow, 0).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 1).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 2).setFont(font)