|
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: Task list entry |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <s32strm.h> |
|
19 #include <fbs.h> |
|
20 |
|
21 #include "tsentryimp.h" |
|
22 |
|
23 // -------------------------------------------------------------------------- |
|
24 CTsEntryImp::~CTsEntryImp() |
|
25 { |
|
26 delete iName; |
|
27 delete iThumbail; |
|
28 } |
|
29 |
|
30 // -------------------------------------------------------------------------- |
|
31 void CTsEntryImp::BaseConstructL(RReadStream& aStream) |
|
32 { |
|
33 aStream >> ( *this ); |
|
34 } |
|
35 |
|
36 // -------------------------------------------------------------------------- |
|
37 TBool CTsEntryImp::IsActive() const |
|
38 { |
|
39 return iIsActive; |
|
40 } |
|
41 |
|
42 // -------------------------------------------------------------------------- |
|
43 /** |
|
44 * Application name. |
|
45 */ |
|
46 const TDesC& CTsEntryImp::DisplayName() const |
|
47 { |
|
48 return iName ? *iName : KNullDesC(); |
|
49 } |
|
50 |
|
51 // -------------------------------------------------------------------------- |
|
52 /** |
|
53 * ETrue if the application is closeable |
|
54 */ |
|
55 TBool CTsEntryImp::IsClosable() const |
|
56 { |
|
57 return iCloseableApp; |
|
58 } |
|
59 |
|
60 // -------------------------------------------------------------------------- |
|
61 /** |
|
62 * Application icon bitmap |
|
63 */ |
|
64 TInt CTsEntryImp::IconHandle() const |
|
65 { |
|
66 return iThumbail ? iThumbail->Handle() : KErrNotFound; |
|
67 } |
|
68 |
|
69 // -------------------------------------------------------------------------- |
|
70 /** |
|
71 * Entry's key |
|
72 */ |
|
73 TTsEntryKey CTsEntryImp::Key() const |
|
74 { |
|
75 return iKey; |
|
76 } |
|
77 |
|
78 // -------------------------------------------------------------------------- |
|
79 TTime CTsEntryImp::Timestamp() const |
|
80 { |
|
81 return iTimestamp; |
|
82 } |
|
83 |
|
84 // -------------------------------------------------------------------------- |
|
85 /** |
|
86 * Timestamp of last entry change |
|
87 */ |
|
88 TTime CTsEntryImp::TimestampUpdate() const |
|
89 { |
|
90 return iUpdateTimestamp; |
|
91 } |
|
92 |
|
93 // -------------------------------------------------------------------------- |
|
94 TBool CTsEntryImp::IsMandatory() const |
|
95 { |
|
96 return ETrue; |
|
97 } |
|
98 |
|
99 // -------------------------------------------------------------------------- |
|
100 void CTsEntryImp::ExternalizeL( RWriteStream& aDst, const MTsEntry& aSrc ) |
|
101 { |
|
102 aDst.WriteInt32L( aSrc.DisplayName().Length() ); |
|
103 if( 0 < aSrc.DisplayName().Length() ) |
|
104 { |
|
105 aDst << aSrc.DisplayName(); |
|
106 } |
|
107 TPckgBuf<TTime> timestamp(aSrc.TimestampUpdate()); |
|
108 aDst.WriteL(timestamp); |
|
109 aDst.WriteInt32L( aSrc.IconHandle() ); |
|
110 aDst.WriteInt32L( TTsEntryKey::Size() ); |
|
111 aDst << aSrc.Key(); |
|
112 aDst.WriteInt32L( aSrc.IsActive() ); |
|
113 aDst.WriteInt32L( aSrc.IsClosable() ); |
|
114 } |
|
115 |
|
116 // -------------------------------------------------------------------------- |
|
117 void CTsEntryImp::InternalizeL( RReadStream& aSrc ) |
|
118 { |
|
119 TInt lenght = aSrc.ReadInt32L(); |
|
120 delete iName; |
|
121 iName = 0; |
|
122 if(0 < lenght) |
|
123 { |
|
124 iName = HBufC::NewL(aSrc, lenght); |
|
125 } |
|
126 |
|
127 TPckgBuf<TTime> timestamp; |
|
128 aSrc.ReadL(timestamp); |
|
129 iUpdateTimestamp = timestamp(); |
|
130 |
|
131 delete iThumbail; |
|
132 iThumbail = 0; |
|
133 TInt handle = aSrc.ReadInt32L(); |
|
134 if(KErrNotFound != handle) |
|
135 { |
|
136 iThumbail = new(ELeave)CFbsBitmap(); |
|
137 User::LeaveIfError(iThumbail->Duplicate(handle)); |
|
138 } |
|
139 aSrc.ReadInt32L(); |
|
140 aSrc >> iKey; |
|
141 |
|
142 iIsActive = aSrc.ReadInt32L(); |
|
143 iCloseableApp = aSrc.ReadInt32L(); |
|
144 } |
|
145 // end of file |