34
|
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 |
|
|
10 |
#include "tspropertylistener.h"
|
|
11 |
#include "previewproviderlogging.h"
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
// --------------------------------------------------------------------------
|
|
16 |
// CTsPropertyListener::~CTsPropertyListener
|
|
17 |
// --------------------------------------------------------------------------
|
|
18 |
//
|
|
19 |
CTsPropertyListener::~CTsPropertyListener()
|
|
20 |
{
|
|
21 |
Cancel();
|
|
22 |
iProperty.Close();
|
|
23 |
}
|
|
24 |
|
|
25 |
// --------------------------------------------------------------------------
|
|
26 |
// CTsPropertyListener::CTsPropertyListener
|
|
27 |
// --------------------------------------------------------------------------
|
|
28 |
//
|
|
29 |
CTsPropertyListener::CTsPropertyListener( MTsFastSwapPreviewObserver& aObs ) :
|
|
30 |
CActive( CActive::EPriorityHigh ), iObs( aObs )
|
|
31 |
{
|
|
32 |
}
|
|
33 |
|
|
34 |
// --------------------------------------------------------------------------
|
|
35 |
// CTsPropertyListener::NewL
|
|
36 |
// --------------------------------------------------------------------------
|
|
37 |
//
|
|
38 |
CTsPropertyListener* CTsPropertyListener::NewL( MTsFastSwapPreviewObserver& aObs )
|
|
39 |
{
|
|
40 |
CTsPropertyListener* self = new ( ELeave ) CTsPropertyListener( aObs );
|
|
41 |
CleanupStack::PushL( self );
|
|
42 |
self->ConstructL();
|
|
43 |
CleanupStack::Pop( self );
|
|
44 |
return self;
|
|
45 |
}
|
|
46 |
|
|
47 |
// --------------------------------------------------------------------------
|
|
48 |
// CTsPropertyListener::RunL
|
|
49 |
// --------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
void CTsPropertyListener::RunL()
|
|
52 |
{
|
|
53 |
// Resubscribe before processing new value to prevent missing updates
|
|
54 |
Subscribe();
|
|
55 |
|
|
56 |
// Read all properties to member variables
|
|
57 |
ReadPropertiesL();
|
|
58 |
|
|
59 |
// Do the callback
|
|
60 |
switch( iOperation )
|
|
61 |
{
|
|
62 |
case EOperationUnregister:
|
|
63 |
{
|
|
64 |
iObs.HandleFswPpApplicationUnregistered( iWgId );
|
|
65 |
break;
|
|
66 |
}
|
|
67 |
case EOperationBitmapUpdated:
|
|
68 |
{
|
|
69 |
iObs.HandleFswPpApplicationChange( iWgId, iFbsBitmapId );
|
|
70 |
break;
|
|
71 |
}
|
|
72 |
case EOperationBitmapRotation90:
|
|
73 |
{
|
|
74 |
iObs.HandleFswPpApplicationBitmapRotation( iWgId, ETrue );
|
|
75 |
break;
|
|
76 |
}
|
|
77 |
case EOperationBitmapRotation270:
|
|
78 |
{
|
|
79 |
iObs.HandleFswPpApplicationBitmapRotation( iWgId, EFalse );
|
|
80 |
break;
|
|
81 |
}
|
|
82 |
default:
|
|
83 |
break;
|
|
84 |
}
|
|
85 |
}
|
|
86 |
|
|
87 |
// --------------------------------------------------------------------------
|
|
88 |
// CTsPropertyListener::DoCancel
|
|
89 |
// --------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
void CTsPropertyListener::DoCancel()
|
|
92 |
{
|
|
93 |
iProperty.Cancel();
|
|
94 |
}
|
|
95 |
|
|
96 |
// --------------------------------------------------------------------------
|
|
97 |
// CTsPropertyListener::ReadProperties
|
|
98 |
// --------------------------------------------------------------------------
|
|
99 |
//
|
|
100 |
void CTsPropertyListener::ReadPropertiesL()
|
|
101 |
{
|
|
102 |
// Read all properties
|
|
103 |
User::LeaveIfError( iProperty.Get( KPSUidPreviewProvider, KPSKeyWgId, iWgId ) );
|
|
104 |
User::LeaveIfError( iProperty.Get( KPSUidPreviewProvider, KPSKeyFbsBitmapId, iFbsBitmapId ) );
|
|
105 |
TInt operation( 0 );
|
|
106 |
User::LeaveIfError( iProperty.Get( KPSUidPreviewProvider, KPSKeyOperation, operation ) );
|
|
107 |
iOperation = static_cast<TPreviewOperation>( operation );
|
|
108 |
}
|
|
109 |
|
|
110 |
// --------------------------------------------------------------------------
|
|
111 |
// CTsPropertyListener::DefinePropertyL
|
|
112 |
// --------------------------------------------------------------------------
|
|
113 |
//
|
|
114 |
void CTsPropertyListener::DefinePropertyL( TInt aPSKey )
|
|
115 |
{
|
|
116 |
TInt err = RProperty::Define( KPSUidPreviewProvider, aPSKey, RProperty::EInt );
|
|
117 |
// Don't mind the already exists error
|
|
118 |
if ( err != KErrAlreadyExists && err != KErrPermissionDenied )
|
|
119 |
{
|
|
120 |
User::LeaveIfError( err );
|
|
121 |
}
|
|
122 |
}
|
|
123 |
|
|
124 |
// --------------------------------------------------------------------------
|
|
125 |
// CTsPropertyListener::Subscribe
|
|
126 |
// --------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
void CTsPropertyListener::Subscribe()
|
|
129 |
{
|
|
130 |
iProperty.Subscribe( iStatus );
|
|
131 |
SetActive();
|
|
132 |
}
|
|
133 |
|
|
134 |
// --------------------------------------------------------------------------
|
|
135 |
// CTsPropertyListener::ConstructL
|
|
136 |
// --------------------------------------------------------------------------
|
|
137 |
//
|
|
138 |
void CTsPropertyListener::ConstructL()
|
|
139 |
{
|
|
140 |
TSLOG_CONTEXT( ConstructL, TSLOG_LOCAL );
|
|
141 |
TSLOG_IN();
|
|
142 |
|
|
143 |
DefinePropertyL( KPSKeyWgId );
|
|
144 |
DefinePropertyL( KPSKeyFbsBitmapId );
|
|
145 |
DefinePropertyL( KPSKeyOperation );
|
|
146 |
|
|
147 |
User::LeaveIfError( iProperty.Attach( KPSUidPreviewProvider, KPSKeyWgId ) );
|
|
148 |
CActiveScheduler::Add( this );
|
|
149 |
|
|
150 |
// initial subscription
|
|
151 |
Subscribe();
|
|
152 |
|
|
153 |
TSLOG_OUT();
|
|
154 |
}
|
|
155 |
|
|
156 |
// End of file
|
|
157 |
|