00001 /* 00002 * ============================================================================== 00003 * Name : cssyncdocument.cpp 00004 * Part of : CSSync 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 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 00019 // INCLUDE FILES 00020 #include "CSSyncAppUi.h" 00021 #include "CSSyncDocument.h" 00022 00023 // ========================= MEMBER FUNCTIONS ================================== 00024 00025 // ----------------------------------------------------------------------------- 00026 // CCSSyncDocument::NewL() 00027 // Two-phased constructor. 00028 // ----------------------------------------------------------------------------- 00029 // 00030 CCSSyncDocument* CCSSyncDocument::NewL( CEikApplication& aApp ) 00031 { 00032 CCSSyncDocument* self = NewLC( aApp ); 00033 CleanupStack::Pop( self ); 00034 return self; 00035 } 00036 00037 // ----------------------------------------------------------------------------- 00038 // CCSSyncDocument::NewLC() 00039 // Two-phased constructor. 00040 // ----------------------------------------------------------------------------- 00041 // 00042 CCSSyncDocument* CCSSyncDocument::NewLC( CEikApplication& aApp ) 00043 { 00044 CCSSyncDocument* self = new ( ELeave ) CCSSyncDocument( aApp ); 00045 CleanupStack::PushL( self ); 00046 self->ConstructL(); 00047 return self; 00048 } 00049 00050 // ----------------------------------------------------------------------------- 00051 // CCSSyncDocument::ConstructL() 00052 // Symbian 2nd phase constructor can leave. 00053 // ----------------------------------------------------------------------------- 00054 // 00055 void CCSSyncDocument::ConstructL() 00056 { 00057 User::LeaveIfError( iServer.Connect() ); 00058 } 00059 00060 // ----------------------------------------------------------------------------- 00061 // CCSSyncDocument::CCSSyncDocument() 00062 // C++ default constructor can NOT contain any code, that might leave. 00063 // ----------------------------------------------------------------------------- 00064 // 00065 CCSSyncDocument::CCSSyncDocument( CEikApplication& aApp ) 00066 : CAknDocument( aApp ) 00067 { 00068 // No implementation required 00069 } 00070 00071 // ----------------------------------------------------------------------------- 00072 // CCSSyncDocument::~CCSSyncDocument() 00073 // Destructor. 00074 // ----------------------------------------------------------------------------- 00075 // 00076 CCSSyncDocument::~CCSSyncDocument() 00077 { 00078 iServer.Close(); 00079 } 00080 00081 // ----------------------------------------------------------------------------- 00082 // CCSSyncDocument::CreateAppUiL() 00083 // Creates a CCSAsyncAppUi object and return a pointer to it. 00084 // ----------------------------------------------------------------------------- 00085 // 00086 CEikAppUi* CCSSyncDocument::CreateAppUiL() 00087 { 00088 // Create the application user interface, and return a pointer to it 00089 return ( static_cast<CEikAppUi*>( new ( ELeave ) CCSSyncAppUi() ) ); 00090 } 00091 00092 // ----------------------------------------------------------------------------- 00093 // CCSSyncDocument::UpdateTime() 00094 // Asks the time server to update this documents locally stored time. 00095 // ----------------------------------------------------------------------------- 00096 // 00097 void CCSSyncDocument::UpdateTime() 00098 { 00099 iServer.RequestTime( iTime ); 00100 } 00101 00102 // ----------------------------------------------------------------------------- 00103 // CCSSyncDocument::Time() 00104 // Returns the currently stored time. 00105 // ----------------------------------------------------------------------------- 00106 // 00107 const TTime& CCSSyncDocument::Time() const 00108 { 00109 return iTime; 00110 } 00111 00112 00113 // End of File