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