Check value of QFile::{open,flush,write}() when saving messages/attachments
[trojita.git] / src / Gui / SimplePartWidget.h
blob0bff29f7279e586e86cf6f7e911aa0a10011ecc7
1 /* Copyright (C) 2006 - 2013 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 SIMPLEPARTWIDGET_H
23 #define SIMPLEPARTWIDGET_H
25 #include "AbstractPartWidget.h"
26 #include "EmbeddedWebView.h"
27 #include "Composer/PlainTextFormatter.h"
28 #include <QAction>
29 #include <QFile>
30 #include <QPersistentModelIndex>
32 class QModelIndex;
33 class QNetworkReply;
35 namespace Imap
37 namespace Network
39 class MsgPartNetAccessManager;
43 namespace Gui
46 class MessageView;
48 /** @short Widget that handles display of primitive message parts
50 More complicated parts are handled by other widgets. Role of this one is to
51 simply render data that can't be broken down to more trivial pieces.
54 class SimplePartWidget : public EmbeddedWebView, public AbstractPartWidget
56 Q_OBJECT
57 public:
58 SimplePartWidget(QWidget *parent, Imap::Network::MsgPartNetAccessManager *manager, const QModelIndex &partIndex,
59 MessageView *messageView);
60 virtual QString quoteMe() const;
61 virtual void reloadContents();
62 QList<QAction *> contextMenuSpecificActions() const;
63 private slots:
64 void slotFileNameRequested(QString *fileName);
65 void slotMarkupPlainText();
66 void slotDownloadPart();
67 void slotDownloadMessage();
68 signals:
69 void linkHovered(const QString &link, const QString &title, const QString &textContent);
70 void searchDialogRequested();
71 private:
72 QPersistentModelIndex m_partIndex;
73 QAction *m_savePart;
74 QAction *m_saveMessage;
75 QAction *m_findAction;
76 MessageView *m_messageView;
77 Imap::Network::MsgPartNetAccessManager *m_netAccessManager;
78 Composer::Util::FlowedFormat flowedFormat;
80 SimplePartWidget(const SimplePartWidget &); // don't implement
81 SimplePartWidget &operator=(const SimplePartWidget &); // don't implement
86 #endif // SIMPLEPARTWIDGET_H