|
1 /* |
|
2 * Copyright (c) 2001-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 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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of PAP UI class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <papui.h> |
|
22 #include <EapTlsPeapUiConnection.h> |
|
23 #include "papuiview.h" |
|
24 #include <papui.rsg> |
|
25 #include <bautils.h> |
|
26 #include <coemain.h> |
|
27 #include <data_caging_path_literals.hrh> |
|
28 |
|
29 |
|
30 // CONSTANTS |
|
31 _LIT( KDriveZ, "z:" ); // ROM folder |
|
32 _LIT( KResourceFileName, "papui.rsc" ); |
|
33 |
|
34 |
|
35 // CLASS DECLARATION |
|
36 class TResourceFileCleanupItem |
|
37 { |
|
38 public: |
|
39 CCoeEnv* iCoeEnv; |
|
40 TInt iResourceFileOffset; |
|
41 }; |
|
42 |
|
43 |
|
44 // ============================= LOCAL FUNCTIONS =============================== |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CleanupResourceFile |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 static void CleanupResourceFile( TAny* aObject ) |
|
51 { |
|
52 TResourceFileCleanupItem* item = |
|
53 REINTERPRET_CAST( TResourceFileCleanupItem*, aObject ); |
|
54 item->iCoeEnv->DeleteResourceFile( item->iResourceFileOffset ); |
|
55 delete item; |
|
56 } |
|
57 |
|
58 |
|
59 // ============================ MEMBER FUNCTIONS =============================== |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CPapUi::CPapUi |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CPapUi::CPapUi( CEapTlsPeapUiConnection* aConnection ) |
|
66 : iConnection( aConnection ) |
|
67 { |
|
68 } |
|
69 |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CPapUi::NewL |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 CPapUi* CPapUi::NewL( CEapTlsPeapUiConnection* aConnection ) |
|
76 { |
|
77 CPapUi* self = new( ELeave ) CPapUi( aConnection ); |
|
78 CleanupStack::PushL( self ); |
|
79 self->ConstructL(); |
|
80 CleanupStack::Pop( self ); |
|
81 return self; |
|
82 } |
|
83 |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CPapUi::ConstructL |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void CPapUi::ConstructL() |
|
90 { |
|
91 } |
|
92 |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CPapUi::~CPapUi |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 CPapUi::~CPapUi() |
|
99 { |
|
100 } |
|
101 |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CPapUi::InvokeUiL |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 TInt CPapUi::InvokeUiL() |
|
108 { |
|
109 TFileName fileName; |
|
110 fileName.Append( KDriveZ ); |
|
111 fileName.Append( KDC_RESOURCE_FILES_DIR ); |
|
112 fileName.Append( KResourceFileName ); |
|
113 |
|
114 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
115 |
|
116 BaflUtils::NearestLanguageFile( coeEnv->FsSession(), fileName ); |
|
117 |
|
118 TResourceFileCleanupItem* item = new( ELeave ) TResourceFileCleanupItem; |
|
119 |
|
120 item->iCoeEnv = coeEnv; |
|
121 CleanupStack::PushL( TCleanupItem( CleanupResourceFile, item ) ); |
|
122 |
|
123 item->iResourceFileOffset = coeEnv->AddResourceFileL( fileName ); |
|
124 |
|
125 TInt buttonId; |
|
126 CPapUiDialog* settingsDlg = new( ELeave ) CPapUiDialog( |
|
127 iConnection, buttonId ); |
|
128 |
|
129 settingsDlg->ConstructAndRunLD( R_PAP_SETTING_DIALOG ); |
|
130 |
|
131 CleanupStack::PopAndDestroy(); // Resource file |
|
132 |
|
133 return buttonId; |
|
134 } |
|
135 |
|
136 |
|
137 // End of File |