|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : CCEOperationObserver.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 "CCEOperationObserver.h" 00019 00020 #include "CLFExample.hrh" 00021 #include "CCEMusicView.h" 00022 00023 #include <MCLFContentListingEngine.h> 00024 #include <ContentListingFactory.h> 00025 #include <MCLFItemListModel.h> 00026 #include <CLFContentListing.hrh> 00027 #include <CLFExample.rsg> 00028 00029 // ============================ MEMBER FUNCTIONS =============================== 00030 00031 // ----------------------------------------------------------------------------- 00032 // CCEOperationObserver::CCEOperationObserver 00033 // C++ default constructor can NOT contain any code, that 00034 // might leave. 00035 // ----------------------------------------------------------------------------- 00036 // 00037 CCEOperationObserver::CCEOperationObserver() 00038 { 00039 } 00040 00041 // ----------------------------------------------------------------------------- 00042 // CCEOperationObserver::NewL 00043 // Two-phased constructor. 00044 // ----------------------------------------------------------------------------- 00045 // 00046 CCEOperationObserver* CCEOperationObserver::NewL() 00047 { 00048 CCEOperationObserver* self = new (ELeave) CCEOperationObserver; 00049 return self; 00050 } 00051 00052 // Destructor 00053 CCEOperationObserver::~CCEOperationObserver() 00054 { 00055 } 00056 00057 // ----------------------------------------------------------------------------- 00058 // CCEOperationObserver::HandleOperationEventL 00059 // Method to handle list model operation events. 00060 // ----------------------------------------------------------------------------- 00061 // 00062 void CCEOperationObserver::HandleOperationEventL( 00063 TCLFOperationEvent aOperationEvent, 00064 TInt /*aError*/ ) 00065 { 00066 // Waiting is stopped when an event for refresh completion is received 00067 if( aOperationEvent == ECLFRefreshComplete ) 00068 { 00069 iRefreshOngoing = EFalse; 00070 00071 if( iWait && iWait->IsStarted() ) 00072 { 00073 iWait->AsyncStop(); 00074 } 00075 } 00076 else if( aOperationEvent == ECLFModelOutdated ) 00077 { 00078 if( iTarget ) 00079 { 00080 // Report the music files view that there are new/changed files 00081 // in the file system. 00082 iTarget->ItemsChangedL(); 00083 } 00084 } 00085 } 00086 00087 // ----------------------------------------------------------------------------- 00088 // CCEOperationObserver::IsRefreshOngoing 00089 // Check if there is a refresh operation is ongoing. 00090 // ----------------------------------------------------------------------------- 00091 // 00092 TBool CCEOperationObserver::IsRefreshOngoing() 00093 { 00094 return iRefreshOngoing; 00095 } 00096 00097 // ----------------------------------------------------------------------------- 00098 // CCEOperationObserver::PrepareForRefresh 00099 // Prepare for a refresh operation. 00100 // ----------------------------------------------------------------------------- 00101 // 00102 void CCEOperationObserver::PrepareForRefresh( CActiveSchedulerWait& aWait ) 00103 { 00104 // Store the wait instance 00105 iWait = &aWait; 00106 00107 // Refresh operation will be started in a moment 00108 iRefreshOngoing = ETrue; 00109 } 00110 00111 // ----------------------------------------------------------------------------- 00112 // CCEOperationObserver::SetMusicView 00113 // ----------------------------------------------------------------------------- 00114 // 00115 void CCEOperationObserver::SetMusicView( CCEMusicView* aTarget ) 00116 { 00117 iTarget = aTarget; 00118 } 00119 00120 // ----------------------------------------------------------------------------- 00121 // CCEOperationObserver::RemoveMusicView 00122 // ----------------------------------------------------------------------------- 00123 // 00124 void CCEOperationObserver::RemoveMusicView() 00125 { 00126 iTarget = NULL; 00127 } 00128 00129 // End of File
|
© Nokia 2009 |