1 /* Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net> 2 3 This file is part of the Trojita Qt IMAP e-mail client, 4 http://trojita.flaska.net/ 5 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. 13 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. 18 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/>. 21 */ 22 #ifndef UIUTILS_PARTVISITOR_H 23 #define UIUTILS_PARTVISITOR_H 24 25 #include "PartWalker.h" 26 #include "PartLoadingOptions.h" 27 #include <QModelIndex> 28 29 namespace Imap { 30 namespace Network { 31 class MsgPartNetAccessManager; 32 } 33 } 34 35 namespace UiUtils { 36 37 template <typename Result, typename Context> 38 class PartWalker; 39 40 /** @short define how a message part is displayed 41 42 This class is used in PartWalker to display a message part. 43 Inherit this class and implement functions to display a message part for a specific UI environment. 44 */ 45 template <typename Result, typename Context> 46 class PartVisitor{ 47 48 public: 49 virtual ~PartVisitor(); 50 virtual Result visitError(QString text, Result parent) = 0; 51 virtual Result visitLoadablePart(Result parent, 52 Imap::Network::MsgPartNetAccessManager *manager, 53 const QModelIndex &part, 54 PartWalker<Result, Context> *factory, 55 int recursionDepth, 56 const PartLoadingOptions loadingMode) = 0; 57 virtual Result visitAttachmentPart(Result parent, 58 Imap::Network::MsgPartNetAccessManager *manager, 59 const QModelIndex &m_partIndex, 60 Context context, Result contentView) = 0; 61 virtual Result visitMultipartAlternative(Result parent, 62 PartWalker<Result, Context> *factory, 63 const QModelIndex &partIndex, 64 const int recursionDepth, 65 const PartLoadingOptions options) = 0; 66 virtual Result visitMultipartEncryptedView(Result parent, PartWalker<Result, Context> *factory, 67 const QModelIndex &partIndex, const int recursionDepth, 68 const PartLoadingOptions loadingOptions) = 0; 69 virtual Result visitMultipartSignedView(Result parent, PartWalker<Result, Context> *factory, 70 const QModelIndex &partIndex, const int recursionDepth, 71 const PartLoadingOptions loadingOptions) = 0; 72 virtual Result visitGenericMultipartView(Result parent, 73 PartWalker<Result, Context> *factory, 74 const QModelIndex &partIndex, 75 int recursionDepth, const PartLoadingOptions options) = 0; 76 virtual Result visitMessage822View(Result parent, 77 PartWalker<Result, Context> *factory, const QModelIndex &partIndex, 78 int recursionDepth, const PartLoadingOptions options) = 0; 79 virtual Result visitSimplePartView(Result parent, Imap::Network::MsgPartNetAccessManager *manager, 80 const QModelIndex &partIndex, 81 Context messageView) = 0; 82 virtual void applySetHidden(Result view) = 0; 83 }; 84 85 } 86 87 #endif // UIUTILS_PARTVISITOR_H 88