|
1 /* |
|
2 * Copyright (c) 2003 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: Implementation of the parent storage for Decision Making Machine |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "drmactivedeletion.h" |
|
21 #include "drmrightsdb.h" |
|
22 #include "drmrightscleaner.h" |
|
23 #include "drmdbsession.h" |
|
24 |
|
25 // EXTERNAL DATA STRUCTURES |
|
26 |
|
27 // EXTERNAL FUNCTION PROTOTYPES |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // LOCAL CONSTANTS AND MACROS |
|
34 |
|
35 // MODULE DATA STRUCTURES |
|
36 |
|
37 // LOCAL FUNCTION PROTOTYPES |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 |
|
41 |
|
42 // ============================= LOCAL FUNCTIONS =============================== |
|
43 |
|
44 |
|
45 // ============================ MEMBER FUNCTIONS =============================== |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CDRMActiveDeletion::NewLC |
|
49 // |
|
50 // Two-phase constructor. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 CDRMActiveDeletion* CDRMActiveDeletion::NewLC( const RMessagePtr2& aMessage, |
|
54 CDRMDbSession& aSession ) |
|
55 { |
|
56 CDRMActiveDeletion* self = new( ELeave ) CDRMActiveDeletion( aMessage, |
|
57 aSession ); |
|
58 CleanupStack::PushL( self ); |
|
59 |
|
60 return self; |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CDRMActiveDeletion::~CDRMActiveDeletion |
|
65 // |
|
66 // Destructor. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CDRMActiveDeletion::~CDRMActiveDeletion() |
|
70 { |
|
71 if ( iActiveOperation ) |
|
72 { |
|
73 // Construction was successful, but |
|
74 // something has went wrong. |
|
75 |
|
76 iActiveOperation->Cancel(); |
|
77 iMessage.Complete( KErrCancel ); |
|
78 } |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CDRMActiveDeletion::ActivateL |
|
83 // |
|
84 // Activate the thing by issuing a request to the DB and executing it also. |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 void CDRMActiveDeletion::ActivateL( const TTime& aTime, |
|
88 CDRMRightsDB& aDb ) |
|
89 { |
|
90 CActiveScheduler::Add( this ); |
|
91 |
|
92 CDRMRightsCleaner* cleaner = |
|
93 aDb.DeleteExpiredPermissionsL( aTime, iStatus ); |
|
94 CleanupStack::PushL( cleaner ); |
|
95 cleaner->ExecuteCleanupLD(); |
|
96 CleanupStack::Pop(); |
|
97 |
|
98 SetActive(); |
|
99 iActiveOperation = cleaner; |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CDRMActiveDeletion::RunL |
|
104 // |
|
105 // Handles the completition of the request. |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 void CDRMActiveDeletion::RunL() |
|
109 { |
|
110 // All done. |
|
111 iMessage.Complete( iStatus.Int() ); |
|
112 |
|
113 // iActiveOperation deletes itself. |
|
114 iActiveOperation = NULL; |
|
115 |
|
116 Deque(); |
|
117 |
|
118 iSession.AsyncOperationDone(); |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CDRMActiveDeletion::DoCancel |
|
123 // |
|
124 // Cancels the operation. |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void CDRMActiveDeletion::DoCancel() |
|
128 { |
|
129 iActiveOperation->Cancel(); |
|
130 iActiveOperation = NULL; |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CDRMActiveDeletion::CDRMActiveDeletion |
|
135 // |
|
136 // Constructor. |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 CDRMActiveDeletion::CDRMActiveDeletion( const RMessagePtr2& aMessage, |
|
140 CDRMDbSession& aSession ): |
|
141 CActive( EPriorityLow ), |
|
142 iMessage( aMessage ), |
|
143 iSession( aSession ) |
|
144 { |
|
145 // Nothing |
|
146 } |
|
147 |
|
148 // End of file |