profilesservices/MediaFileList/Src/mediafilelist.cpp
branchRCL_3
changeset 24 8ee96d21d9bf
parent 23 8bda91a87a00
child 25 7e0eff37aedb
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
     1 /*
       
     2 * Copyright (c) 2007 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:   Interface of MediaFileList. Provide some API for 
       
    15 *                the user to use mediafilelist
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 
       
    24 #include "mediafilelist.h"
       
    25 #include "mediafiledialog.h"
       
    26 
       
    27 
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CMediaFileList::NewL
       
    31 //
       
    32 // Two-phased constructor.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 EXPORT_C CMediaFileList* CMediaFileList::NewL()
       
    36     {
       
    37     CMediaFileList* self = new (ELeave) CMediaFileList();
       
    38     CleanupStack::PushL( self );
       
    39 	self->ConstructL();
       
    40     CleanupStack::Pop( self );
       
    41 
       
    42 	return self;
       
    43     }
       
    44 
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // Destructor
       
    48 //
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 EXPORT_C CMediaFileList::~CMediaFileList()
       
    52     {
       
    53     delete iDialog;
       
    54     }
       
    55 
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CMediaFileList::ConstructL
       
    59 //
       
    60 // Symbian 2nd phase constructor can leave.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 void CMediaFileList::ConstructL()
       
    64     {
       
    65     iDialog = CMediaFileDialog::NewL();
       
    66     }
       
    67 
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CMediaFileList::CMediaFileList
       
    71 //
       
    72 // C++ default constructor can NOT contain any code, that
       
    73 // might leave.
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 CMediaFileList::CMediaFileList()
       
    77     {
       
    78     }
       
    79 
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CMediaFileList::ShowCMediaFileListL
       
    83 //
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 EXPORT_C TBool CMediaFileList::ShowMediaFileListL( TDes* aFileName, 
       
    87                                                    TInt* aNullItem,
       
    88                                                    TInt* aInfo,
       
    89                                                    TDes* aDesInfo )
       
    90     {
       
    91     TInt err = KErrNone;
       
    92     TInt ret = EFalse;
       
    93     TRAP( err, ret = iDialog->ShowDialogL( aFileName, aNullItem, aInfo, aDesInfo ) );
       
    94     
       
    95     iDialog = NULL;
       
    96     
       
    97     User::LeaveIfError( err );
       
    98     
       
    99     if ( !ret )
       
   100         {
       
   101     	  return EFalse;
       
   102     	  }
       
   103     
       
   104     if ( aFileName->Length() == 0 )
       
   105         {
       
   106         return EFalse;
       
   107         }
       
   108     return ETrue;
       
   109     }
       
   110 
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CMediaFileList::SetAttrL
       
   114 //
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 EXPORT_C void CMediaFileList::SetAttrL( TInt aAttr, TInt aValue )
       
   118     {
       
   119     if ( iDialog )
       
   120         {
       
   121         iDialog->SetAttrL( aAttr, aValue );
       
   122         }
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CMediaFileList::SetAttrL
       
   127 //
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 EXPORT_C void CMediaFileList::SetAttrL( TInt aAttr, const TDesC& aValue )
       
   131     {
       
   132     if ( iDialog )
       
   133         {
       
   134         iDialog->SetAttrL( aAttr, aValue );
       
   135         }
       
   136     }
       
   137 
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // CMediaFileList::SetAttrL
       
   141 //
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 EXPORT_C void CMediaFileList::SetAttrL( TInt aAttr, TAny* aValue )
       
   145     {
       
   146     if ( iDialog )
       
   147         {
       
   148         iDialog->SetAttrL( aAttr, aValue );
       
   149         }
       
   150     }
       
   151 
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CMediaFileList::SetNullItemL
       
   155 //
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 EXPORT_C void CMediaFileList::SetNullItemL( const TDesC& aText, 
       
   159                                             const TDesC& aMediaFile,
       
   160 	                                        TInt aMediaFileType, TInt aIconId )
       
   161     {
       
   162     if ( iDialog )
       
   163         {
       
   164         iDialog->SetNullItemL( aText, aMediaFile, aMediaFileType, aIconId );
       
   165         }
       
   166     }
       
   167 
       
   168 
       
   169 
       
   170 // End of file