examples/ForumNokia/S60_3rd_Edition_TextMTM_Example/modules/Server/inc/TXTSERV.H

00001 // TXTSERV.H
00002 //
00003 // Copyright (c) 1999 Symbian Ltd.  All rights reserved.
00004 //
00005 
00006 #ifndef __TXTSERV_H__
00007 #define __TXTSERV_H__
00008 
00009 #include <mtsr.h>
00010 #include <MSVSTORE.H>
00011 #include <MSVUIDS.H>
00012 #include <MSVIDS.H>
00013 
00014 #include "TXTSPAN.H"
00015 #include "txut.h"
00016 
00017 
00018 //
00019 //      ETxtOperations: The operations the mtm can be in (iCurrentOperation)
00020 //
00021 enum ETxtOperations 
00022         {
00023         ETxtOpIdle,
00024         ETxtOpCopyMoveDel
00025         };
00026 
00027 class CTxtCopyMoveBase;
00028 class CTxtActiveOper;
00029 
00030 //
00031 //      CTextServerMtm: The Server-side MTM implementation
00032 //
00033 class CTextServerMtm : public CBaseServerMtm
00034         {
00035 public:
00036         // Constructor, initialisation, and destructor 
00037         IMPORT_C static CTextServerMtm* NewL(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aInitialEntry);
00038         ~CTextServerMtm();
00039         void SetInitialEntry(CMsvServerEntry* aEntry);
00040 
00041         // Copy and move 
00042         void CopyToLocalL(const CMsvEntrySelection& aSelection,TMsvId aDestination, TRequestStatus& aStatus);
00043         void CopyFromLocalL(const CMsvEntrySelection& aSelection,TMsvId aDestination, TRequestStatus& aStatus);
00044         void CopyWithinServiceL(const CMsvEntrySelection& aSelection,TMsvId aDestination, TRequestStatus& aStatus);
00045         void MoveToLocalL(const CMsvEntrySelection& aSelection,TMsvId aDestination, TRequestStatus& aStatus);
00046         void MoveFromLocalL(const CMsvEntrySelection& aSelection,TMsvId aDestination, TRequestStatus& aStatus);
00047         void MoveWithinServiceL(const CMsvEntrySelection& aSelection,TMsvId aDestination, TRequestStatus& aStatus);
00048 
00049         // Create, change, delete 
00050         void DeleteAllL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus);
00051         void CreateL(TMsvEntry aNewEntry, TRequestStatus& aStatus);
00052         void ChangeL(TMsvEntry aNewEntry, TRequestStatus& aStatus);
00053 
00054         // Command and progress
00055         void StartCommandL(CMsvEntrySelection& aSelection, TInt aCommand, 
00056                 const TDesC8& aParameter, TRequestStatus& aStatus);
00057         TBool CommandExpected();
00058         const TDesC8& Progress();
00059 
00060 protected:
00061         // Active object completion 
00062         void DoCancel();
00063         void DoRunL();
00064         void DoComplete(TInt aError);
00065 
00066 private:
00067         CTextServerMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aInitialEntry);
00068         void ConstructL();
00069         void DoOperationL(CTxtActiveOper* aActiveOperation, const CMsvEntrySelection& aSelection,
00070                 TMsvId aDestination, TRequestStatus& aStatus);
00071         void ConnectToServiceL();
00072         void DoRefreshL();
00073 
00074         // General asserts
00075         void AssertConnected();
00076         void AssertHasServerEntry();
00077         void AssertIdle();
00078 
00079 
00080         
00081 private:
00082         TTxtProgressBuf iProgressBuf;
00083         TInt iCurrentOperation;
00084         CMsvServerEntry* iEntry;        
00085         TRequestStatus* iReportStatus;
00086         RFs      iFs;
00087         TMsvId  iServiceEntryId;
00088         TMTMTxtSettings* iTxtSettings;
00089 
00090         CTxtCopyMoveBase* iTxtCopyMove; // Needed for copy, move, delete ops
00091         TParse iParse; // Needed for the move to remote operations, to keep track of the current folder.
00092         };
00093 
00094 // Assert functions
00095 inline void CTextServerMtm::AssertConnected()
00096         {
00097         __ASSERT_DEBUG(iServiceEntryId != KMsvNullIndexEntryId, gPanic(ETxtsInvalidService));
00098         __ASSERT_DEBUG(iTxtSettings != NULL, gPanic(ETxtsInvalidService));
00099         }
00100 
00101 inline void CTextServerMtm::AssertHasServerEntry()
00102         {
00103         __ASSERT_DEBUG(iEntry != NULL, gPanic(ETxtsInvalidService));
00104         }
00105 
00106 inline void CTextServerMtm::AssertIdle()
00107         {
00108         __ASSERT_DEBUG(iCurrentOperation==ETxtOpIdle,gPanic(ETxtsAlreadyBusy));
00109         }
00110 
00111 
00112 #endif

Generated by  doxygen 1.6.2