116
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <AknDef.h>
|
|
19 |
#include <apgwgnam.h>
|
|
20 |
#include <apgtask.h>
|
|
21 |
|
119
|
22 |
#include "tsrunningappmodel.h"
|
125
|
23 |
#include "tsrunningappstorageimp.h"
|
116
|
24 |
#include "tsdatalist.h"
|
|
25 |
#include "tsmodelobserver.h"
|
|
26 |
#include "tsscreenshotprovider.h"
|
125
|
27 |
#include "tsresourcemanager.h"
|
116
|
28 |
|
|
29 |
CTsRunningAppModel *CTsRunningAppModel::NewL( MTsResourceManager& aResources,
|
119
|
30 |
TsEnv& aEnv )
|
116
|
31 |
{
|
125
|
32 |
CTsRunningAppModel *self = CTsRunningAppModel::NewLC( aResources, aEnv );
|
116
|
33 |
CleanupStack::Pop( self );
|
|
34 |
return self;
|
|
35 |
}
|
|
36 |
|
|
37 |
CTsRunningAppModel *CTsRunningAppModel::NewLC( MTsResourceManager& aResources,
|
119
|
38 |
TsEnv& aEnv )
|
116
|
39 |
{
|
|
40 |
CTsRunningAppModel *self = new (ELeave) CTsRunningAppModel( aResources );
|
|
41 |
CleanupStack::PushL( self );
|
125
|
42 |
self->ConstructL( aResources, aEnv );
|
116
|
43 |
return self;
|
|
44 |
}
|
|
45 |
|
|
46 |
CTsRunningAppModel::~CTsRunningAppModel()
|
|
47 |
{
|
|
48 |
delete iDataList;
|
|
49 |
delete iScreenshotProvider;
|
|
50 |
}
|
|
51 |
|
|
52 |
CTsRunningAppModel::CTsRunningAppModel( MTsResourceManager& aResources )
|
|
53 |
:
|
|
54 |
iResources( aResources )
|
|
55 |
{
|
|
56 |
}
|
|
57 |
|
|
58 |
void CTsRunningAppModel::ConstructL( MTsResourceManager& aResources,
|
119
|
59 |
TsEnv& aEnv)
|
116
|
60 |
{
|
125
|
61 |
iDataList = CTsDataList::NewL( aResources, *this, aEnv );
|
|
62 |
iScreenshotProvider =
|
|
63 |
CTsScreenshotProvider::NewL(*iDataList, aResources.WsMonitor());
|
119
|
64 |
|
116
|
65 |
RArray<RWsSession::TWindowGroupChainInfo> wgList;
|
|
66 |
CleanupClosePushL( wgList );
|
|
67 |
User::LeaveIfError( aResources.WsSession().WindowGroupList( 0, &wgList ) );
|
119
|
68 |
CTsRunningAppStorage* storage = CTsRunningAppStorage::NewLC();
|
|
69 |
storage->HandleWindowGroupChanged(aResources, wgList.Array());
|
|
70 |
iDataList->HandleWindowGroupChanged( aResources, *storage );
|
|
71 |
CleanupStack::PopAndDestroy(storage);
|
116
|
72 |
CleanupStack::PopAndDestroy( &wgList );
|
|
73 |
}
|
|
74 |
|
|
75 |
// --------------------------------------------------------------------------
|
|
76 |
// MHsDataObserver interface implementation
|
|
77 |
// --------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
void CTsRunningAppModel::DataChanged()
|
|
80 |
{
|
|
81 |
if (iObserver)
|
|
82 |
{
|
|
83 |
iObserver->DataChanged( *this );
|
|
84 |
}
|
|
85 |
}
|
|
86 |
|
|
87 |
// --------------------------------------------------------------------------
|
|
88 |
// MTsTaskSettings interface implementation
|
|
89 |
// --------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
TBool CTsRunningAppModel::IsSupported( TInt aFunction ) const
|
|
92 |
{
|
|
93 |
return iDataList->IsSupported( aFunction );
|
|
94 |
}
|
|
95 |
|
|
96 |
void CTsRunningAppModel::HandleDataL( TInt aFunction, RReadStream& aDataStream )
|
|
97 |
{
|
|
98 |
iDataList->HandleDataL( aFunction, aDataStream );
|
|
99 |
}
|
|
100 |
|
|
101 |
// --------------------------------------------------------------------------
|
|
102 |
// MTsModel interface implementation
|
|
103 |
// --------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
TInt CTsRunningAppModel::Count() const
|
|
106 |
{
|
|
107 |
return iDataList->Data().Count();
|
|
108 |
}
|
|
109 |
|
|
110 |
void CTsRunningAppModel::SetObserver( MTsModelObserver* aObserver )
|
|
111 |
{
|
|
112 |
iObserver = aObserver;
|
|
113 |
}
|
|
114 |
|
127
|
115 |
const TDesC& CTsRunningAppModel::DisplayName( TInt aOffset ) const
|
116
|
116 |
{
|
127
|
117 |
return iDataList->Data()[aOffset]->DisplayName();
|
116
|
118 |
}
|
|
119 |
|
127
|
120 |
TInt CTsRunningAppModel::IconHandle( TInt aOffset ) const
|
116
|
121 |
{
|
127
|
122 |
return iDataList->Data()[aOffset]->IconHandle();
|
|
123 |
|
116
|
124 |
}
|
|
125 |
|
127
|
126 |
TTime CTsRunningAppModel::Timestamp( TInt aOffset ) const
|
116
|
127 |
{
|
|
128 |
return iDataList->Data()[aOffset]->Timestamp();
|
|
129 |
}
|
|
130 |
|
127
|
131 |
TTime CTsRunningAppModel::TimestampUpdate(TInt offset) const
|
116
|
132 |
{
|
127
|
133 |
return iDataList->Data()[offset]->TimestampUpdate();
|
116
|
134 |
}
|
|
135 |
|
127
|
136 |
TTsEntryKey CTsRunningAppModel::Key( TInt aOffset ) const
|
116
|
137 |
{
|
127
|
138 |
return TTsEntryKey(iDataList->Data()[aOffset]->Key().Key(),
|
|
139 |
reinterpret_cast<TInt>(this));
|
116
|
140 |
}
|
|
141 |
|
127
|
142 |
TBool CTsRunningAppModel::IsActive( TInt /*aOffset*/ ) const
|
116
|
143 |
{
|
|
144 |
return ETrue;
|
|
145 |
}
|
|
146 |
|
127
|
147 |
TBool CTsRunningAppModel::IsClosable( TInt aOffset ) const
|
116
|
148 |
{
|
127
|
149 |
return iDataList->Data()[aOffset]->IsClosable();
|
116
|
150 |
}
|
|
151 |
|
127
|
152 |
TBool CTsRunningAppModel::IsMandatory( TInt /*aOffset*/ ) const
|
119
|
153 |
{
|
|
154 |
return ETrue;
|
|
155 |
}
|
|
156 |
|
127
|
157 |
TBool CTsRunningAppModel::Close( TTsEntryKey aKey ) const
|
116
|
158 |
{
|
127
|
159 |
TBool retVal(EFalse);
|
|
160 |
TRAP_IGNORE(retVal = iDataList->FindL(aKey).Close());
|
|
161 |
return retVal;
|
116
|
162 |
}
|
|
163 |
|
127
|
164 |
TBool CTsRunningAppModel::Launch( TTsEntryKey aKey ) const
|
116
|
165 |
{
|
127
|
166 |
TBool retVal(EFalse);
|
|
167 |
TRAP_IGNORE(retVal = iDataList->FindL(aKey).Launch());
|
|
168 |
return retVal;
|
116
|
169 |
}
|