appinstall_plat/sifui_api/tsrc/src/sifuidummydetailsprovider.cpp
branchGCC_SURGE
changeset 56 afe7195bb6c3
parent 41 0410b3201a77
parent 54 100b6c869078
equal deleted inserted replaced
41:0410b3201a77 56:afe7195bb6c3
     1 /*
       
     2 * Copyright (c) 2010 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: Dummy implementation for details provider interface.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <sifuidummydetailsprovider.h>  // CDummyDetailsProvider
       
    19 #include <f32file.h>                    // RFs, TVolumeInfo
       
    20 
       
    21 
       
    22 CDummyDetailsProvider::CDummyDetailsProvider( RFs& aFs ) : iFs( aFs )
       
    23     {
       
    24     }
       
    25 
       
    26 CDummyDetailsProvider::~CDummyDetailsProvider()
       
    27     {
       
    28     }
       
    29 
       
    30 void CDummyDetailsProvider::SetToFirstFieldL()
       
    31     {
       
    32     iCurrentField = 0;
       
    33     }
       
    34 
       
    35 TBool CDummyDetailsProvider::HasNextField()
       
    36     {
       
    37     return( iCurrentField < 3 );
       
    38     }
       
    39 
       
    40 void CDummyDetailsProvider::GetNextFieldL( TDes& aFieldName, TDes& aFieldValue )
       
    41     {
       
    42     __ASSERT_ALWAYS( iCurrentField < 3, User::Invariant() );
       
    43     aFieldName.Zero();
       
    44     aFieldName.AppendFormat( _L("Field_%d"), iCurrentField );
       
    45     aFieldValue.Zero();
       
    46     aFieldValue.AppendFormat( _L("Value %d"), iCurrentField );
       
    47     ++iCurrentField;
       
    48     }
       
    49 
       
    50 void CDummyDetailsProvider::SetToFirstItemL()
       
    51     {
       
    52     iCurrentItem = 0;
       
    53     }
       
    54 
       
    55 TBool CDummyDetailsProvider::HasNextItem()
       
    56     {
       
    57     return( iCurrentField < 3 );
       
    58     }
       
    59 
       
    60 void CDummyDetailsProvider::GetNextItemL( TDes& aItemName )
       
    61     {
       
    62     __ASSERT_ALWAYS( iCurrentItem < 3, User::Invariant() );
       
    63     aItemName.Zero();
       
    64     aItemName.AppendFormat( _L("Item_%d"), iCurrentItem );
       
    65     ++iCurrentItem;
       
    66     }
       
    67 
       
    68 MSifUiDetailsIterator* CDummyDetailsProvider::DetailsIterator( const TDesC& aItemName )
       
    69     {
       
    70     return this;
       
    71     }
       
    72 
       
    73 MSifUiDetailsIterator* CDummyDetailsProvider::AppDetailsIterator()
       
    74     {
       
    75     return this;
       
    76     }
       
    77 
       
    78 MSifUiListIterator* CDummyDetailsProvider::CertificatesListL()
       
    79     {
       
    80     return this;
       
    81     }
       
    82 
       
    83 MSifUiListIterator* CDummyDetailsProvider::DrmFilesListL()
       
    84     {
       
    85     return this;
       
    86     }
       
    87 
       
    88 void CDummyDetailsProvider::GetDriveListL( RArray<TDriveUnit>& aDriveList )
       
    89     {
       
    90     aDriveList.Reset();
       
    91     TDriveList driveList;
       
    92     User::LeaveIfError( iFs.DriveList( driveList ) );
       
    93     for( TInt driveNumber = EDriveA; driveNumber <= EDriveZ; ++driveNumber )
       
    94         {
       
    95         if( driveList[ driveNumber ] )
       
    96             {
       
    97             TVolumeInfo volInfo;
       
    98             if( iFs.Volume( volInfo, driveNumber ) == KErrNone )
       
    99                 {
       
   100                 if( volInfo.iDrive.iType != EMediaNotPresent &&
       
   101                     volInfo.iDrive.iType != EMediaRom &&
       
   102                     volInfo.iDrive.iType != EMediaRemote &&
       
   103                     !( volInfo.iDrive.iDriveAtt & KDriveAttRom ) &&
       
   104                     !( volInfo.iDrive.iDriveAtt & KDriveAttSubsted ) )
       
   105                     {
       
   106                     aDriveList.AppendL( driveNumber );
       
   107                     }
       
   108                 }
       
   109             }
       
   110         }
       
   111     }
       
   112 
       
   113 void CDummyDetailsProvider::GetFolderListL( const TDesC& aParent, CDesCArray& aFolderList )
       
   114     {
       
   115     aFolderList.Reset();
       
   116     if( aParent.Find( _L("SubSub") ) != KErrNotFound )
       
   117         {
       
   118         // no subfolders, should not get here
       
   119         User::Invariant();
       
   120         }
       
   121     else if( ( aParent.Find( _L("Applications") ) != KErrNotFound ) ||
       
   122              ( aParent.Find( _L("Programs") ) != KErrNotFound ) ||
       
   123              ( aParent.Find( _L("Installations") ) != KErrNotFound ) )
       
   124         {
       
   125         aFolderList.AppendL( _L("SubSubDir") );
       
   126         aFolderList.AppendL( _L("SubSubFolder") );
       
   127         }
       
   128     else
       
   129         {
       
   130         aFolderList.AppendL( _L("Applications") );
       
   131         aFolderList.AppendL( _L("Programs") );
       
   132         aFolderList.AppendL( _L("Installations") );
       
   133         }
       
   134     }
       
   135 
       
   136 TBool CDummyDetailsProvider::HasFolderSubfolders( const TDesC& aParent, const TDesC& aFolder )
       
   137     {
       
   138     return( aParent.Find( _L("SubSub") ) != KErrNotFound );
       
   139     }
       
   140