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