|
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 #include "nmapiengine.h" |
|
18 #include "nmapimailboxlisting_p.h" |
|
19 |
|
20 namespace EmailClientApi |
|
21 { |
|
22 NmMailboxListingPrivate::NmMailboxListingPrivate(QObject* parent) : |
|
23 QObject(parent), mNmEngine(NULL) |
|
24 { |
|
25 |
|
26 } |
|
27 |
|
28 NmMailboxListingPrivate::~NmMailboxListingPrivate() |
|
29 { |
|
30 |
|
31 } |
|
32 |
|
33 /*! |
|
34 * \brief It initialize engine for email operations. |
|
35 * |
|
36 * When use initializeEngine need to remember release it. |
|
37 * It return value if initialization go good. |
|
38 * \sa releaseEngine |
|
39 * \return Return true if engine is good initilialized. |
|
40 */ |
|
41 bool NmMailboxListingPrivate::initializeEngine() |
|
42 { |
|
43 if (!mNmEngine) { |
|
44 mNmEngine = NmEngine::instance(); |
|
45 } |
|
46 |
|
47 return mNmEngine ? true : false; |
|
48 } |
|
49 |
|
50 /*! |
|
51 * \brief It release engine for email operations. |
|
52 * |
|
53 * It release Engine and return value if release go good. |
|
54 * |
|
55 * \arg engine Is used to get info if engine was released, if yes, then argument have value 0. |
|
56 * |
|
57 * \sa initializeEngine |
|
58 */ |
|
59 void NmMailboxListingPrivate::releaseEngine() |
|
60 { |
|
61 NmEngine::releaseInstance(mNmEngine); |
|
62 } |
|
63 |
|
64 /*! |
|
65 * \brief It grab mailboxes from engine. |
|
66 * |
|
67 * When it start grabing, it release all old. |
|
68 * Because it uses NmMailbox with sharedData we don't need care about release memory. |
|
69 * |
|
70 * \return Count of mailboxes |
|
71 */ |
|
72 qint32 NmMailboxListingPrivate::grabMailboxes() |
|
73 { |
|
74 mMailboxes.clear(); |
|
75 |
|
76 mNmEngine->listMailboxes(mMailboxes); |
|
77 return mMailboxes.count(); |
|
78 } |
|
79 } |