Git commit a07a1dcb7e284d98e809c3723aa0ba462bd3ed62 by Jan Kundr?t. Committed on 12/03/2013 at 12:33. Pushed by jkt into branch 'master'.
GUI: improve the attachments widget - Add a nice icon from the Oxygen theme - Make it multiline to conserve space on loooooong MIME types like the application/vnd.openxmlformats-officedocument.* - Make it possible to select the attachment filename by mouse for copy-paste M +24 -4 src/Gui/AttachmentView.cpp M +1 -0 src/icons.qrc A +- -- src/icons/mail-attachment.png http://commits.kde.org/trojita/a07a1dcb7e284d98e809c3723aa0ba462bd3ed62 diff --git a/src/Gui/AttachmentView.cpp b/src/Gui/AttachmentView.cpp index 38325ad..e8bfd0f 100644 --- a/src/Gui/AttachmentView.cpp +++ b/src/Gui/AttachmentView.cpp @@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "AttachmentView.h" +#include "IconLoader.h" #include "Common/DeleteAfter.h" #include "Imap/Network/FileDownloadManager.h" #include "Imap/Model/MailboxTree.h" @@ -49,11 +50,30 @@ AttachmentView::AttachmentView(QWidget *parent, Imap::Network::MsgPartNetAccessM { m_fileDownloadManager = new Imap::Network::FileDownloadManager(this, manager, partIndex); QHBoxLayout *layout = new QHBoxLayout(this); - QLabel *lbl = new QLabel(tr("Attachment %1 (%2, %3)").arg(partIndex.data(Imap::Mailbox::RolePartFileName).toString(), - partIndex.data(Imap::Mailbox::RolePartMimeType).toString(), - Imap::Mailbox::PrettySize::prettySize(partIndex.data(Imap::Mailbox::RolePartOctets).toUInt(), - Imap::Mailbox::PrettySize::WITH_BYTES_SUFFIX))); + // Icon on the left + QLabel *lbl = new QLabel(); + lbl->setPixmap(loadIcon(QLatin1String("mail-attachment")).pixmap(22, 22)); layout->addWidget(lbl); + QWidget *labelArea = new QWidget(); + QVBoxLayout *subLayout = new QVBoxLayout(labelArea); + // The file name shall be mouse-selectable + lbl = new QLabel(); + lbl->setTextFormat(Qt::PlainText); + lbl->setText(partIndex.data(Imap::Mailbox::RolePartFileName).toString()); + lbl->setTextInteractionFlags(Qt::TextSelectableByMouse); + subLayout->addWidget(lbl); + // Some metainformation -- the MIME type and the file size + lbl = new QLabel(tr("%2, %3").arg(partIndex.data(Imap::Mailbox::RolePartMimeType).toString(), + Imap::Mailbox::PrettySize::prettySize(partIndex.data(Imap::Mailbox::RolePartOctets).toUInt(), + Imap::Mailbox::PrettySize::WITH_BYTES_SUFFIX))); + QFont f = lbl->font(); + f.setItalic(true); + f.setPointSizeF(f.pointSizeF() * 0.8); + lbl->setFont(f); + subLayout->addWidget(lbl); + layout->addWidget(labelArea); + layout->addStretch(); + // Download/Open buttons m_downloadButton = new QToolButton(); m_downloadButton->setPopupMode(QToolButton::MenuButtonPopup); m_downloadButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); diff --git a/src/icons.qrc b/src/icons.qrc index 2ee1beb..f7ba028 100644 --- a/src/icons.qrc +++ b/src/icons.qrc @@ -9,6 +9,7 @@ <file>icons/mail-replied-forw.png</file> <file>icons/mail-replied.png</file> <file>icons/mail-unread.png</file> + <file>icons/mail-attachment.png</file> <file>icons/folder.png</file> <file>icons/transparent.png</file> <file>icons/trojita.png</file> diff --git a/src/icons/mail-attachment.png b/src/icons/mail-attachment.png new file mode 100644 index 0000000..60c2f87 Binary files /dev/null and b/src/icons/mail-attachment.png differ
