inc/unidatamodelplugininterface.h
branchRCL_3
changeset 57 ebe688cedc25
equal deleted inserted replaced
54:fa1df4b99609 57:ebe688cedc25
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: This is the domain header API for general message data model
       
    15  *              plugin behavior
       
    16  */
       
    17 
       
    18 #ifndef UNIDATAMODELPLUGININTERFACE_H_
       
    19 #define UNIDATAMODELPLUGININTERFACE_H_
       
    20 
       
    21 #include <QtPlugin>
       
    22 #include <msvstd.h>
       
    23 #include <QDateTime>
       
    24 #include <msvapi.h>
       
    25 #include <cmsvattachment.h>
       
    26 #include "convergedmessageaddress.h"
       
    27 
       
    28 /**
       
    29  * Enum defining Message  priority
       
    30  * @attention This enum can have values from 0 to 2 only.
       
    31  */
       
    32 enum MsgPriority
       
    33 {
       
    34     Low = 0, Normal, High
       
    35 };
       
    36 
       
    37 /**
       
    38  * UniMessageInfo
       
    39  * Definition of Message's media objects
       
    40  */
       
    41 
       
    42 class UniMessageInfo
       
    43 {
       
    44 public:
       
    45     /**
       
    46      * Constructor
       
    47      */
       
    48    inline  UniMessageInfo(const QString& filepath, const int size,
       
    49                    const QString& mimetype);
       
    50 
       
    51     /**
       
    52      * Destructor
       
    53      */
       
    54     inline ~UniMessageInfo();
       
    55 
       
    56     /**
       
    57      * setPath
       
    58      * @param file's path
       
    59      */
       
    60     inline void setPath(const QString& filepath);
       
    61 
       
    62     /**
       
    63      * setMimeType
       
    64      * @param file's mimetype
       
    65      */
       
    66    inline void setMimeType(const QString& mimetype);
       
    67 
       
    68     /**
       
    69      * path
       
    70      * @return file's path
       
    71      */
       
    72     inline const QString& path();
       
    73 
       
    74     /**
       
    75      * size
       
    76      * @return file's size
       
    77      */
       
    78     inline const int size();
       
    79 
       
    80     /**
       
    81      * mimetype
       
    82      * @return file's mimetype
       
    83      */
       
    84     inline const QString& mimetype();
       
    85 
       
    86     /**
       
    87      * isProtected
       
    88      * @return true if DRM protected object else false.
       
    89      */
       
    90     inline bool isProtected() const;
       
    91 
       
    92     /**
       
    93      * setProtected
       
    94      * @param isProtected true if DRM protected object else false.
       
    95      */
       
    96     inline void setProtected(bool isProtected);
       
    97 
       
    98     /**
       
    99      * isCorrupted
       
   100      * @return true if object is corrupted else false.
       
   101      */
       
   102     inline bool isCorrupted() const;
       
   103 
       
   104     /**
       
   105      * setCorrupted
       
   106      * @param corrupted true if object is corrupted else false.
       
   107      */
       
   108     inline void setCorrupted(bool corrupted);
       
   109 
       
   110     /**
       
   111      * Serialize the data memebers into the stream.
       
   112      * @param stream data stream to which data is serialized.
       
   113      */
       
   114     inline void serialize(QDataStream &stream) const;
       
   115 
       
   116     /**
       
   117      * Deserialize the stream to data members.
       
   118      * @param stream data stream from which data is deserialized.
       
   119      */
       
   120    inline void deserialize(QDataStream &stream);
       
   121 
       
   122 private:
       
   123     QString mPath;
       
   124     QString mMimeType;
       
   125     int mSize;
       
   126     bool mProtected;
       
   127     bool mCorrupt;
       
   128 
       
   129 };
       
   130 
       
   131 
       
   132 typedef QList<UniMessageInfo*> UniMessageInfoList;
       
   133 
       
   134 class UniDataModelPluginInterface
       
   135 {
       
   136 public:
       
   137 
       
   138     /**
       
   139      * Destructor
       
   140      */
       
   141     virtual ~UniDataModelPluginInterface()
       
   142     {
       
   143     }
       
   144 
       
   145     /**
       
   146      * Creates the new instance of the plugin
       
   147      * @return plugin instance
       
   148      */    
       
   149     virtual QObject* createInstance()=0;
       
   150 
       
   151     /**
       
   152      * Sets the id of the message whose details needs to be extacted.
       
   153      * @param TMsvId of the message.
       
   154      */
       
   155 
       
   156     virtual int setMessageId(int messageId)=0;
       
   157 
       
   158     /** Reset the datamodel
       
   159      * Resets the data model to be used again
       
   160      */
       
   161     virtual void reset() =0;
       
   162 
       
   163     /**
       
   164      * Get the body of the message
       
   165      * @param aBodyText , a QString to hold the message body
       
   166      */
       
   167     virtual void body(QString& aBodyText)=0;
       
   168 
       
   169     /**
       
   170      * Size of the message
       
   171      * @return message size
       
   172      */
       
   173     virtual int messageSize()=0;
       
   174 
       
   175     /**
       
   176      * List of the message To recipients 
       
   177      * @param  mAddressList, list of all addresses in the message
       
   178      */
       
   179     virtual void toRecipientList(ConvergedMessageAddressList& mAddressList)=0;
       
   180 
       
   181     /**
       
   182      * List of the message CC recipients 
       
   183      * @param  mAddressList, list of all addresses in the message
       
   184      */
       
   185     virtual void ccRecipientList(ConvergedMessageAddressList& mAddressList)=0;
       
   186 
       
   187     /**
       
   188      * List of the message  bCC recipients 
       
   189      * @param  mAddressList, list of all addresses in the message
       
   190      */
       
   191     virtual void bccRecipientList(ConvergedMessageAddressList& mAddressList)=0;
       
   192 
       
   193     /**
       
   194      * The from address of a message
       
   195      * @param messageAddress
       
   196      */
       
   197     virtual void fromAddress(QString& messageAddress)=0;
       
   198 
       
   199     /**
       
   200      * List of attachments in the message.
       
   201      * @return the attachment list for the message.
       
   202      */
       
   203     virtual UniMessageInfoList attachmentList()=0;
       
   204 
       
   205     /**
       
   206      * Type of the message (SMS/MMS etc..)
       
   207      * @return message type
       
   208      */
       
   209     virtual QString messageType()=0;
       
   210 
       
   211     /**
       
   212      * Priority of the message (low/medium/high)
       
   213      * @return MsgPriority.
       
   214      */
       
   215     virtual MsgPriority messagePriority()=0;
       
   216 
       
   217     /**
       
   218      * Number of attachments with the message
       
   219      * @return count of attachment
       
   220      */
       
   221     virtual int attachmentCount()=0;
       
   222 
       
   223     /**
       
   224      * To check if the message has attachments
       
   225      * @return true/false
       
   226      */
       
   227 
       
   228     virtual bool hasAttachment()=0;
       
   229 
       
   230     /**
       
   231      * Number of objects asociated with a MMS message
       
   232      * @return object count
       
   233      */
       
   234     virtual int objectCount()=0;
       
   235 
       
   236     /**
       
   237      * The MMS object list asociated with a MMS message
       
   238      * @return object list 
       
   239      */
       
   240     virtual UniMessageInfoList objectList()=0;
       
   241 
       
   242     /**
       
   243      * Number of slides asociated with a MMS message
       
   244      * @return slide count
       
   245      */
       
   246     virtual int slideCount()=0;
       
   247 
       
   248     /**
       
   249      * The content of a Slide in case of a MMS message
       
   250      * @param list of messageinfo objects.
       
   251      */
       
   252     virtual UniMessageInfoList slideContent(int count)=0;
       
   253 
       
   254     /**
       
   255      * Time stamp of the message when it was created/received.
       
   256      * @param message time
       
   257      */
       
   258     virtual QDateTime timeStamp()=0;
       
   259 
       
   260     /**
       
   261      *  Restores the model for editing purpose
       
   262      *  @param CBaseMtm
       
   263      */        
       
   264     virtual void restore(CBaseMtm& mtm)=0;
       
   265 	
       
   266 		/**
       
   267      * Subject associated with the message
       
   268      * @return QString
       
   269      */
       
   270 		virtual QString subject()=0;
       
   271 	
       
   272 		/**
       
   273      * Session with the Messaging Server 
       
   274      * @return CMsvSession*
       
   275      */
       
   276 		virtual CMsvSession* session() =0;
       
   277 };
       
   278 
       
   279 Q_DECLARE_INTERFACE(UniDataModelPluginInterface,
       
   280         "org.nokia.messaging.UniDataModelPluginInterface/1.0")
       
   281 
       
   282 #include "unidatamodelplugininterface.inl"
       
   283 
       
   284 #endif //UNIDATAMODELPLUGININTERFACE_H_