Update contrib.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "rsdisplaychangeao.h"
17 #include "displaypolicy.h"
19 CRsDisplayChangeNotifier::CRsDisplayChangeNotifier(MWsDisplayControl* aNextLevelInterface, CDisplayPolicy* aDisplayPolicy)
20 :CActive(EPriorityHigh),iWsStatus(NULL)
22 CActiveScheduler::Add(this);
23 iNextLevelInterface = aNextLevelInterface;
24 iDisplayPolicy = aDisplayPolicy;
27 CRsDisplayChangeNotifier* CRsDisplayChangeNotifier::NewL(MWsDisplayControl* aNextLevelInterface, CDisplayPolicy* aDisplayPolicy)
29 CRsDisplayChangeNotifier* self = new(ELeave) CRsDisplayChangeNotifier(aNextLevelInterface, aDisplayPolicy);
33 void CRsDisplayChangeNotifier::IssueNotificationRequest()
35 iNextLevelInterface->NotifyOnDisplayChange(iStatus);
38 void CRsDisplayChangeNotifier::RegisterActiveStatus(TRequestStatus &aStatus)
43 void CRsDisplayChangeNotifier::CancelNotificationRequest()
48 void CRsDisplayChangeNotifier::RunL()
50 //IssueNotificationRequest will overwrite iStatus, save a copy first;
51 TInt result = iStatus.Int();
52 IssueNotificationRequest();
54 //calculate min UI buffer size depending on physical resolutions
55 TInt ret = iNextLevelInterface->NumberOfResolutions();
56 RArray<MDisplayControlBase::TResolution> resolutions;
57 CleanupClosePushL(resolutions);
60 //just ignore the error. if there's an error, an empty resolution list is passed in, and uibuffer
61 //will remain the previous size
62 iNextLevelInterface->GetResolutions(resolutions);
64 iDisplayPolicy->CalculateMinBufferSize(resolutions, ret);
65 CleanupStack::PopAndDestroy(&resolutions);
67 if(iWsStatus && *iWsStatus == KRequestPending)
69 User::RequestComplete(iWsStatus, result);
73 void CRsDisplayChangeNotifier::DoCancel()
75 iNextLevelInterface->NotifyOnDisplayChangeCancel();
76 if(iWsStatus && *iWsStatus == KRequestPending)
77 User::RequestComplete(iWsStatus, KErrCancel);
80 CRsDisplayChangeNotifier::~CRsDisplayChangeNotifier()
85 CRsConfigChangeNotifier::CRsConfigChangeNotifier(MWsDisplayControl* aNextLevelInterface)
86 :CActive(EPriorityHigh), iWsStatus(NULL)
88 CActiveScheduler::Add(this);
89 iNextLevelInterface = aNextLevelInterface;
92 CRsConfigChangeNotifier* CRsConfigChangeNotifier::NewL(MWsDisplayControl* aNextLevelInterface)
94 CRsConfigChangeNotifier* self = new(ELeave) CRsConfigChangeNotifier(aNextLevelInterface);
98 void CRsConfigChangeNotifier::IssueNotificationRequest()
100 iNextLevelInterface->NotifyOnConfigChange(iStatus);
104 void CRsConfigChangeNotifier::RegisterActiveStatus(TRequestStatus &aStatus)
106 iWsStatus = &aStatus;
109 void CRsConfigChangeNotifier::CancelNotificationRequest()
114 void CRsConfigChangeNotifier::RunL()
116 //IssueNotificationRequest will overwrite iStatus, save a copy first;
117 TInt result = iStatus.Int();
118 IssueNotificationRequest();
119 if(iWsStatus && *iWsStatus == KRequestPending)
121 User::RequestComplete(iWsStatus, result);
125 void CRsConfigChangeNotifier::DoCancel()
127 iNextLevelInterface->NotifyOnConfigChangeCancel();
128 if(iWsStatus && *iWsStatus == KRequestPending)
129 User::RequestComplete(iWsStatus, KErrCancel);
132 CRsConfigChangeNotifier::~CRsConfigChangeNotifier()