Git commit c0d85b3b81b07bf7e8e4582be4ba9976a3f6f48e by Jan Kundr?t. Committed on 04/08/2013 at 21:34. Pushed by jkt into branch 'master'.
GUI: don't load overly long inlined attachments when not in "online, trash data" mode M +10 -6 src/Gui/PartWidgetFactory.cpp http://commits.kde.org/trojita/c0d85b3b81b07bf7e8e4582be4ba9976a3f6f48e diff --git a/src/Gui/PartWidgetFactory.cpp b/src/Gui/PartWidgetFactory.cpp index 437a5ae..25ed5c7 100644 --- a/src/Gui/PartWidgetFactory.cpp +++ b/src/Gui/PartWidgetFactory.cpp @@ -159,16 +159,17 @@ QWidget *PartWidgetFactory::create(const QModelIndex &partIndex, int recursionDe } } + const Imap::Mailbox::Model *constModel = 0; + Imap::Mailbox::TreeItemPart *part = dynamic_cast<Imap::Mailbox::TreeItemPart *>(Imap::Mailbox::Model::realTreeItem(partIndex, &constModel)); + Imap::Mailbox::Model *model = const_cast<Imap::Mailbox::Model *>(constModel); + Q_ASSERT(model); + Q_ASSERT(part); + part->fetchFromCache(model); + // The problem is that some nasty MUAs (hint hint Thunderbird) would // happily attach a .tar.gz and call it "inline" if (showInline && recognizedMimeType && partIndex.data(Imap::Mailbox::RolePartFileName).toString().isEmpty()) { // showing inline without any decorations whatsoever - const Imap::Mailbox::Model *constModel = 0; - Imap::Mailbox::TreeItemPart *part = dynamic_cast<Imap::Mailbox::TreeItemPart *>(Imap::Mailbox::Model::realTreeItem(partIndex, &constModel)); - Imap::Mailbox::Model *model = const_cast<Imap::Mailbox::Model *>(constModel); - Q_ASSERT(model); - Q_ASSERT(part); - part->fetchFromCache(model); bool showDirectly = loadingMode == LOAD_IMMEDIATELY; if (!part->fetched()) @@ -190,6 +191,9 @@ QWidget *PartWidgetFactory::create(const QModelIndex &partIndex, int recursionDe if (contentWidget && !showInline) { contentWidget->hide(); } + if (contentWidget && !part->fetched() && !model->isNetworkOnline() && part->octets() > ExpensiveFetchThreshold) { + contentWidget->hide(); + } return new AttachmentView(0, manager, partIndex, contentWidget); } }
