emailservices/nmclientapi/inc/nmapiengine.h
changeset 18 578830873419
child 23 2dc6caa42ec3
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 NMAPIENGINE_H
       
    19 #define NMAPIENGINE_H
       
    20 
       
    21 #include "nmenginedef.h"
       
    22 #include "nmcommon.h"
       
    23 #include "nmapimailbox.h"
       
    24 #include "nmapifolder.h"
       
    25 #include "nmprivateclasses.h"
       
    26 #include "nmapimessageenvelope.h"
       
    27 
       
    28 class NmDataPluginFactory;
       
    29 
       
    30 class NmEngine : public QObject
       
    31 {
       
    32     Q_OBJECT
       
    33 public:
       
    34     static NmEngine* instance();
       
    35     static void releaseInstance(NmEngine *&engine);
       
    36 
       
    37     void listMailboxes(QList<EmailClientApi::NmMailbox> &mailboxList);
       
    38 
       
    39     void listFolders(const quint64 mailboxId, QList<EmailClientApi::NmFolder> &folderList);
       
    40     void listEnvelopes(const quint64 mailboxId, const quint64 folderId, QList<
       
    41         EmailClientApi::NmMessageEnvelope> &messageEnvelopeList);
       
    42 
       
    43     bool envelopeById(
       
    44         const quint64 mailboxId,
       
    45         const quint64 folderId,
       
    46         const quint64 envelopeId,
       
    47         EmailClientApi::NmMessageEnvelope &envelope);
       
    48     bool mailboxById(const quint64 mailboxId, EmailClientApi::NmMailbox &mailbox);
       
    49 
       
    50     void startCollectingEvents();
       
    51     signals:
       
    52     /*!
       
    53      * It contains info about event in emailstore.
       
    54      * 
       
    55      * \arg Contains info about event and related object (message or mailbox list)
       
    56      */
       
    57     void emailStoreEvent(NmApiMessage message);
       
    58 
       
    59 public slots:
       
    60     void mailboxChangedArrived(NmMailboxEvent, const QList<NmId> &mailboxIds);
       
    61     void messageChangedArrived(
       
    62         NmMessageEvent messageEvent,
       
    63         const NmId &folderId,
       
    64         const QList<NmId> &messageIds,
       
    65         const NmId &mailboxId);
       
    66 
       
    67 private:
       
    68     NmEngine();
       
    69     virtual ~NmEngine();
       
    70 
       
    71 private:
       
    72     static NmEngine *mInstance;//!<Static instance of NmEngine. There can be only one instance of engine
       
    73     static quint32 mReferenceCount;//!<Count of refences to engine instance
       
    74 
       
    75     NmDataPluginFactory *mFactory;//!<Plugin factory. Is needed to get plugins for emails
       
    76 };
       
    77 
       
    78 #endif /* NMENGINE_H_ */