1 /* |
|
2 * Copyright (c) 2005 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: RsfwPlugin Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Includes |
|
20 #include <StringLoader.h> |
|
21 #include <rsfwgspluginrsc.rsg> |
|
22 #include <gsfwviewuids.h> // for KUidGS |
|
23 #include <aknnotewrappers.h> |
|
24 #include <hlplch.h> |
|
25 #include <utf.h> |
|
26 #include <rsfwgsplugin.mbg> |
|
27 #include <featmgr.h> |
|
28 #include <csxhelp/cp.hlp.hrh> |
|
29 #include <rsfwmountman.h> |
|
30 #include <rsfwmountentry.h> |
|
31 |
|
32 #include "rsfwgsplugin.h" |
|
33 #include "rsfwinterface.h" |
|
34 #include "rsfwgsplugindrivelistcontainer.h" |
|
35 #include "rsfwgsremotedrivesettingscontainer.h" |
|
36 #include "rsfwgslocalviewids.h" |
|
37 |
|
38 |
|
39 #define KUidGeneralSettings 0x100058EC |
|
40 |
|
41 // ========================= MEMBER FUNCTIONS ================================ |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // CRsfwGsPlugin::CRsfwGsPlugin() |
|
45 // Constructor |
|
46 // |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CRsfwGsPlugin::CRsfwGsPlugin( ) |
|
50 : iAppUi( CAknView::AppUi() ), iResources( *CCoeEnv::Static() ) |
|
51 { |
|
52 |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CRsfwGsPlugin::~CRsfwGsPlugin() |
|
57 // Destructor |
|
58 // |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CRsfwGsPlugin::~CRsfwGsPlugin() |
|
62 { |
|
63 FeatureManager::UnInitializeLib(); |
|
64 |
|
65 if (iCurrentContainer && iAppUi) |
|
66 { |
|
67 iAppUi->RemoveFromViewStack( *this, iCurrentContainer ); |
|
68 } |
|
69 delete iMainListContainer; |
|
70 delete iSettingListContainer; |
|
71 delete iMountMan; |
|
72 delete iSender; |
|
73 iResources.Close(); |
|
74 /** Nice to know when the plugin is cleaned up */ |
|
75 #ifdef _DEBUG |
|
76 RDebug::Print( _L( "[CRsfwGsPlugin] ~CRsfwGsPlugin()" ) ); |
|
77 #endif |
|
78 |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // CRsfwGsPlugin::ConstructL() |
|
83 // Symbian OS two-phased constructor |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void CRsfwGsPlugin::ConstructL() |
|
87 { |
|
88 // To know if the plugin is loaded (for debugging) |
|
89 #ifdef _DEBUG |
|
90 RDebug::Print(_L("[CRsfwGsPlugin] ConstructL()" )); |
|
91 RDebug::Print( _L( "[CRsfwGsPlugin] Loading resource from :" ) ); |
|
92 RDebug::Print( KRsfwGsPluginResourceFileName ); |
|
93 #endif |
|
94 |
|
95 iMountMan = CRsfwMountMan::NewL(0, NULL); |
|
96 |
|
97 iSender = CRsfwGsRemoteDriveSend::NewL(EGSCmdAppSendLink); |
|
98 |
|
99 TFileName fileName( KRsfwGsPluginResourceFileName ); |
|
100 iResources.OpenL( fileName ); |
|
101 BaseConstructL( R_GS_RSFW_MAIN_VIEW ); |
|
102 |
|
103 FeatureManager::InitializeLibL(); |
|
104 |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CRsfwGsPlugin::NewL() |
|
109 // Static constructor |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 CRsfwGsPlugin* CRsfwGsPlugin::NewL( TAny* /*aInitParams*/ ) |
|
113 { |
|
114 CRsfwGsPlugin* self = new(ELeave) CRsfwGsPlugin( ); |
|
115 CleanupStack::PushL(self); |
|
116 self->ConstructL(); |
|
117 CleanupStack::Pop(self); |
|
118 return self; |
|
119 } |
|
120 |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // CRsfwGsPlugin::Id() const |
|
124 // --------------------------------------------------------------------------- |
|
125 // |
|
126 TUid CRsfwGsPlugin::Id() const |
|
127 { |
|
128 return KGSRsfwPluginUID; |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // CRsfwGsPlugin::HandleClientRectChange() |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 void CRsfwGsPlugin::HandleViewRectChange() |
|
136 { |
|
137 if ( iMainListContainer->IsVisible() ) |
|
138 { |
|
139 iMainListContainer->SetRect( ClientRect() ); |
|
140 } |
|
141 |
|
142 if ( iSettingListContainer->IsVisible() ) |
|
143 { |
|
144 iSettingListContainer->SetRect( ClientRect() ); |
|
145 } |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // CRsfwGsPlugin::DoActivateL() |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 void CRsfwGsPlugin::DoActivateL( const TVwsViewId& aPrevViewId, |
|
153 TUid aCustomMessageId, |
|
154 const TDesC8& aCustomMessage ) |
|
155 { |
|
156 iPrevViewId = aPrevViewId; |
|
157 if (iCurrentContainer) |
|
158 { |
|
159 iAppUi->RemoveFromViewStack( *this, iCurrentContainer ); |
|
160 iCurrentContainer = NULL; |
|
161 } |
|
162 |
|
163 |
|
164 if( iMainListContainer ) |
|
165 { |
|
166 delete iMainListContainer; |
|
167 iMainListContainer=NULL; |
|
168 } |
|
169 |
|
170 if( iSettingListContainer ) |
|
171 { |
|
172 delete iSettingListContainer; |
|
173 iSettingListContainer = NULL; |
|
174 } |
|
175 |
|
176 iMainListContainer = new( ELeave ) CRsfwGsPluginDriveListContainer(this); |
|
177 iMainListContainer->SetMopParent(this); |
|
178 TRAPD( error, iMainListContainer->ConstructL( ClientRect(), iMountMan ) ); |
|
179 if (error) |
|
180 { |
|
181 delete iMainListContainer; |
|
182 iMainListContainer = NULL; |
|
183 User::Leave( error ); |
|
184 } |
|
185 |
|
186 iSettingListContainer = new( ELeave ) CRsfwGsPluginDriveSettingsContainer(this); |
|
187 iSettingListContainer->SetMopParent(this); |
|
188 TRAPD( error1, iSettingListContainer->ConstructL( ClientRect(), iMountMan)); |
|
189 if (error1) |
|
190 { |
|
191 delete iSettingListContainer; |
|
192 iSettingListContainer = NULL; |
|
193 User::Leave( error1 ); |
|
194 } |
|
195 |
|
196 if (aCustomMessageId == KRemoteDriveSettingsViewId) |
|
197 { |
|
198 TBuf<KMaxFriendlyNameLength> remoteDrive; |
|
199 CnvUtfConverter::ConvertToUnicodeFromUtf8(remoteDrive, aCustomMessage); |
|
200 iSettingListContainer->MakeVisible(ETrue); |
|
201 if (remoteDrive.Length() > 0) |
|
202 { |
|
203 LoadSettingsViewL(EEditExisting, remoteDrive, EFalse); |
|
204 } |
|
205 else |
|
206 { |
|
207 LoadSettingsViewL(ENewDefault, |
|
208 iMainListContainer->GetNextRemoteDriveNameL(), EFalse); |
|
209 } |
|
210 iCurrentContainer = iSettingListContainer; |
|
211 } |
|
212 else |
|
213 { |
|
214 iSettingListContainer->MakeVisible(EFalse); |
|
215 iCurrentContainer = iMainListContainer; |
|
216 } |
|
217 |
|
218 UpdateCbaL(); |
|
219 iAppUi->AddToViewStackL( *this, iCurrentContainer ); |
|
220 } |
|
221 |
|
222 |
|
223 // --------------------------------------------------------------------------- |
|
224 // CRsfwGsPlugin::DoDeactivate() |
|
225 // --------------------------------------------------------------------------- |
|
226 // |
|
227 void CRsfwGsPlugin::DoDeactivate() |
|
228 { |
|
229 // try to save settings if in settings list container |
|
230 if ( iCurrentContainer && iSettingListContainer |
|
231 && iCurrentContainer == iSettingListContainer ) |
|
232 { |
|
233 TRAP_IGNORE(iSettingListContainer->SaveSettingsL()); |
|
234 } |
|
235 |
|
236 if ( iCurrentContainer ) |
|
237 { |
|
238 iAppUi->RemoveFromViewStack( *this, iCurrentContainer ); |
|
239 } |
|
240 iCurrentContainer = NULL; |
|
241 |
|
242 if( iMainListContainer ) |
|
243 { |
|
244 delete iMainListContainer; |
|
245 iMainListContainer = NULL; |
|
246 } |
|
247 |
|
248 if( iSettingListContainer ) |
|
249 { |
|
250 delete iSettingListContainer; |
|
251 iSettingListContainer = NULL; |
|
252 } |
|
253 } |
|
254 |
|
255 |
|
256 |
|
257 // --------------------------------------------------------------------------- |
|
258 // CRsfwGsPlugin::HandleCommandL() |
|
259 // --------------------------------------------------------------------------- |
|
260 // |
|
261 void CRsfwGsPlugin::HandleCommandL( TInt aCommand ) |
|
262 { |
|
263 switch ( aCommand ) |
|
264 { |
|
265 case EAknSoftkeyBack: |
|
266 if (iCurrentContainer == iSettingListContainer) |
|
267 { |
|
268 if (iSettingListContainer->IsExitProcessingOKL()) |
|
269 { |
|
270 // if we are called from GS, go back to the main view |
|
271 // otherwise we are called e.g. from FileManager => |
|
272 // go back to the previous view |
|
273 if (iPrevViewId.iAppUid == KUidGS) |
|
274 { |
|
275 LoadMainViewL(); |
|
276 // set focus on the newly created/modified drive |
|
277 // we have to pass the name cause in case a drive has just been created |
|
278 // we don't know its position on the list |
|
279 iMainListContainer->SetFocusL(iSettingListContainer->GetCurrentRemoteDriveName()); |
|
280 } |
|
281 else |
|
282 { |
|
283 iAppUi->ActivateLocalViewL( iPrevViewId.iViewUid ); |
|
284 } |
|
285 |
|
286 } |
|
287 } |
|
288 else |
|
289 { |
|
290 iAppUi->ActivateLocalViewL( iPrevViewId.iViewUid ); |
|
291 } |
|
292 |
|
293 break; |
|
294 case EGSCmdAppEdit: |
|
295 if (!(iMainListContainer->IsListEmpty())) |
|
296 { |
|
297 iMainListContainer->EditCurrentItemL(); |
|
298 } |
|
299 break; |
|
300 case EGSCmdAppChange: |
|
301 iSettingListContainer->EditCurrentItemL(); |
|
302 break; |
|
303 case EGSCmdAppNew: |
|
304 // Number of remote drives is limited to 9, so that drive |
|
305 // letters are also available for other technologies. |
|
306 if (iMainListContainer->RemoteDriveCount() < KMaxRemoteDrives) |
|
307 { |
|
308 LoadSettingsViewL(ENewDefault, |
|
309 iMainListContainer->GetNextRemoteDriveNameL(), ETrue); |
|
310 } |
|
311 else |
|
312 { |
|
313 HBufC* myDisplayMessage = NULL; |
|
314 myDisplayMessage = StringLoader::LoadLC(R_STR_RSFW_ERROR_MAX_DRIVES); |
|
315 CAknErrorNote* errorNote = new CAknErrorNote(EFalse); |
|
316 errorNote->ExecuteLD(*myDisplayMessage); |
|
317 CleanupStack::PopAndDestroy(myDisplayMessage); |
|
318 } |
|
319 break; |
|
320 case EGSCmdAppDelete: |
|
321 DeleteRemoteDriveL(); |
|
322 break; |
|
323 case EGSCmdAppConnect: |
|
324 ConnectRemoteDriveL(); |
|
325 break; |
|
326 case EGSCmdAppDisconnect: |
|
327 DisconnectRemoteDriveL(); |
|
328 break; |
|
329 case EAknCmdHelp: |
|
330 { |
|
331 if (iCurrentContainer == iSettingListContainer) |
|
332 { |
|
333 LaunchHelpL(KRD_HLP_REMOTE_DRIVE_CONFIG); |
|
334 } |
|
335 |
|
336 else |
|
337 { |
|
338 LaunchHelpL(KRD_HLP_REMOTE_DRIVES); |
|
339 } |
|
340 |
|
341 } |
|
342 break; |
|
343 case EGSCmdAppSendLink: |
|
344 { |
|
345 SendLinkL(); |
|
346 } |
|
347 break; |
|
348 default: |
|
349 iAppUi->HandleCommandL( aCommand ); |
|
350 break; |
|
351 } |
|
352 } |
|
353 |
|
354 |
|
355 // --------------------------------------------------------------------------- |
|
356 // CRsfwGsPlugin::GetCaptionL() |
|
357 // --------------------------------------------------------------------------- |
|
358 // |
|
359 void CRsfwGsPlugin::GetCaptionL( TDes& aCaption ) const |
|
360 { |
|
361 StringLoader::Load( aCaption, R_GS_REMOTE_DRIVES_VIEW_CAPTION ); |
|
362 } |
|
363 |
|
364 // --------------------------------------------------------------------------- |
|
365 // CRsfwGsPlugin::CreateIconL() |
|
366 // --------------------------------------------------------------------------- |
|
367 // |
|
368 CGulIcon* CRsfwGsPlugin::CreateIconL( const TUid aIconType ) |
|
369 { |
|
370 CGulIcon* icon; |
|
371 |
|
372 if( aIconType == KGSIconTypeLbxItem ) |
|
373 { |
|
374 icon = AknsUtils::CreateGulIconL( |
|
375 AknsUtils::SkinInstance(), |
|
376 KAknsIIDQgnPropSetConnRemotedrive, |
|
377 KGSPluginBitmapFile, |
|
378 EMbmRsfwgspluginQgn_prop_set_conn_remotedrive, |
|
379 EMbmRsfwgspluginQgn_prop_set_conn_remotedrive_mask); |
|
380 } |
|
381 else |
|
382 { |
|
383 icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
384 } |
|
385 return icon; |
|
386 } |
|
387 |
|
388 |
|
389 // --------------------------------------------------------------------------- |
|
390 // CRsfwGsPlugin::LoadSettingsViewL() |
|
391 // --------------------------------------------------------------------------- |
|
392 // |
|
393 void CRsfwGsPlugin::LoadSettingsViewL(TRsfwSettingsViewType aType, TDesC& aRemoteDrive, TBool aAddToViewStack) |
|
394 { |
|
395 switch(aType) |
|
396 { |
|
397 case EEditExisting: |
|
398 iSettingListContainer->PrepareRemoteDriveForEditingL(aRemoteDrive); |
|
399 break; |
|
400 case ENewDefault: |
|
401 iSettingListContainer->PrepareRemoteDriveNewDefaultL(aRemoteDrive); |
|
402 break; |
|
403 default: |
|
404 break; |
|
405 } |
|
406 if (iCurrentContainer) |
|
407 iAppUi->RemoveFromViewStack( *this, iCurrentContainer ); |
|
408 iCurrentContainer = iSettingListContainer; |
|
409 if (aAddToViewStack) |
|
410 { |
|
411 iAppUi->AddToViewStackL( *this, iCurrentContainer ); |
|
412 } |
|
413 iMainListContainer->MakeVisible(EFalse); |
|
414 iSettingListContainer->MakeVisible(ETrue); |
|
415 UpdateCbaL(); |
|
416 } |
|
417 |
|
418 |
|
419 // --------------------------------------------------------------------------- |
|
420 // CRsfwGsPlugin::LoadMainViewL() |
|
421 // --------------------------------------------------------------------------- |
|
422 // |
|
423 void CRsfwGsPlugin::LoadMainViewL() |
|
424 { |
|
425 iMainListContainer->LoadRemoteDriveListArrayL(); |
|
426 if (iCurrentContainer) |
|
427 iAppUi->RemoveFromViewStack( *this, iCurrentContainer ); |
|
428 iCurrentContainer = iMainListContainer; |
|
429 iAppUi->AddToViewStackL( *this, iCurrentContainer ); |
|
430 |
|
431 iMainListContainer->SetFocus(); |
|
432 |
|
433 iSettingListContainer->MakeVisible(EFalse); |
|
434 UpdateCbaL(); |
|
435 iMainListContainer->MakeVisible(ETrue); |
|
436 Cba()->DrawDeferred(); |
|
437 } |
|
438 |
|
439 |
|
440 |
|
441 // --------------------------------------------------------------------------- |
|
442 // CRsfwGsPlugin::DynInitMenuPaneL() |
|
443 // --------------------------------------------------------------------------- |
|
444 // |
|
445 void CRsfwGsPlugin::DynInitMenuPaneL( TInt aResourceId, |
|
446 CEikMenuPane* aMenuPane ) |
|
447 { |
|
448 if ( aResourceId == R_GS_REMOTE_DRIVES_MENU ) |
|
449 { |
|
450 if (iCurrentContainer == iMainListContainer) |
|
451 { |
|
452 aMenuPane->SetItemDimmed(EGSCmdAppChange, ETrue); |
|
453 if (iMainListContainer->IsListEmpty()) |
|
454 { |
|
455 aMenuPane->SetItemDimmed( EGSCmdAppEdit, ETrue ); |
|
456 aMenuPane->SetItemDimmed( EGSCmdAppDelete, ETrue ); |
|
457 aMenuPane->SetItemDimmed( EGSCmdAppConnect, ETrue ); |
|
458 aMenuPane->SetItemDimmed( EGSCmdAppDisconnect, ETrue ); |
|
459 aMenuPane->SetItemDimmed( EGSCmdAppSendLink, ETrue ); |
|
460 } |
|
461 else |
|
462 { |
|
463 TBool isDriveConnected = IsDriveConnectedL(); |
|
464 aMenuPane->SetItemDimmed( EGSCmdAppDelete, isDriveConnected ); |
|
465 aMenuPane->SetItemDimmed( EGSCmdAppConnect, isDriveConnected ); |
|
466 aMenuPane->SetItemDimmed( EGSCmdAppEdit, isDriveConnected ); |
|
467 aMenuPane->SetItemDimmed( EGSCmdAppDisconnect, !isDriveConnected ); |
|
468 } |
|
469 } |
|
470 else |
|
471 { |
|
472 aMenuPane->SetItemDimmed( EGSCmdAppNew, ETrue ); |
|
473 aMenuPane->SetItemDimmed( EGSCmdAppEdit, ETrue ); |
|
474 aMenuPane->SetItemDimmed( EGSCmdAppDelete, ETrue ); |
|
475 aMenuPane->SetItemDimmed( EGSCmdAppConnect, ETrue ); |
|
476 aMenuPane->SetItemDimmed( EGSCmdAppDisconnect, ETrue ); |
|
477 aMenuPane->SetItemDimmed( EGSCmdAppSendLink, ETrue ); |
|
478 } |
|
479 |
|
480 } |
|
481 |
|
482 if (aResourceId == R_GS_MENU_ITEM_EXIT) |
|
483 { |
|
484 if (!FeatureManager::FeatureSupported( KFeatureIdHelp )) |
|
485 { |
|
486 aMenuPane->SetItemDimmed( EAknCmdHelp , ETrue ); |
|
487 } |
|
488 } |
|
489 } |
|
490 |
|
491 |
|
492 // --------------------------------------------------------------------------- |
|
493 // CRsfwGsPlugin::DeleteRemoteDriveL() |
|
494 // --------------------------------------------------------------------------- |
|
495 // |
|
496 void CRsfwGsPlugin::DeleteRemoteDriveL() |
|
497 { |
|
498 |
|
499 HBufC* myFormatMessage = NULL; |
|
500 HBufC* here = iMainListContainer->GetCurrentRemoteDriveNameLC(); |
|
501 TChar driveId = iMainListContainer->GetCurrentRemoteDriveIdL(); |
|
502 |
|
503 if (!iMainListContainer->IsDriveConnectedL(*here)) |
|
504 { |
|
505 if ( here->Length() ) |
|
506 { |
|
507 myFormatMessage = StringLoader::LoadLC( R_STR_RSFW_CONF_DELETE, *here ); |
|
508 } |
|
509 else |
|
510 { |
|
511 myFormatMessage = StringLoader::LoadLC( R_STR_RSFW_CONF_DELETE ); |
|
512 } |
|
513 |
|
514 CAknQueryDialog* query = CAknQueryDialog::NewL(CAknQueryDialog::EConfirmationTone); |
|
515 |
|
516 iDialog = query; |
|
517 iDeletingId = iMainListContainer->GetCurrentRemoteDriveIdL(); |
|
518 |
|
519 if ( query->ExecuteLD( R_CONFIRMATION_QUERY, *myFormatMessage ) ) |
|
520 { |
|
521 if (iMainListContainer->RemoteDriveCount() > 0) |
|
522 { |
|
523 TChar currentdriveId = iMainListContainer->GetCurrentRemoteDriveIdL(); |
|
524 if (driveId == currentdriveId) |
|
525 { |
|
526 iMainListContainer->DeleteCurrentRemoteDriveL(); |
|
527 } |
|
528 } |
|
529 } |
|
530 iDialog = NULL; |
|
531 |
|
532 CleanupStack::PopAndDestroy(myFormatMessage); |
|
533 |
|
534 UpdateCbaL(); |
|
535 |
|
536 } |
|
537 CleanupStack::PopAndDestroy(here); |
|
538 } |
|
539 |
|
540 // --------------------------------------------------------------------------- |
|
541 // CRsfwGsPlugin::ProcessDeletingDialog() |
|
542 // --------------------------------------------------------------------------- |
|
543 // |
|
544 void CRsfwGsPlugin::ProcessDeletingDialog() |
|
545 { |
|
546 if ( (iMainListContainer->RemoteDriveCount() == 0) || |
|
547 (iDeletingId != iMainListContainer->GetCurrentRemoteDriveIdL()) ) |
|
548 { |
|
549 if (iDialog) |
|
550 { |
|
551 delete iDialog; |
|
552 iDialog = NULL; |
|
553 } |
|
554 } |
|
555 } |
|
556 |
|
557 // --------------------------------------------------------- |
|
558 // CRsfwGsPlugin::LaunchHelpL() |
|
559 // --------------------------------------------------------- |
|
560 // |
|
561 void CRsfwGsPlugin::LaunchHelpL( const TDesC& aContext ) |
|
562 { |
|
563 //make context array |
|
564 //granurality 1 is ok cos there is added just one item |
|
565 CArrayFix< TCoeHelpContext >* cntx = new( ELeave ) CArrayFixFlat< TCoeHelpContext >( 1 ); |
|
566 CleanupStack::PushL( cntx ); |
|
567 |
|
568 cntx->AppendL( TCoeHelpContext( TUid::Uid(KUidGeneralSettings), aContext ) ); |
|
569 CleanupStack::Pop( cntx ); |
|
570 |
|
571 //and launch help - takes ownership of context array |
|
572 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), cntx); |
|
573 } |
|
574 |
|
575 // --------------------------------------------------------- |
|
576 // CRsfwGsPlugin::HandleResourceChangeManual |
|
577 // --------------------------------------------------------- |
|
578 // |
|
579 void CRsfwGsPlugin::HandleResourceChangeManual(TInt aType) |
|
580 { |
|
581 if (iCurrentContainer==iSettingListContainer) |
|
582 iMainListContainer->HandleResourceChangeManual(aType); |
|
583 else if (iCurrentContainer==iMainListContainer) |
|
584 iSettingListContainer->HandleResourceChangeManual(aType); |
|
585 } |
|
586 |
|
587 // --------------------------------------------------------------------------- |
|
588 // CRsfwGsPlugin::IsDriveConnected() |
|
589 // --------------------------------------------------------------------------- |
|
590 // |
|
591 TBool CRsfwGsPlugin::IsDriveConnectedL() |
|
592 { |
|
593 TBool connected; |
|
594 HBufC* currentDriveName = iMainListContainer->GetCurrentRemoteDriveNameLC(); |
|
595 if (!currentDriveName) |
|
596 { |
|
597 User::Leave(KErrNotFound); |
|
598 } |
|
599 TPtrC drivePtr = currentDriveName->Ptr(); |
|
600 connected = iMainListContainer->IsDriveConnectedL(drivePtr.Left(currentDriveName->Length())); |
|
601 CleanupStack::PopAndDestroy(currentDriveName); |
|
602 return connected; |
|
603 } |
|
604 |
|
605 // --------------------------------------------------------------------------- |
|
606 // CRsfwGsPlugin::ConnectRemoteDrive() |
|
607 // --------------------------------------------------------------------------- |
|
608 // |
|
609 void CRsfwGsPlugin::ConnectRemoteDriveL() |
|
610 { |
|
611 iMainListContainer->ConnectCurrentRemoteDriveL(); |
|
612 } |
|
613 |
|
614 // --------------------------------------------------------------------------- |
|
615 // CRsfwGsPlugin::DisconnectRemoteDrive() |
|
616 // --------------------------------------------------------------------------- |
|
617 // |
|
618 void CRsfwGsPlugin::DisconnectRemoteDriveL() |
|
619 { |
|
620 iMainListContainer->DisconnectCurrentRemoteDriveL(); |
|
621 } |
|
622 |
|
623 |
|
624 |
|
625 // ---------------------------------------------------- |
|
626 // CRsfwGsPlugin::DoSendAsL |
|
627 // ---------------------------------------------------- |
|
628 // |
|
629 void CRsfwGsPlugin::DoSendAsL() |
|
630 { |
|
631 // read the source setting |
|
632 const CRsfwMountEntry* mountEntry = NULL; |
|
633 HBufC* currentDriveName = iMainListContainer->GetCurrentRemoteDriveNameLC(); |
|
634 TPtrC drivePtr = currentDriveName->Ptr(); |
|
635 mountEntry = iMountMan->MountEntryL( |
|
636 drivePtr.Left(currentDriveName->Length())); |
|
637 CleanupStack::PopAndDestroy(currentDriveName); |
|
638 iSender->SendL( *mountEntry ); |
|
639 } |
|
640 |
|
641 |
|
642 void CRsfwGsPlugin::SendLinkL( ) |
|
643 { |
|
644 HBufC* driveBuf = iMainListContainer->GetCurrentRemoteDriveNameLC(); |
|
645 iSender->DisplaySendCascadeMenuL(); |
|
646 |
|
647 // make sure that the mountentry was not deleted |
|
648 if (driveBuf) |
|
649 { |
|
650 const CRsfwMountEntry* mountentry = iMountMan->MountEntryL(*driveBuf); |
|
651 CleanupStack::PopAndDestroy(driveBuf); |
|
652 if (mountentry) |
|
653 { |
|
654 if (iSender->CanSend()) |
|
655 { |
|
656 DoSendAsL(); |
|
657 } |
|
658 } |
|
659 } |
|
660 |
|
661 } |
|
662 |
|
663 void CRsfwGsPlugin::UpdateCbaL() |
|
664 { |
|
665 CEikButtonGroupContainer* cbaGroup = Cba(); |
|
666 |
|
667 if (iCurrentContainer == iMainListContainer) |
|
668 { |
|
669 cbaGroup->SetCommandSetL(R_RSFW_SOFTKEYS_OPTIONS_BACK_EDIT); |
|
670 if (iMainListContainer->IsListEmpty()) |
|
671 { |
|
672 cbaGroup->MakeCommandVisible(EGSCmdAppEdit, EFalse); |
|
673 } |
|
674 else if (IsDriveConnectedL()) |
|
675 { |
|
676 cbaGroup->MakeCommandVisible(EGSCmdAppEdit, EFalse); |
|
677 } |
|
678 else |
|
679 { |
|
680 cbaGroup->MakeCommandVisible(EGSCmdAppEdit, ETrue); |
|
681 } |
|
682 } |
|
683 else if (iCurrentContainer == iSettingListContainer) |
|
684 { |
|
685 cbaGroup->SetCommandSetL(R_RSFW_SOFTKEYS_OPTIONS_BACK_CHANGE); |
|
686 // it is possible that the MSK command was dimmed |
|
687 cbaGroup->MakeCommandVisible(EGSCmdAppChange, ETrue); |
|
688 } |
|
689 |
|
690 Cba()->DrawDeferred(); |
|
691 } |
|
692 |
|
693 CCoeControl* CRsfwGsPlugin::CurrentContainer() |
|
694 { |
|
695 return iCurrentContainer; |
|
696 } |
|
697 |
|
698 // End of file |
|
699 |
|