|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : CCEAppUi.cpp 00004 * Part of : Content Listing Framework Sample Application 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 00017 // INCLUDE FILES 00018 #include "CCEAppUi.h" 00019 00020 #include "CCEGroupView.h" 00021 #include "CCEMusicView.h" 00022 #include "CCEOperationObserver.h" 00023 #include "CLFExample.hrh" 00024 00025 #include <MCLFContentListingEngine.h> 00026 #include <ContentListingFactory.h> 00027 #include <MCLFItemListModel.h> 00028 #include <CLFContentListing.hrh> 00029 #include <CLFExample.rsg> 00030 00031 // ============================ MEMBER FUNCTIONS =============================== 00032 00033 // ----------------------------------------------------------------------------- 00034 // CCEAppUi::CCEAppUi 00035 // C++ default constructor can NOT contain any code, that 00036 // might leave. 00037 // ----------------------------------------------------------------------------- 00038 // 00039 CCEAppUi::CCEAppUi() 00040 { 00041 } 00042 00043 // ----------------------------------------------------------------------------- 00044 // CCEAppUi::ConstructL 00045 // Symbian 2nd phase constructor can leave. 00046 // ----------------------------------------------------------------------------- 00047 // 00048 void CCEAppUi::ConstructL() 00049 { 00050 BaseConstructL( CAknAppUi::EAknEnableSkin ); 00051 00052 // Create CLF Operation Observer to monitor, when 00053 // refresh operation has completed 00054 iObserver = CCEOperationObserver::NewL(); 00055 00056 // Create Content Listing Engine and a list model 00057 iEngine = ContentListingFactory::NewContentListingEngineLC(); 00058 CleanupStack::Pop(); // iEngine 00059 iModel = iEngine->CreateListModelLC( *iObserver ); 00060 CleanupStack::Pop(); // iModel 00061 00062 // Create a view for music files listing 00063 iAppView = CCEMusicView::NewLC( iEngine, iModel, iObserver ); 00064 AddViewL( iAppView ); // ownership transfers 00065 CleanupStack::Pop(); // iAppView 00066 00067 // Create a view for groups listing 00068 iAppView = CCEGroupView::NewLC( iEngine, iModel, iObserver ); 00069 AddViewL( iAppView ); // ownership transfers 00070 CleanupStack::Pop(); // iAppView 00071 SetDefaultViewL( *iAppView ); 00072 00073 // Create an array for wanted media types 00074 RArray<TInt> array; 00075 CleanupClosePushL( array ); 00076 00077 // Append music-type to wanted types array to exclude 00078 // all other files than music files from the list model 00079 array.AppendL( ECLFMediaTypeMusic ); 00080 00081 // Set wanted media types array to the model 00082 iModel->SetWantedMediaTypesL( array.Array() ); 00083 CleanupStack::PopAndDestroy( &array ); 00084 } 00085 00086 // Destructor 00087 CCEAppUi::~CCEAppUi() 00088 { 00089 if( iModel ) 00090 { 00091 iModel->CancelRefresh(); 00092 delete iModel; 00093 } 00094 00095 delete iEngine; 00096 delete iObserver; 00097 } 00098 00099 // ----------------------------------------------------------------------------- 00100 // CCEAppUi::HandleCommandL 00101 // Handle user's commands. 00102 // ----------------------------------------------------------------------------- 00103 // 00104 void CCEAppUi::HandleCommandL( TInt aCommand ) 00105 { 00106 switch( aCommand ) 00107 { 00108 case EEikCmdExit: 00109 case EAknSoftkeyExit: 00110 case EAknCmdExit: 00111 case ECECmdExit: 00112 { 00113 Exit(); 00114 break; 00115 } 00116 00117 default: 00118 { 00119 break; 00120 } 00121 } 00122 } 00123 00124 // End of File
|
© Nokia 2009 |