96
|
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 <w32std.h>// key event
|
|
19 |
#include <apgwgnam.h>// for CApaWindowGroupName
|
|
20 |
#include <apgtask.h>
|
|
21 |
#include <coedef.h>
|
|
22 |
#include <f32file.h>
|
|
23 |
#include <flogger.h>
|
|
24 |
#include <e32property.h>
|
|
25 |
#include <startupdomainpskeys.h>
|
|
26 |
|
|
27 |
#include "tsbackstepping.h"
|
|
28 |
|
|
29 |
const TUid KHSUid = {0x20022f35};
|
|
30 |
|
|
31 |
|
|
32 |
/**
|
|
33 |
* CTsBackstepping::NewL
|
|
34 |
* two phase constructor
|
|
35 |
*/
|
98
|
36 |
EXPORT_C CTsBackstepping* CTsBackstepping::NewL(MTsWindowGroupsMonitor &monitor)
|
96
|
37 |
{
|
|
38 |
RDebug::Print(_L("CTsBackstepping::NewL"));
|
98
|
39 |
CTsBackstepping* self = CTsBackstepping::NewLC(monitor);
|
96
|
40 |
CleanupStack::Pop(self);
|
|
41 |
return self;
|
|
42 |
}
|
|
43 |
|
|
44 |
/**
|
|
45 |
* CTsBackstepping::NewLC
|
|
46 |
* two phase constructor
|
|
47 |
*/
|
98
|
48 |
EXPORT_C CTsBackstepping* CTsBackstepping::NewLC(MTsWindowGroupsMonitor &monitor)
|
96
|
49 |
{
|
98
|
50 |
CTsBackstepping* self = new (ELeave) CTsBackstepping(monitor);
|
96
|
51 |
CleanupStack::PushL(self);
|
|
52 |
self->ConstructL();
|
|
53 |
return self;
|
|
54 |
}
|
|
55 |
|
|
56 |
/**
|
|
57 |
* CTsBackstepping::CTsBackstepping
|
|
58 |
* constructor
|
|
59 |
*/
|
98
|
60 |
CTsBackstepping::CTsBackstepping(MTsWindowGroupsMonitor &monitor)
|
|
61 |
:
|
|
62 |
CTsWindowGroupsObserver(monitor)
|
96
|
63 |
{
|
|
64 |
}
|
|
65 |
|
|
66 |
|
|
67 |
/**
|
|
68 |
* CTsBackstepping::~CTsBackstepping
|
|
69 |
* deconstructor
|
|
70 |
*/
|
|
71 |
EXPORT_C CTsBackstepping::~CTsBackstepping()
|
|
72 |
{
|
|
73 |
}
|
|
74 |
|
|
75 |
/**
|
|
76 |
* CTsBackstepping::ConstructL
|
|
77 |
* two phase constructor
|
|
78 |
*/
|
|
79 |
void CTsBackstepping::ConstructL ()
|
|
80 |
{
|
|
81 |
RDebug::Print(_L("CTsBackstepping::ConstructL"));
|
98
|
82 |
BaseConstructL();
|
96
|
83 |
}
|
|
84 |
|
|
85 |
/**
|
98
|
86 |
* CTsBackstepping::AnalyseWindowStackL
|
|
87 |
* Analyzes window stack and move homescreen to proper position
|
96
|
88 |
*/
|
98
|
89 |
void CTsBackstepping::HandleWindowGroupChanged(MTsResourceManager &resource, const TArray<RWsSession::TWindowGroupChainInfo> &windowGroups)
|
96
|
90 |
{
|
98
|
91 |
TRAP_IGNORE(HandleWindowGroupChangedL(resource, windowGroups));
|
96
|
92 |
}
|
|
93 |
|
|
94 |
/**
|
|
95 |
* CTsBackstepping::AnalyseWindowStackL
|
|
96 |
* Analyzes window stack and move homescreen to proper position
|
|
97 |
*/
|
98
|
98 |
void CTsBackstepping::HandleWindowGroupChangedL(MTsResourceManager &resource,
|
|
99 |
const TArray<RWsSession::TWindowGroupChainInfo> &windowGroups)
|
96
|
100 |
{
|
|
101 |
RDebug::Print(_L("CTsBackstepping::GetWindowCaption"));
|
|
102 |
|
98
|
103 |
CApaWindowGroupName *windowGroupName = CApaWindowGroupName::NewLC(resource.WsSession());
|
96
|
104 |
|
|
105 |
TInt count(windowGroups.Count());
|
|
106 |
TInt pos(0);
|
|
107 |
TInt whereToJump(1);
|
|
108 |
for (TInt i=0; i<count; i++) {//iterate through list and give debug info
|
98
|
109 |
windowGroupName->ConstructFromWgIdL(windowGroups[i].iId);
|
96
|
110 |
if (windowGroupName->AppUid() != TUid::Null()) {
|
|
111 |
// find the window group id and check that it has no parent
|
98
|
112 |
if ( windowGroups[i].iParentId <= 0 ) {
|
|
113 |
RDebug::Print( _L("CTsBackstepping::GetWindowCaption wgid:%d is standalone view"), windowGroups[i].iId);
|
96
|
114 |
//check if it is homescreen
|
|
115 |
if (windowGroupName->AppUid() == KHSUid) {
|
|
116 |
RDebug::Print(_L("CTsBackstepping::GetWindowCaption Homescreen position = %d ; list:%d/%d"), pos, i, count);
|
|
117 |
if (pos <= 1) {// HS is in foreground or second in line - do nothing
|
|
118 |
RDebug::Print(_L("CTsBackstepping::nothing to be done - it will stop checking here"));
|
|
119 |
} else {//we should move homescreen to be second (ommit embeded views) from top
|
|
120 |
RDebug::Print(_L("CTsBackstepping::moving homescreen to be second from top"));
|
|
121 |
RDebug::Print(_L("CTsBackstepping::whereToJump = %d"), whereToJump);
|
98
|
122 |
resource.WsSession().SetWindowGroupOrdinalPosition(windowGroups[i].iId, whereToJump);
|
96
|
123 |
}
|
|
124 |
// and break
|
|
125 |
break;
|
|
126 |
}
|
|
127 |
pos++;
|
|
128 |
} else {
|
|
129 |
// only embeded items for first standalone launch should be counted
|
|
130 |
if (!pos) {
|
|
131 |
++whereToJump;
|
|
132 |
}
|
98
|
133 |
RDebug::Print(_L("CTsBackstepping::GetWindowCaption wgid:%d is embedded view"), windowGroups[i].iId);
|
96
|
134 |
}
|
|
135 |
}
|
|
136 |
}
|
|
137 |
CleanupStack::PopAndDestroy(windowGroupName);
|
|
138 |
}
|
|
139 |
|
|
140 |
// end of file
|