examples/Messaging/TextMTM/txts/TXTSERV.H

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

Generated on Thu Jan 21 10:32:59 2010 for TB10.1 Example Applications by  doxygen 1.5.3