File indexing completed on 2024-11-24 04:53:08
0001 /* 0002 Certain enhancements (www.xtuple.com/trojita-enhancements) 0003 are copyright © 2010 by OpenMFG LLC, dba xTuple. All rights reserved. 0004 0005 Redistribution and use in source and binary forms, with or without 0006 modification, are permitted provided that the following conditions are met: 0007 0008 - Redistributions of source code must retain the above copyright notice, this 0009 list of conditions and the following disclaimer. 0010 - Redistributions in binary form must reproduce the above copyright notice, 0011 this list of conditions and the following disclaimer in the documentation 0012 and/or other materials provided with the distribution. 0013 - Neither the name of xTuple nor the names of its contributors may be used to 0014 endorse or promote products derived from this software without specific prior 0015 written permission. 0016 0017 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0018 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0019 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 0020 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 0021 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 0022 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 0023 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 0024 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0025 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 0026 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0027 0028 */ 0029 0030 #ifndef IMAP_MODEL_FINDINTERESTINGPART_H 0031 #define IMAP_MODEL_FINDINTERESTINGPART_H 0032 0033 #include <QModelIndex> 0034 0035 namespace Imap { 0036 namespace Mailbox { 0037 0038 /** @short Find the most interesting part of a given message */ 0039 struct FindInterestingPart 0040 { 0041 /** @short Manipulate the index to find a "main part" of a message 0042 0043 This function will try to find the most interesting part of a message, ie. something which can be 0044 stored as representative data of a message in an environment which doesn't support MIME. If the 0045 main part can't be found, this function will return a string message mentioning what has happened. 0046 */ 0047 static QString findMainPart( QModelIndex &part ); 0048 0049 /** @short Status of finding the main part */ 0050 enum MainPartReturnCode { 0051 MAINPART_FOUND, /**< It was found and data are available right now */ 0052 MAINPART_MESSAGE_NOT_LOADED, /**< The bodystructure is not known yet */ 0053 MAINPART_PART_LOADING, /**< @short It was found, but the part data themselves weren't fetched yet */ 0054 MAINPART_PART_CANNOT_DETERMINE /**< @short There's no supported MIME part in this message */ 0055 }; 0056 0057 /** @short Try to find a usable "main part" of a message 0058 0059 @see findMainPart(), MainPartReturnCode 0060 */ 0061 static MainPartReturnCode findMainPartOfMessage(const QModelIndex &message, QModelIndex &mainPartIndex, QString &partMessage, 0062 QString *partData); 0063 }; 0064 0065 } 0066 } 0067 0068 #endif // IMAP_MODEL_FINDINTERESTINGPART_H