114
|
1 |
/*
|
|
2 |
* Copyright (c) 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: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <liwcommon.h>
|
|
20 |
|
|
21 |
#include "ccontentmap.h"
|
|
22 |
#include "cpglobals.h"
|
|
23 |
#include "cpdebug.h"
|
|
24 |
#include "cpssqlcommands.h"
|
|
25 |
#include "cpsecuritypolicy.h"
|
|
26 |
|
|
27 |
// ---------------------------------------------------------------------------
|
|
28 |
//
|
|
29 |
// ---------------------------------------------------------------------------
|
|
30 |
//
|
|
31 |
|
|
32 |
CContentMap::CContentMap()
|
|
33 |
{
|
|
34 |
|
|
35 |
}
|
|
36 |
|
|
37 |
// ---------------------------------------------------------------------------
|
|
38 |
//
|
|
39 |
// ---------------------------------------------------------------------------
|
|
40 |
//
|
|
41 |
void CContentMap::ConstructL()
|
|
42 |
{
|
|
43 |
CCPLiwMap::ConstructL( );
|
|
44 |
}
|
|
45 |
|
|
46 |
// ---------------------------------------------------------------------------
|
|
47 |
//
|
|
48 |
// ---------------------------------------------------------------------------
|
|
49 |
//
|
|
50 |
EXPORT_C CContentMap* CContentMap::NewL( )
|
|
51 |
{
|
|
52 |
CContentMap* self = CContentMap::NewLC( );
|
|
53 |
CleanupStack::Pop( self );
|
|
54 |
return self;
|
|
55 |
}
|
|
56 |
|
|
57 |
// ---------------------------------------------------------------------------
|
|
58 |
//
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
//
|
|
61 |
EXPORT_C CContentMap* CContentMap::NewLC( )
|
|
62 |
{
|
|
63 |
CContentMap* self = new (ELeave) CContentMap();
|
|
64 |
self->PushL();
|
|
65 |
self->ConstructL( );
|
|
66 |
return self;
|
|
67 |
}
|
|
68 |
|
|
69 |
// ---------------------------------------------------------------------------
|
|
70 |
//
|
|
71 |
// ---------------------------------------------------------------------------
|
|
72 |
//
|
|
73 |
CContentMap::~CContentMap()
|
|
74 |
{
|
|
75 |
|
|
76 |
}
|
|
77 |
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
// ---------------------------------------------------------------------------
|
|
81 |
//
|
|
82 |
TInt32 CContentMap::AddL( RSqlDatabase aSqlDb,
|
|
83 |
CLiwDefaultList* aNotificationList ) const
|
|
84 |
{
|
|
85 |
CP_DEBUG( _L8("CContentMap::AddL") );
|
|
86 |
TInt32 id( 0);
|
|
87 |
if ( !GetProperty( KId, id ) )
|
|
88 |
{
|
|
89 |
FetchIdL( aSqlDb, KSQLFetchId, id );
|
|
90 |
}
|
|
91 |
if ( id )
|
|
92 |
{
|
|
93 |
UpdateL( aSqlDb, id, aNotificationList );
|
|
94 |
}
|
|
95 |
else
|
|
96 |
{
|
|
97 |
id = AddToDbL( aSqlDb, aNotificationList );
|
|
98 |
}
|
|
99 |
return id;
|
|
100 |
}
|
|
101 |
|
|
102 |
// ---------------------------------------------------------------------------
|
|
103 |
//
|
|
104 |
// ---------------------------------------------------------------------------
|
|
105 |
//
|
|
106 |
TUint CContentMap::GetListL( RSqlDatabase aSqlDb,
|
|
107 |
CLiwGenericParamList* aList, RArray<TInt32>& aItemsToDelete ) const
|
|
108 |
{
|
|
109 |
CP_DEBUG( _L8("CContentMap::GetListL") );
|
|
110 |
aItemsToDelete.Reset( );
|
|
111 |
return CCPLiwMap::GetListL( aSqlDb, KSQLGetList, aList, aItemsToDelete );
|
|
112 |
}
|
|
113 |
|
|
114 |
// ---------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
// ---------------------------------------------------------------------------
|
|
117 |
//
|
|
118 |
void CContentMap::RemoveL( RSqlDatabase aSqlDb,
|
|
119 |
CLiwDefaultList* aNotificationList ) const
|
|
120 |
{
|
|
121 |
CP_DEBUG( _L8("CContentMap::RemoveL") );
|
|
122 |
//get ids of items to be deleted
|
|
123 |
GetIdsOfRemovedEntriesL( aSqlDb, KSQLGetIds, aNotificationList );
|
|
124 |
CCPLiwMap::RemoveL( aSqlDb, KSQLDelete );
|
|
125 |
}
|
|
126 |
|
|
127 |
// ---------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
// ---------------------------------------------------------------------------
|
|
130 |
//
|
|
131 |
void CContentMap::SaveQueryResultsL( RSqlStatement& aStmt,
|
|
132 |
CLiwGenericParamList& aList, RArray<TInt32>& aItemsToDelete ) const
|
|
133 |
{
|
|
134 |
CP_DEBUG( _L8("CContentMap::SaveQueryResultsL") );
|
|
135 |
TInt idIndex = ColumnIndexL( aStmt, KColumnId );
|
|
136 |
TInt publisherIndex = ColumnIndexL( aStmt, KColumnPublisher );
|
|
137 |
TInt contentIndex = ColumnIndexL( aStmt, KColumnContent_type );
|
|
138 |
TInt content_idIndex = ColumnIndexL( aStmt, KColumnContent_id );
|
|
139 |
TInt expiration_dateIndex = ColumnIndexL( aStmt, KColumnExpiration_date );
|
|
140 |
TInt acl_Index = ColumnIndexL( aStmt, KColumnAccessList );
|
|
141 |
TInt data_Index = ColumnIndexL( aStmt, KColumnData );
|
|
142 |
TInt action_Index = ColumnIndexL( aStmt, KColumnAction );
|
|
143 |
|
|
144 |
TBool aclCheckFailed( EFalse );
|
|
145 |
while ( aStmt.Next( ) == KSqlAtRow )
|
|
146 |
{
|
|
147 |
TBool securityOk( EFalse );
|
|
148 |
if( iPolicy )
|
|
149 |
{
|
|
150 |
TPtrC8 acl;
|
|
151 |
User::LeaveIfError( aStmt.ColumnBinary( acl_Index, acl ) );
|
|
152 |
securityOk = iPolicy->CheckSecurityL( acl ,
|
|
153 |
CCPSecurityPolicy::ERead );
|
|
154 |
if ( !securityOk )
|
|
155 |
{
|
|
156 |
aclCheckFailed = ETrue;
|
|
157 |
}
|
|
158 |
}
|
|
159 |
if ( !iPolicy || securityOk )
|
|
160 |
{
|
|
161 |
TInt32 id = aStmt.ColumnInt( idIndex ) ;
|
|
162 |
TPtrC publisher;
|
|
163 |
User::LeaveIfError( aStmt.ColumnText( publisherIndex,
|
|
164 |
publisher ) );
|
|
165 |
TPtrC content_type;
|
|
166 |
User::LeaveIfError( aStmt.ColumnText( contentIndex,
|
|
167 |
content_type ) );
|
|
168 |
TPtrC content_id;
|
|
169 |
User::LeaveIfError( aStmt.ColumnText( content_idIndex,
|
|
170 |
content_id ) );
|
|
171 |
CLiwDefaultMap* targetMap = CLiwDefaultMap::NewLC( );
|
|
172 |
targetMap->InsertL( KId, TLiwVariant( id ) );
|
|
173 |
targetMap->InsertL( KType, TLiwVariant( KCpData ) );
|
|
174 |
targetMap->InsertL( KPublisherId, TLiwVariant( publisher ) );
|
|
175 |
targetMap->InsertL( KContentType, TLiwVariant(content_type ) );
|
|
176 |
targetMap->InsertL( KContentId, TLiwVariant( content_id ) );
|
|
177 |
|
|
178 |
TInt64 expiration_date;
|
|
179 |
expiration_date = aStmt.ColumnInt64( expiration_dateIndex );
|
|
180 |
if ( ( expiration_date )
|
|
181 |
&&(IsOutdated( TTime( expiration_date ) )) )
|
|
182 |
{
|
|
183 |
// add id of item to be deleted to aItemsToDelete array
|
|
184 |
// do not continue getlist operation
|
|
185 |
aItemsToDelete.AppendL( id );
|
|
186 |
}//if
|
|
187 |
else
|
|
188 |
{
|
|
189 |
// continue getlist operation
|
|
190 |
TPtrC8 data;
|
|
191 |
User::LeaveIfError( aStmt.ColumnBinary( data_Index, data ) );
|
|
192 |
TPtrC8 action;
|
|
193 |
User::LeaveIfError( aStmt.ColumnBinary( action_Index, action ) );
|
|
194 |
if( data.Ptr() )
|
|
195 |
{
|
|
196 |
targetMap->InsertL( KDataMap , TLiwVariant( data ) );
|
|
197 |
}
|
|
198 |
if( action.Ptr() )
|
|
199 |
{
|
|
200 |
targetMap->InsertL( KActionMap , TLiwVariant( action ) );
|
|
201 |
}
|
|
202 |
TLiwGenericParam result( KListMap, TLiwVariant( targetMap ));
|
|
203 |
aList.AppendL( result );
|
|
204 |
}//else
|
|
205 |
CleanupStack::PopAndDestroy( targetMap );
|
|
206 |
}// if
|
|
207 |
}//while
|
|
208 |
//leave only if ACL security check for all items failed
|
|
209 |
if ( aclCheckFailed && !aList.Count())
|
|
210 |
{
|
|
211 |
User::Leave( KErrPermissionDenied );
|
|
212 |
}
|
|
213 |
}
|
|
214 |
|
|
215 |
// ---------------------------------------------------------------------------
|
|
216 |
//
|
|
217 |
// ---------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
void CContentMap::PrepareStmtforAddL( RSqlDatabase aSqlDb,
|
|
220 |
RSqlStatement& aStmt, const TDesC& aQuery ) const
|
|
221 |
{
|
|
222 |
CP_DEBUG( _L8("CContentMap::PrepareStmtforAddL") );
|
|
223 |
CCPLiwMap::PrepareStmtforAddL( aSqlDb, aStmt, aQuery );
|
|
224 |
TTime expiration_date( NULL);
|
|
225 |
GetExpirationDateL( expiration_date );
|
|
226 |
TInt expiration_dateIndex = aStmt.ParameterIndex( KSQLExpiration_date );
|
|
227 |
if ( expiration_dateIndex != KErrNotFound )
|
|
228 |
{
|
|
229 |
BindInt64L( aStmt, expiration_dateIndex, expiration_date.Int64() );
|
|
230 |
}
|
|
231 |
}
|
|
232 |
|
|
233 |
// ---------------------------------------------------------------------------
|
|
234 |
//
|
|
235 |
// ---------------------------------------------------------------------------
|
|
236 |
//
|
|
237 |
void CContentMap::PrepareStmtforUpdateL( RSqlDatabase aSqlDb,
|
|
238 |
RSqlStatement& aStmt, TInt32 aId ) const
|
|
239 |
{
|
|
240 |
CP_DEBUG( _L8("CContentMap::PrepareStmtforUpdateL") );
|
|
241 |
TTime expiration_date;
|
|
242 |
TBool isExpirationDate = GetExpirationDateL( expiration_date );
|
|
243 |
TBool isParameter(EFalse);
|
|
244 |
RBuf query;
|
|
245 |
query.CleanupClosePushL();
|
|
246 |
query.CreateL( KSQLUpdate().Length( ) );
|
|
247 |
query.Append( KSQLUpdate );
|
|
248 |
RBuf8 data;
|
|
249 |
data.CleanupClosePushL();
|
|
250 |
RBuf8 action;
|
|
251 |
action.CleanupClosePushL();
|
|
252 |
if ( GetPropertyL( KDataMap, data ) )
|
|
253 |
{
|
|
254 |
query.ReAllocL( query.Length( ) + KSQLUpdateData().Length( ) );
|
|
255 |
query.Append( KSQLUpdateData );
|
|
256 |
isParameter = ETrue;
|
|
257 |
}
|
|
258 |
if ( GetPropertyL( KActionMap, action ) )
|
|
259 |
{
|
|
260 |
if ( isParameter )
|
|
261 |
{
|
|
262 |
query.ReAllocL( query.Length( ) + KComma().Length( ) );
|
|
263 |
query.Append( KComma );
|
|
264 |
}
|
|
265 |
query.ReAllocL( query.Length( ) + KSQLUpdateAction().Length( ) );
|
|
266 |
query.Append( KSQLUpdateAction );
|
|
267 |
isParameter = ETrue;
|
|
268 |
}
|
|
269 |
if ( isExpirationDate )
|
|
270 |
{
|
|
271 |
if ( isParameter )
|
|
272 |
{
|
|
273 |
query.ReAllocL( query.Length( ) + KComma().Length( ) );
|
|
274 |
query.Append( KComma );
|
|
275 |
}
|
|
276 |
query.ReAllocL( query.Length( ) + KSQLUpdateExpirationDate().Length( ) );
|
|
277 |
query.Append( KSQLUpdateExpirationDate );
|
|
278 |
isParameter = ETrue;
|
|
279 |
}
|
|
280 |
if ( !isParameter ) User::Leave( KErrPathNotFound );
|
|
281 |
query.ReAllocL( query.Length( ) + KSQLUpdateWhere().Length( ) );
|
|
282 |
query.Append( KSQLUpdateWhere );
|
|
283 |
|
|
284 |
User::LeaveIfError( aStmt.Prepare( aSqlDb, query ) );
|
|
285 |
TInt dataId = aStmt.ParameterIndex( KSQLId );
|
|
286 |
BindIntL( aStmt, dataId, aId );
|
|
287 |
|
|
288 |
if ( data.Length( ) )
|
|
289 |
{
|
|
290 |
TInt dataIndex = aStmt.ParameterIndex( KSQLData );
|
|
291 |
BindBinaryL( aStmt, dataIndex, data );
|
|
292 |
}
|
|
293 |
if ( action.Length( ) )
|
|
294 |
{
|
|
295 |
TInt actionIndex = aStmt.ParameterIndex( KSQLAction );
|
|
296 |
BindBinaryL( aStmt, actionIndex, action );
|
|
297 |
}
|
|
298 |
if ( isExpirationDate )
|
|
299 |
{
|
|
300 |
TInt expiration_dateIndex =
|
|
301 |
aStmt.ParameterIndex( KSQLExpiration_date );
|
|
302 |
BindInt64L( aStmt, expiration_dateIndex,
|
|
303 |
expiration_date.Int64( ) );
|
|
304 |
|
|
305 |
}
|
|
306 |
CleanupStack::PopAndDestroy( &action );
|
|
307 |
CleanupStack::PopAndDestroy( &data );
|
|
308 |
CleanupStack::PopAndDestroy( &query );
|
|
309 |
}
|
|
310 |
// ---------------------------------------------------------------------------
|
|
311 |
//
|
|
312 |
// ---------------------------------------------------------------------------
|
|
313 |
//
|
|
314 |
void CContentMap::UpdateL( RSqlDatabase aSqlDb, TInt32 aId,
|
|
315 |
CLiwDefaultList* aNotificationList ) const
|
|
316 |
{
|
|
317 |
CP_DEBUG( _L8("CContentMap::UpdateL") );
|
|
318 |
RSqlStatement stmt;
|
|
319 |
CleanupClosePushL( stmt );
|
|
320 |
CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC( );
|
|
321 |
FetchIdsL( aId, KSQLFetchIds, changeInfoMap, aSqlDb );
|
|
322 |
if ( aNotificationList )
|
|
323 |
{
|
|
324 |
changeInfoMap->InsertL( KType, TLiwVariant( KCpData ) );
|
|
325 |
aNotificationList->AppendL( TLiwVariant( changeInfoMap ) );
|
|
326 |
}
|
|
327 |
CleanupStack::PopAndDestroy( changeInfoMap );
|
|
328 |
PrepareStmtforUpdateL( aSqlDb, stmt, aId );
|
|
329 |
if ( stmt.Exec( ) <= 0 )
|
|
330 |
{
|
|
331 |
User::Leave( KErrNotFound );
|
|
332 |
}
|
|
333 |
CleanupStack::PopAndDestroy( &stmt );
|
|
334 |
}
|
|
335 |
|
|
336 |
// ---------------------------------------------------------------------------
|
|
337 |
//
|
|
338 |
// ---------------------------------------------------------------------------
|
|
339 |
//
|
|
340 |
TInt32 CContentMap::AddToDbL( RSqlDatabase aSqlDb,
|
|
341 |
CLiwDefaultList* aNotificationList ) const
|
|
342 |
{
|
|
343 |
CP_DEBUG( _L8("CContentMap::AddToDbL") );
|
|
344 |
RSqlStatement stmt;
|
|
345 |
CleanupClosePushL( stmt );
|
|
346 |
PrepareStmtforAddL( aSqlDb, stmt, KSQLInsert );
|
|
347 |
|
|
348 |
TInt dataIndex = stmt.ParameterIndex( KSQLData );
|
|
349 |
TInt actionIndex = stmt.ParameterIndex( KSQLAction );
|
|
350 |
TInt aclIndex = stmt.ParameterIndex( KSQLAccessList );
|
|
351 |
|
|
352 |
RBuf8 data;
|
|
353 |
data.CleanupClosePushL();
|
|
354 |
GetPropertyL( KDataMap, data ) ;
|
|
355 |
BindBinaryL( stmt, dataIndex, data );
|
|
356 |
|
|
357 |
RBuf8 action;
|
|
358 |
action.CleanupClosePushL();
|
|
359 |
GetPropertyL( KActionMap, action ) ;
|
|
360 |
BindBinaryL( stmt, actionIndex, action );
|
|
361 |
|
|
362 |
RBuf8 acl;
|
|
363 |
acl.CleanupClosePushL();
|
|
364 |
if( !GetPropertyL( KAccessList , acl ) )
|
|
365 |
{
|
|
366 |
iPolicy->GetDefaultSecurityL( acl );
|
|
367 |
}
|
|
368 |
|
|
369 |
BindBinaryL( stmt, aclIndex, acl );
|
|
370 |
if ( stmt.Exec( ) <= 0 )
|
|
371 |
{
|
|
372 |
User::Leave( KErrGeneral );
|
|
373 |
}
|
|
374 |
|
|
375 |
TSqlScalarFullSelectQuery id_query(aSqlDb);
|
|
376 |
TInt32 ret( 0);
|
|
377 |
ret = id_query.SelectIntL( KSQLGetLastInsertId );
|
|
378 |
|
|
379 |
if ( aNotificationList )
|
|
380 |
{
|
|
381 |
RBuf publisher;
|
|
382 |
publisher.CleanupClosePushL();
|
|
383 |
RBuf contentType;
|
|
384 |
contentType.CleanupClosePushL();
|
|
385 |
RBuf contentId;
|
|
386 |
contentId.CleanupClosePushL();
|
|
387 |
GetPropertyL( KPublisherId, publisher ) ;
|
|
388 |
GetPropertyL( KContentType, contentType );
|
|
389 |
GetPropertyL( KContentId, contentId );
|
|
390 |
CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC( );
|
|
391 |
changeInfoMap->InsertL( KId, TLiwVariant( ret ) );
|
|
392 |
changeInfoMap->InsertL( KType, TLiwVariant( KCpData ) );
|
|
393 |
changeInfoMap->InsertL( KPublisherId, TLiwVariant( publisher ) );
|
|
394 |
changeInfoMap->InsertL( KContentType, TLiwVariant( contentType ) );
|
|
395 |
changeInfoMap->InsertL( KContentId, TLiwVariant( contentId ) );
|
|
396 |
changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationAdd ) );
|
|
397 |
aNotificationList->AppendL( TLiwVariant( changeInfoMap ) );
|
|
398 |
CleanupStack::PopAndDestroy( changeInfoMap ) ;
|
|
399 |
CleanupStack::PopAndDestroy( &contentId ) ;
|
|
400 |
CleanupStack::PopAndDestroy( &contentType ) ;
|
|
401 |
CleanupStack::PopAndDestroy( &publisher ) ;
|
|
402 |
}
|
|
403 |
|
|
404 |
CleanupStack::PopAndDestroy( &acl ) ;
|
|
405 |
CleanupStack::PopAndDestroy( &action ) ;
|
|
406 |
CleanupStack::PopAndDestroy( &data ) ;
|
|
407 |
CleanupStack::PopAndDestroy( &stmt ) ;
|
|
408 |
return ret;
|
|
409 |
}
|
|
410 |
|
|
411 |
// ---------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
// ---------------------------------------------------------------------------
|
|
414 |
//
|
|
415 |
void CContentMap::AppendSortL( RBuf& aQuery, const TCPSortOrder& aSort ) const
|
|
416 |
{
|
|
417 |
CP_DEBUG( _L8("CContentMap::AppendSortL") );
|
|
418 |
switch ( aSort )
|
|
419 |
{
|
|
420 |
case ECPPublisher:
|
|
421 |
aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderPublisher().Length( ) );
|
|
422 |
aQuery.Append( KSQLOrderPublisher );
|
|
423 |
break;
|
|
424 |
case ECPContent:
|
|
425 |
aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderContent().Length( ) );
|
|
426 |
aQuery.Append( KSQLOrderContent );
|
|
427 |
break;
|
|
428 |
default:
|
|
429 |
aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderRecent().Length( ) );
|
|
430 |
aQuery.Append( KSQLOrderRecent );
|
|
431 |
break;
|
|
432 |
}
|
|
433 |
}
|
|
434 |
|
|
435 |
// ---------------------------------------------------------------------------
|
|
436 |
//
|
|
437 |
// ---------------------------------------------------------------------------
|
|
438 |
//
|
|
439 |
TBool CContentMap::IsOutdated( const TTime aExpirationTime ) const
|
|
440 |
{
|
|
441 |
CP_DEBUG( _L8("CContentMap::IsOutdated") );
|
|
442 |
TBool result(EFalse);
|
|
443 |
TTime currentTime(0);
|
|
444 |
currentTime.HomeTime( );
|
|
445 |
if ( currentTime>aExpirationTime )
|
|
446 |
{
|
|
447 |
result = ETrue;
|
|
448 |
}
|
|
449 |
return result;
|
|
450 |
}
|
|
451 |
|
|
452 |
// ---------------------------------------------------------------------------
|
|
453 |
//
|
|
454 |
// ---------------------------------------------------------------------------
|
|
455 |
//
|
|
456 |
void CContentMap::IsDataMapL() const
|
|
457 |
{
|
|
458 |
TInt pos( 0 );
|
|
459 |
const TLiwGenericParam* paramForValue = iMap->FindFirst( pos, KDataMap );
|
|
460 |
if ( pos != KErrNotFound )
|
|
461 |
{
|
|
462 |
if( paramForValue->Value().TypeId() != LIW::EVariantTypeDesC8 )
|
|
463 |
{
|
|
464 |
User::Leave( KErrBadName );
|
|
465 |
}
|
|
466 |
}
|
|
467 |
else
|
|
468 |
{
|
|
469 |
User::Leave( KErrPathNotFound );
|
|
470 |
}
|
|
471 |
}
|
|
472 |
|
|
473 |
// ---------------------------------------------------------------------------
|
|
474 |
//
|
|
475 |
// ---------------------------------------------------------------------------
|
|
476 |
//
|
|
477 |
TBool CContentMap::GetExpirationDateL( TTime& aResult ) const
|
|
478 |
{
|
|
479 |
CP_DEBUG( _L8("CContentMap::GetExpirationDateL") );
|
|
480 |
TInt pos( 0);
|
|
481 |
TBool result(EFalse);
|
|
482 |
const TLiwGenericParam* param= NULL;
|
|
483 |
param = iMap->FindFirst( pos, KExpirationDate );
|
|
484 |
if ( KErrNotFound != pos )
|
|
485 |
{
|
|
486 |
if ( !param->Value().Get( aResult ) )
|
|
487 |
User::Leave( KErrArgument );
|
|
488 |
result = ETrue;
|
|
489 |
}
|
|
490 |
return result;
|
|
491 |
}
|
|
492 |
|
|
493 |
// ---------------------------------------------------------------------------
|
|
494 |
//
|
|
495 |
// ---------------------------------------------------------------------------
|
|
496 |
//
|
|
497 |
void CContentMap::IsValidForDeleteL() const
|
|
498 |
{
|
|
499 |
CP_DEBUG( _L8("CContentMap::IsValidFilterL") );
|
|
500 |
TInt err( KErrNone );
|
|
501 |
TInt32 id( 0 );
|
|
502 |
if( GetProperty( KId, id ) && ( id < 1 ) )
|
|
503 |
{
|
|
504 |
err = KErrArgument;
|
|
505 |
}
|
|
506 |
else if( !IsId() && PropertyExists( KId ) )
|
|
507 |
{
|
|
508 |
err = KErrBadName;
|
|
509 |
}
|
|
510 |
|
|
511 |
if( err == KErrNone && !IsId( ) && !( IsPublisherNameL( )
|
|
512 |
|| IsContentTypeL( ) || IsContentIdL() ) )
|
|
513 |
{
|
|
514 |
err = KErrPathNotFound;
|
|
515 |
}
|
|
516 |
|
|
517 |
if( err != KErrNone )
|
|
518 |
{
|
|
519 |
User::Leave( err );
|
|
520 |
}
|
|
521 |
}
|
|
522 |
|
|
523 |
// ---------------------------------------------------------------------------
|
|
524 |
//
|
|
525 |
// ---------------------------------------------------------------------------
|
|
526 |
//
|
|
527 |
void CContentMap::IsValidForGetListL() const
|
|
528 |
{
|
|
529 |
CP_DEBUG( _L8("CContentMap::IsValidForGetListL") );
|
|
530 |
TInt err( KErrNone );
|
|
531 |
TInt32 id( 0 );
|
|
532 |
if( GetProperty( KId, id ) && ( id < 1 ) )
|
|
533 |
{
|
|
534 |
err = KErrArgument;
|
|
535 |
}
|
|
536 |
else if( !IsId() && PropertyExists( KId ) )
|
|
537 |
{
|
|
538 |
err = KErrBadName;
|
|
539 |
}
|
|
540 |
|
|
541 |
if( err != KErrNone )
|
|
542 |
{
|
|
543 |
User::Leave( err );
|
|
544 |
}
|
|
545 |
}
|
|
546 |
|
|
547 |
// ---------------------------------------------------------------------------
|
|
548 |
//
|
|
549 |
// ---------------------------------------------------------------------------
|
|
550 |
//
|
|
551 |
TBool CContentMap::ActivateActionSupport( ) const
|
|
552 |
{
|
|
553 |
return EFalse;
|
|
554 |
}
|
|
555 |
|
|
556 |
// ---------------------------------------------------------------------------
|
|
557 |
//
|
|
558 |
// ---------------------------------------------------------------------------
|
|
559 |
//
|
|
560 |
TBool CContentMap::GetActivateInfo( ) const
|
|
561 |
{
|
|
562 |
return EFalse;
|
|
563 |
}
|
|
564 |
|