equal
deleted
inserted
replaced
35 |
35 |
36 #include "fmutils.h" |
36 #include "fmutils.h" |
37 #include <QSettings> |
37 #include <QSettings> |
38 #include <XQConversions> |
38 #include <XQConversions> |
39 |
39 |
40 // CONSTANTS |
|
41 const TInt KAppCloseTimeout = 1000000; |
|
42 |
|
43 /*! |
40 /*! |
44 constructor. |
41 constructor. |
45 */ |
42 */ |
46 CFmServiceUtilsHandler::CFmServiceUtilsHandler() : |
43 CFmServiceUtilsHandler::CFmServiceUtilsHandler() : |
47 CActive( CActive::EPriorityStandard ) |
44 CActive( CActive::EPriorityStandard ), iObserver( 0 ) |
48 { |
45 { |
49 } |
46 } |
50 |
47 |
51 /*! |
48 /*! |
52 Two-phased constructor. |
49 Two-phased constructor. |
93 |
90 |
94 /* |
91 /* |
95 \sa CActive |
92 \sa CActive |
96 */ |
93 */ |
97 void CFmServiceUtilsHandler::RunL() |
94 void CFmServiceUtilsHandler::RunL() |
98 { |
95 { |
99 iWait.AsyncStop(); |
|
100 TInt err( iStatus.Int() ); |
96 TInt err( iStatus.Int() ); |
|
97 if( iObserver ) { |
|
98 TRAP_IGNORE( iObserver->handleCloseAppCompleteL( err ) ); |
101 } |
99 } |
|
100 } |
102 |
101 |
103 /* |
102 /* |
104 \sa CActive |
103 \sa CActive |
105 */ |
104 */ |
106 TInt CFmServiceUtilsHandler::RunError( TInt /*aError*/ ) |
105 TInt CFmServiceUtilsHandler::RunError( TInt aError ) |
107 { |
106 { |
108 iWait.AsyncStop(); |
107 if( iObserver ) { |
|
108 TRAP_IGNORE( iObserver->handleCloseAppCompleteL( aError ) ); |
|
109 } |
109 return KErrNone; |
110 return KErrNone; |
110 } |
111 } |
111 |
112 |
112 /* |
113 /*! |
113 Call CBaBackupSessionWrapper to close apps |
114 Call CBaBackupSessionWrapper to close apps |
114 this is synchronous which will take a while, please call this function in thread |
115 this is synchronous which will take a while, please call this function in thread |
115 */ |
116 */ |
116 void CFmServiceUtilsHandler::CloseAppsL() |
117 void CFmServiceUtilsHandler::CloseAppsL() |
117 { |
118 { |
126 MBackupObserver::EReleaseLockNoAccess, |
127 MBackupObserver::EReleaseLockNoAccess, |
127 MBackupOperationObserver::EStart ); |
128 MBackupOperationObserver::EStart ); |
128 iBSWrapper->NotifyBackupOperationL( atts ); |
129 iBSWrapper->NotifyBackupOperationL( atts ); |
129 iBSWrapper->CloseAll( MBackupObserver::EReleaseLockNoAccess, iStatus ); |
130 iBSWrapper->CloseAll( MBackupObserver::EReleaseLockNoAccess, iStatus ); |
130 SetActive(); |
131 SetActive(); |
131 |
|
132 // Memory card formatting cannot be executed if there are open files on it. |
|
133 // It has been detected, that in some cases memory card using applications |
|
134 // have no time to close file handles before formatting is tried to be executed. |
|
135 // To address this issue, we need to add a delay here after client-notification |
|
136 // about pending format and real formatting procedure. |
|
137 User::After( KAppCloseTimeout ); |
|
138 StartWait(); |
|
139 } |
132 } |
140 |
133 |
141 /* |
134 /*! |
142 Call CBaBackupSessionWrapper to restart closed apps |
135 Call CBaBackupSessionWrapper to restart closed apps |
143 this is synchronous which will return quickly. |
136 this is synchronous which will return quickly. |
144 */ |
137 */ |
145 void CFmServiceUtilsHandler::RestartAppsL() |
138 void CFmServiceUtilsHandler::RestartAppsL() |
146 { |
139 { |
157 // Get rid of the wrapper instance |
150 // Get rid of the wrapper instance |
158 delete iBSWrapper; |
151 delete iBSWrapper; |
159 iBSWrapper = 0; |
152 iBSWrapper = 0; |
160 } |
153 } |
161 |
154 |
162 /* |
155 /*! |
163 wait till request returned in RunL |
156 set observer so that observer can be notified when operation is finished |
164 */ |
157 */ |
165 void CFmServiceUtilsHandler::StartWait() |
158 void CFmServiceUtilsHandler::setObserver( MServiceUtilsObserver *observer ) |
166 { |
159 { |
167 if ( iWait.IsStarted() != (TInt)ETrue ) |
160 iObserver = observer; |
168 { |
|
169 iWait.Start(); |
|
170 } |
|
171 } |
161 } |
172 |
162 |
173 // End of File |
163 // End of File |