00001 /* 00002 * ============================================================================== 00003 * Name : csasyncdocument.cpp 00004 * Part of : CSAsync 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2004-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 // INCLUDE FILES 00017 #include "CSAsyncAppUi.h" 00018 #include "CSAsyncDocument.h" 00019 #include "CSAsyncRequestHandler.h" 00020 00021 // ========================= MEMBER FUNCTIONS ================================== 00022 00023 // ----------------------------------------------------------------------------- 00024 // CCSAsyncDocument::NewL() 00025 // Two-phased constructor. 00026 // ----------------------------------------------------------------------------- 00027 // 00028 CCSAsyncDocument* CCSAsyncDocument::NewL( CEikApplication& aApp ) 00029 { 00030 CCSAsyncDocument* self = NewLC( aApp ); 00031 CleanupStack::Pop( self ); 00032 return self; 00033 } 00034 00035 // ----------------------------------------------------------------------------- 00036 // CCSAsyncDocument::NewLC() 00037 // Two-phased constructor. 00038 // ----------------------------------------------------------------------------- 00039 // 00040 CCSAsyncDocument* CCSAsyncDocument::NewLC( CEikApplication& aApp ) 00041 { 00042 CCSAsyncDocument* self = new ( ELeave ) CCSAsyncDocument( aApp ); 00043 CleanupStack::PushL( self ); 00044 self->ConstructL(); 00045 return self; 00046 } 00047 00048 // ----------------------------------------------------------------------------- 00049 // CCSAsyncDocument::ConstructL() 00050 // Symbian 2nd phase constructor can leave. 00051 // ----------------------------------------------------------------------------- 00052 // 00053 void CCSAsyncDocument::ConstructL() 00054 { 00055 // No implementation required 00056 } 00057 00058 // ----------------------------------------------------------------------------- 00059 // CCSAsyncDocument::CCSAsyncDocument() 00060 // C++ default constructor can NOT contain any code, that might leave. 00061 // ----------------------------------------------------------------------------- 00062 CCSAsyncDocument::CCSAsyncDocument( CEikApplication& aApp ) 00063 : CAknDocument( aApp ) 00064 { 00065 // No implementation required 00066 } 00067 00068 // ----------------------------------------------------------------------------- 00069 // CCSAsyncDocument::~CCSAsyncDocument() 00070 // Destructor. 00071 // ----------------------------------------------------------------------------- 00072 // 00073 CCSAsyncDocument::~CCSAsyncDocument() 00074 { 00075 delete iHandler; 00076 } 00077 00078 // ----------------------------------------------------------------------------- 00079 // CCSAsyncDocument::CreateAppUiL() 00080 // Creates a CCSAsyncAppUi object and return a pointer to it. 00081 // ----------------------------------------------------------------------------- 00082 // 00083 CEikAppUi* CCSAsyncDocument::CreateAppUiL() 00084 { 00085 // Create the application user interface, and return a pointer to it 00086 CCSAsyncAppUi* appUi = new ( ELeave ) CCSAsyncAppUi; 00087 CleanupStack::PushL( appUi ); 00088 iHandler = CCSAsyncRequestHandler::NewL( *appUi ); 00089 CleanupStack::Pop( appUi ) ; 00090 return appUi; 00091 } 00092 00093 // ----------------------------------------------------------------------------- 00094 // CCSAsyncDocument::UpdateTime() 00095 // Asks the time server to update this documents locally stored time. 00096 // ----------------------------------------------------------------------------- 00097 // 00098 void CCSAsyncDocument::UpdateTime() 00099 { 00100 iHandler->RequestTime(); 00101 } 00102 00103 // ----------------------------------------------------------------------------- 00104 // CCSAsyncDocument::StopClock() 00105 // Stops the clock. 00106 // ----------------------------------------------------------------------------- 00107 // 00108 void CCSAsyncDocument::StopClock() 00109 { 00110 if ( ClockActive() ) 00111 { 00112 iHandler->CancelRequest() ; 00113 } 00114 } 00115 00116 // ----------------------------------------------------------------------------- 00117 // CCSAsyncDocument::Time() 00118 // Returns the currently stored time. 00119 // ----------------------------------------------------------------------------- 00120 // 00121 TTime CCSAsyncDocument::Time() const 00122 { 00123 return iHandler->Time(); 00124 } 00125 00126 // ----------------------------------------------------------------------------- 00127 // CCSAsyncDocument::ClockActive() 00128 // Checks whether the clock has been started. 00129 // ----------------------------------------------------------------------------- 00130 // 00131 TBool CCSAsyncDocument::ClockActive() const 00132 { 00133 return iHandler->IsActive(); 00134 } 00135 00136 // End of File 00137