|
1 /* |
|
2 * Copyright (c) 2006 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: Implementation of CCmSettingsUiImpl. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <cmmanager.rsg> |
|
19 |
|
20 #include "cmsettingsuiimpl.h" |
|
21 #include "cmmanagerimpl.h" |
|
22 #include "destdlg.h" |
|
23 #include <cmcommonconstants.h> |
|
24 #include "selectdestinationdlg.h" |
|
25 #include <data_caging_path_literals.hrh> |
|
26 |
|
27 //----------------------------------------------------------------------------- |
|
28 // CCmSettingsUiImpl::NewL() |
|
29 //----------------------------------------------------------------------------- |
|
30 // |
|
31 CCmSettingsUiImpl* CCmSettingsUiImpl::NewL() |
|
32 { |
|
33 CCmSettingsUiImpl* self = new (ELeave) CCmSettingsUiImpl(); |
|
34 CleanupStack::PushL( self ); |
|
35 self->ConstructL(); |
|
36 CleanupStack::Pop( self ); |
|
37 return self; |
|
38 } |
|
39 |
|
40 //----------------------------------------------------------------------------- |
|
41 // CCmSettingsUiImpl::CCmSettingsUiImpl |
|
42 //----------------------------------------------------------------------------- |
|
43 // |
|
44 CCmSettingsUiImpl::CCmSettingsUiImpl(): |
|
45 iResourceReader( *CCoeEnv::Static() ) |
|
46 { |
|
47 } |
|
48 |
|
49 //----------------------------------------------------------------------------- |
|
50 // CCmSettingsUiImpl::LoadResourceL |
|
51 // Load the resource for the dll module |
|
52 // ---------------------------------------------------------------------------- |
|
53 // |
|
54 TInt CCmSettingsUiImpl::LoadResourceL () |
|
55 { |
|
56 // Add resource file. |
|
57 TParse* fp = new(ELeave) TParse(); |
|
58 TInt err = fp->Set( KACMManagerResDirAndFileName, |
|
59 &KDC_RESOURCE_FILES_DIR, |
|
60 NULL ); |
|
61 if ( err != KErrNone) |
|
62 { |
|
63 User::Leave( err ); |
|
64 } |
|
65 |
|
66 TFileName resourceFileNameBuf = fp->FullName(); |
|
67 delete fp; |
|
68 |
|
69 iResourceReader.OpenL (resourceFileNameBuf); |
|
70 return err; |
|
71 } |
|
72 |
|
73 //----------------------------------------------------------------------------- |
|
74 // CCmSettingsUiImpl::~CCmSettingsUiImpl |
|
75 //----------------------------------------------------------------------------- |
|
76 // |
|
77 CCmSettingsUiImpl::~CCmSettingsUiImpl() |
|
78 { |
|
79 delete iCmManagerImpl; |
|
80 iResourceReader.Close(); |
|
81 } |
|
82 |
|
83 //----------------------------------------------------------------------------- |
|
84 // CCmSettingsUiImpl::ConstructL |
|
85 //----------------------------------------------------------------------------- |
|
86 // |
|
87 void CCmSettingsUiImpl::ConstructL() |
|
88 { |
|
89 iCmManagerImpl = CCmManagerImpl::NewL(); |
|
90 LoadResourceL(); |
|
91 AknsUtils::SetAvkonSkinEnabledL( ETrue ); |
|
92 } |
|
93 |
|
94 //----------------------------------------------------------------------------- |
|
95 // CCmSettingsUiImpl::RunSettingsL |
|
96 //----------------------------------------------------------------------------- |
|
97 // |
|
98 TInt CCmSettingsUiImpl::RunSettingsL() |
|
99 { |
|
100 CDestDlg* destDlg = new (ELeave) CDestDlg; |
|
101 |
|
102 TUint32 selected = 0; |
|
103 // No need to push it on to the cleanup stack as CEikDialog::PrepareLC |
|
104 // does this favour for us. |
|
105 |
|
106 TBool exiting = EFalse; |
|
107 |
|
108 TInt result = destDlg->ConstructAndRunLD( |
|
109 iCmManagerImpl, 0, selected, exiting ); |
|
110 |
|
111 return ( exiting ) ? KDialogUserExit: KDialogUserBack; |
|
112 } |
|
113 |
|
114 //----------------------------------------------------------------------------- |
|
115 // CCmSettingsUiImpl::SelectDestinationDlgL |
|
116 //----------------------------------------------------------------------------- |
|
117 // |
|
118 TBool CCmSettingsUiImpl::SelectDestinationDlgL( TUint32& aDestinationId ) |
|
119 { |
|
120 CSelectDestinationDlg* dlg = CSelectDestinationDlg::NewL( aDestinationId, |
|
121 *iCmManagerImpl ); |
|
122 |
|
123 return dlg->ExecuteLD( R_CMMANAGER_LIST_QUERY_WITH_MSGBOX ); |
|
124 } |