|
1 /* |
|
2 * Copyright (c) 2007 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: Message store property container with permanent storage client implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "MsgStoreWritablePropertyContainer.h" |
|
20 #include "MsgStoreSessionContext.h" |
|
21 |
|
22 // ---------------------------------- |
|
23 // CMsgStoreWritablePropertyContainer |
|
24 // ---------------------------------- |
|
25 CMsgStoreWritablePropertyContainer* CMsgStoreWritablePropertyContainer::NewL( CMsgStoreSessionContext& aSessionContext, |
|
26 TMsgStoreId aId, |
|
27 TMsgStoreId aParentId, |
|
28 TMsgStoreId aMailBoxId, |
|
29 const TDesC8& aPropertiesBuf ) |
|
30 { |
|
31 CMsgStoreWritablePropertyContainer* self = new(ELeave) CMsgStoreWritablePropertyContainer( aSessionContext, aId, aParentId, aMailBoxId ); |
|
32 CleanupStack::PushL( self ); |
|
33 self->ConstructL( aPropertiesBuf ); |
|
34 CleanupStack::Pop( self ); |
|
35 return self; |
|
36 } |
|
37 |
|
38 // ========================================================================== |
|
39 // FUNCTION: Constructor |
|
40 // ========================================================================== |
|
41 CMsgStoreWritablePropertyContainer::CMsgStoreWritablePropertyContainer( |
|
42 CMsgStoreSessionContext& aSessionContext, |
|
43 TMsgStoreId aId, |
|
44 TMsgStoreId aParentId, |
|
45 TMsgStoreId aMailBoxId ) : |
|
46 iContext( aSessionContext ), |
|
47 iMailBoxId(aMailBoxId) |
|
48 { |
|
49 SetIds( aId, aParentId ); |
|
50 } // end |
|
51 |
|
52 // ========================================================================== |
|
53 // FUNCTION: ConstructL |
|
54 // ========================================================================== |
|
55 void CMsgStoreWritablePropertyContainer::ConstructL( const TDesC8& aPropertiesBuf ) |
|
56 { |
|
57 DeserializeL( aPropertiesBuf ); |
|
58 } // end |
|
59 |
|
60 // ========================================================================== |
|
61 // FUNCTION: StorePropertiesL |
|
62 // ========================================================================== |
|
63 EXPORT_C void CMsgStoreWritablePropertyContainer::StorePropertiesL( ) |
|
64 { |
|
65 RBuf8 serializedBuf; |
|
66 CleanupClosePushL( serializedBuf ); |
|
67 SerializeL( serializedBuf ); |
|
68 |
|
69 iContext.iSession.UpdatePropertiesL( iId, iParentId, iMailBoxId, serializedBuf ); |
|
70 |
|
71 CleanupStack::PopAndDestroy( &serializedBuf ); |
|
72 } // end StorePropertiesL |
|
73 |
|
74 // ========================================================================== |
|
75 // FUNCTION: StorePropertyL |
|
76 // ========================================================================== |
|
77 EXPORT_C void CMsgStoreWritablePropertyContainer::StorePropertyL( TUint aPropertyIndex ) |
|
78 { |
|
79 ValidateIndexL( aPropertyIndex ); |
|
80 |
|
81 iContext.iSession.UpdatePropertyL( iId, |
|
82 iParentId, |
|
83 iMailBoxId, |
|
84 iProperties[aPropertyIndex]->iName, |
|
85 iProperties[aPropertyIndex]->iType, |
|
86 iProperties[aPropertyIndex]->iValue ); |
|
87 } // end StorePropertyL |