|
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 <cntabstractviewmanager.h> |
|
19 #include "cntdefaultengine.h" |
|
20 #include "cntextensionmanager.h" |
|
21 #include "cntthumbnailmanager.h" |
|
22 #include "cntdebug.h" |
|
23 |
|
24 CntDefaultEngine::CntDefaultEngine( CntAbstractViewManager& aManager ) : |
|
25 mViewManager( aManager ), |
|
26 mExtManager( NULL ), |
|
27 mThumbnail( NULL ) |
|
28 { |
|
29 } |
|
30 |
|
31 CntDefaultEngine::~CntDefaultEngine() |
|
32 { |
|
33 qDeleteAll(mBackends); |
|
34 mBackends.clear(); |
|
35 |
|
36 delete mExtManager; |
|
37 delete mThumbnail; |
|
38 } |
|
39 |
|
40 QContactManager& CntDefaultEngine::contactManager( const QString& aType ) |
|
41 { |
|
42 CNT_ENTRY |
|
43 |
|
44 foreach ( QContactManager* mgr, mBackends ) |
|
45 { |
|
46 QString uri = mgr->managerUri(); |
|
47 if ( aType.compare(uri, Qt::CaseInsensitive) == 0 ) |
|
48 { |
|
49 return *mgr; |
|
50 } |
|
51 } |
|
52 |
|
53 QContactManager* manager = QContactManager::fromUri( aType ); |
|
54 |
|
55 if ( manager ) |
|
56 { |
|
57 mBackends.append( manager ); |
|
58 } |
|
59 |
|
60 CNT_EXIT |
|
61 return *manager; |
|
62 } |
|
63 |
|
64 CntAbstractViewManager& CntDefaultEngine::viewManager() |
|
65 { |
|
66 return mViewManager; |
|
67 } |
|
68 |
|
69 CntExtensionManager& CntDefaultEngine::extensionManager() |
|
70 { |
|
71 if ( !mExtManager ) |
|
72 mExtManager = new CntExtensionManager(); |
|
73 |
|
74 return *mExtManager; |
|
75 } |
|
76 |
|
77 CntThumbnailManager& CntDefaultEngine::thumbnailManager() |
|
78 { |
|
79 if ( !mThumbnail ) |
|
80 mThumbnail = new CntThumbnailManager(); |
|
81 |
|
82 return *mThumbnail; |
|
83 } |
|
84 |
|
85 // End of File |