SVN_SILENT made messages (.desktop file) - always resolve ours
[trojita.git] / src / Gui / PartWidget.h
blobd5e5256addbb8f7e19877f2ef5ce60b7648996fd
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 GUI_PARTWIDGET_H
23 #define GUI_PARTWIDGET_H
25 #include <QFrame>
26 #include <QTabWidget>
28 #include "Gui/AbstractPartWidget.h"
29 #include "Gui/MessageView.h"
30 #include "Gui/PartWalker.h"
31 #include "Gui/Spinner.h"
32 #include "UiUtils/PartLoadingOptions.h"
34 class QModelIndex;
35 class QPushButton;
37 namespace Gui
40 /** @short Message quoting support for multipart/alternative MIME type */
41 class MultipartAlternativeWidget: public QTabWidget, public AbstractPartWidget
43 Q_OBJECT
44 public:
45 MultipartAlternativeWidget(QWidget *parent, PartWidgetFactory *factory,
46 const QModelIndex &partIndex,
47 const int recursionDepth, const UiUtils::PartLoadingOptions options);
48 virtual QString quoteMe() const override;
49 virtual bool searchDialogRequested() override;
50 virtual void reloadContents() override;
51 virtual void zoomIn() override;
52 virtual void zoomOut() override;
53 virtual void zoomOriginal() override;
54 protected:
55 bool eventFilter(QObject *o, QEvent *e) override;
58 /** @short Widget to display status information when processing message parts */
59 class PartStatusWidget: public QFrame
61 Q_OBJECT
62 public:
63 explicit PartStatusWidget(QWidget *parent);
65 void showStatus(const QString &icon, const QString &status, const QString &details = QString());
67 protected slots:
68 void showDetails();
70 private:
71 QLabel *m_icon, *m_text, *m_details;
72 QFrame *m_seperator;
73 QPushButton *m_detailButton;
76 /** @short Base class for handling parts where the structure of the chilren is not known yet */
77 class AsynchronousPartWidget: public QFrame, public AbstractPartWidget
79 Q_OBJECT
80 public:
81 AsynchronousPartWidget(QWidget *parent, PartWidgetFactory *factory, const QModelIndex &partIndex, const int recursionDepth,
82 const UiUtils::PartLoadingOptions loadingOptions);
84 protected slots:
85 void handleRowsInserted(const QModelIndex &parent, int first, int last);
86 void handleLayoutChanged(const QList<QPersistentModelIndex> &parents);
87 void handleError(const QModelIndex &parent, const QString &status, const QString &details);
88 void handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
89 virtual void updateStatusIndicator() = 0;
91 private:
92 void buildWidgets();
94 protected:
95 virtual QWidget *addingOneWidget(const QModelIndex &index, UiUtils::PartLoadingOptions options);
97 PartStatusWidget *m_statusWidget;
98 PartWidgetFactory *m_factory;
99 QPersistentModelIndex m_partIndex;
100 const int m_recursionDepth;
101 const UiUtils::PartLoadingOptions m_options;
104 /** @short Widget for multipart/signed or multipart/encrypted MIME types */
105 class MultipartSignedEncryptedWidget: public AsynchronousPartWidget
107 Q_OBJECT
108 public:
109 MultipartSignedEncryptedWidget(QWidget *parent, PartWidgetFactory *factory,
110 const QModelIndex &partIndex, const int recursionDepth,
111 const UiUtils::PartLoadingOptions loadingOptions);
112 virtual QString quoteMe() const override;
113 virtual bool searchDialogRequested() override;
114 virtual void reloadContents() override;
115 virtual void zoomIn() override;
116 virtual void zoomOut() override;
117 virtual void zoomOriginal() override;
118 protected slots:
119 virtual void updateStatusIndicator() override;
120 protected:
121 virtual QWidget *addingOneWidget(const QModelIndex &index, UiUtils::PartLoadingOptions options) override;
124 /** @short Message quoting support for generic multipart/ * */
125 class GenericMultipartWidget: public QWidget, public AbstractPartWidget
127 Q_OBJECT
128 public:
129 GenericMultipartWidget(QWidget *parent, PartWidgetFactory *factory,
130 const QModelIndex &partIndex, const int recursionDepth,
131 const UiUtils::PartLoadingOptions loadingOptions);
132 virtual QString quoteMe() const override;
133 virtual bool searchDialogRequested() override;
134 virtual void reloadContents() override;
135 virtual void zoomIn() override;
136 virtual void zoomOut() override;
137 virtual void zoomOriginal() override;
140 /** @short Message quoting support for generic multipart/ * */
141 class Message822Widget: public QWidget, public AbstractPartWidget
143 Q_OBJECT
144 public:
145 Message822Widget(QWidget *parent, PartWidgetFactory *factory,
146 const QModelIndex &partIndex, const int recursionDepth,
147 const UiUtils::PartLoadingOptions loadingOptions);
148 virtual QString quoteMe() const override;
149 virtual bool searchDialogRequested() override;
150 virtual void reloadContents() override;
151 virtual void zoomIn() override;
152 virtual void zoomOut() override;
153 virtual void zoomOriginal() override;
159 #endif // GUI_PARTWIDGET_H