emailservices/nmclientapi/inc/nmapidataplugininterface.h
changeset 23 2dc6caa42ec3
parent 20 ecc8def7944a
child 25 61b206842ac4
child 27 9ba4404ef423
child 38 b4618f2cf6ac
equal deleted inserted replaced
20:ecc8def7944a 23:2dc6caa42ec3
     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:
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef NMAPIDATAPLUGININTERFACE_H_
       
    19 #define NMAPIDATAPLUGININTERFACE_H_
       
    20 
       
    21 #include <QList>
       
    22 #include "nmcommon.h"
       
    23 
       
    24 class NmMailbox;
       
    25 class NmMessage;
       
    26 class NmMessagePart;
       
    27 class NmFolder;
       
    28 class NmMessageEnvelope;
       
    29 class NmOperation;
       
    30 class NmMessageCreationOperation;
       
    31 class NmStoreEnvelopesOperation;
       
    32 
       
    33 /*!
       
    34  \class NmDataPluginInterface
       
    35  \brief The class NmDataPluginInterface provides an interface to access email data from
       
    36  protocol plugins.
       
    37  Implementation classes of this interface are expected to emit following signals:
       
    38  void mailboxEvent(NmMailboxEvent event,
       
    39  const QList<NmId> &mailboxIds);
       
    40  void messageEvent(NmMessageEvent event,
       
    41  const NmId &folderId,
       
    42  const QList<NmId> &messageIds,
       
    43  const NmId&);
       
    44  */
       
    45 class NmDataPluginInterface
       
    46 {
       
    47 public:
       
    48 
       
    49     virtual ~NmDataPluginInterface()
       
    50     {
       
    51     }
       
    52     ;
       
    53     virtual int listMailboxIds(QList<NmId> &mailboxIdList) = 0;
       
    54     virtual int listMailboxes(QList<NmMailbox*> &mailboxList) = 0;
       
    55     virtual int getMailboxById(const NmId &id, NmMailbox *&mailbox) = 0;
       
    56     virtual int deleteMailboxById(const NmId &id) = 0;
       
    57     virtual int getMessageById(
       
    58         const NmId &mailboxId,
       
    59         const NmId &folderId,
       
    60         const NmId &messageId,
       
    61         NmMessage *&message) = 0;
       
    62     virtual int listFolders(const NmId &mailboxId, QList<NmFolder*> &folderList) = 0;
       
    63     virtual int listMessages(
       
    64         const NmId &mailboxId,
       
    65         const NmId &folderId,
       
    66         QList<NmMessageEnvelope*> &messageEnvelopeList) = 0;
       
    67 
       
    68     virtual NmOperation *fetchMessage(
       
    69         const NmId &mailboxId,
       
    70         const NmId &folderId,
       
    71         const NmId &messageId) = 0;
       
    72 
       
    73     /*!
       
    74      Get standard folder. Returns NmId.getId() == 0 if not found.
       
    75      */
       
    76     virtual NmId getStandardFolderId(const NmId &mailbox, NmFolderType folderType) = 0;
       
    77     virtual int refreshMailbox(NmId mailboxId) = 0;
       
    78     virtual int contentToMessagePart(
       
    79         const NmId &mailboxId,
       
    80         const NmId &folderId,
       
    81         const NmId &messageId,
       
    82         NmMessagePart &messagePart) = 0;
       
    83 
       
    84     virtual int deleteMessages(
       
    85         const NmId &mailboxId,
       
    86         const NmId &folderId,
       
    87         const QList<NmId> &messageIdList) = 0;
       
    88 
       
    89     virtual NmStoreEnvelopesOperation *storeEnvelopes(
       
    90         const NmId &mailboxId,
       
    91         const NmId &folderId,
       
    92         const QList<const NmMessageEnvelope*> &envelopeList) = 0;
       
    93 
       
    94     /*!
       
    95      Creates a new message into the drafts folder of the given mailbox.
       
    96      */
       
    97     virtual NmMessageCreationOperation *createNewMessage(const NmId &mailboxId) = 0;
       
    98 
       
    99     /*!
       
   100      Creates a new forward message into the drafts folder of the given mailbox.
       
   101      */
       
   102     virtual NmMessageCreationOperation *createForwardMessage(
       
   103         const NmId &mailboxId,
       
   104         const NmId &originalMessageId) = 0;
       
   105 
       
   106     /*!
       
   107      Creates a new reply message into the drafts folder of the given mailbox.
       
   108      */
       
   109     virtual NmMessageCreationOperation *createReplyMessage(
       
   110         const NmId &mailboxId,
       
   111         const NmId &originalMessageId,
       
   112         const bool replyAll) = 0;
       
   113 
       
   114     virtual int saveMessage(const NmMessage &message) = 0;
       
   115 
       
   116     /*!
       
   117      Removes the message from mailbox.
       
   118      */
       
   119     virtual int
       
   120         removeMessage(const NmId& mailboxId, const NmId& folderId, const NmId& messageId) = 0;
       
   121 
       
   122     /*!
       
   123      To get any events from plugins mailboxes must subscribe events first.
       
   124      */
       
   125     virtual void subscribeMailboxEvents(const NmId& mailboxId) = 0;
       
   126 
       
   127     /*!
       
   128      When events are no longer needed for mailbox, subscription must be stopped.
       
   129      */
       
   130     virtual void unsubscribeMailboxEvents(const NmId& mailboxId) = 0;
       
   131 
       
   132     virtual NmOperation *sendMessage(const NmMessage &message) = 0;
       
   133 };
       
   134 
       
   135 Q_DECLARE_INTERFACE(NmDataPluginInterface, "sf.app.commonmail.emailuis.nmailuiengine.NmDataPluginInterface/1.0")
       
   136 
       
   137 #endif /* NMDATAPLUGININTERFACE_H_ */
       
   138