examples/S60CppExamples/ClientServerSync/client/src/cssyncdocument.cpp

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

Generated by  doxygen 1.6.2