125
|
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 |
#include "tsrunningappstorageimp.h"
|
|
18 |
//------------------------------------------------------------------------------
|
|
19 |
CTsRunningAppStorage* CTsRunningAppStorage::NewLC()
|
|
20 |
{
|
|
21 |
CTsRunningAppStorage* self = new(ELeave) CTsRunningAppStorage();
|
|
22 |
CleanupStack::PushL( self );
|
|
23 |
return self;
|
|
24 |
}
|
|
25 |
|
|
26 |
//------------------------------------------------------------------------------
|
|
27 |
CTsRunningAppStorage::CTsRunningAppStorage()
|
|
28 |
{
|
|
29 |
//No implementation required
|
|
30 |
}
|
|
31 |
|
|
32 |
//------------------------------------------------------------------------------
|
|
33 |
CTsRunningAppStorage::~CTsRunningAppStorage()
|
|
34 |
{
|
|
35 |
iRunningApps.ResetAndDestroy();
|
|
36 |
}
|
|
37 |
|
|
38 |
//------------------------------------------------------------------------------
|
|
39 |
void CTsRunningAppStorage::HandleWindowGroupChanged(
|
|
40 |
MTsResourceManager &aResources,
|
|
41 |
const TArray<RWsSession::TWindowGroupChainInfo> & aWindowGroups )
|
|
42 |
{
|
|
43 |
CTsRunningApp* app(0);
|
|
44 |
iRunningApps.ResetAndDestroy();
|
|
45 |
iBlockedWindowGroups.Reset();
|
|
46 |
TRAP_IGNORE(
|
|
47 |
for( TInt iter(0); iter < aWindowGroups.Count(); ++iter )
|
|
48 |
{
|
|
49 |
app = CTsRunningApp::NewLC(aResources, aWindowGroups[iter]);
|
|
50 |
iRunningApps.AppendL(app);
|
|
51 |
CleanupStack::Pop(app);
|
|
52 |
}
|
|
53 |
)//TRAP_IGNORE
|
|
54 |
}
|
|
55 |
|
|
56 |
//------------------------------------------------------------------------------
|
|
57 |
void CTsRunningAppStorage::HandleWindowGroupChanged(
|
|
58 |
MTsResourceManager &aResources,
|
|
59 |
const TArray<RWsSession::TWindowGroupChainInfo>& aFull,
|
|
60 |
const TArray<RWsSession::TWindowGroupChainInfo>& aFiltered)
|
|
61 |
{
|
|
62 |
TInt filtered(0);
|
|
63 |
HandleWindowGroupChanged(aResources, aFiltered);
|
|
64 |
for(TInt full(0); full < aFull.Count(); ++full)
|
|
65 |
{
|
|
66 |
for(filtered = 0; filtered < aFiltered.Count(); ++filtered)
|
|
67 |
{
|
|
68 |
if(aFull[full].iId == aFiltered[ filtered].iId)
|
|
69 |
{
|
|
70 |
break;
|
|
71 |
}
|
|
72 |
}
|
|
73 |
if(aFiltered.Count() == filtered)
|
|
74 |
{
|
|
75 |
iBlockedWindowGroups.Append(aFull[full].iId);
|
|
76 |
}
|
|
77 |
}
|
|
78 |
}
|
|
79 |
//------------------------------------------------------------------------------
|
|
80 |
const MTsRunningApplication& CTsRunningAppStorage::operator[] (TInt aOffset) const
|
|
81 |
{
|
|
82 |
return *iRunningApps[aOffset];
|
|
83 |
}
|
|
84 |
|
|
85 |
//------------------------------------------------------------------------------
|
|
86 |
TInt CTsRunningAppStorage::Count() const
|
|
87 |
{
|
|
88 |
return iRunningApps.Count();
|
|
89 |
}
|
|
90 |
|
|
91 |
//------------------------------------------------------------------------------
|
|
92 |
TInt CTsRunningAppStorage::ParentIndex( const MTsRunningApplication& aRunningApp ) const
|
|
93 |
{
|
|
94 |
const TInt applicationIndex(Find(aRunningApp.WindowGroupId()));
|
|
95 |
return KErrNotFound == applicationIndex ?
|
|
96 |
applicationIndex : ParentIndex(applicationIndex);
|
|
97 |
}
|
|
98 |
|
|
99 |
//------------------------------------------------------------------------------
|
|
100 |
TArray<TInt> CTsRunningAppStorage::BlockedWindowGroups() const
|
|
101 |
{
|
|
102 |
return iBlockedWindowGroups.Array();
|
|
103 |
}
|
|
104 |
|
|
105 |
//------------------------------------------------------------------------------
|
|
106 |
TInt CTsRunningAppStorage::ParentIndex( TInt aOffset ) const
|
|
107 |
{
|
|
108 |
TInt retval(aOffset);
|
|
109 |
if(iRunningApps[aOffset]->IsEmbeded())
|
|
110 |
{
|
|
111 |
const TInt parentIndex( Find(iRunningApps[aOffset]->ParentWindowGroupId(),
|
|
112 |
aOffset + 1) );
|
|
113 |
if( KErrNotFound != parentIndex )
|
|
114 |
{
|
|
115 |
retval = ParentIndex( parentIndex );
|
|
116 |
}
|
|
117 |
}
|
|
118 |
return retval;
|
|
119 |
}
|
|
120 |
|
|
121 |
//------------------------------------------------------------------------------
|
|
122 |
TInt CTsRunningAppStorage::Find(TInt aWindowGroupId, TInt aOffset) const
|
|
123 |
{
|
|
124 |
TInt retVal(KErrNotFound);
|
|
125 |
for( TInt iter(aOffset);
|
|
126 |
KErrNotFound == retVal && iter < iRunningApps.Count();
|
|
127 |
++iter )
|
|
128 |
{
|
|
129 |
if( iRunningApps[iter]->WindowGroupId() == aWindowGroupId )
|
|
130 |
{
|
|
131 |
retVal = iter;
|
|
132 |
}
|
|
133 |
}
|
|
134 |
return retVal;
|
|
135 |
}
|
|
136 |
|
|
137 |
|