|
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 #define __E32SVR_H__ |
|
19 #include <s32strm.h> |
|
20 #include <fbs.h> |
|
21 #include "tsentry.h" |
|
22 #include "tsdataobserver.h" |
|
23 |
|
24 // -------------------------------------------------------------------------- |
|
25 // CTsFswEntry::NewL |
|
26 // -------------------------------------------------------------------------- |
|
27 // |
|
28 CTsEntry* CTsEntry::NewL(const TTsEntryKey &key, MTsDataObserver &observer) |
|
29 { |
|
30 CTsEntry* self = NewLC(key, observer); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 // -------------------------------------------------------------------------- |
|
36 // CTsFswEntry::NewLC |
|
37 // -------------------------------------------------------------------------- |
|
38 // |
|
39 CTsEntry* CTsEntry::NewLC(const TTsEntryKey &key, MTsDataObserver &observer) |
|
40 { |
|
41 CTsEntry* self = new (ELeave) CTsEntry(key, observer); |
|
42 CleanupStack::PushL(self); |
|
43 return self; |
|
44 } |
|
45 |
|
46 // -------------------------------------------------------------------------- |
|
47 // CTsFswEntry::~CTsFswEntry |
|
48 // -------------------------------------------------------------------------- |
|
49 // |
|
50 CTsEntry::~CTsEntry() |
|
51 { |
|
52 delete mAppName; |
|
53 delete mAppIconBitmap; |
|
54 delete mScreenshot; |
|
55 delete mImgTool; |
|
56 } |
|
57 |
|
58 // -------------------------------------------------------------------------- |
|
59 // CTsFswEntry::CTsFswEntry |
|
60 // -------------------------------------------------------------------------- |
|
61 // |
|
62 CTsEntry::CTsEntry(const TTsEntryKey &key, MTsDataObserver &observer) |
|
63 : |
|
64 mVisibility(Visible), |
|
65 mKey(key), |
|
66 mPriority(Low), |
|
67 mObserver(observer) |
|
68 { |
|
69 } |
|
70 |
|
71 // -------------------------------------------------------------------------- |
|
72 // CTsFswEntry::SetAppUid |
|
73 // -------------------------------------------------------------------------- |
|
74 // |
|
75 void CTsEntry::SetAppUid(const TUid &uid) |
|
76 { |
|
77 mAppUid = uid; |
|
78 } |
|
79 |
|
80 // -------------------------------------------------------------------------- |
|
81 // CTsFswEntry::SetAppNameL |
|
82 // -------------------------------------------------------------------------- |
|
83 // |
|
84 void CTsEntry::SetAppNameL(const TDesC &appName) |
|
85 { |
|
86 delete mAppName; |
|
87 mAppName = 0; |
|
88 mAppName = appName.AllocL(); |
|
89 } |
|
90 |
|
91 // -------------------------------------------------------------------------- |
|
92 // CTsFswEntry::SetSystemApp |
|
93 // -------------------------------------------------------------------------- |
|
94 // |
|
95 void CTsEntry::SetCloseableApp(TBool value) |
|
96 { |
|
97 mCloseableApp = value; |
|
98 } |
|
99 |
|
100 // -------------------------------------------------------------------------- |
|
101 // CTsFswEntry::SetAppIconHandles |
|
102 // -------------------------------------------------------------------------- |
|
103 // |
|
104 void CTsEntry::SetAppIcon(CFbsBitmap * bitmap) |
|
105 { |
|
106 mAppIconBitmap = bitmap; |
|
107 } |
|
108 |
|
109 // -------------------------------------------------------------------------- |
|
110 /** |
|
111 * Application uid. |
|
112 */ |
|
113 TUid CTsEntry::AppUid() const |
|
114 { |
|
115 return mAppUid; |
|
116 } |
|
117 |
|
118 // -------------------------------------------------------------------------- |
|
119 /** |
|
120 * Application name. |
|
121 */ |
|
122 const TDesC& CTsEntry::AppName() const |
|
123 { |
|
124 return mAppName ? *mAppName : KNullDesC(); |
|
125 } |
|
126 |
|
127 // -------------------------------------------------------------------------- |
|
128 /** |
|
129 * Retrieve entry visibilit status |
|
130 */ |
|
131 Visibility CTsEntry::GetVisibility() const |
|
132 { |
|
133 return mVisibility; |
|
134 } |
|
135 |
|
136 // -------------------------------------------------------------------------- |
|
137 /** |
|
138 * Change entry visibility status |
|
139 * @param visibility - new visibility status |
|
140 */ |
|
141 void CTsEntry::SetVisibility(Visibility visibility) |
|
142 { |
|
143 mVisibility = visibility; |
|
144 } |
|
145 |
|
146 // -------------------------------------------------------------------------- |
|
147 /** |
|
148 * ETrue if the application is closeable |
|
149 */ |
|
150 TBool CTsEntry::CloseableApp() const |
|
151 { |
|
152 return mCloseableApp; |
|
153 } |
|
154 |
|
155 // -------------------------------------------------------------------------- |
|
156 /** |
|
157 * Application icon bitmap |
|
158 */ |
|
159 CFbsBitmap *CTsEntry::AppIconBitmap() const |
|
160 { |
|
161 return mAppIconBitmap; |
|
162 } |
|
163 |
|
164 // -------------------------------------------------------------------------- |
|
165 /** |
|
166 * Entry's key |
|
167 */ |
|
168 const TTsEntryKey &CTsEntry::Key() const |
|
169 { |
|
170 return mKey; |
|
171 } |
|
172 |
|
173 TTime CTsEntry::Timestamp() const |
|
174 { |
|
175 return mTimestamp; |
|
176 } |
|
177 |
|
178 void CTsEntry::SetTimestamp(const TTime ×tamp) |
|
179 { |
|
180 mTimestamp = timestamp; |
|
181 } |
|
182 |
|
183 // -------------------------------------------------------------------------- |
|
184 // CTsFswEntry::SetScreenshot |
|
185 // -------------------------------------------------------------------------- |
|
186 // |
|
187 void CTsEntry::SetScreenshotL(const CFbsBitmap &bitmapArg, UpdatePriority priority) |
|
188 { |
|
189 TInt currentPriority = static_cast<TInt> (mPriority); |
|
190 TInt newPriority = static_cast<TInt> (priority); |
|
191 if(newPriority <currentPriority) { |
|
192 User::Leave(KErrAccessDenied); |
|
193 } |
|
194 |
|
195 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
|
196 CleanupStack::PushL(bitmap); |
|
197 User::LeaveIfError(bitmap->Duplicate(bitmapArg.Handle())); |
|
198 CleanupStack::Pop(bitmap); |
|
199 |
|
200 mPriority = priority; |
|
201 delete mScreenshot; |
|
202 mScreenshot = bitmap; |
|
203 |
|
204 delete mImgTool; |
|
205 mImgTool = 0; |
|
206 |
|
207 mImgTool = CTsGraphicFileScalingHandler::NewL(*this, *mScreenshot, TSize(128, 128), |
|
208 CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding); |
|
209 } |
|
210 |
|
211 // -------------------------------------------------------------------------- |
|
212 // CTsFswEntry::RemoveScreenshot |
|
213 // -------------------------------------------------------------------------- |
|
214 // |
|
215 void CTsEntry::RemoveScreenshotL() |
|
216 { |
|
217 if (!mScreenshot) { |
|
218 User::Leave(KErrNotFound); |
|
219 } |
|
220 delete mScreenshot; |
|
221 mScreenshot = NULL; |
|
222 mPriority = Low; |
|
223 |
|
224 mObserver.DataChanged(); |
|
225 } |
|
226 |
|
227 // -------------------------------------------------------------------------- |
|
228 /** |
|
229 * Application screenshot. |
|
230 */ |
|
231 CFbsBitmap* CTsEntry::Screenshot() const |
|
232 { |
|
233 return mScreenshot; |
|
234 } |
|
235 |
|
236 // -------------------------------------------------------------------------- |
|
237 // CTsFswEntry::Priority |
|
238 // -------------------------------------------------------------------------- |
|
239 // |
|
240 void CTsEntry::ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap) |
|
241 { |
|
242 if (KErrNone == error && 0 != bitmap) { |
|
243 mScreenshot->Reset(); |
|
244 mScreenshot->Duplicate(bitmap->Handle()); |
|
245 |
|
246 mObserver.DataChanged(); |
|
247 } |
|
248 } |
|
249 |
|
250 // end of file |