emailservices/nmclientapi/src/nmapiemailservice.cpp
changeset 23 2dc6caa42ec3
parent 20 ecc8def7944a
child 30 759dc5235cdb
equal deleted inserted replaced
20:ecc8def7944a 23:2dc6caa42ec3
    13  *
    13  *
    14  * Description:
    14  * Description:
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 #include "nmapiemailservice.h"
    18 #include <nmapiemailservice.h>
    19 #include "nmapiengine.h"
    19 #include "nmapiengine.h"
       
    20 
       
    21 #include <nmapimailbox.h>
       
    22 #include <nmapimessageenvelope.h>
       
    23 
    20 namespace EmailClientApi
    24 namespace EmailClientApi
    21 {
    25 {
    22 NmEmailService::NmEmailService(QObject *parent) :
    26 
    23     QObject(parent), mEngine(NULL)
    27 /*!
       
    28    constructor for NmEmailService
       
    29  */
       
    30 NmApiEmailService::NmApiEmailService(QObject *parent) :
       
    31     QObject(parent), mEngine(NULL), mIsRunning(false)
    24 {
    32 {
    25 
    33 
    26 }
    34 }
    27 
    35 
    28 NmEmailService::~NmEmailService()
    36 /*!
       
    37    destructor for NmApiEmailService
       
    38  */
       
    39 NmApiEmailService::~NmApiEmailService()
    29 {
    40 {
    30     if (mEngine) {
    41     if (mEngine) {
    31         uninitialise();
    42         uninitialise();
    32     }
    43     }
    33 }
    44 }
    34 
    45 
    35 bool NmEmailService::getEnvelope(
    46 /*!
       
    47    gets mail message envelope by id (see also NmEventNotifier)
       
    48  */
       
    49 bool NmApiEmailService::getEnvelope(
    36     const quint64 mailboxId,
    50     const quint64 mailboxId,
    37     const quint64 folderId,
    51     const quint64 folderId,
    38     const quint64 envelopeId,
    52     const quint64 envelopeId,
    39     NmMessageEnvelope &envelope)
    53     EmailClientApi::NmApiMessageEnvelope &envelope)
    40 {
    54 {
    41     if (!mEngine) {
    55     if (!mEngine) {
    42         return false;
    56         return false;
    43     }
    57     }
    44     return mEngine->envelopeById(mailboxId, folderId, envelopeId, envelope);
    58     return mEngine->getEnvelopeById(mailboxId, folderId, envelopeId, envelope);
    45 }
    59 }
    46 
    60 
    47 bool NmEmailService::getMailbox(const quint64 mailboxId, NmMailbox &mailboxInfo)
    61 /*!
       
    62     gets mailbox info by id (see also NmEventNotifier)
       
    63  */
       
    64 bool NmApiEmailService::getMailbox(const quint64 mailboxId, EmailClientApi::NmApiMailbox &mailboxInfo)
    48 {
    65 {
    49     if (!mEngine) {
    66     if (!mEngine) {
    50         return false;
    67         return false;
    51     }
    68     }
    52     return mEngine->mailboxById(mailboxId, mailboxInfo);
    69     return mEngine->getMailboxById(mailboxId, mailboxInfo);
    53 }
    70 }
    54 
    71 
    55 void NmEmailService::initialise()
    72 /*!
       
    73    Initialises email service. this must be called and initialised signal received 
       
    74    before services of the library are used.
       
    75  */
       
    76 void NmApiEmailService::initialise()
    56 {
    77 {
    57     if (!mEngine) {
    78     if (!mEngine) {
    58         mEngine = NmEngine::instance();
    79         mEngine = NmApiEngine::instance();
    59     }
    80     }
    60 
    81 
    61     if (mEngine) {
    82     if (mEngine) {
    62         mIsRunning = true;
    83         mIsRunning = true;
    63         emit initialized(true);
    84         emit initialized(true);
    65     else {
    86     else {
    66         emit initialized(false);
    87         emit initialized(false);
    67     }
    88     }
    68 }
    89 }
    69 
    90 
    70 void NmEmailService::uninitialise()
    91 /*!
       
    92     frees resources.
       
    93  */
       
    94 void NmApiEmailService::uninitialise()
    71 {
    95 {
    72     NmEngine::releaseInstance(mEngine);
    96     NmApiEngine::releaseInstance(mEngine);
    73     mIsRunning = false;
    97     mIsRunning = false;
    74 }
    98 }
    75 
    99 
    76 bool NmEmailService::isRunning() const
   100 /*!
       
   101    returns isrunning flag value
       
   102  */
       
   103 bool NmApiEmailService::isRunning() const
    77 {
   104 {
    78     return mIsRunning;
   105     return mIsRunning;
    79 }
   106 }
    80 
   107 
    81 }
   108 }
       
   109