1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
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: Sis package installation event listener |
|
15 * |
8 * |
16 */ |
9 * Initial Contributors: |
17 |
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Sis package installation event listener |
|
15 * |
|
16 */ |
18 |
17 |
19 #include <sacls.h> |
18 #include <sacls.h> |
20 #include "cawidgetscannerinstallnotifier.h" |
19 #include "cawidgetscannerinstallnotifier.h" |
21 #include "cawidgetscannerplugin.h" |
20 #include "cawidgetscannerplugin.h" |
22 |
21 |
23 // ============================ MEMBER FUNCTIONS ============================= |
22 // ============================ MEMBER FUNCTIONS ============================= |
24 |
23 |
25 // ----------------------------------------------------------------------------- |
24 // ----------------------------------------------------------------------------- |
26 // CCaWidgetScannerInstallNotifier::CCaWidgetScannerInstallNotifier |
25 // |
27 // C++ default constructor |
|
28 // ----------------------------------------------------------------------------- |
26 // ----------------------------------------------------------------------------- |
29 // |
27 // |
30 CCaWidgetScannerInstallNotifier::CCaWidgetScannerInstallNotifier( |
28 CCaWidgetScannerInstallNotifier::CCaWidgetScannerInstallNotifier( |
31 CCaWidgetScannerPlugin* aCallback, TUid aCategory, TUint aKey ) : |
29 CCaWidgetScannerPlugin* aCallback, TUid aCategory, TUint aKey ) : |
32 CActive(EPriorityNormal) |
30 CActive( EPriorityNormal ) |
33 { |
31 { |
34 CActiveScheduler::Add( this ); |
32 CActiveScheduler::Add( this ); |
35 |
33 |
36 iCallback = aCallback; |
34 iCallback = aCallback; |
37 iCategory = aCategory; |
35 iCategory = aCategory; |
38 iKey = aKey; |
36 iKey = aKey; |
39 // Prepare automatically |
|
40 iProperty.Attach( iCategory, iKey ); |
37 iProperty.Attach( iCategory, iKey ); |
41 SetActive( ); |
38 SetActive(); |
42 iProperty.Subscribe( iStatus ); |
39 iProperty.Subscribe( iStatus ); |
|
40 iHackFlag = EFalse; |
43 } |
41 } |
44 |
42 |
45 // ----------------------------------------------------------------------------- |
43 // ----------------------------------------------------------------------------- |
46 // CCaWidgetScannerInstallNotifier::ConstructL |
44 // |
47 // S2nd phase constructor. |
|
48 // ----------------------------------------------------------------------------- |
45 // ----------------------------------------------------------------------------- |
49 // |
46 // |
50 void CCaWidgetScannerInstallNotifier::ConstructL() |
47 void CCaWidgetScannerInstallNotifier::ConstructL() |
51 { |
48 { |
52 iHackFlag = EFalse; |
|
53 } |
49 } |
54 |
50 |
55 // --------------------------------------------------------------------------- |
51 // --------------------------------------------------------------------------- |
56 // CCaWidgetScannerInstallNotifier::NewL |
52 // |
57 // --------------------------------------------------------------------------- |
53 // --------------------------------------------------------------------------- |
58 // |
54 // |
59 CCaWidgetScannerInstallNotifier* CCaWidgetScannerInstallNotifier::NewL( |
55 CCaWidgetScannerInstallNotifier* CCaWidgetScannerInstallNotifier::NewL( |
60 CCaWidgetScannerPlugin* aCallback, TUid aCategory, TUint aKey ) |
56 CCaWidgetScannerPlugin* aCallback, TUid aCategory, TUint aKey ) |
61 { |
57 { |
62 CCaWidgetScannerInstallNotifier* self = |
58 CCaWidgetScannerInstallNotifier* self = |
63 new (ELeave) CCaWidgetScannerInstallNotifier( aCallback, |
59 new ( ELeave ) CCaWidgetScannerInstallNotifier( aCallback, |
64 aCategory, aKey ); |
60 aCategory, aKey ); |
65 CleanupStack::PushL( self ); |
61 CleanupStack::PushL( self ); |
66 self->ConstructL( ); |
62 self->ConstructL(); |
67 CleanupStack::Pop( self ); |
63 CleanupStack::Pop( self ); |
68 |
64 |
69 return self; |
65 return self; |
70 } |
66 } |
71 |
67 |
72 // --------------------------------------------------------------------------- |
68 // --------------------------------------------------------------------------- |
73 // CCaWidgetScannerInstallNotifier::~CCaWidgetScannerInstallNotifier |
69 // |
74 // --------------------------------------------------------------------------- |
70 // --------------------------------------------------------------------------- |
75 // |
71 // |
76 CCaWidgetScannerInstallNotifier::~CCaWidgetScannerInstallNotifier() |
72 CCaWidgetScannerInstallNotifier::~CCaWidgetScannerInstallNotifier() |
77 { |
73 { |
78 Cancel( ); |
74 Cancel(); |
79 iProperty.Close( ); |
75 iProperty.Close(); |
80 } |
76 } |
81 |
77 |
82 // --------------------------------------------------------------------------- |
78 // --------------------------------------------------------------------------- |
83 // CCaWidgetScannerInstallNotifier::DoCancel |
79 // |
84 // --------------------------------------------------------------------------- |
80 // --------------------------------------------------------------------------- |
85 // |
81 // |
86 void CCaWidgetScannerInstallNotifier::DoCancel() |
82 void CCaWidgetScannerInstallNotifier::DoCancel() |
87 { |
83 { |
88 iProperty.Cancel( ); |
84 iProperty.Cancel(); |
89 } |
85 } |
90 |
86 |
|
87 #ifdef COVERAGE_MEASUREMENT |
|
88 #pragma CTC SKIP |
|
89 #endif //COVERAGE_MEASUREMENT (error is ignored) |
91 // --------------------------------------------------------------------------- |
90 // --------------------------------------------------------------------------- |
92 // CCaWidgetScannerInstallNotifier::RunError |
91 // |
93 // --------------------------------------------------------------------------- |
92 // --------------------------------------------------------------------------- |
94 // |
93 // |
95 TInt CCaWidgetScannerInstallNotifier::RunError( TInt /*aError*/) |
94 TInt CCaWidgetScannerInstallNotifier::RunError( TInt /*aError*/) |
96 { |
95 { |
97 // No need to do anything |
96 // No need to do anything |
98 return KErrNone; |
97 return KErrNone; |
99 } |
98 } |
|
99 #ifdef COVERAGE_MEASUREMENT |
|
100 #pragma CTC ENDSKIP |
|
101 #endif //COVERAGE_MEASUREMENT |
100 |
102 |
101 // --------------------------------------------------------------------------- |
103 // --------------------------------------------------------------------------- |
102 // CCaWidgetScannerInstallNotifier::RunL |
104 // |
103 // --------------------------------------------------------------------------- |
105 // --------------------------------------------------------------------------- |
104 // |
106 // |
105 void CCaWidgetScannerInstallNotifier::RunL() |
107 void CCaWidgetScannerInstallNotifier::RunL() |
106 { |
108 { |
107 // Re-issue request before notifying |
109 // Re-issue request before notifying |
108 SetActive( ); |
110 SetActive(); |
109 iProperty.Subscribe( iStatus ); |
111 iProperty.Subscribe( iStatus ); |
110 |
112 |
111 TInt status; |
113 TInt status; |
112 User::LeaveIfError( iProperty.Get( KUidSystemCategory, |
114 User::LeaveIfError( iProperty.Get( KUidSystemCategory, |
113 KSAUidSoftwareInstallKeyValue, status ) ); |
115 KSAUidSoftwareInstallKeyValue, status ) ); |
114 |
116 |
115 if( iHackFlag ) |
117 if ( iHackFlag ) |
116 { |
118 { |
117 iHackFlag = EFalse; |
119 iHackFlag = EFalse; |
118 iCallback->SynchronizeL(); |
120 iCallback->SynchronizeL(); |
119 } |
121 } |
120 else if ( (status & EInstOpInstall )||(status & EInstOpUninstall ) ) |
122 else if ( ( status & EInstOpInstall ) || ( status & EInstOpUninstall ) ) |
121 { |
123 { |
122 iHackFlag = ETrue; |
124 iHackFlag = ETrue; |
123 } |
125 } |
124 } |
126 } |
125 // End of File |
127 // End of File |