|
1 /* |
|
2 * Copyright (c) 2007 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: New memory selection setting item to support multiple drives. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32std.h> |
|
21 #include "CAknCFDFileSystemEvent.h" |
|
22 #include "MAknCFDFileSystemObserver.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CAknCFDFileSystemEvent::CAknCFDFileSystemEvent |
|
28 // C++ default constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CAknCFDFileSystemEvent::CAknCFDFileSystemEvent( |
|
33 RFs& aFs, |
|
34 MAknCFDFileSystemObserver& aObserver, |
|
35 TNotifyType aNotifyType ) : |
|
36 CActive( CActive::EPriorityLow ), |
|
37 iFs( aFs ), |
|
38 iObserver( aObserver), |
|
39 iNotifyType( aNotifyType ) |
|
40 { |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CAknCFDFileSystemEvent::ConstructL |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CAknCFDFileSystemEvent::ConstructL( const TDesC& aFullPath ) |
|
49 { |
|
50 CActiveScheduler::Add( this ); |
|
51 |
|
52 if ( aFullPath.Length() ) |
|
53 { |
|
54 iFullPath = aFullPath.AllocL(); |
|
55 } |
|
56 |
|
57 Setup(); |
|
58 } |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CAknCFDFileSystemEvent::NewL |
|
61 // Two-phased constructor. |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 CAknCFDFileSystemEvent* CAknCFDFileSystemEvent::NewL( |
|
65 RFs& aFs, |
|
66 MAknCFDFileSystemObserver& aObserver, |
|
67 TNotifyType aNotifyType, |
|
68 const TDesC& aFullPath ) |
|
69 { |
|
70 CAknCFDFileSystemEvent* self = |
|
71 new( ELeave ) CAknCFDFileSystemEvent( |
|
72 aFs, |
|
73 aObserver, |
|
74 aNotifyType ); |
|
75 |
|
76 CleanupStack::PushL( self ); |
|
77 self->ConstructL( aFullPath ); |
|
78 CleanupStack::Pop( self ); |
|
79 |
|
80 return self; |
|
81 } |
|
82 |
|
83 // ------------------------------------------------------------------------------ |
|
84 // CAknCFDFileSystemEvent::~CAknCFDFileSystemEvent |
|
85 // |
|
86 // ------------------------------------------------------------------------------ |
|
87 CAknCFDFileSystemEvent::~CAknCFDFileSystemEvent() |
|
88 { |
|
89 Cancel(); |
|
90 delete iFullPath; |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CAknCFDFileSystemEvent::RunL |
|
95 // From CActive. Called when asynchronous request is completed. |
|
96 // Notifies the observer |
|
97 // (other items were commented in a header). |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void CAknCFDFileSystemEvent::RunL() |
|
101 { |
|
102 TInt err( iStatus.Int() ); |
|
103 |
|
104 // Mark as received if there is no error |
|
105 if ( err == KErrNone ) |
|
106 { |
|
107 iIsReceived = ETrue; |
|
108 } |
|
109 |
|
110 // If not ENotifyDisk, do refresh when event is checked |
|
111 // using CheckFileSystemEvent |
|
112 if ( iNotifyType == ENotifyDisk ) |
|
113 { |
|
114 iObserver.NotifyFileSystemChangedL(); |
|
115 } |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CAknCFDFileSystemEvent::RunError |
|
120 // From CActive. Called when error occurred in asynchronous request |
|
121 // Notifies the observer |
|
122 // (other items were commented in a header). |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 TInt CAknCFDFileSystemEvent::RunError( TInt /*aError*/ ) |
|
126 { |
|
127 return KErrNone; |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CAknCFDFileSystemEvent::DoCancel |
|
132 // From CActive. Called when asynchronous request is canceled |
|
133 // (other items were commented in a header). |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 void CAknCFDFileSystemEvent::DoCancel() |
|
137 { |
|
138 iFs.NotifyChangeCancel( iStatus ); |
|
139 } |
|
140 |
|
141 // ------------------------------------------------------------------------------ |
|
142 // CAknCFDFileSystemEvent::Setup |
|
143 // |
|
144 // ------------------------------------------------------------------------------ |
|
145 // |
|
146 void CAknCFDFileSystemEvent::Setup() |
|
147 { |
|
148 if( IsActive() ) |
|
149 { |
|
150 return; |
|
151 } |
|
152 |
|
153 iIsReceived = EFalse; |
|
154 |
|
155 if( iFullPath ) |
|
156 { |
|
157 iFs.NotifyChange( iNotifyType, iStatus, *iFullPath ); |
|
158 } |
|
159 else |
|
160 { |
|
161 iFs.NotifyChange( iNotifyType, iStatus ); |
|
162 } |
|
163 |
|
164 SetActive(); |
|
165 } |
|
166 |
|
167 // ------------------------------------------------------------------------------ |
|
168 // CAknCFDFileSystemEvent::CheckFileSystemEvent |
|
169 // |
|
170 // ------------------------------------------------------------------------------ |
|
171 // |
|
172 void CAknCFDFileSystemEvent::CheckFileSystemEvent() |
|
173 {} |
|
174 |
|
175 // End of File |