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