159 |
157 |
160 // --------------------------------------------------------------------------- |
158 // --------------------------------------------------------------------------- |
161 // ProcessCommandParametersL |
159 // ProcessCommandParametersL |
162 // --------------------------------------------------------------------------- |
160 // --------------------------------------------------------------------------- |
163 // |
161 // |
164 TBool CGlxIVwrAppUi::ProcessCommandParametersL(TApaCommand aCommand, |
162 TBool CGlxIVwrAppUi::ProcessCommandParametersL(TApaCommand /*aCommand*/, |
165 TFileName& aDocumentName, const TDesC8& aTail) |
163 TFileName& /*aDocumentName*/, const TDesC8& /*aTail*/) |
166 { |
164 { |
167 TRACER("TBool CGlxIVwrAppUi::ProcessCommandParametersL(TApaCommand /*aCommand*/,TFileName& /*aDocumentName*/, const TDesC8& aTail)"); |
165 TRACER("TBool CGlxIVwrAppUi::ProcessCommandParametersL(TApaCommand /*aCommand*/,TFileName& /*aDocumentName*/, const TDesC8& aTail)"); |
168 |
166 |
169 TRAPD(err, HandleActivationMessageL(aCommand, aDocumentName, aTail)); |
167 // Bring the application to foreground, if not already |
170 if ( KErrNone != err ) |
168 if (0 != iEikonEnv->RootWin().OrdinalPosition()) |
171 { |
169 { |
172 // Open collection for main view |
170 iEikonEnv->RootWin().SetOrdinalPosition(0); |
173 iStartupViewUid = TUid::Null(); |
171 } |
174 // Open navigational state at root level |
172 |
175 CMPXCollectionPath* newState = CMPXCollectionPath::NewL(); |
173 //To call OpenFileL in document class it must retun ETrue |
176 CleanupStack::PushL( newState ); |
174 return ETrue; |
177 iNavigationalState->NavigateToL( *newState ); |
|
178 CleanupStack::PopAndDestroy( newState ); |
|
179 } |
|
180 if(0 == aTail.CompareC(KNullDesC8)) |
|
181 { |
|
182 return ETrue; |
|
183 } |
|
184 else |
|
185 { |
|
186 return EFalse; |
|
187 } |
|
188 |
|
189 } |
175 } |
190 |
176 |
191 // --------------------------------------------------------------------------- |
177 // --------------------------------------------------------------------------- |
192 // Handle navigational state change |
178 // Handle navigational state change |
193 // --------------------------------------------------------------------------- |
179 // --------------------------------------------------------------------------- |
216 } |
202 } |
217 } |
203 } |
218 |
204 |
219 CleanupStack::PopAndDestroy( naviState ); |
205 CleanupStack::PopAndDestroy( naviState ); |
220 |
206 |
221 HBufC* activationParam = iActivationParam; |
|
222 iActivationParam = NULL; // release ownership |
|
223 CleanupStack::PushL( activationParam ); |
|
224 |
|
225 if ( TUid::Null() != iStartupViewUid ) |
207 if ( TUid::Null() != iStartupViewUid ) |
226 { |
208 { |
227 GLX_LOG_INFO("CGlxAppUi::HandleNavigationalStateChanged: Activating startup view"); |
209 GLX_LOG_INFO("CGlxAppUi::HandleNavigationalStateChanged: Activating startup view"); |
228 // Activate startup view |
210 // Activate startup view |
229 iViewUtility->ActivateViewL( iStartupViewUid, activationParam ); |
211 iViewUtility->ActivateViewL( iStartupViewUid, NULL ); |
230 iStartupViewUid = TUid::Null(); |
212 iStartupViewUid = TUid::Null(); |
231 } |
213 } |
232 else |
214 else |
233 { |
215 { |
234 GLX_LOG_INFO("CGlxAppUi::HandleNavigationalStateChanged: Activating view"); |
216 GLX_LOG_INFO("CGlxAppUi::HandleNavigationalStateChanged: Activating view"); |
238 CleanupClosePushL( scoringIds ); |
220 CleanupClosePushL( scoringIds ); |
239 GetViewScoringIdsL( scoringIds ); |
221 GetViewScoringIdsL( scoringIds ); |
240 |
222 |
241 GLX_LOG_INFO1( "CGlxIVwrAppUi::HandleNavigationalStateChanged: Uid count %d", scoringIds.Count()); |
223 GLX_LOG_INFO1( "CGlxIVwrAppUi::HandleNavigationalStateChanged: Uid count %d", scoringIds.Count()); |
242 // let view utility to select the best view based on scoring ids |
224 // let view utility to select the best view based on scoring ids |
243 iViewUtility->ActivateViewL( scoringIds, activationParam ); |
225 iViewUtility->ActivateViewL( scoringIds, NULL ); |
244 |
226 |
245 CleanupStack::PopAndDestroy( &scoringIds ); |
227 CleanupStack::PopAndDestroy( &scoringIds ); |
246 } |
228 } |
247 |
|
248 CleanupStack::PopAndDestroy( activationParam ); |
|
249 } |
229 } |
250 |
230 |
251 // --------------------------------------------------------------------------- |
231 // --------------------------------------------------------------------------- |
252 // Populate array with view scoring ids |
232 // Populate array with view scoring ids |
253 // --------------------------------------------------------------------------- |
233 // --------------------------------------------------------------------------- |
363 return TUid::Null(); |
343 return TUid::Null(); |
364 } |
344 } |
365 } |
345 } |
366 |
346 |
367 // --------------------------------------------------------------------------- |
347 // --------------------------------------------------------------------------- |
368 // HandleActivationMessageL |
348 // HandleOpenFileL |
369 // --------------------------------------------------------------------------- |
349 // --------------------------------------------------------------------------- |
370 // |
350 // |
371 void CGlxIVwrAppUi::HandleActivationMessageL(const TApaCommand& aCommand, |
351 void CGlxIVwrAppUi::HandleOpenFileL() |
372 const TFileName& aDocumentName, const TDesC8& aData) |
352 { |
373 { |
353 TRACER("void CGlxIVwrAppUi::HandleOpenFileL()"); |
374 TRACER("void CGlxIVwrAppUi::HandleActivationMessageL(const TApaCommand& aCommand, const TFileName& aDocumentName, const TDesC8& aData)"); |
354 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
375 |
355 CleanupStack::PushL(path); |
376 delete iActivationParam; |
356 path->AppendL( KGlxCollectionPluginImageViewerImplementationUid ); |
377 iActivationParam = NULL; |
357 iNavigationalState->NavigateToL( *path ); |
378 |
358 CleanupStack::PopAndDestroy( path ); |
379 if ( 0 == aData.CompareC(KNullDesC8) ) |
|
380 { |
|
381 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
382 CleanupStack::PushL(path); |
|
383 path->AppendL( KGlxCollectionPluginImageViewerImplementationUid ); |
|
384 iNavigationalState->NavigateToL( *path ); |
|
385 CleanupStack::PopAndDestroy( path ); |
|
386 } |
|
387 |
|
388 // Introduced to fix bug EMJN-78GH6N. Rowland Cook 10/12/2007 |
|
389 if (0 != iEikonEnv->RootWin().OrdinalPosition()) |
|
390 { |
|
391 iEikonEnv->RootWin().SetOrdinalPosition(0); |
|
392 } |
|
393 } |
|
394 |
|
395 // --------------------------------------------------------------------------- |
|
396 // SetActivationParamL |
|
397 // --------------------------------------------------------------------------- |
|
398 // |
|
399 void CGlxIVwrAppUi::SetActivationParamL(const TDesC8& aParam) |
|
400 { |
|
401 TRACER("void CGlxIVwrAppUi::SetActivationParamL(const TDesC8& aParam)"); |
|
402 iActivationParam = HBufC::NewL(aParam.Length()); |
|
403 iActivationParam->Des().Copy(aParam); |
|
404 } |
359 } |
405 |
360 |
406 // --------------------------------------------------------------------------- |
361 // --------------------------------------------------------------------------- |
407 // HandleApplicationSpecificEventL |
362 // HandleApplicationSpecificEventL |
408 // |
363 // |