|
1 /* |
|
2 * Copyright (c) 2005-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: Part of SyncML Data Synchronization Plug In Adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <msvuids.h> |
|
20 #include "snapshotitem.h" |
|
21 |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // TSnapshotItem::TSnapshotItem |
|
25 // C++ default constructor can NOT contain any code, that might leave |
|
26 // ----------------------------------------------------------------------------- |
|
27 TSnapshotItem::TSnapshotItem() : TNSmlSnapshotItem() |
|
28 { |
|
29 iUnread = EFalse; |
|
30 } |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // TSnapshotItem::TSnapshotItem |
|
34 // Constructor, takes item id as a parameter |
|
35 // ----------------------------------------------------------------------------- |
|
36 TSnapshotItem::TSnapshotItem( const TSmlDbItemUid& aItemId, |
|
37 const TSmlDbItemUid& aParent, TBool aUnread ) |
|
38 : TNSmlSnapshotItem( aItemId ) |
|
39 { |
|
40 SetParentId( aParent ); |
|
41 iUnread = aUnread; |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // TSnapshotItem::ExternalizeL |
|
46 // Writes the contents of this class and it's base to stream |
|
47 // ----------------------------------------------------------------------------- |
|
48 void TSnapshotItem::ExternalizeL( RWriteStream& aStream ) const |
|
49 { |
|
50 TNSmlSnapshotItem::ExternalizeL( aStream ); |
|
51 aStream.WriteInt32L( iUnread ); |
|
52 TPckgBuf<TFolderName> nameBuf(iFolderName); |
|
53 aStream << nameBuf; |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // TSnapshotItem::InternalizeL |
|
58 // Reads the contents of this class and it's base from stream |
|
59 // ----------------------------------------------------------------------------- |
|
60 void TSnapshotItem::InternalizeL( RReadStream& aStream ) |
|
61 { |
|
62 TNSmlSnapshotItem::InternalizeL( aStream ); |
|
63 iUnread = aStream.ReadInt32L(); |
|
64 TPckgBuf<TFolderName> nameBuf; |
|
65 aStream >> nameBuf; |
|
66 iFolderName = nameBuf(); |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // TSnapshotItem::SetUnread |
|
71 // Sets unread flag |
|
72 // ----------------------------------------------------------------------------- |
|
73 void TSnapshotItem::SetUnread( TBool aState ) |
|
74 { |
|
75 iUnread = aState; |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // TSnapshotItem::Unread |
|
80 // Gets unread flag |
|
81 // ----------------------------------------------------------------------------- |
|
82 TBool TSnapshotItem::Unread() const |
|
83 { |
|
84 return iUnread; |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // TSnapshotItem::SetFolderNameL |
|
89 // Sets folder name |
|
90 // ----------------------------------------------------------------------------- |
|
91 void TSnapshotItem::SetFolderNameL( const TDesC& aFolderName ) |
|
92 { |
|
93 if ( aFolderName.Length() > KMaxFolderNameLength ) |
|
94 { |
|
95 User::Leave( KErrTooBig ); |
|
96 } |
|
97 iFolderName.Copy( aFolderName ); |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // TSnapshotItem::FolderName |
|
102 // Gets folder name |
|
103 // ----------------------------------------------------------------------------- |
|
104 const TDesC& TSnapshotItem::FolderName() const |
|
105 { |
|
106 return iFolderName; |
|
107 } |