66
|
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 :
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CALENATTACHMENTINFO_H
|
|
19 |
#define CALENATTACHMENTINFO_H
|
|
20 |
|
|
21 |
#include <apmstd.h>
|
|
22 |
#include <msvstd.h>
|
|
23 |
|
|
24 |
class CGulIcon;
|
|
25 |
class CCalenAttachmentModel;
|
|
26 |
|
|
27 |
// ========== CONSTANTS ====================================
|
|
28 |
|
|
29 |
// Farsi takes 14 bytes when attachment has > 1000 bytes
|
|
30 |
const TInt KCalenAttaSizeStringLength = 32;
|
|
31 |
// One KiloByte
|
|
32 |
const TInt KLocalKilo = 1024;
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Attachment information
|
|
36 |
*/
|
|
37 |
class CCalenAttachmentInfo : public CBase
|
|
38 |
{
|
|
39 |
public:
|
|
40 |
|
|
41 |
enum TCalenAttachmentStoreType
|
|
42 |
{
|
|
43 |
ECalenNewAttachment,
|
|
44 |
ECalenAttachmentFetchedFromEntry
|
|
45 |
};
|
|
46 |
|
|
47 |
/**
|
|
48 |
* First phase construction
|
|
49 |
*
|
|
50 |
* @param aAttachmentModel reference to the CCalenAttachmentModel
|
|
51 |
* @param aFileName filename of the attachment
|
|
52 |
* @param aSize size of the attachment
|
|
53 |
* @param aFetched attachment fetched or not
|
|
54 |
* @param aDataType mime type of the attachment
|
|
55 |
* @param aStoreType storetype of the attachment info
|
|
56 |
* @return returns pointer to the CCalenAttachmentInfo
|
|
57 |
*/
|
|
58 |
IMPORT_C static CCalenAttachmentInfo* NewL( CCalenAttachmentModel& aAttachmentModel,
|
|
59 |
const TFileName& aFileName,
|
|
60 |
const TFileName& aSystemFileName,
|
|
61 |
TInt aSize,
|
|
62 |
TBool Fetched,
|
|
63 |
const TDataType& aDataType,
|
|
64 |
const TCalenAttachmentStoreType aStoreType );
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Destructor.
|
|
68 |
*/
|
|
69 |
~CCalenAttachmentInfo();
|
|
70 |
|
|
71 |
private:
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Default Constructor.
|
|
75 |
*
|
|
76 |
* @param aAttachmentModel reference to the CCalenAttachmentModel
|
|
77 |
* @param aFileName filename of the attachment
|
|
78 |
* @param aSize size of the attachment
|
|
79 |
* @param aFetched attachment fetched or not
|
|
80 |
* @param aDataType mime type of the attachment
|
|
81 |
* @param aStoreType storetype of the attachment info
|
|
82 |
*/
|
|
83 |
CCalenAttachmentInfo( CCalenAttachmentModel& aAttachmentModel,
|
|
84 |
const TFileName& aFileName,
|
|
85 |
const TFileName& aSystemFileName,
|
|
86 |
TInt aSize,
|
|
87 |
TBool aFetched,
|
|
88 |
const TDataType& aDataType,
|
|
89 |
const TCalenAttachmentStoreType aStoreType);
|
|
90 |
|
|
91 |
/**
|
|
92 |
* 2nd phase constructor.
|
|
93 |
*/
|
|
94 |
void ConstructL();
|
|
95 |
|
|
96 |
public:
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Returns reference to the filename this attachment represents.
|
|
100 |
*
|
|
101 |
* @return returns filename of the attachment
|
|
102 |
*/
|
|
103 |
IMPORT_C const TFileName& FileName() const;
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Set the filename of this attachment.
|
|
107 |
*
|
|
108 |
* @param aFileName filename of the attachment
|
|
109 |
*/
|
|
110 |
IMPORT_C void SetFileName( const TFileName& aFileName );
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Returns the size of the attachment.
|
|
114 |
*
|
|
115 |
* @return returns size of the attachmen
|
|
116 |
*/
|
|
117 |
IMPORT_C TInt Size() const;
|
|
118 |
|
|
119 |
/**
|
|
120 |
* Returns the size of the atatchment in the form of a string to be displayed on the UI
|
|
121 |
*
|
|
122 |
* @return returns size string
|
|
123 |
*/
|
|
124 |
IMPORT_C HBufC* SizeString() const;
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Returns ETrue if this attachment is fetched.
|
|
128 |
* @return
|
|
129 |
*/
|
|
130 |
IMPORT_C TBool IsFetched() const;
|
|
131 |
|
|
132 |
/**
|
|
133 |
* Sets the fetched attribute of this attachment.
|
|
134 |
* @param aFetched
|
|
135 |
*/
|
|
136 |
IMPORT_C void SetFetched( TBool aFetched );
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Returns the datatype (MIME type) of this attachment.
|
|
140 |
* @return
|
|
141 |
*/
|
|
142 |
IMPORT_C const TDataType& DataType() const;
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Get icon of this attachment.
|
|
146 |
* @return
|
|
147 |
*/
|
|
148 |
IMPORT_C CGulIcon* Icon() const;
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Get the store type whether attachment is fetched from the entry
|
|
152 |
* or attachment is new one
|
|
153 |
*
|
|
154 |
* @return TCalenAttachmentStoreType
|
|
155 |
* ECalenNewAttachment if attachment is new
|
|
156 |
* ECalenAttachmentFetchedFromEntry if attachment is fetched from entry
|
|
157 |
*/
|
|
158 |
IMPORT_C TCalenAttachmentStoreType StoreType() const;
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Returns reference to the systemfilename this attachment represents.
|
|
162 |
*
|
|
163 |
* @return returns systemfilename of the attachment
|
|
164 |
*/
|
|
165 |
IMPORT_C const TFileName& SystemFileName() const;
|
|
166 |
/**
|
|
167 |
* Performs icon updating.
|
|
168 |
*/
|
|
169 |
void DoUpdateIconL();
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Sets the file handle.
|
|
173 |
* @param aFile File handle to be set
|
|
174 |
*
|
|
175 |
*/
|
|
176 |
void SetFileHandle(RFile& aFile);
|
|
177 |
|
|
178 |
/**
|
|
179 |
* Gets the file handle.
|
|
180 |
* @param File handle.
|
|
181 |
*
|
|
182 |
*/
|
|
183 |
void FileHandle( RFile& aFile );
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Check whether the file handle is set or not.
|
|
187 |
* @return The isSetFileHandle
|
|
188 |
*
|
|
189 |
*/
|
|
190 |
TBool IsFileHandleSet();
|
|
191 |
|
|
192 |
|
|
193 |
private:
|
|
194 |
|
|
195 |
CCalenAttachmentModel& iAttachmentModel;
|
|
196 |
TFileName iFileName;
|
|
197 |
TFileName iSystemFileName;
|
|
198 |
TInt iSize;
|
|
199 |
TDataType iDataType;
|
|
200 |
CGulIcon* iIcon;
|
|
201 |
TBool iIsFetched;
|
|
202 |
TCalenAttachmentStoreType iAttachmentStoreType;
|
|
203 |
RFile iFile;
|
|
204 |
TBool isSetFileHandle;
|
|
205 |
};
|
|
206 |
|
|
207 |
#endif // CALENATTACHMENTINFO_H
|
|
208 |
|