25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: FreestyleEmailUi attachments list model and model item definition.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __FREESTYLEEMAILUI_SENDATTACHMENTSLISTMODEL_H__
|
|
20 |
#define __FREESTYLEEMAILUI_SENDATTACHMENTSLISTMODEL_H__
|
|
21 |
|
|
22 |
// SYSTEM INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
//<cmail>
|
|
25 |
#include "fstreelistconstants.h"
|
|
26 |
#include "fstreelistobserver.h"
|
|
27 |
//</cmail>
|
|
28 |
|
|
29 |
// INTERNAL INCLUDES
|
|
30 |
#include "FreestyleEmailUiListModel.h"
|
|
31 |
|
|
32 |
// FORWARD DECLARATIONS
|
|
33 |
class CFreestyleEmailUiAppUi;
|
|
34 |
class CFreestyleEmailUiSendAttachmentsListControl;
|
|
35 |
class CFsTreeVisualizerBase;
|
|
36 |
class CFsTreeList;
|
|
37 |
class CAlfEnv;
|
|
38 |
// <cmail>
|
|
39 |
// class TFsTreeListEvent;
|
|
40 |
// </cmail>
|
|
41 |
|
|
42 |
// CLASS DECLARATION
|
|
43 |
class CFSEmailUiSendAttachmentsListModelItem :
|
|
44 |
public CBase,
|
|
45 |
public MFSListModelItem
|
|
46 |
{
|
|
47 |
public:
|
|
48 |
static CFSEmailUiSendAttachmentsListModelItem* NewL(
|
|
49 |
const TDesC& aFileName,
|
|
50 |
TInt aFileSize,
|
|
51 |
TFileType aFileType,
|
|
52 |
TBool aRemote,
|
|
53 |
TBool aReadOnly );
|
|
54 |
|
|
55 |
static CFSEmailUiSendAttachmentsListModelItem* NewLC(
|
|
56 |
const TDesC& aFileName,
|
|
57 |
TInt aFileSize,
|
|
58 |
TFileType aFileType,
|
|
59 |
TBool aRemote,
|
|
60 |
TBool aReadOnly );
|
|
61 |
|
|
62 |
virtual ~CFSEmailUiSendAttachmentsListModelItem();
|
|
63 |
|
|
64 |
private:
|
|
65 |
CFSEmailUiSendAttachmentsListModelItem(
|
|
66 |
const TDesC& aFileName,
|
|
67 |
TInt aFileSize,
|
|
68 |
TFileType aFileType,
|
|
69 |
TBool aRemote,
|
|
70 |
TBool aReadOnly );
|
|
71 |
|
|
72 |
public:
|
|
73 |
const TDesC& FileName() const;
|
|
74 |
TPtrC FileExtension() const;
|
|
75 |
TFSMailMsgId MailMsgPartId() const;
|
|
76 |
void SetMailMsgPartId( const TFSMailMsgId aPartId );
|
|
77 |
TInt FileSize() const;
|
|
78 |
TFsTreeItemId ItemId() const;
|
|
79 |
void SetItemId( TFsTreeItemId aItemId );
|
|
80 |
void SetRemote( TBool aIsRemote );
|
|
81 |
TBool IsRemote();
|
|
82 |
TBool IsReadOnly();
|
|
83 |
TFileType FileType();
|
|
84 |
|
|
85 |
private:
|
|
86 |
|
|
87 |
TFileName iFileName;
|
|
88 |
TFSMailMsgId iMailMsgPartId;
|
|
89 |
TInt iFileSize;
|
|
90 |
TFsTreeItemId iItemId;
|
|
91 |
TBool iRemote;
|
|
92 |
TBool iReadOnly;
|
|
93 |
TFileType iFileType;
|
|
94 |
};
|
|
95 |
|
|
96 |
// CLASS DECLARATION
|
|
97 |
class CFSEmailUiSendAttachmentsListModel :
|
|
98 |
public CBase,
|
|
99 |
public MFSEmailListModel,
|
|
100 |
public MFsTreeListObserver
|
|
101 |
{
|
|
102 |
public: // 2nd phase constructors
|
|
103 |
static CFSEmailUiSendAttachmentsListModel* NewL(
|
|
104 |
CFreestyleEmailUiAppUi* aAppUi,
|
|
105 |
CAlfEnv& aEnv,
|
|
106 |
CFreestyleEmailUiSendAttachmentsListControl* aControl );
|
|
107 |
|
|
108 |
static CFSEmailUiSendAttachmentsListModel* NewLC(
|
|
109 |
CFreestyleEmailUiAppUi* aAppUi,
|
|
110 |
CAlfEnv& aEnv,
|
|
111 |
CFreestyleEmailUiSendAttachmentsListControl* aControl);
|
|
112 |
|
|
113 |
virtual ~CFSEmailUiSendAttachmentsListModel();
|
|
114 |
|
|
115 |
public:
|
|
116 |
void AppendL( MFSListModelItem* aItem );
|
|
117 |
|
|
118 |
void InsertL( MFSListModelItem* aItem, TInt aIndex );
|
|
119 |
|
|
120 |
void RemoveAndDestroy( TInt aIndex );
|
|
121 |
|
|
122 |
MFSListModelItem* Item( TInt aIndex );
|
|
123 |
|
|
124 |
TInt HighlightedIndex();
|
|
125 |
|
|
126 |
TInt Count() const;
|
|
127 |
|
|
128 |
CFreestyleEmailUiAppUi* AppUi();
|
|
129 |
|
|
130 |
TFsTreeItemId AppendItemToAttachmentListL(
|
|
131 |
CFSEmailUiSendAttachmentsListModelItem* aItem );
|
|
132 |
|
|
133 |
CFsTreeList* AttachmentList();
|
|
134 |
|
|
135 |
void ReFreshListL();
|
|
136 |
|
|
137 |
void ReScaleUiL();
|
|
138 |
|
|
139 |
void UpdateHeaderItemTextL();
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Removes item from model and list and also
|
|
143 |
* calls fw to remove attachment from message
|
|
144 |
*/
|
|
145 |
void RemoveItemByIndexL( const TInt aIndex );
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Removes all attachment items from the model, list, and message
|
|
149 |
*/
|
|
150 |
void RemoveAllAttachmentsL();
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Returns the total size of attachments in bytes.
|
|
154 |
*/
|
|
155 |
TInt TotalAttachmentSize();
|
|
156 |
|
|
157 |
TBool HasRemoteAttachments();
|
|
158 |
|
|
159 |
TBool HasReadOnlyAttachments();
|
|
160 |
|
|
161 |
CFSEmailUiSendAttachmentsListModelItem* GetSelectedItem();
|
|
162 |
|
|
163 |
CFSEmailUiSendAttachmentsListModelItem* GetItemByNodeId( TFsTreeItemId aNodeId );
|
|
164 |
|
|
165 |
TBool CanSelectPreviousItem();
|
|
166 |
|
|
167 |
void GoToTopL();
|
|
168 |
void GoToBottomL();
|
|
169 |
void CollapseL();
|
|
170 |
void ExpandL();
|
|
171 |
void CollapseExpandAllToggleL();
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Empties model from items
|
|
175 |
* Does not call fw to remove attas from message
|
|
176 |
*/
|
|
177 |
void Clear();
|
|
178 |
|
|
179 |
//<cmail> touch
|
|
180 |
CFsTreeVisualizerBase* GetVisualizer();
|
|
181 |
//</cmail>
|
|
182 |
|
|
183 |
CAlfLayout* GetParentLayout() const;
|
|
184 |
|
|
185 |
/** Handles action for the focused item. */
|
|
186 |
void HandleActionL();
|
|
187 |
|
|
188 |
protected: // from MFsTreeListObserver
|
|
189 |
|
|
190 |
// <cmail> Touch
|
|
191 |
void TreeListEventL( const TFsTreeListEvent aEvent,
|
|
192 |
const TFsTreeItemId aId,
|
|
193 |
const TPoint& aPoint );
|
|
194 |
// </cmail>
|
|
195 |
|
|
196 |
|
|
197 |
private: // constructors not available directly
|
|
198 |
|
|
199 |
CFSEmailUiSendAttachmentsListModel( CFreestyleEmailUiAppUi* aAppUi );
|
|
200 |
void ConstructL(
|
|
201 |
CAlfEnv& aEnv,
|
|
202 |
CFreestyleEmailUiSendAttachmentsListControl* aControl );
|
|
203 |
|
|
204 |
private:
|
|
205 |
|
|
206 |
//<cmail> touch
|
|
207 |
void DoHandleActionL( );
|
|
208 |
//</cmail>
|
|
209 |
|
|
210 |
void CreateListSkeletonL();
|
|
211 |
void CreateListItemsL();
|
|
212 |
void InitAttachmentListL();
|
|
213 |
void CreateListSeparatorL(
|
|
214 |
TInt aResourceId,
|
|
215 |
TFsTreeItemId aParentNodeId,
|
|
216 |
CFsTreePlainOneLineNodeVisualizer*& aVisualizer,
|
|
217 |
TFsTreeItemId& aSeparatorNodeId );
|
|
218 |
|
|
219 |
//<cmail>
|
|
220 |
void SetupTitlePaneTextL();
|
|
221 |
//</cmail>
|
|
222 |
|
|
223 |
private:
|
|
224 |
|
|
225 |
CFreestyleEmailUiAppUi* iAppUi;
|
|
226 |
RPointerArray<CFSEmailUiSendAttachmentsListModelItem> iItems;
|
|
227 |
//<cmail>
|
|
228 |
|
|
229 |
//</cmail>
|
|
230 |
CAlfEnv* iEnv;
|
|
231 |
CFreestyleEmailUiSendAttachmentsListControl* iControl;
|
|
232 |
|
|
233 |
// Attachment list
|
|
234 |
CFsTreeList* iAttachmentsList;
|
|
235 |
CAlfDeckLayout* iListLayout;
|
|
236 |
CFsTreeVisualizerBase* iAttachmentsTreeListVisualizer;
|
|
237 |
|
|
238 |
TFsTreeItemId iLocalNode;
|
|
239 |
TFsTreeItemId iRemoteNode;
|
|
240 |
//not owned
|
|
241 |
CFsTreePlainOneLineNodeVisualizer* iLocalNodeVisualiser;
|
|
242 |
//not owned
|
|
243 |
CFsTreePlainOneLineNodeVisualizer* iRemoteNodeVisualiser;
|
|
244 |
};
|
|
245 |
|
|
246 |
#endif //__FREESTYLEEMAILUI_SENDATTACHMENTSLISTMODEL_H__
|
|
247 |
|