|
1 /* |
|
2 * Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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 * Kanrikogaku Kenkyusho, Ltd. - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * This class for DirectPrint UI_Plugin managemrnt |
|
16 * |
|
17 */ |
|
18 |
|
19 // User includes |
|
20 #include "DirectPrintUiPluginMgr.h" |
|
21 #include "DirectPrintModel.h" |
|
22 #include "DirectPrintUiPlugin.h" |
|
23 #include "directprintprinterdata.h" |
|
24 |
|
25 CDirectPrintUiPluginMgr::CDirectPrintUiPluginMgr(CDirectPrintModel& aModel) |
|
26 : iModel(aModel) |
|
27 , iPlugin(NULL) |
|
28 { |
|
29 } |
|
30 |
|
31 CDirectPrintUiPluginMgr::~CDirectPrintUiPluginMgr() |
|
32 { |
|
33 delete iPlugin; |
|
34 } |
|
35 |
|
36 CDirectPrintUiPluginMgr* CDirectPrintUiPluginMgr::NewL(CDirectPrintModel& aModel) |
|
37 { |
|
38 CDirectPrintUiPluginMgr* self = CDirectPrintUiPluginMgr::NewLC(aModel); |
|
39 CleanupStack::Pop(self); |
|
40 return self; |
|
41 } |
|
42 |
|
43 CDirectPrintUiPluginMgr* CDirectPrintUiPluginMgr::NewLC(CDirectPrintModel& aModel) |
|
44 { |
|
45 CDirectPrintUiPluginMgr* self = new(ELeave) CDirectPrintUiPluginMgr(aModel); |
|
46 CleanupStack::PushL(self); |
|
47 self->ConstructL(); |
|
48 return self; |
|
49 } |
|
50 |
|
51 void CDirectPrintUiPluginMgr::ConstructL() |
|
52 { |
|
53 iCurrentPluginUid = TUid::Uid(0); |
|
54 } |
|
55 |
|
56 void CDirectPrintUiPluginMgr::LoadPluginL(TUid aUid) |
|
57 { |
|
58 delete iPlugin; |
|
59 iPlugin = NULL; |
|
60 if (aUid.iUid > 0) |
|
61 { |
|
62 iPlugin = CDirectPrintUiPlugin::NewL(aUid); |
|
63 } |
|
64 } |
|
65 |
|
66 void CDirectPrintUiPluginMgr::LoadPluginL(const TDesC8& aKey) |
|
67 { |
|
68 delete iPlugin; |
|
69 iPlugin = NULL; |
|
70 if (aKey.Length() > 0) |
|
71 { |
|
72 iPlugin = CDirectPrintUiPlugin::NewL(aKey); |
|
73 } |
|
74 } |
|
75 |
|
76 CDirectPrintUiPlugin* CDirectPrintUiPluginMgr::CurrentPluginL() |
|
77 { |
|
78 TUid uid = iModel.SettingUIPluginUidL(); |
|
79 if (iCurrentPluginUid != uid) |
|
80 { |
|
81 LoadPluginL(uid); |
|
82 iCurrentPluginUid = uid; |
|
83 } |
|
84 |
|
85 return iPlugin; |
|
86 } |
|
87 |