110 void CTsRunningAppModel::SetObserver( MTsModelObserver* aObserver ) |
110 void CTsRunningAppModel::SetObserver( MTsModelObserver* aObserver ) |
111 { |
111 { |
112 iObserver = aObserver; |
112 iObserver = aObserver; |
113 } |
113 } |
114 |
114 |
115 const TDesC& CTsRunningAppModel::DisplayNameL( TInt aOffset ) const |
115 const TDesC& CTsRunningAppModel::DisplayName( TInt aOffset ) const |
116 { |
116 { |
117 return iDataList->Data()[aOffset]->AppName(); |
117 return iDataList->Data()[aOffset]->DisplayName(); |
118 } |
118 } |
119 |
119 |
120 TInt CTsRunningAppModel::IconHandleL( TInt aOffset ) const |
120 TInt CTsRunningAppModel::IconHandle( TInt aOffset ) const |
121 { |
121 { |
122 CFbsBitmap *bitmap = iDataList->Data()[aOffset]->Screenshot(); |
122 return iDataList->Data()[aOffset]->IconHandle(); |
123 if( !bitmap ) |
123 |
124 { |
|
125 bitmap = iDataList->Data()[aOffset]->AppIconBitmap(); |
|
126 } |
|
127 return bitmap ? bitmap->Handle() : KErrNotFound; |
|
128 } |
124 } |
129 |
125 |
130 TTime CTsRunningAppModel::TimestampL( TInt aOffset ) const |
126 TTime CTsRunningAppModel::Timestamp( TInt aOffset ) const |
131 { |
127 { |
132 return iDataList->Data()[aOffset]->Timestamp(); |
128 return iDataList->Data()[aOffset]->Timestamp(); |
133 } |
129 } |
134 |
130 |
135 TTime CTsRunningAppModel::TimestampUpdateL(TInt offset) const |
131 TTime CTsRunningAppModel::TimestampUpdate(TInt offset) const |
136 { |
132 { |
137 return iDataList->Data()[offset]->LastUpdateTimestamp(); |
133 return iDataList->Data()[offset]->TimestampUpdate(); |
138 } |
134 } |
139 |
135 |
140 TTsModelItemKey CTsRunningAppModel::KeyL( TInt aOffset ) const |
136 TTsEntryKey CTsRunningAppModel::Key( TInt aOffset ) const |
141 { |
137 { |
142 return TTsModelItemKey(iDataList->Data()[aOffset]->Key().WindowGroupId(), |
138 return TTsEntryKey(iDataList->Data()[aOffset]->Key().Key(), |
143 reinterpret_cast<TInt>(this)); |
139 reinterpret_cast<TInt>(this)); |
144 } |
140 } |
145 |
141 |
146 TBool CTsRunningAppModel::IsActiveL( TInt /*aOffset*/ ) const |
142 TBool CTsRunningAppModel::IsActive( TInt /*aOffset*/ ) const |
147 { |
143 { |
148 return ETrue; |
144 return ETrue; |
149 } |
145 } |
150 |
146 |
151 TBool CTsRunningAppModel::IsClosableL( TInt aOffset ) const |
147 TBool CTsRunningAppModel::IsClosable( TInt aOffset ) const |
152 { |
148 { |
153 return iDataList->Data()[aOffset]->CloseableApp(); |
149 return iDataList->Data()[aOffset]->IsClosable(); |
154 } |
150 } |
155 |
151 |
156 TBool CTsRunningAppModel::IsMandatoryL( TInt /*aOffset*/ ) const |
152 TBool CTsRunningAppModel::IsMandatory( TInt /*aOffset*/ ) const |
157 { |
153 { |
158 return ETrue; |
154 return ETrue; |
159 } |
155 } |
160 |
156 |
161 TBool CTsRunningAppModel::CloseL( TTsModelItemKey aKey ) const |
157 TBool CTsRunningAppModel::Close( TTsEntryKey aKey ) const |
162 { |
158 { |
163 TApaTask task( iResources.WsSession() ); |
159 TBool retVal(EFalse); |
164 task.SetWgId( aKey.Key() ); |
160 TRAP_IGNORE(retVal = iDataList->FindL(aKey).Close()); |
165 task.EndTask(); |
161 return retVal; |
166 return ETrue; |
|
167 } |
162 } |
168 |
163 |
169 TBool CTsRunningAppModel::LaunchL( TTsModelItemKey aKey ) const |
164 TBool CTsRunningAppModel::Launch( TTsEntryKey aKey ) const |
170 { |
165 { |
171 // find uid by wgid from key |
166 TBool retVal(EFalse); |
172 CApaWindowGroupName *windowGroupName = |
167 TRAP_IGNORE(retVal = iDataList->FindL(aKey).Launch()); |
173 CApaWindowGroupName::NewLC( iResources.WsSession(), aKey.Key() ); |
168 return retVal; |
174 TUid uid = windowGroupName->AppUid(); |
|
175 CleanupStack::PopAndDestroy( windowGroupName ); |
|
176 |
|
177 TApaTask task = TApaTaskList( iResources.WsSession() ).FindApp( uid ); |
|
178 task.BringToForeground(); |
|
179 return task.Exists(); |
|
180 } |
169 } |