|
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 #include "nmapieventnotifier_p.h" |
|
19 |
|
20 namespace EmailClientApi |
|
21 { |
|
22 /*! |
|
23 * Constructor |
|
24 */ |
|
25 NmEventNotifierPrivate::NmEventNotifierPrivate(QObject *parent) : |
|
26 QObject(parent), mEmitSignals(NULL), mEngine(NULL), mIsRunning(false) |
|
27 { |
|
28 |
|
29 } |
|
30 |
|
31 /*! |
|
32 * Destructor |
|
33 */ |
|
34 NmEventNotifierPrivate::~NmEventNotifierPrivate() |
|
35 { |
|
36 |
|
37 } |
|
38 |
|
39 /*! |
|
40 * \brief It initialize engine for email operations. |
|
41 * |
|
42 * When use initializeEngine need to remember release it. |
|
43 * It return value if initialization go good. |
|
44 * \sa releaseEngine |
|
45 * \return Return true if engine works. |
|
46 */ |
|
47 bool NmEventNotifierPrivate::initializeEngine() |
|
48 { |
|
49 if (!mEngine) { |
|
50 mEngine = NmEngine::instance(); |
|
51 } |
|
52 |
|
53 return mEngine ? true : false; |
|
54 } |
|
55 |
|
56 /*! |
|
57 * \brief It release engine for email operations. |
|
58 * |
|
59 * It release Engine and return value if release go good. |
|
60 * |
|
61 * \arg engine Is used to get info if engine was released, if yes, then argument have value 0. |
|
62 * |
|
63 * \sa initializeEngine |
|
64 */ |
|
65 void NmEventNotifierPrivate::releaseEngine() |
|
66 { |
|
67 if (mIsRunning) { |
|
68 cancel(); |
|
69 } |
|
70 else { |
|
71 NmEngine::releaseInstance(mEngine); |
|
72 } |
|
73 } |
|
74 |
|
75 /*! |
|
76 * Add one email event into buffer. |
|
77 * |
|
78 * It is run by \sa NmEngine::emailStoreEvent signal. |
|
79 * \sa NmApiMessage |
|
80 * \arg It contains full info about object and it event. |
|
81 */ |
|
82 void NmEventNotifierPrivate::emailStoreEvent(const NmApiMessage &events) |
|
83 { |
|
84 mBufferOfEvents << events; |
|
85 } |
|
86 |
|
87 void NmEventNotifierPrivate::cancel() |
|
88 { |
|
89 |
|
90 } |
|
91 |
|
92 } |
|
93 |