|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef CMTPMOVEOBJECT_H |
|
22 #define CMTPMOVEOBJECT_H |
|
23 |
|
24 #include <badesca.h> |
|
25 |
|
26 #include "cmtprequestprocessor.h" |
|
27 #include "mmtptransactionproxy.h" |
|
28 |
|
29 class MMTPRequestProcessor; |
|
30 class CMTPObjectBrowser; |
|
31 class CFileMan; |
|
32 |
|
33 /** |
|
34 Implements the proxy data provider MoveObject request processor. |
|
35 @internalComponent |
|
36 |
|
37 */ |
|
38 class CMTPMoveObject : public CMTPRequestProcessor, public MMTPTransactionProxy |
|
39 { |
|
40 private: |
|
41 enum TState |
|
42 { |
|
43 EInit, |
|
44 ERemoveSourceFolderTree |
|
45 }; |
|
46 |
|
47 public: |
|
48 static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection); |
|
49 ~CMTPMoveObject(); |
|
50 |
|
51 private: // From CMTPRequestProcessor |
|
52 void ServiceL(); |
|
53 |
|
54 private: // From MMTPTransactionProxy |
|
55 void ProxyReceiveDataL(MMTPType& aData, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection, TRequestStatus& aStatus); |
|
56 void ProxySendDataL(const MMTPType& aData, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection, TRequestStatus& aStatus); |
|
57 void ProxySendResponseL(const TMTPTypeResponse& aResponse, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection, TRequestStatus& aStatus); |
|
58 void ProxyTransactionCompleteL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection); |
|
59 |
|
60 private: // Helpers |
|
61 /*TMTPResponseCode CreateNewFoldersL(); |
|
62 void CreateAllSubFoldersL(TUint aParentHandle); |
|
63 TBool IsFolderObject(const CMTPObjectMetaData& aObject); |
|
64 void FinalPhaseCreateL();*/ |
|
65 void GetParametersL(); |
|
66 void GetDefaultParentObjectL( TDes& aObjectName ); |
|
67 TMTPResponseCode CanMoveObjectL(const TDesC& aOldName, const TDesC& aNewName) const; |
|
68 void GetSuidFromHandleL(TUint aHandle, TDes& aSuid) const; |
|
69 |
|
70 private: // From CActive |
|
71 void RunL(); |
|
72 TInt RunError(TInt aError); |
|
73 |
|
74 private: |
|
75 CMTPMoveObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection); |
|
76 void ConstructL(); |
|
77 void SendResponseL(TUint16 aCode); |
|
78 void Schedule(TInt aError); |
|
79 |
|
80 private: |
|
81 TMTPResponseCode CreateFolderL(); |
|
82 void RemoveSourceFolderTreeL(); |
|
83 void BrowseHandlesL(); |
|
84 void NextObjectHandleL(); |
|
85 static void OnBrowseObjectL( TAny* aSelf, TUint aHandle, TUint32 aCurDepth ); |
|
86 |
|
87 private: |
|
88 /** |
|
89 FLOGGER debug trace member variable. |
|
90 */ |
|
91 __FLOG_DECLARATION_MEMBER_MUTABLE; |
|
92 |
|
93 RMTPFramework iSingletons; |
|
94 TUint iOwnerDp; |
|
95 RBuf iNewParent; |
|
96 TUint32 iStorageId; |
|
97 CDesCArray* iPathToCreate; |
|
98 static const TMTPRequestElementInfo KMTPMoveObjectPolicy[]; |
|
99 |
|
100 CMTPObjectBrowser* iObjBrowser; |
|
101 RArray< TUint32 > iHandles; |
|
102 RArray< TUint32 > iHandleDepths; |
|
103 RArray< TUint32 > iNewHandleParentStack; |
|
104 TInt iCurrentHandle; |
|
105 TMTPTypeRequest iCurrentRequest; |
|
106 TBool iIsMovingFolder; |
|
107 CMTPObjectMetaData* iObjInfoCache; |
|
108 RBuf iFolderToRemove; |
|
109 TInt iState; |
|
110 CFileMan* iFileMan; |
|
111 RArray<TUint> iTargetDps; |
|
112 }; |
|
113 |
|
114 #endif // CMTPMOVEOBJECT_H |
|
115 |