emailuis/nmailuiengine/inc/nmdataplugininterface.h
changeset 18 578830873419
child 20 ecc8def7944a
equal deleted inserted replaced
4:e7aa27f58ae1 18:578830873419
       
     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 NMDATAPLUGININTERFACE_H_
       
    19 #define NMDATAPLUGININTERFACE_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 class NmAddAttachmentsOperation;
       
    33 class NmCheckOutboxOperation;
       
    34 class NmMessageSendingOperation;
       
    35 
       
    36 /*!
       
    37     \class NmDataPluginInterface
       
    38     \brief The class NmDataPluginInterface provides an interface to access email data from
       
    39     protocol plugins.
       
    40     Implementation classes of this interface are expected to emit following signals:
       
    41     void mailboxEvent(NmMailboxEvent event,
       
    42                       const QList<NmId> &mailboxIds);
       
    43     void messageEvent(NmMessageEvent event,
       
    44                       const NmId &folderId,
       
    45                       const QList<NmId> &messageIds);
       
    46                       const NmId& mailboxId);
       
    47  */
       
    48 class NmDataPluginInterface
       
    49 {
       
    50 public:
       
    51 
       
    52     virtual ~NmDataPluginInterface() {};
       
    53     
       
    54     virtual int listMailboxIds(QList<NmId> &mailboxIdList) = 0;
       
    55     
       
    56     virtual int listMailboxes(QList<NmMailbox*> &mailboxList) = 0;
       
    57     
       
    58     virtual int getMailboxById(const NmId &id, NmMailbox *&mailbox) = 0;
       
    59     
       
    60     virtual int deleteMailboxById(const NmId &id) = 0;
       
    61     
       
    62     virtual int getMessageById(
       
    63         const NmId &mailboxId,
       
    64         const NmId &folderId,
       
    65         const NmId &messageId,
       
    66         NmMessage *&message) = 0;
       
    67     
       
    68     virtual int listFolders(
       
    69         const NmId &mailboxId,
       
    70         QList<NmFolder*> &folderList) = 0;
       
    71     
       
    72     virtual int listMessages(
       
    73         const NmId &mailboxId,
       
    74         const NmId &folderId,
       
    75         QList<NmMessageEnvelope*> &messageEnvelopeList) = 0;  
       
    76     
       
    77     virtual NmOperation *fetchMessage( 
       
    78         const NmId &mailboxId, 
       
    79         const NmId &folderId,
       
    80         const NmId &messageId ) = 0;
       
    81     
       
    82     
       
    83     virtual NmOperation *fetchMessagePart( 
       
    84         const NmId &mailboxId,
       
    85         const NmId &folderId,
       
    86         const NmId &messageId,
       
    87         const NmId &messagePartId) = 0;
       
    88     
       
    89     virtual NmId getStandardFolderId(
       
    90         const NmId &mailbox,
       
    91         NmFolderType folderType ) = 0;
       
    92     
       
    93     virtual int refreshMailbox(NmId mailboxId) = 0;
       
    94     
       
    95     virtual int contentToMessagePart(
       
    96         const NmId &mailboxId,
       
    97         const NmId &folderId,
       
    98         const NmId &messageId,
       
    99         NmMessagePart &messagePart) = 0;
       
   100     
       
   101     virtual int deleteMessages(
       
   102         const NmId &mailboxId,
       
   103         const NmId &folderId,
       
   104         const QList<NmId> &messageIdList) = 0;
       
   105 
       
   106     virtual NmStoreEnvelopesOperation *storeEnvelopes(
       
   107         const NmId &mailboxId,
       
   108         const NmId &folderId,
       
   109         const QList<const NmMessageEnvelope*> &envelopeList) = 0;
       
   110 
       
   111     virtual NmMessageCreationOperation *createNewMessage(const NmId &mailboxId) = 0;
       
   112 
       
   113     virtual NmMessageCreationOperation *createForwardMessage(
       
   114         const NmId &mailboxId,
       
   115         const NmId &originalMessageId) = 0;
       
   116 
       
   117     virtual NmMessageCreationOperation *createReplyMessage(
       
   118         const NmId &mailboxId,
       
   119         const NmId &originalMessageId,
       
   120         const bool replyAll) = 0;
       
   121 
       
   122     virtual int saveMessage(const NmMessage &message) = 0;
       
   123 
       
   124     virtual NmOperation *saveMessageWithSubparts(const NmMessage &message) = 0;
       
   125 
       
   126     virtual int removeMessage(
       
   127                 const NmId& mailboxId,
       
   128                 const NmId& folderId,
       
   129                 const NmId& messageId) = 0;
       
   130 
       
   131     virtual void subscribeMailboxEvents(const NmId& mailboxId) = 0;
       
   132     
       
   133     virtual void unsubscribeMailboxEvents(const NmId& mailboxId) = 0;
       
   134 
       
   135     virtual NmMessageSendingOperation *sendMessage(NmMessage *message) = 0;
       
   136     
       
   137     virtual NmAddAttachmentsOperation *addAttachments(
       
   138             const NmMessage &message,
       
   139             const QList<QString> &fileList) = 0;
       
   140     
       
   141     virtual NmOperation *removeAttachment(
       
   142             const NmMessage &message,
       
   143             const NmId &attachmentPartId) = 0;
       
   144 
       
   145     virtual NmCheckOutboxOperation *checkOutbox(const NmId &mailboxId) = 0;
       
   146     
       
   147     virtual NmSyncState syncState(const NmId& mailboxId) const = 0;
       
   148     
       
   149     virtual NmConnectState connectionState(const NmId& mailboxId) const = 0;
       
   150 };
       
   151 
       
   152 Q_DECLARE_INTERFACE(NmDataPluginInterface, "sf.app.commonmail.emailuis.nmailuiengine.NmDataPluginInterface/1.0")
       
   153 
       
   154 
       
   155 #endif /* NMDATAPLUGININTERFACE_H_ */
       
   156 
       
   157