1 /* Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net>
3 This file is part of the Trojita Qt IMAP e-mail client,
4 http://trojita.flaska.net/
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of
9 the License or (at your option) version 3 or any later version
10 accepted by the membership of KDE e.V. (or its successor approved
11 by the membership of KDE e.V.), which shall act as a proxy
12 defined in Section 14 of version 3 of the license.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef ATTACHMENTVIEW_H
23 #define ATTACHMENTVIEW_H
26 #include <QModelIndex>
27 #include "Gui/AbstractPartWidget.h"
40 class MsgPartNetAccessManager
;
49 /** @short Widget depicting an attachment
51 This widget provides a graphical representation about an e-mail attachment,
52 that is, an interactive item which shows some basic information like the MIME
53 type of the body part and the download button. It also includes code for
54 handling the actual download.
56 class AttachmentView
: public QFrame
, public AbstractPartWidget
60 AttachmentView(QWidget
*parent
, Imap::Network::MsgPartNetAccessManager
*manager
, const QModelIndex
&m_partIndex
,
61 MessageView
*messageView
, QWidget
*contentWidget
);
62 virtual QString
quoteMe() const;
63 virtual void reloadContents();
65 virtual void mouseMoveEvent(QMouseEvent
*event
);
66 virtual void mousePressEvent(QMouseEvent
*event
);
67 virtual void paintEvent(QPaintEvent
*event
);
69 void slotDownloadAttachment();
70 void slotOpenAttachment();
73 void openDownloadedAttachment();
74 void slotFileNameRequestedOnOpen(QString
*fileName
);
75 void slotFileNameRequested(QString
*fileName
);
76 void enableDownloadAgain();
78 void updateShowHideAttachmentState();
80 void showMenuOrPreview();
81 void toggleIconCursor();
84 QPersistentModelIndex m_partIndex
;
86 MessageView
*m_messageView
;
88 QAction
*m_downloadAttachment
;
89 QAction
*m_openAttachment
;
90 QAction
*m_showHideAttachment
;
95 Imap::Network::MsgPartNetAccessManager
*m_netAccess
;
97 QTemporaryFile
*m_tmpFile
;
98 QWidget
*m_contentWidget
;
100 QPoint m_dragStartPos
;
102 bool previewIsShown() const;
104 AttachmentView(const AttachmentView
&); // don't implement
105 AttachmentView
&operator=(const AttachmentView
&); // don't implement
110 #endif // ATTACHMENTVIEW_H