|         |      1 /* | 
|         |      2 * Copyright (c) 2009 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: | 
|         |     15 * | 
|         |     16 */ | 
|         |     17  | 
|         |     18 // INCLUDE FILES | 
|         |     19  | 
|         |     20 #include "audiofetcherdialogutils.h" | 
|         |     21 #include "audiofetcherlog.h" | 
|         |     22  | 
|         |     23 #include <bautils.h>  // bafl.lib | 
|         |     24 #include <StringLoader.h> | 
|         |     25 #include <driveinfo.h> | 
|         |     26 #include <pathinfo.h> | 
|         |     27  | 
|         |     28 #include <aknnavide.h>          // CAknNavigationDecorator | 
|         |     29 #include <aknnavilabel.h>       // CAknNaviLabel | 
|         |     30 #include <akntitle.h>           // CAknTitlePane | 
|         |     31 #include <AknQueryDialog.h> | 
|         |     32 #include <aknnotewrappers.h> | 
|         |     33 #include <AknsUtils.h>          // AknsUtils | 
|         |     34  | 
|         |     35 #include <data_caging_path_literals.hrh> // KDC_APP_RESOURCE_DIR | 
|         |     36  | 
|         |     37  | 
|         |     38 /****************************************************************************** | 
|         |     39  * class CActiveCaller | 
|         |     40  ******************************************************************************/ | 
|         |     41  | 
|         |     42  | 
|         |     43 // ----------------------------------------------------------------------------- | 
|         |     44 // CActiveCaller::NewL | 
|         |     45 //  | 
|         |     46 // ----------------------------------------------------------------------------- | 
|         |     47 // | 
|         |     48 CActiveCaller* CActiveCaller::NewL( MActiveCallerObserver* aObserver ) | 
|         |     49     { | 
|         |     50     CActiveCaller* self = new (ELeave) CActiveCaller( aObserver ); | 
|         |     51 	CleanupStack::PushL( self ); | 
|         |     52 	self->ConstructL(); | 
|         |     53 	CleanupStack::Pop( self ); | 
|         |     54  | 
|         |     55  	return self; | 
|         |     56     } | 
|         |     57  | 
|         |     58  | 
|         |     59 // ----------------------------------------------------------------------------- | 
|         |     60 // Destructor | 
|         |     61 //  | 
|         |     62 // ----------------------------------------------------------------------------- | 
|         |     63 // | 
|         |     64 CActiveCaller::~CActiveCaller() | 
|         |     65     { | 
|         |     66     WLOG("CActiveCaller::~CActiveCaller >"); | 
|         |     67  	Cancel(); | 
|         |     68 	iTimer.Close(); | 
|         |     69 	WLOG("CActiveCaller::~CActiveCaller <"); | 
|         |     70     } | 
|         |     71  | 
|         |     72  | 
|         |     73 // ----------------------------------------------------------------------------- | 
|         |     74 // CActiveCaller::CActiveCaller | 
|         |     75 //  | 
|         |     76 // ----------------------------------------------------------------------------- | 
|         |     77 // | 
|         |     78 CActiveCaller::CActiveCaller(MActiveCallerObserver* aObserver) : CActive(CActive::EPriorityStandard) | 
|         |     79     { | 
|         |     80 	iObserver = aObserver; | 
|         |     81     } | 
|         |     82  | 
|         |     83  | 
|         |     84 // ----------------------------------------------------------------------------- | 
|         |     85 // CActiveCaller::ConstructL | 
|         |     86 //  | 
|         |     87 // ----------------------------------------------------------------------------- | 
|         |     88 // | 
|         |     89 void CActiveCaller::ConstructL() | 
|         |     90     { | 
|         |     91     WLOG("CActiveCaller::ConstructL >"); | 
|         |     92 	User::LeaveIfError( iTimer.CreateLocal() ); | 
|         |     93 	CActiveScheduler::Add( this ); | 
|         |     94 	WLOG("CActiveCaller::ConstructL <"); | 
|         |     95     } | 
|         |     96  | 
|         |     97  | 
|         |     98 // ----------------------------------------------------------------------------- | 
|         |     99 // CActiveCaller::DoCancel | 
|         |    100 // | 
|         |    101 // ----------------------------------------------------------------------------- | 
|         |    102 // | 
|         |    103 void CActiveCaller::DoCancel() | 
|         |    104     { | 
|         |    105     WLOG("CActiveCaller::DoCancel >"); | 
|         |    106  	iTimer.Cancel(); | 
|         |    107  	WLOG("CActiveCaller::DoCancel <"); | 
|         |    108     } | 
|         |    109  | 
|         |    110  | 
|         |    111 // ----------------------------------------------------------------------------- | 
|         |    112 // CActiveCaller::RunL | 
|         |    113 // | 
|         |    114 // ----------------------------------------------------------------------------- | 
|         |    115 // | 
|         |    116 void CActiveCaller::RunL() | 
|         |    117     { | 
|         |    118     WLOG("CActiveCaller::RunL >"); | 
|         |    119     TRAP_IGNORE( iObserver->HandleActiveCallL( iCallId ) ); | 
|         |    120     WLOG("CActiveCaller::RunL <"); | 
|         |    121     } | 
|         |    122  | 
|         |    123  | 
|         |    124 // ----------------------------------------------------------------------------- | 
|         |    125 // CActiveCaller::Request | 
|         |    126 // | 
|         |    127 // This function calls this class RunL. | 
|         |    128 // ----------------------------------------------------------------------------- | 
|         |    129 // | 
|         |    130 void CActiveCaller::Request() | 
|         |    131     { | 
|         |    132 	Cancel(); | 
|         |    133 	SetActive(); | 
|         |    134 	TRequestStatus* status = &iStatus; | 
|         |    135 	User::RequestComplete( status, KErrNone ); | 
|         |    136     } | 
|         |    137  | 
|         |    138  | 
|         |    139 // ----------------------------------------------------------------------------- | 
|         |    140 // CActiveCaller::Start | 
|         |    141 // | 
|         |    142 // ----------------------------------------------------------------------------- | 
|         |    143 // | 
|         |    144 void CActiveCaller::Start( TInt aCallId, TInt aMilliseconds ) | 
|         |    145     { | 
|         |    146     WLOG("CActiveCaller::Start >"); | 
|         |    147     const TInt KThousand = 1000; | 
|         |    148     Cancel(); | 
|         |    149 	 | 
|         |    150 	iCallId = aCallId; | 
|         |    151  | 
|         |    152 	if ( aMilliseconds <= 0 ) | 
|         |    153 		{ | 
|         |    154 		Request();  // no delay - complete asap | 
|         |    155 		} | 
|         |    156 	else | 
|         |    157 		{ | 
|         |    158 	    iTimer.After( iStatus, aMilliseconds*KThousand ); | 
|         |    159 	    SetActive(); | 
|         |    160 		} | 
|         |    161 	WLOG("CActiveCaller::Start <"); | 
|         |    162     } | 
|         |    163  | 
|         |    164  | 
|         |    165 // ----------------------------------------------------------------------------- | 
|         |    166 // CActiveCaller::Stop | 
|         |    167 // | 
|         |    168 // ----------------------------------------------------------------------------- | 
|         |    169 // | 
|         |    170 void CActiveCaller::Stop() | 
|         |    171     { | 
|         |    172     WLOG("CActiveCaller::Stop >"); | 
|         |    173     Cancel(); | 
|         |    174     WLOG("CActiveCaller::Stop <"); | 
|         |    175     } | 
|         |    176  | 
|         |    177  | 
|         |    178  | 
|         |    179  | 
|         |    180 /******************************************************************************* | 
|         |    181  * class CNaviPaneHandler | 
|         |    182  *******************************************************************************/ | 
|         |    183  | 
|         |    184  | 
|         |    185 // ----------------------------------------------------------------------------- | 
|         |    186 // Destructor | 
|         |    187 // | 
|         |    188 // ----------------------------------------------------------------------------- | 
|         |    189 // | 
|         |    190 CNaviPaneHandler::~CNaviPaneHandler() | 
|         |    191     { | 
|         |    192     WLOG("CNaviPaneHandler::~CNaviPaneHandler >"); | 
|         |    193     if ( iNaviDecorator ) | 
|         |    194         { | 
|         |    195         if ( iNaviPane && iNavidecoratorPushed ) | 
|         |    196             { | 
|         |    197             iNaviPane->Pop( iNaviDecorator ); | 
|         |    198             } | 
|         |    199      | 
|         |    200         delete iNaviDecorator; | 
|         |    201         } | 
|         |    202          | 
|         |    203     if ( iNaviPane && iNavipanePushed ) | 
|         |    204         { | 
|         |    205         iNaviPane->Pop(); // restore previous navi pane | 
|         |    206         } | 
|         |    207     WLOG("CNaviPaneHandler::~CNaviPaneHandler <"); | 
|         |    208     } | 
|         |    209  | 
|         |    210  | 
|         |    211 // ----------------------------------------------------------------------------- | 
|         |    212 // CNaviPaneHandler::CNaviPaneHandler | 
|         |    213 // | 
|         |    214 // ----------------------------------------------------------------------------- | 
|         |    215 // | 
|         |    216 CNaviPaneHandler::CNaviPaneHandler( CEikStatusPane* aStatusPane ) : iStatusPane( aStatusPane ) | 
|         |    217     { | 
|         |    218     iNavidecoratorPushed = EFalse; | 
|         |    219     iNavipanePushed = EFalse; | 
|         |    220      | 
|         |    221     if ( iStatusPane ) | 
|         |    222         { | 
|         |    223         TRAP_IGNORE( iNaviPane = (CAknNavigationControlContainer*)iStatusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi)) ); | 
|         |    224         } | 
|         |    225     } | 
|         |    226  | 
|         |    227  | 
|         |    228 // ---------------------------------------------------------------------------- | 
|         |    229 // CNaviPaneHandler::SetNaviPaneTitleL | 
|         |    230 //  | 
|         |    231 // ---------------------------------------------------------------------------- | 
|         |    232 // | 
|         |    233 void CNaviPaneHandler::SetNaviPaneTitleL(const TDesC& aTitle) | 
|         |    234     { | 
|         |    235     if ( !iStatusPane || !iNaviPane ) | 
|         |    236         { | 
|         |    237         return; | 
|         |    238         } | 
|         |    239  | 
|         |    240     if ( iNaviDecorator ) | 
|         |    241         { | 
|         |    242         CAknNaviLabel* naviLabel = static_cast<CAknNaviLabel*>(iNaviDecorator->DecoratedControl()); | 
|         |    243         if ( naviLabel ) | 
|         |    244             { | 
|         |    245             naviLabel->SetTextL( aTitle ); | 
|         |    246             iNaviDecorator->DrawDeferred(); | 
|         |    247             } | 
|         |    248         } | 
|         |    249      else | 
|         |    250         { | 
|         |    251         iNaviDecorator = iNaviPane->CreateNavigationLabelL( aTitle ) ; | 
|         |    252         iNaviPane->PushL( *iNaviDecorator ); // activate navi label in navi pane | 
|         |    253         iNavidecoratorPushed = ETrue; | 
|         |    254         } | 
|         |    255     } | 
|         |    256  | 
|         |    257  | 
|         |    258 // ---------------------------------------------------------------------------- | 
|         |    259 // CNaviPaneHandler::StoreNavipaneL | 
|         |    260 //  | 
|         |    261 // ---------------------------------------------------------------------------- | 
|         |    262 // | 
|         |    263 void CNaviPaneHandler::StoreNavipaneL() | 
|         |    264     { | 
|         |    265     if ( !iNaviPane || !iStatusPane || iNavipanePushed ) | 
|         |    266         { | 
|         |    267         return; | 
|         |    268         } | 
|         |    269  | 
|         |    270     if ( iStatusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)).IsPresent() ) | 
|         |    271         { | 
|         |    272         iNaviPane->PushDefaultL(); | 
|         |    273         iNavipanePushed = ETrue; | 
|         |    274         } | 
|         |    275     } | 
|         |    276  | 
|         |    277  | 
|         |    278  | 
|         |    279  | 
|         |    280 /******************************************************************************* | 
|         |    281  * class CStatusPaneHandler | 
|         |    282  *******************************************************************************/ | 
|         |    283  | 
|         |    284 // ----------------------------------------------------------------------------- | 
|         |    285 // CStatusPaneHandler::NewL | 
|         |    286 // | 
|         |    287 // Two-phased constructor. | 
|         |    288 // ----------------------------------------------------------------------------- | 
|         |    289 // | 
|         |    290 CStatusPaneHandler* CStatusPaneHandler::NewL( CAknAppUi* aAppUi ) | 
|         |    291     { | 
|         |    292     CStatusPaneHandler* self = new (ELeave) CStatusPaneHandler( aAppUi ); | 
|         |    293     CleanupStack::PushL( self ); | 
|         |    294     self->ConstructL(); | 
|         |    295     CleanupStack::Pop( self ); | 
|         |    296     return self; | 
|         |    297     } | 
|         |    298  | 
|         |    299  | 
|         |    300 // ----------------------------------------------------------------------------- | 
|         |    301 // Destructor | 
|         |    302 // | 
|         |    303 // ----------------------------------------------------------------------------- | 
|         |    304 // | 
|         |    305 CStatusPaneHandler::~CStatusPaneHandler() | 
|         |    306     { | 
|         |    307     WLOG("CStatusPaneHandler::~CStatusPaneHandler >"); | 
|         |    308     TRAP_IGNORE( RestoreOriginalTitleL() ); | 
|         |    309      | 
|         |    310     delete iNaviPaneHandler; | 
|         |    311     WLOG("CStatusPaneHandler::~CStatusPaneHandler <"); | 
|         |    312     } | 
|         |    313  | 
|         |    314  | 
|         |    315 // ----------------------------------------------------------------------------- | 
|         |    316 // CStatusPaneHandler::ConstructL | 
|         |    317 // | 
|         |    318 // Symbian 2nd phase constructor can leave. | 
|         |    319 // ----------------------------------------------------------------------------- | 
|         |    320 // | 
|         |    321 void CStatusPaneHandler::ConstructL() | 
|         |    322     { | 
|         |    323     WLOG("CStatusPaneHandler::ConstructL >"); | 
|         |    324     iNaviPaneHandler = new (ELeave) CNaviPaneHandler( iAppUi->StatusPane() ); | 
|         |    325     WLOG("CStatusPaneHandler::ConstructL <"); | 
|         |    326     } | 
|         |    327  | 
|         |    328  | 
|         |    329 // ----------------------------------------------------------------------------- | 
|         |    330 // CStatusPaneHandler::CStatusPaneHandler | 
|         |    331 // | 
|         |    332 // ----------------------------------------------------------------------------- | 
|         |    333 // | 
|         |    334 CStatusPaneHandler::CStatusPaneHandler( CAknAppUi* aAppUi ) : iAppUi(aAppUi ) | 
|         |    335     { | 
|         |    336     //__ASSERT_ALWAYS( iAppUi, User::Panic( KErrGeneral ) ); | 
|         |    337  | 
|         |    338     iOriginalTitleStored = EFalse; | 
|         |    339     iOriginalTitle = KNullDesC; | 
|         |    340     } | 
|         |    341  | 
|         |    342  | 
|         |    343 // ---------------------------------------------------------------------------- | 
|         |    344 // CStatusPaneHandler::GetTitleL | 
|         |    345 //  | 
|         |    346 // ---------------------------------------------------------------------------- | 
|         |    347 // | 
|         |    348 TBool CStatusPaneHandler::GetTitleL( CAknAppUi* aAppUi, TDes& aTitle ) | 
|         |    349     { | 
|         |    350     aTitle = KNullDesC; | 
|         |    351  | 
|         |    352     CEikStatusPane* statusPane = aAppUi->StatusPane(); | 
|         |    353     if (statusPane && statusPane->PaneCapabilities( TUid::Uid( EEikStatusPaneUidTitle ) ).IsPresent() ) | 
|         |    354         { | 
|         |    355         CAknTitlePane* titlePane = static_cast<CAknTitlePane*> | 
|         |    356             ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); | 
|         |    357         if ( titlePane->Text() )  | 
|         |    358             { | 
|         |    359             StrCopy( aTitle, *titlePane->Text() ); | 
|         |    360             return ETrue; | 
|         |    361             } | 
|         |    362         } | 
|         |    363  | 
|         |    364     return EFalse; | 
|         |    365     } | 
|         |    366  | 
|         |    367  | 
|         |    368 // ---------------------------------------------------------------------------- | 
|         |    369 // CStatusPaneHandler::SetTitleL | 
|         |    370 //  | 
|         |    371 // ---------------------------------------------------------------------------- | 
|         |    372 // | 
|         |    373 TBool CStatusPaneHandler::SetTitleL( CAknAppUi* aAppUi, const TDesC& aTitle ) | 
|         |    374     { | 
|         |    375     CEikStatusPane* statusPane = aAppUi->StatusPane(); | 
|         |    376     if ( statusPane && statusPane->PaneCapabilities( TUid::Uid( EEikStatusPaneUidTitle ) ).IsPresent() ) | 
|         |    377         { | 
|         |    378         CAknTitlePane* titlePane = static_cast<CAknTitlePane*> | 
|         |    379             ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); | 
|         |    380         if ( titlePane->Text() )  | 
|         |    381             { | 
|         |    382             titlePane->SetTextL( aTitle ); | 
|         |    383             return ETrue; | 
|         |    384             } | 
|         |    385         } | 
|         |    386     return EFalse; | 
|         |    387     } | 
|         |    388  | 
|         |    389  | 
|         |    390 // ---------------------------------------------------------------------------- | 
|         |    391 // CStatusPaneHandler::SetNaviPaneTitleL | 
|         |    392 //  | 
|         |    393 // ---------------------------------------------------------------------------- | 
|         |    394 // | 
|         |    395 void CStatusPaneHandler::SetNaviPaneTitleL( const TDesC& aTitle ) | 
|         |    396     { | 
|         |    397     iNaviPaneHandler->SetNaviPaneTitleL( aTitle ); | 
|         |    398     } | 
|         |    399  | 
|         |    400  | 
|         |    401 // ---------------------------------------------------------------------------- | 
|         |    402 // CStatusPaneHandler::SetNaviPaneTitle | 
|         |    403 //  | 
|         |    404 // ---------------------------------------------------------------------------- | 
|         |    405 // | 
|         |    406 void CStatusPaneHandler::SetNaviPaneTitle( const TDesC& aTitle ) | 
|         |    407     { | 
|         |    408     TRAP_IGNORE( iNaviPaneHandler->SetNaviPaneTitleL( aTitle ) ); | 
|         |    409     } | 
|         |    410  | 
|         |    411  | 
|         |    412 // ---------------------------------------------------------------------------- | 
|         |    413 // CStatusPaneHandler::SetNaviPaneTitleL | 
|         |    414 //  | 
|         |    415 // ---------------------------------------------------------------------------- | 
|         |    416 // | 
|         |    417 void CStatusPaneHandler::SetNaviPaneTitleL( TInt aResource ) | 
|         |    418     { | 
|         |    419     HBufC* hBuf = StringLoader::LoadLC( aResource) ; | 
|         |    420     SetNaviPaneTitleL( hBuf->Des() ); | 
|         |    421     CleanupStack::PopAndDestroy( hBuf ); | 
|         |    422     } | 
|         |    423  | 
|         |    424  | 
|         |    425 // ---------------------------------------------------------------------------- | 
|         |    426 // CStatusPaneHandler::StoreNavipaneL | 
|         |    427 //  | 
|         |    428 // ---------------------------------------------------------------------------- | 
|         |    429 // | 
|         |    430 void CStatusPaneHandler::StoreNavipaneL() | 
|         |    431     { | 
|         |    432     iNaviPaneHandler->StoreNavipaneL(); | 
|         |    433     } | 
|         |    434  | 
|         |    435  | 
|         |    436 // ---------------------------------------------------------------------------- | 
|         |    437 // CStatusPaneHandler::StoreOriginalTitleL | 
|         |    438 //  | 
|         |    439 // ---------------------------------------------------------------------------- | 
|         |    440 // | 
|         |    441 void CStatusPaneHandler::StoreOriginalTitleL() | 
|         |    442     { | 
|         |    443     TBool ret = GetTitleL( iAppUi, iOriginalTitle ); | 
|         |    444      | 
|         |    445     if ( ret ) | 
|         |    446         { | 
|         |    447         iOriginalTitleStored = ETrue; | 
|         |    448         } | 
|         |    449     } | 
|         |    450  | 
|         |    451  | 
|         |    452 // ---------------------------------------------------------------------------- | 
|         |    453 // CStatusPaneHandler::RestoreOriginalTitleL | 
|         |    454 //  | 
|         |    455 // ---------------------------------------------------------------------------- | 
|         |    456 // | 
|         |    457 void CStatusPaneHandler::RestoreOriginalTitleL() | 
|         |    458     { | 
|         |    459     if ( iOriginalTitleStored ) | 
|         |    460         { | 
|         |    461         SetTitleL( iAppUi, iOriginalTitle ); | 
|         |    462         } | 
|         |    463     } | 
|         |    464  | 
|         |    465  | 
|         |    466 // ---------------------------------------------------------------------------- | 
|         |    467 // CStatusPaneHandler::SetTitleL | 
|         |    468 //  | 
|         |    469 // ---------------------------------------------------------------------------- | 
|         |    470 // | 
|         |    471 void CStatusPaneHandler::SetTitleL( const TDesC& aText ) | 
|         |    472     { | 
|         |    473     if ( iOriginalTitleStored ) | 
|         |    474         { | 
|         |    475         SetTitleL( iAppUi, aText ); | 
|         |    476         } | 
|         |    477     } | 
|         |    478  | 
|         |    479  | 
|         |    480 // ---------------------------------------------------------------------------- | 
|         |    481 // CStatusPaneHandler::SetTitleL | 
|         |    482 //  | 
|         |    483 // ---------------------------------------------------------------------------- | 
|         |    484 // | 
|         |    485 void CStatusPaneHandler::SetTitleL( TInt aResourceId ) | 
|         |    486     { | 
|         |    487     HBufC* hBuf = StringLoader::LoadLC( aResourceId ); | 
|         |    488     SetTitleL( hBuf->Des() ); | 
|         |    489     CleanupStack::PopAndDestroy( hBuf ); | 
|         |    490     } | 
|         |    491  | 
|         |    492  | 
|         |    493 // ----------------------------------------------------------------------------- | 
|         |    494 // CStatusPaneHandler::StrCopy | 
|         |    495 // | 
|         |    496 // ----------------------------------------------------------------------------- | 
|         |    497 // | 
|         |    498 void CStatusPaneHandler::StrCopy( TDes& aTarget, const TDesC& aSource ) | 
|         |    499     { | 
|         |    500     WLOG("CStatusPaneHandler::StrCopy >"); | 
|         |    501     TInt len = aTarget.MaxLength(); | 
|         |    502     if( len < aSource.Length() )  | 
|         |    503         { | 
|         |    504         aTarget.Copy( aSource.Left(len) ); | 
|         |    505         return; | 
|         |    506         } | 
|         |    507     aTarget.Copy( aSource ); | 
|         |    508     WLOG("CStatusPaneHandler::StrCopy <"); | 
|         |    509     } | 
|         |    510  | 
|         |    511  | 
|         |    512  | 
|         |    513 /****************************************************************************** | 
|         |    514  * class CDriveUtil | 
|         |    515  ******************************************************************************/ | 
|         |    516  | 
|         |    517  | 
|         |    518 // ----------------------------------------------------------------------------- | 
|         |    519 // CDriveUtil::NewL | 
|         |    520 //  | 
|         |    521 // ----------------------------------------------------------------------------- | 
|         |    522 // | 
|         |    523 CDriveUtil* CDriveUtil::NewL() | 
|         |    524     { | 
|         |    525     CDriveUtil* self = new (ELeave) CDriveUtil(); | 
|         |    526     CleanupStack::PushL( self ); | 
|         |    527     self->ConstructL(); | 
|         |    528     CleanupStack::Pop( self ); | 
|         |    529  | 
|         |    530     return self; | 
|         |    531     } | 
|         |    532  | 
|         |    533  | 
|         |    534 // ----------------------------------------------------------------------------- | 
|         |    535 // Destructor | 
|         |    536 //  | 
|         |    537 // ----------------------------------------------------------------------------- | 
|         |    538 // | 
|         |    539 CDriveUtil::~CDriveUtil() | 
|         |    540     { | 
|         |    541     WLOG("CDriveUtil::~CDriveUtil >"); | 
|         |    542     iFsSession.Close(); | 
|         |    543     WLOG("CDriveUtil::~CDriveUtil <"); | 
|         |    544     } | 
|         |    545  | 
|         |    546  | 
|         |    547 // ----------------------------------------------------------------------------- | 
|         |    548 // CDriveUtil::CDriveUtil | 
|         |    549 //  | 
|         |    550 // ----------------------------------------------------------------------------- | 
|         |    551 // | 
|         |    552 CDriveUtil::CDriveUtil() | 
|         |    553     { | 
|         |    554     } | 
|         |    555  | 
|         |    556  | 
|         |    557 // ----------------------------------------------------------------------------- | 
|         |    558 // CDriveUtil::ConstructL | 
|         |    559 //  | 
|         |    560 // ----------------------------------------------------------------------------- | 
|         |    561 // | 
|         |    562 void CDriveUtil::ConstructL() | 
|         |    563     { | 
|         |    564     WLOG("CDriveUtil::ConstructL >"); | 
|         |    565     User::LeaveIfError( iFsSession.Connect() ); | 
|         |    566     WLOG("CDriveUtil::ConstructL <"); | 
|         |    567     } | 
|         |    568  | 
|         |    569  | 
|         |    570 // ----------------------------------------------------------------------------- | 
|         |    571 // CDriveUtil::IsRom | 
|         |    572 //  | 
|         |    573 // ----------------------------------------------------------------------------- | 
|         |    574 // | 
|         |    575 TBool CDriveUtil::IsRom( const TDesC& aFullPath ) | 
|         |    576     { | 
|         |    577     const TUint KMassStorageBits = DriveInfo::EDriveRom; | 
|         |    578  | 
|         |    579     TDriveUnit drive( aFullPath ); | 
|         |    580     TUint driveStatus( 0 ); | 
|         |    581      | 
|         |    582     TInt err = DriveInfo::GetDriveStatus( iFsSession, drive, driveStatus ); | 
|         |    583     if ( err != KErrNone ) | 
|         |    584         { | 
|         |    585         return EFalse; | 
|         |    586         } | 
|         |    587          | 
|         |    588     if ( (driveStatus & KMassStorageBits) == KMassStorageBits ) | 
|         |    589         { | 
|         |    590         return ETrue; | 
|         |    591         } | 
|         |    592          | 
|         |    593     return EFalse; | 
|         |    594     } | 
|         |    595  | 
|         |    596  | 
|         |    597 // ----------------------------------------------------------------------------- | 
|         |    598 // CDriveUtil::IsMassStorage | 
|         |    599 //  | 
|         |    600 // ----------------------------------------------------------------------------- | 
|         |    601 // | 
|         |    602 TBool CDriveUtil::IsMassStorage( const TDesC& aFullPath ) | 
|         |    603     { | 
|         |    604     const TUint KMassStorageBits = DriveInfo::EDriveInternal | | 
|         |    605                                    DriveInfo::EDriveExternallyMountable; | 
|         |    606  | 
|         |    607     TDriveUnit drive( aFullPath ); | 
|         |    608     TUint driveStatus( 0 ); | 
|         |    609      | 
|         |    610     TInt err = DriveInfo::GetDriveStatus( iFsSession, drive, driveStatus ); | 
|         |    611     if ( err != KErrNone ) | 
|         |    612         { | 
|         |    613         return EFalse; | 
|         |    614         } | 
|         |    615          | 
|         |    616     if ( (driveStatus & KMassStorageBits) == KMassStorageBits ) | 
|         |    617         { | 
|         |    618         return ETrue; | 
|         |    619         } | 
|         |    620          | 
|         |    621     return EFalse; | 
|         |    622     } | 
|         |    623  | 
|         |    624  | 
|         |    625 // ----------------------------------------------------------------------------- | 
|         |    626 // CDriveUtil::IsMemoryCard | 
|         |    627 //  | 
|         |    628 // ----------------------------------------------------------------------------- | 
|         |    629 // | 
|         |    630 TBool CDriveUtil::IsMemoryCard( const TDesC& aFullPath ) | 
|         |    631     { | 
|         |    632     const TUint KMemoryCardBits = DriveInfo::EDriveRemovable | | 
|         |    633                                   DriveInfo::EDriveExternallyMountable; | 
|         |    634  | 
|         |    635     TDriveUnit drive( aFullPath ); | 
|         |    636     TUint driveStatus( 0 ); | 
|         |    637      | 
|         |    638     TInt err = DriveInfo::GetDriveStatus( iFsSession, drive, driveStatus ); | 
|         |    639     if ( err != KErrNone ) | 
|         |    640         { | 
|         |    641         return EFalse; | 
|         |    642         } | 
|         |    643          | 
|         |    644     if ( (driveStatus & KMemoryCardBits) == KMemoryCardBits ) | 
|         |    645         { | 
|         |    646         return ETrue; | 
|         |    647         } | 
|         |    648          | 
|         |    649     return EFalse; | 
|         |    650     } | 
|         |    651  | 
|         |    652 //  End of File   |