equal
deleted
inserted
replaced
60 // ----------------------------------------------------------------------------- |
60 // ----------------------------------------------------------------------------- |
61 // |
61 // |
62 CMmSmsCache::CMmSmsCache() |
62 CMmSmsCache::CMmSmsCache() |
63 { |
63 { |
64 TFLOGSTRING("TSY: CMmSmsCache::CMmSmsCache"); |
64 TFLOGSTRING("TSY: CMmSmsCache::CMmSmsCache"); |
65 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_CMMSMSCACHE, "CMmSmsCache::CMmSmsCache" ); |
65 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_CMMSMSCACHE_TD, "CMmSmsCache::CMmSmsCache" ); |
66 Reset(); |
66 Reset(); |
67 // If SIM is offline,then won't get |
67 // If SIM is offline,then won't get |
68 // sim ready completion and cache error state stays as |
68 // sim ready completion and cache error state stays as |
69 // KErrNotFound. If user accesses SIM SMS --> immediate complete |
69 // KErrNotFound. If user accesses SIM SMS --> immediate complete |
70 // with KErrNotFound |
70 // with KErrNotFound |
77 // ----------------------------------------------------------------------------- |
77 // ----------------------------------------------------------------------------- |
78 // |
78 // |
79 CMmSmsCache::~CMmSmsCache() |
79 CMmSmsCache::~CMmSmsCache() |
80 { |
80 { |
81 TFLOGSTRING("TSY: CMmSmsCache::~CMmSmsCache"); |
81 TFLOGSTRING("TSY: CMmSmsCache::~CMmSmsCache"); |
82 OstTrace0( TRACE_NORMAL, DUP1_CMMSMSCACHE_CMMSMSCACHE, "CMmSmsCache::~CMmSmsCache" ); |
82 OstTrace0( TRACE_NORMAL, DUP1_CMMSMSCACHE_CMMSMSCACHE_TD, "CMmSmsCache::~CMmSmsCache" ); |
83 Reset(); |
83 Reset(); |
84 } |
84 } |
85 |
85 |
86 // ----------------------------------------------------------------------------- |
86 // ----------------------------------------------------------------------------- |
87 // CMmSmsCache::Reset |
87 // CMmSmsCache::Reset |
89 // ----------------------------------------------------------------------------- |
89 // ----------------------------------------------------------------------------- |
90 // |
90 // |
91 void CMmSmsCache::Reset() |
91 void CMmSmsCache::Reset() |
92 { |
92 { |
93 TFLOGSTRING("TSY: CMmSmsCache::Reset"); |
93 TFLOGSTRING("TSY: CMmSmsCache::Reset"); |
94 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_RESET, "CMmSmsCache::Reset" ); |
94 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_RESET_TD, "CMmSmsCache::Reset" ); |
95 |
95 |
96 iError = KErrNotReady; |
96 iError = KErrNotReady; |
97 iDeleteLocation = 0; |
97 iDeleteLocation = 0; |
98 |
98 |
99 for ( TInt i = 0; i < iElements.Count(); i++ ) |
99 for ( TInt i = 0; i < iElements.Count(); i++ ) |
110 // ----------------------------------------------------------------------------- |
110 // ----------------------------------------------------------------------------- |
111 // |
111 // |
112 TInt CMmSmsCache::UsedEntries() |
112 TInt CMmSmsCache::UsedEntries() |
113 { |
113 { |
114 TFLOGSTRING("TSY: CMmSmsCache::UsedEntries"); |
114 TFLOGSTRING("TSY: CMmSmsCache::UsedEntries"); |
115 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_USEDENTRIES, "CMmSmsCache::UsedEntries" ); |
115 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_USEDENTRIES_TD, "CMmSmsCache::UsedEntries" ); |
116 TInt count( 0 ); |
116 TInt count( 0 ); |
117 for ( TInt i = 0; i < iElements.Count(); i++ ) |
117 for ( TInt i = 0; i < iElements.Count(); i++ ) |
118 { |
118 { |
119 if ( iElements[i] ) |
119 if ( iElements[i] ) |
120 { |
120 { |
130 // ----------------------------------------------------------------------------- |
130 // ----------------------------------------------------------------------------- |
131 // |
131 // |
132 TInt CMmSmsCache::TotalEntries() |
132 TInt CMmSmsCache::TotalEntries() |
133 { |
133 { |
134 TFLOGSTRING2("TSY: CMmSmsCache::TotalEntries: %d",iElements.Count()); |
134 TFLOGSTRING2("TSY: CMmSmsCache::TotalEntries: %d",iElements.Count()); |
135 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_TOTALENTRIES, "CMmSmsCache::TotalEntries;iElements.Count=%d", iElements.Count() ); |
135 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_TOTALENTRIES_TD, "CMmSmsCache::TotalEntries;iElements.Count=%d", iElements.Count() ); |
136 return iElements.Count(); |
136 return iElements.Count(); |
137 } |
137 } |
138 |
138 |
139 // ----------------------------------------------------------------------------- |
139 // ----------------------------------------------------------------------------- |
140 // CMmSmsCache::Status |
140 // CMmSmsCache::Status |
144 // ----------------------------------------------------------------------------- |
144 // ----------------------------------------------------------------------------- |
145 // |
145 // |
146 TInt CMmSmsCache::Status() |
146 TInt CMmSmsCache::Status() |
147 { |
147 { |
148 TFLOGSTRING("TSY: CMmSmsCache::Status"); |
148 TFLOGSTRING("TSY: CMmSmsCache::Status"); |
149 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_STATUS, "CMmSmsCache::Status" ); |
149 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_STATUS_TD, "CMmSmsCache::Status" ); |
150 return iError; |
150 return iError; |
151 } |
151 } |
152 |
152 |
153 // ----------------------------------------------------------------------------- |
153 // ----------------------------------------------------------------------------- |
154 // CMmSmsCache::SetStatus |
154 // CMmSmsCache::SetStatus |
156 // ----------------------------------------------------------------------------- |
156 // ----------------------------------------------------------------------------- |
157 // |
157 // |
158 void CMmSmsCache::SetStatus( TInt aError ) |
158 void CMmSmsCache::SetStatus( TInt aError ) |
159 { |
159 { |
160 TFLOGSTRING2("TSY: CMmSmsCache::SetStatus %d", aError); |
160 TFLOGSTRING2("TSY: CMmSmsCache::SetStatus %d", aError); |
161 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_SETSTATUS, "CMmSmsCache::SetStatus;aError=%d", aError ); |
161 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_SETSTATUS_TD, "CMmSmsCache::SetStatus;aError=%d", aError ); |
162 iError = aError; |
162 iError = aError; |
163 } |
163 } |
164 |
164 |
165 // ----------------------------------------------------------------------------- |
165 // ----------------------------------------------------------------------------- |
166 // CMmSmsCache::SetTotalEntriesL |
166 // CMmSmsCache::SetTotalEntriesL |
169 // ----------------------------------------------------------------------------- |
169 // ----------------------------------------------------------------------------- |
170 // |
170 // |
171 void CMmSmsCache::SetTotalEntriesL( TInt aTotal ) |
171 void CMmSmsCache::SetTotalEntriesL( TInt aTotal ) |
172 { |
172 { |
173 TFLOGSTRING2("TSY: CMmSmsCache::SetTotalEntriesL %d", aTotal); |
173 TFLOGSTRING2("TSY: CMmSmsCache::SetTotalEntriesL %d", aTotal); |
174 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_SETTOTALENTRIESL, "CMmSmsCache::SetTotalEntriesL;aTotal=%d", aTotal ); |
174 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_SETTOTALENTRIESL_TD, "CMmSmsCache::SetTotalEntriesL;aTotal=%d", aTotal ); |
175 |
175 |
176 RMobileSmsStore::TMobileGsmSmsEntryV1* element = NULL; |
176 RMobileSmsStore::TMobileGsmSmsEntryV1* element = NULL; |
177 for ( TInt i = 0; i < aTotal; i++ ) |
177 for ( TInt i = 0; i < aTotal; i++ ) |
178 { |
178 { |
179 iElements.AppendL( element ); |
179 iElements.AppendL( element ); |
191 TBool CMmSmsCache::AddEntryL( |
191 TBool CMmSmsCache::AddEntryL( |
192 const RMobileSmsStore::TMobileGsmSmsEntryV1* aEntry, |
192 const RMobileSmsStore::TMobileGsmSmsEntryV1* aEntry, |
193 const TUint8 aRecordId ) |
193 const TUint8 aRecordId ) |
194 { |
194 { |
195 TFLOGSTRING("TSY: CMmSmsCache::AddEntryL"); |
195 TFLOGSTRING("TSY: CMmSmsCache::AddEntryL"); |
196 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_ADDENTRYL, "CMmSmsCache::AddEntryL" ); |
196 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_ADDENTRYL_TD, "CMmSmsCache::AddEntryL" ); |
197 |
197 |
198 if ( 0 < iElements.Count() ) |
198 if ( 0 < iElements.Count() ) |
199 { |
199 { |
200 delete iElements[aRecordId - 1]; |
200 delete iElements[aRecordId - 1]; |
201 iElements[aRecordId - 1] = NULL; |
201 iElements[aRecordId - 1] = NULL; |
227 // ----------------------------------------------------------------------------- |
227 // ----------------------------------------------------------------------------- |
228 // |
228 // |
229 RMobileSmsStore::TMobileGsmSmsEntryV1* CMmSmsCache::GetEntry( TInt aLocation ) |
229 RMobileSmsStore::TMobileGsmSmsEntryV1* CMmSmsCache::GetEntry( TInt aLocation ) |
230 { |
230 { |
231 TFLOGSTRING2("TSY: CMmSmsCache::GetEntry - location: %d", aLocation); |
231 TFLOGSTRING2("TSY: CMmSmsCache::GetEntry - location: %d", aLocation); |
232 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_GETENTRY, "CMmSmsCache::GetEntry;aLocation=%d", aLocation ); |
232 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_GETENTRY_TD, "CMmSmsCache::GetEntry;aLocation=%d", aLocation ); |
233 RMobileSmsStore::TMobileGsmSmsEntryV1* smsData = NULL; |
233 RMobileSmsStore::TMobileGsmSmsEntryV1* smsData = NULL; |
234 if ( aLocation <= iElements.Count() && aLocation >= 1 ) |
234 if ( aLocation <= iElements.Count() && aLocation >= 1 ) |
235 { |
235 { |
236 if ( iElements[aLocation-1] ) |
236 if ( iElements[aLocation-1] ) |
237 { |
237 { |
250 // ----------------------------------------------------------------------------- |
250 // ----------------------------------------------------------------------------- |
251 // |
251 // |
252 TUint CMmSmsCache::FirstFreeLocation() |
252 TUint CMmSmsCache::FirstFreeLocation() |
253 { |
253 { |
254 TFLOGSTRING("TSY: CMmSmsCache::FirstFreeLocation"); |
254 TFLOGSTRING("TSY: CMmSmsCache::FirstFreeLocation"); |
255 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_FIRSTFREELOCATION, "CMmSmsCache::FirstFreeLocation" ); |
255 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_FIRSTFREELOCATION_TD, "CMmSmsCache::FirstFreeLocation" ); |
256 TInt location( 0 ); |
256 TInt location( 0 ); |
257 for ( TInt i = 0; i < iElements.Count(); i++ ) |
257 for ( TInt i = 0; i < iElements.Count(); i++ ) |
258 { |
258 { |
259 if ( !iElements[i] ) |
259 if ( !iElements[i] ) |
260 { |
260 { |
261 location = i + 1; |
261 location = i + 1; |
262 i = iElements.Count(); // exit loop |
262 i = iElements.Count(); // exit loop |
263 } |
263 } |
264 } |
264 } |
265 TFLOGSTRING2("TSY: CMmSmsCache::FirstFreeLocation - found location: %d", location); |
265 TFLOGSTRING2("TSY: CMmSmsCache::FirstFreeLocation - found location: %d", location); |
266 OstTrace0( TRACE_NORMAL, DUP1_CMMSMSCACHE_FIRSTFREELOCATION, "CMmSmsCache::FirstFreeLocation" ); |
266 OstTrace0( TRACE_NORMAL, DUP1_CMMSMSCACHE_FIRSTFREELOCATION_TD, "CMmSmsCache::FirstFreeLocation" ); |
267 return location; |
267 return location; |
268 } |
268 } |
269 |
269 |
270 // ----------------------------------------------------------------------------- |
270 // ----------------------------------------------------------------------------- |
271 // CMmSmsCache::SetDeleteLocation |
271 // CMmSmsCache::SetDeleteLocation |
273 // ----------------------------------------------------------------------------- |
273 // ----------------------------------------------------------------------------- |
274 // |
274 // |
275 void CMmSmsCache::SetDeleteLocation( TInt aLocation ) |
275 void CMmSmsCache::SetDeleteLocation( TInt aLocation ) |
276 { |
276 { |
277 TFLOGSTRING2("TSY: CMmSmsCache::SetDeleteLocation %d", aLocation); |
277 TFLOGSTRING2("TSY: CMmSmsCache::SetDeleteLocation %d", aLocation); |
278 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_SETDELETELOCATION, "CMmSmsCache::SetDeleteLocation;aLocation=%d", aLocation ); |
278 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_SETDELETELOCATION_TD, "CMmSmsCache::SetDeleteLocation;aLocation=%d", aLocation ); |
279 iDeleteLocation = aLocation; |
279 iDeleteLocation = aLocation; |
280 } |
280 } |
281 |
281 |
282 // ----------------------------------------------------------------------------- |
282 // ----------------------------------------------------------------------------- |
283 // CMmSmsCache::Delete |
283 // CMmSmsCache::Delete |
285 // ----------------------------------------------------------------------------- |
285 // ----------------------------------------------------------------------------- |
286 // |
286 // |
287 void CMmSmsCache::Delete() |
287 void CMmSmsCache::Delete() |
288 { |
288 { |
289 TFLOGSTRING("TSY: CMmSmsCache::Delete"); |
289 TFLOGSTRING("TSY: CMmSmsCache::Delete"); |
290 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_DELETE, "CMmSmsCache::Delete" ); |
290 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_DELETE_TD, "CMmSmsCache::Delete" ); |
291 if ( iDeleteLocation!=0 ) |
291 if ( iDeleteLocation!=0 ) |
292 { |
292 { |
293 Delete( iDeleteLocation ); |
293 Delete( iDeleteLocation ); |
294 iDeleteLocation = NULL; |
294 iDeleteLocation = NULL; |
295 } |
295 } |
301 // ----------------------------------------------------------------------------- |
301 // ----------------------------------------------------------------------------- |
302 // |
302 // |
303 void CMmSmsCache::Delete( TInt aLocation ) |
303 void CMmSmsCache::Delete( TInt aLocation ) |
304 { |
304 { |
305 TFLOGSTRING2("TSY: CMmSmsCache::Delete %d", aLocation); |
305 TFLOGSTRING2("TSY: CMmSmsCache::Delete %d", aLocation); |
306 OstTrace1( TRACE_NORMAL, DUP1_CMMSMSCACHE_DELETE, "CMmSmsCache::Delete;aLocation=%d", aLocation ); |
306 OstTrace1( TRACE_NORMAL, DUP1_CMMSMSCACHE_DELETE_TD, "CMmSmsCache::Delete;aLocation=%d", aLocation ); |
307 |
307 |
308 if ( aLocation <= iElements.Count() && aLocation >= 1 ) |
308 if ( aLocation <= iElements.Count() && aLocation >= 1 ) |
309 { |
309 { |
310 delete iElements[aLocation-1]; |
310 delete iElements[aLocation-1]; |
311 iElements[aLocation-1] = NULL; |
311 iElements[aLocation-1] = NULL; |
318 // ----------------------------------------------------------------------------- |
318 // ----------------------------------------------------------------------------- |
319 // |
319 // |
320 void CMmSmsCache::DeleteAll() |
320 void CMmSmsCache::DeleteAll() |
321 { |
321 { |
322 TFLOGSTRING("TSY: CMmSmsCache::DeleteAll"); |
322 TFLOGSTRING("TSY: CMmSmsCache::DeleteAll"); |
323 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_DELETEALL, "CMmSmsCache::DeleteAll" ); |
323 OstTrace0( TRACE_NORMAL, CMMSMSCACHE_DELETEALL_TD, "CMmSmsCache::DeleteAll" ); |
324 for ( TInt i = 0; i < iElements.Count(); i++ ) |
324 for ( TInt i = 0; i < iElements.Count(); i++ ) |
325 { |
325 { |
326 delete iElements[i]; |
326 delete iElements[i]; |
327 iElements[i] = NULL; |
327 iElements[i] = NULL; |
328 } |
328 } |
336 void CMmSmsCache::SetStorageStatus( |
336 void CMmSmsCache::SetStorageStatus( |
337 TInt aLocation, |
337 TInt aLocation, |
338 RMobileSmsStore::TMobileSmsStoreStatus aMsgStatus ) |
338 RMobileSmsStore::TMobileSmsStoreStatus aMsgStatus ) |
339 { |
339 { |
340 TFLOGSTRING2("TSY: CMmSmsCache::SetStorageStatus(loc=%d)", aLocation); |
340 TFLOGSTRING2("TSY: CMmSmsCache::SetStorageStatus(loc=%d)", aLocation); |
341 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_SETSTORAGESTATUS, "CMmSmsCache::SetStorageStatus;aLocation=%d", aLocation ); |
341 OstTrace1( TRACE_NORMAL, CMMSMSCACHE_SETSTORAGESTATUS_TD, "CMmSmsCache::SetStorageStatus;aLocation=%d", aLocation ); |
342 |
342 |
343 if ( aLocation <= iElements.Count() |
343 if ( aLocation <= iElements.Count() |
344 && aLocation >= 1 |
344 && aLocation >= 1 |
345 && iElements[aLocation-1] ) |
345 && iElements[aLocation-1] ) |
346 { |
346 { |