|
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 "themerepositorylistener.h" |
|
18 |
|
19 #include <platform/mw/pslninternalcrkeys.h> |
|
20 |
|
21 |
|
22 CThemeRepositoryListener::CThemeRepositoryListener(TBool* aValueToChange) : CActive(EPriorityStandard), |
|
23 iValueToChange(aValueToChange) |
|
24 { |
|
25 CActiveScheduler::Add(this); |
|
26 } |
|
27 |
|
28 CThemeRepositoryListener::~CThemeRepositoryListener() |
|
29 { |
|
30 Cancel(); |
|
31 delete iThemesRepository; |
|
32 } |
|
33 |
|
34 CThemeRepositoryListener* CThemeRepositoryListener::NewL(TBool* aValueToChange) |
|
35 { |
|
36 CThemeRepositoryListener* me = new (ELeave)CThemeRepositoryListener(aValueToChange); |
|
37 CleanupStack::PushL(me); |
|
38 me->ConstructL(); |
|
39 CleanupStack::Pop(); |
|
40 return me; |
|
41 } |
|
42 |
|
43 void CThemeRepositoryListener::ConstructL() |
|
44 { |
|
45 iThemesRepository = CRepository::NewL(KCRUidThemes); |
|
46 iThemesRepository->Get(KThemesAnimBackgroundSupport, iPreviousValue); |
|
47 } |
|
48 |
|
49 void CThemeRepositoryListener::RunL() |
|
50 { |
|
51 TInt value = 0; |
|
52 iThemesRepository->Get(KThemesAnimBackgroundSupport, value); |
|
53 // we are only interested in the value if it |
|
54 // is something else than 0 |
|
55 // as it means that we should stop... |
|
56 if (value && value != iPreviousValue) |
|
57 { |
|
58 *iValueToChange = EFalse; |
|
59 } |
|
60 |
|
61 iPreviousValue = value; |
|
62 |
|
63 if (iStatus.Int() != KErrCancel) |
|
64 { |
|
65 IssueRequest(); |
|
66 } |
|
67 } |
|
68 |
|
69 void CThemeRepositoryListener::DoCancel() |
|
70 { |
|
71 iThemesRepository->NotifyCancelAll(); |
|
72 } |
|
73 |
|
74 void CThemeRepositoryListener::IssueRequest() |
|
75 { |
|
76 TInt err = iThemesRepository->NotifyRequest(KThemesAnimBackgroundSupport,iStatus); |
|
77 if (!err) |
|
78 { |
|
79 SetActive(); |
|
80 } |
|
81 } |
|
82 |
|
83 void CThemeRepositoryListener::GPuMemLow(TBool aLow) |
|
84 { |
|
85 iPreviousValue = aLow ? KMaxTInt : 0; |
|
86 iThemesRepository->Set(KThemesAnimBackgroundSupport, iPreviousValue ); |
|
87 } |
|
88 |
|
89 |
|
90 |