|
1 /* |
|
2 * Copyright (c) 2002 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 * Help classes to handle Service Centres and settings. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDES |
|
22 #include <eikclb.h> // CEikColumnListBox |
|
23 #include <StringLoader.h> // StringLoader |
|
24 #include <smutset.h> // CSmsSettings |
|
25 #include <SMUM.rsg> // resource ids |
|
26 #include "SMSETDLG.H" // dialogs |
|
27 #include "SmumSettingsDialogGSM.h" //ESmumSendOptServiceCentreInUseLBI |
|
28 // LOCAL CONSTANTS AND MACROS |
|
29 const TInt KSmumNumberOfSeparatingColumnCharacters = 2; |
|
30 const TInt KSmumNumberOfEndColumnCharacters = 1; |
|
31 const TInt KMaxLengthOfNameAndNumberString = 100; |
|
32 const TUint KSpaceChar = ' '; |
|
33 _LIT(KSmumSpaceString, " "); |
|
34 |
|
35 // MEMBER FUNCTIONS |
|
36 |
|
37 |
|
38 /** |
|
39 * TSmumSCNameInfo - class |
|
40 */ |
|
41 |
|
42 // --------------------------------------------------------- |
|
43 // TSmumSCNameInfo::TSmumSCNameInfo |
|
44 // |
|
45 // --------------------------------------------------------- |
|
46 TSmumSCNameInfo::TSmumSCNameInfo( const TDesC& aName, const TDesC& aAddress ) |
|
47 :iNameAndAddress( aName ), iNameLength( 0 ) |
|
48 { |
|
49 iNameAndAddress.Append( KColumnListSeparator ); |
|
50 iNameAndAddress.Append( KColumnListSeparator ); |
|
51 iNameAndAddress.Append( aAddress ); |
|
52 iNameAndAddress.Append( KColumnListSeparator ); |
|
53 iNameLength = aName.Length(); |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------- |
|
57 // TSmumSCNameInfo::~TSmumSCNameInfo |
|
58 // |
|
59 // --------------------------------------------------------- |
|
60 TSmumSCNameInfo::~TSmumSCNameInfo() |
|
61 { |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------- |
|
65 // TSmumSCNameInfo::TSmumSCNameInfo |
|
66 // |
|
67 // --------------------------------------------------------- |
|
68 TSmumSCNameInfo::TSmumSCNameInfo( const TDesC& aName ) |
|
69 :iNameAndAddress( aName ), iNameLength ( 0 ) |
|
70 { |
|
71 iNameLength = aName.Length(); |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------- |
|
75 // TSmumSCNameInfo::Name |
|
76 // |
|
77 // --------------------------------------------------------- |
|
78 TPtrC TSmumSCNameInfo::Name() const |
|
79 { |
|
80 return iNameAndAddress.Left( iNameLength ); |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // TSmumSCNameInfo::Address |
|
85 // |
|
86 // --------------------------------------------------------- |
|
87 TPtrC TSmumSCNameInfo::Address() const |
|
88 { |
|
89 const TInt nameAndAddressLength = iNameAndAddress.Length(); |
|
90 if ( iNameLength == nameAndAddressLength ) |
|
91 { |
|
92 return TPtrC( KNullDesC ); |
|
93 } |
|
94 |
|
95 return iNameAndAddress.Mid( |
|
96 iNameLength + KSmumNumberOfSeparatingColumnCharacters, |
|
97 nameAndAddressLength - iNameLength - |
|
98 KSmumNumberOfEndColumnCharacters - KSmumNumberOfSeparatingColumnCharacters ); |
|
99 } |
|
100 |
|
101 /** |
|
102 * CSmumSCArray - class |
|
103 */ |
|
104 |
|
105 // --------------------------------------------------------- |
|
106 // CSmumSCArray::CSmumSCArray |
|
107 // |
|
108 // --------------------------------------------------------- |
|
109 CSmumSCArray::CSmumSCArray( TInt aGranularity ) |
|
110 :CArrayFixFlat<TSmumSCNameInfo>( aGranularity ) |
|
111 { |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------- |
|
115 // CSmumSCArray::~CSmumSCArray |
|
116 // |
|
117 // --------------------------------------------------------- |
|
118 CSmumSCArray::~CSmumSCArray() |
|
119 { |
|
120 delete iStringForSCName; |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------- |
|
124 // CSmumSCArray::NewL |
|
125 // |
|
126 // --------------------------------------------------------- |
|
127 CSmumSCArray* CSmumSCArray::NewL( TInt aGranularity ) |
|
128 { |
|
129 CSmumSCArray* self = new ( ELeave ) CSmumSCArray( aGranularity ); |
|
130 CleanupStack::PushL( self ); |
|
131 self->ConstructL(); |
|
132 CleanupStack::Pop(); // self |
|
133 return self; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------- |
|
137 // CSmumSCArray::ConstructL |
|
138 // |
|
139 // --------------------------------------------------------- |
|
140 void CSmumSCArray::ConstructL() |
|
141 { |
|
142 iStringForSCName = HBufC::NewL( KMaxLengthOfNameAndNumberString ); |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------- |
|
146 // CSmumSCArray::MdcaCount |
|
147 // |
|
148 // --------------------------------------------------------- |
|
149 TInt CSmumSCArray::MdcaCount() const |
|
150 { |
|
151 return Count(); |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------- |
|
155 // CSmumSCArray::MdcaPoint |
|
156 // |
|
157 // --------------------------------------------------------- |
|
158 TPtrC CSmumSCArray::MdcaPoint( TInt aIndex ) const |
|
159 { |
|
160 TPtr tempText = iStringForSCName->Des(); |
|
161 tempText.Zero(); |
|
162 |
|
163 if ( Count()) |
|
164 { |
|
165 tempText.Append( KSpaceChar ); |
|
166 tempText.Append( KColumnListSeparator ); |
|
167 tempText.Append( At( aIndex ).Name()); |
|
168 } |
|
169 |
|
170 return tempText; |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------- |
|
174 // CSmumSCArray::SCNameInfo |
|
175 // |
|
176 // --------------------------------------------------------- |
|
177 TSmumSCNameInfo& CSmumSCArray::SCNameInfo( TInt aIndex ) |
|
178 { |
|
179 return At( aIndex ); |
|
180 } |
|
181 |
|
182 |
|
183 /** |
|
184 * CSmumSettingsArray - class |
|
185 */ |
|
186 |
|
187 // --------------------------------------------------------- |
|
188 // CSmumSettingsArray::NewL |
|
189 // |
|
190 // --------------------------------------------------------- |
|
191 CSmumSettingsArray* CSmumSettingsArray::NewL( TInt aResourceId ) |
|
192 { |
|
193 CSmumSettingsArray* self = new ( ELeave ) CSmumSettingsArray(); |
|
194 CleanupStack::PushL( self ); |
|
195 self->ConstructL( aResourceId ); |
|
196 CleanupStack::Pop(); // self |
|
197 return self; |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------- |
|
201 // CSmumSettingsArray::ConstructL |
|
202 // |
|
203 // --------------------------------------------------------- |
|
204 void CSmumSettingsArray::ConstructL( TInt aResourceId ) |
|
205 { |
|
206 iReplyPathString = StringLoader::LoadL( R_QTN_SMS_REPLY_PATH ); |
|
207 CMuiuSettingsArray::ConstructL( aResourceId ); |
|
208 } |
|
209 |
|
210 // --------------------------------------------------------- |
|
211 // CSmumSettingsArray::CSmumSettingsArray |
|
212 // |
|
213 // --------------------------------------------------------- |
|
214 CSmumSettingsArray::CSmumSettingsArray() |
|
215 { |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------- |
|
219 // CSmumSettingsArray::~CSmumSettingsArray |
|
220 // |
|
221 // --------------------------------------------------------- |
|
222 CSmumSettingsArray::~CSmumSettingsArray() |
|
223 { |
|
224 delete iReplyPathString; |
|
225 } |
|
226 |
|
227 // --------------------------------------------------------- |
|
228 // CSmumSettingsArray::SetReplyPath |
|
229 // |
|
230 // --------------------------------------------------------- |
|
231 void CSmumSettingsArray::SetReplyPath( TBool aReplyPathProvided ) |
|
232 { |
|
233 iReplyPathProvided = aReplyPathProvided; |
|
234 } |
|
235 |
|
236 // --------------------------------------------------------- |
|
237 // CSmumSettingsArray::ReplyPathProvided |
|
238 // |
|
239 // --------------------------------------------------------- |
|
240 TBool CSmumSettingsArray::ReplyPathProvided() |
|
241 { |
|
242 return iReplyPathProvided; |
|
243 } |
|
244 |
|
245 // --------------------------------------------------------- |
|
246 // CSmumSettingsArray::MdcaPoint |
|
247 // |
|
248 // --------------------------------------------------------- |
|
249 TPtrC CSmumSettingsArray::MdcaPoint( TInt aIndex ) const |
|
250 { |
|
251 if ( iReplyPathProvided && ESmumSendOptServiceCentreInUseLBI == aIndex ) |
|
252 { |
|
253 TPtr tempText = iTempText->Des(); |
|
254 tempText.Zero(); |
|
255 tempText.Append( KSmumSpaceString ); |
|
256 tempText.Append( KColumnListSeparator ); |
|
257 tempText.Append( At( aIndex ).iLabelText ); |
|
258 tempText.Append( KColumnListSeparator ); |
|
259 tempText.Append( KColumnListSeparator ); |
|
260 tempText.Append( *iReplyPathString ); |
|
261 return tempText; |
|
262 } |
|
263 else |
|
264 { |
|
265 return CMuiuSettingsArray::MdcaPoint( aIndex ); |
|
266 } |
|
267 } |
|
268 |
|
269 // End of File |