|
1 /* |
|
2 * Copyright (c) 2005-2008 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: VoIP profile handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CaUiVoIPExtension.h" |
|
22 #include <CallUI.rsg> |
|
23 #include <featmgr.h> |
|
24 #include <spsettings.h> |
|
25 #include <spproperty.h> |
|
26 #include <StringLoader.h> // String Loader. |
|
27 |
|
28 |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CCaUiVoIPExtension::CCaUiVoIPExtension |
|
34 // C++ default constructor can NOT contain any code, that |
|
35 // might leave. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CCaUiVoIPExtension::CCaUiVoIPExtension() |
|
39 { |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CCaUiVoIPExtension::ConstructL |
|
44 // Symbian 2nd phase constructor can leave. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 void CCaUiVoIPExtension::ConstructL() |
|
48 { |
|
49 |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CCaUiVoIPExtension::NewL |
|
54 // Two-phased constructor. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CCaUiVoIPExtension* CCaUiVoIPExtension::NewL() |
|
58 { |
|
59 CCaUiVoIPExtension* self = new( ELeave ) CCaUiVoIPExtension; |
|
60 |
|
61 CleanupStack::PushL( self ); |
|
62 self->ConstructL(); |
|
63 CleanupStack::Pop( self ); |
|
64 |
|
65 return self; |
|
66 } |
|
67 |
|
68 |
|
69 // Destructor |
|
70 CCaUiVoIPExtension::~CCaUiVoIPExtension() |
|
71 { |
|
72 |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CCaUiVoIPExtension::IsVoIPProfilesL() |
|
77 // Checks if any service supports internet call |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 TBool CCaUiVoIPExtension::IsVoIPProfilesL() |
|
81 { |
|
82 TBool isProfiles = EFalse; |
|
83 |
|
84 RIdArray voipServiceIds; |
|
85 CleanupClosePushL( voipServiceIds ); |
|
86 GetVoIPServiceIdsL( voipServiceIds ); |
|
87 if ( voipServiceIds.Count() ) |
|
88 { |
|
89 isProfiles = ETrue; |
|
90 } |
|
91 CleanupStack::PopAndDestroy( &voipServiceIds ); |
|
92 |
|
93 return isProfiles; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CCaUiVoIPExtension::GetVoIPServiceIdsL() |
|
98 // |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void CCaUiVoIPExtension::GetVoIPServiceIdsL( RIdArray& aVoipServiceIds ) const |
|
102 { |
|
103 aVoipServiceIds.Reset(); |
|
104 |
|
105 // Fetch the settings api. |
|
106 CSPSettings* settingsApi = CSPSettings::NewLC(); |
|
107 |
|
108 // read all service ids to array |
|
109 RIdArray idArray; |
|
110 CleanupClosePushL( idArray ); |
|
111 |
|
112 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
113 { |
|
114 User::LeaveIfError( settingsApi->FindServiceIdsL( idArray ) ); |
|
115 |
|
116 // go throught all the services and check if any |
|
117 // of them supports internet call |
|
118 for ( TInt i = 0; idArray.Count() > i; i++) |
|
119 { |
|
120 // check if the service supports internet call |
|
121 CSPProperty* property = CSPProperty::NewLC(); |
|
122 // get attribute mask of the service |
|
123 User::LeaveIfError( settingsApi->FindPropertyL( idArray[i], |
|
124 EPropertyServiceAttributeMask, *property ) ); |
|
125 |
|
126 // read the value of mask property |
|
127 TInt mask = 0; |
|
128 if ( KErrNone == property->GetValue( mask ) ) |
|
129 { |
|
130 if ( ( mask & ESupportsInternetCall ) |
|
131 && ( mask & EIsVisibleInCallMenu ) ) |
|
132 { |
|
133 aVoipServiceIds.Append( idArray[i] ); |
|
134 } |
|
135 } |
|
136 CleanupStack::PopAndDestroy( property ); |
|
137 } |
|
138 } |
|
139 CleanupStack::PopAndDestroy( 2, settingsApi ); |
|
140 } |
|
141 |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CCaUiVoIPExtension::GetVoipServiceNameL() |
|
145 // |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 void CCaUiVoIPExtension::GetVoipServiceNameL( TServiceId aServiceId, TDes& aServiceName ) const |
|
149 { |
|
150 CSPSettings* settingsApi = CSPSettings::NewLC(); |
|
151 CSPProperty* property = CSPProperty::NewLC(); |
|
152 |
|
153 settingsApi->FindPropertyL( aServiceId, EServiceName, *property ); |
|
154 User::LeaveIfError( property->GetValue( aServiceName ) ); |
|
155 |
|
156 CleanupStack::PopAndDestroy( 2, settingsApi ); |
|
157 } |
|
158 |
|
159 // End of File |