author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:32:06 +0100 | |
branch | GCC_SURGE |
changeset 47 | 5b14749788d7 |
parent 27 | e4592d119491 |
parent 44 | 36f374c67aa8 |
permissions | -rw-r--r-- |
31 | 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: Offers file share services. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef __SHARE_UI_PRIVATE_H__ |
|
19 |
#define __SHARE_UI_PRIVATE_H__ |
|
20 |
||
21 |
#include <QObject> |
|
22 |
#include <QMap> |
|
23 |
#include <QAction> |
|
24 |
#include <QModelIndex> |
|
25 |
#include <QStandardItemModel> |
|
26 |
#include <HbListViewItem> |
|
27 |
#include <xqappmgr.h> |
|
28 |
||
29 |
// FORWARD DECLARATIONS |
|
30 |
class XQAiwRequest; |
|
31 |
class XQAiwInterfaceDescriptor; |
|
32 |
class HbAction; |
|
33 |
class HbDialog; |
|
34 |
class HbListView; |
|
35 |
class HbListViewItem; |
|
36 |
class HbTextItem; |
|
37 |
class HbIconItem; |
|
38 |
||
39 |
#define SERVICE_INTERFACE "com.nokia.symbian.IFileShare" |
|
40 |
#define SHARE_OP "send(QVariant)" |
|
41 |
||
42 |
/** |
|
43 |
* Data roles for list |
|
44 |
*/ |
|
45 |
enum ShareItemDataRole { |
|
46 |
ProviderNameRole = 10000, |
|
47 |
ProviderIconRole = 10001 |
|
48 |
}; |
|
49 |
||
50 |
/** |
|
51 |
* Share List item prototype |
|
52 |
*/ |
|
53 |
class ShareListItem : public HbListViewItem |
|
54 |
{ |
|
55 |
Q_OBJECT |
|
56 |
||
57 |
public: |
|
58 |
ShareListItem(QGraphicsItem* parent=0); |
|
59 |
HbAbstractViewItem* createItem(); |
|
60 |
void updateChildItems(); |
|
61 |
private: |
|
62 |
HbIconItem* mProviderIcon; |
|
63 |
HbTextItem *mProviderName; |
|
64 |
}; |
|
65 |
||
66 |
/** |
|
67 |
* Private implementaion of shareui. |
|
68 |
* implements showing sending services dialog and sending files |
|
69 |
*/ |
|
70 |
class ShareUiPrivate : public QObject |
|
71 |
{ |
|
72 |
Q_OBJECT |
|
73 |
||
74 |
public: |
|
75 |
||
76 |
/** |
|
77 |
* Constructor |
|
78 |
*/ |
|
79 |
ShareUiPrivate(); |
|
80 |
||
81 |
/** |
|
82 |
* Destructor |
|
83 |
*/ |
|
84 |
virtual ~ShareUiPrivate(); |
|
85 |
||
86 |
/** |
|
87 |
* Initiate share for the specified files. |
|
88 |
* @param fileList list of paths to files.eg: c:\images\sunset.jpg |
|
89 |
* @param embedded true if service launched is embedded in the |
|
90 |
* launched application. |
|
91 |
* |
|
92 |
* @return bool true if dialog initialization successfull. Otherwise false. |
|
93 |
*/ |
|
94 |
bool init(QStringList& fileList, bool embedded); |
|
95 |
||
96 |
public slots: |
|
97 |
||
98 |
/** |
|
99 |
* Handles setting the arguments for triggered service. |
|
100 |
*/ |
|
101 |
void onTriggered(void); |
|
102 |
||
103 |
/** |
|
104 |
* Slot for handling valid returns from the framework. |
|
105 |
* @param result const QVariant& |
|
106 |
*/ |
|
107 |
void handleOk(const QVariant& result); |
|
108 |
||
109 |
/** |
|
110 |
* Slot for handling errors. Error ids are provided as |
|
111 |
* 32-bit integers. |
|
112 |
* @param errorCode qint32 |
|
113 |
*/ |
|
114 |
void handleError(int errorCode, const QString& errorMessage); |
|
115 |
||
116 |
private slots: |
|
117 |
||
118 |
/** |
|
119 |
* When a list box item is pressed, this slot should be invoked. The action |
|
120 |
* corresponding to the clicked list item should be invoked with the stored lis |
|
121 |
* of files. |
|
122 |
* |
|
123 |
* @param index QModelIndex |
|
124 |
* |
|
125 |
*/ |
|
126 |
void itemActivated(QModelIndex index); |
|
127 |
||
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
128 |
/** |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
129 |
* Reset internal data structures |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
130 |
*/ |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
131 |
void reset(); |
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
132 |
|
31 | 133 |
private: |
134 |
/** |
|
135 |
* Fetch the action associated with a specified interface descriptor. |
|
136 |
* @param interfaceDescriptor Descriptor got from application manager. |
|
137 |
* @return The action. |
|
138 |
*/ |
|
139 |
HbAction* fetchServiceAction(XQAiwInterfaceDescriptor interfaceDescriptor); |
|
140 |
||
141 |
/** |
|
142 |
* Creates the view for the share ui dialog. |
|
143 |
*/ |
|
144 |
void initializeUi(); |
|
145 |
||
146 |
/** |
|
147 |
* Update the shareui dialog (and associated list items) once the required |
|
148 |
* information has been fetched. |
|
149 |
* @param action HbAction* The action associated with list entry. |
|
150 |
* @param iconName The icon to be displayed |
|
151 |
*/ |
|
152 |
void updateShareUiDialogList(HbAction* action, QString iconName); |
|
153 |
||
154 |
/** |
|
155 |
* Convert a QAction to HbAction. |
|
156 |
* @param action QAction* |
|
157 |
* @return HbAction* |
|
158 |
*/ |
|
159 |
HbAction* convertAction(QAction *action); |
|
160 |
||
161 |
#ifdef __SHAREUI_MIME_HANDLING__ |
|
162 |
/** |
|
163 |
* Checks if the specified content type is allowed as per the |
|
164 |
* specified MIME pattern strings. |
|
165 |
* @param mimeType List of file MIME types |
|
166 |
* @param mimePattern List of file MIME patterns |
|
167 |
* @return true if the content is allowed. |
|
168 |
*/ |
|
169 |
bool isContentAllowed ( QStringList mimeType, QString mimePattern ); |
|
170 |
||
171 |
/** Checks if the specified content type is blocked as per the |
|
172 |
* specified MIME pattern strings. |
|
173 |
* @param mimeType List of file MIME types |
|
174 |
* @param mimePattern List of file MIME patterns |
|
175 |
* @return true if the content is blocked. |
|
176 |
*/ |
|
177 |
bool isContentBlocked ( QStringList mimeType, QString mimePattern ); |
|
178 |
||
179 |
/** |
|
180 |
* Get file attributes |
|
181 |
* @param fileList List of files. |
|
182 |
* @param mimeTypeList (out) List of MIME types corresponding to the files. |
|
183 |
* @param forwardStatusList (out) List of forward status corresponding to the files. |
|
184 |
*/ |
|
185 |
void getFileAttributes ( QStringList& fileList, QStringList& mimeTypeList, |
|
186 |
QStringList& forwardStatusList ); |
|
187 |
#endif |
|
188 |
||
189 |
/** |
|
190 |
* Show notes |
|
191 |
*/ |
|
192 |
void showNote(QString text); |
|
44
36f374c67aa8
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
193 |
|
31 | 194 |
private: |
195 |
/** |
|
196 |
* List of files to be sent. |
|
197 |
*/ |
|
198 |
QList<QVariant> mFileList; |
|
199 |
||
200 |
/** |
|
201 |
* Service List |
|
202 |
*/ |
|
203 |
QList<XQAiwRequest*> mAiwRequestList; |
|
204 |
||
205 |
/** |
|
206 |
* ShareUi dialog |
|
207 |
*/ |
|
208 |
HbDialog* mSharePopup; |
|
209 |
||
210 |
/** |
|
211 |
* item model for content list view. |
|
212 |
*/ |
|
213 |
QStandardItemModel* mContentItemModel; |
|
214 |
||
215 |
/** |
|
216 |
* content view |
|
217 |
*/ |
|
218 |
HbListView* mContentListView; |
|
219 |
||
220 |
/** |
|
221 |
* mapping qmodelindex to the action |
|
222 |
*/ |
|
223 |
QMap<QModelIndex, HbAction*> mIndexActionMap; |
|
224 |
||
225 |
/** |
|
226 |
* Application Manager. |
|
227 |
*/ |
|
228 |
XQApplicationManager mAppManager; |
|
229 |
||
230 |
/** |
|
231 |
* Whether to launch the sending application as embedded or not. |
|
232 |
*/ |
|
233 |
bool mIsEmbedded; |
|
234 |
}; |
|
235 |
||
236 |
#endif /* __SHARE_UI_PRIVATE_H__ */ |