|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Attachment fetch utility class for event viewers and editors |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMRATTACHMENTUI_H |
|
19 #define CMRATTACHMENTUI_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> // RFs |
|
24 #include <mediafiletypes.hrh> // TMediaFileType |
|
25 #include <aknprogressdialog.h> // MProgressDialogCallback |
|
26 #include <mmgfetchverifier.h> |
|
27 #include <maknfileselectionobserver.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MESMRCalEntry; |
|
31 class CMRAttachmentProgressInfo; |
|
32 class CMRFileManager; |
|
33 class CMRGrid; |
|
34 |
|
35 // CLASS DECLARATIONS |
|
36 /** |
|
37 * Observer for the attachment operation |
|
38 */ |
|
39 class MMRAttachmentUiObserver |
|
40 { |
|
41 public: |
|
42 virtual void AttachmentOperationCompleted( MDesC16Array& aArray ) = 0; |
|
43 |
|
44 protected: |
|
45 virtual ~MMRAttachmentUiObserver() { } |
|
46 }; |
|
47 |
|
48 /** |
|
49 * Class for attachment operation results |
|
50 */ |
|
51 class TAttachmentOpResult |
|
52 { |
|
53 public: |
|
54 inline TAttachmentOpResult() : iFiles( NULL ){} |
|
55 |
|
56 public: |
|
57 MDesC16Array* iFiles; |
|
58 }; |
|
59 |
|
60 /** |
|
61 * Facade class for the attachment related ui operations |
|
62 */ |
|
63 NONSHARABLE_CLASS( CMRAttachmentUi ): public CBase, public MProgressDialogCallback, |
|
64 public MMGFetchVerifier, public MAknFileSelectionObserver |
|
65 { |
|
66 public: |
|
67 /** |
|
68 * Static c'tor |
|
69 */ |
|
70 IMPORT_C static CMRAttachmentUi* NewL(); |
|
71 |
|
72 /** |
|
73 * D'tor |
|
74 */ |
|
75 IMPORT_C ~CMRAttachmentUi(); |
|
76 |
|
77 public: // Interface |
|
78 |
|
79 /** |
|
80 * Launches Attachment Fetch UI |
|
81 * Works synchronously |
|
82 * @param aEntry Entry that will updated with attachments |
|
83 * @return System wide error code |
|
84 */ |
|
85 IMPORT_C TInt LaunchFetchUi( MESMRCalEntry& aEntry ); |
|
86 |
|
87 /** |
|
88 * Launches Attachment Fetch UI |
|
89 * Works synchronously |
|
90 * @param aEntry Entry which attachments will be listed. |
|
91 * Attachments can be added by user also. |
|
92 * @return System wide error code |
|
93 */ |
|
94 IMPORT_C TInt LaunchViewerUi( MESMRCalEntry& aEntry ); |
|
95 |
|
96 /** |
|
97 * Add observer |
|
98 * @param aObserver Observer for attachment process |
|
99 */ |
|
100 IMPORT_C void SetObserver( MMRAttachmentUiObserver& aObserver ); |
|
101 |
|
102 IMPORT_C TAttachmentOpResult LatestOperationResult(); |
|
103 |
|
104 public: // From MProgressDialogCallback |
|
105 void DialogDismissedL( TInt aButtonId ); |
|
106 |
|
107 public: // From MMGFetchVerifier |
|
108 TBool VerifySelectionL( const MDesCArray* aSelectedFiles ); |
|
109 |
|
110 public: // From MAknFileSelectionObserver |
|
111 TBool OkToExitL( const TDesC& aDriveAndPath, const TEntry& aEntry ); |
|
112 |
|
113 private: // Implementation |
|
114 CMRAttachmentUi(); |
|
115 void ConstructL(); |
|
116 void DoLaunchFetchUiL(); |
|
117 void DoLaunchViewerUiL(); |
|
118 TMediaFileType ResolveAttachmentTypeL(); |
|
119 void StartCopyOpL(); |
|
120 void UpdateEntryL(); |
|
121 TBool FileDrmProtectedL( RFile& aFile ); |
|
122 TBool IsDuplicateNameL( const TDesC& aSelectedFile ); |
|
123 |
|
124 private: // Data |
|
125 /// Ref: Currently active entry |
|
126 MESMRCalEntry* iEntry; |
|
127 /// Own: file server sesssion handle |
|
128 RFs iFsSession; |
|
129 /// Own: Progress bar |
|
130 CMRAttachmentProgressInfo* iProgress; |
|
131 /// Own: File count for files to be copied |
|
132 TInt iFileCount; |
|
133 /// Own: Array of files to be copied |
|
134 CDesCArrayFlat* iFilesToCopy; |
|
135 /// Own: Array of files to be added without copy |
|
136 CDesCArrayFlat* iFilesToAdd; |
|
137 /// Own: File copy manager |
|
138 CMRFileManager* iManager; |
|
139 /// Ref: Attachment ui process observer reference |
|
140 MMRAttachmentUiObserver* iObserver; |
|
141 }; |
|
142 #endif // CMRATTACHMENTUI_H |
|
143 // End of file |