44 #include "hswidgetpositioningonwidgetadd.h" |
44 #include "hswidgetpositioningonwidgetadd.h" |
45 #include "hsconfiguration.h" |
45 #include "hsconfiguration.h" |
46 #include "hstest_global.h" |
46 #include "hstest_global.h" |
47 #include "hswidgetpositioningonwidgetmove.h" |
47 #include "hswidgetpositioningonwidgetmove.h" |
48 |
48 |
|
49 #ifdef Q_OS_SYMBIAN |
|
50 #include <xqappmgr.h> |
|
51 #include <xqcallinfo.h> |
|
52 #include <logsservices.h> |
|
53 #include <xqrequestinfo.h> |
|
54 #endif // Q_OS_SYMBIAN |
|
55 |
49 QTM_USE_NAMESPACE |
56 QTM_USE_NAMESPACE |
50 #define hbApp qobject_cast<HbApplication*>(qApp) |
57 #define hbApp qobject_cast<HbApplication*>(qApp) |
51 |
58 |
52 namespace |
59 namespace |
53 { |
60 { |
78 : QStateMachine(parent), |
85 : QStateMachine(parent), |
79 mContentService(0), |
86 mContentService(0), |
80 mHomeScreenActive(false), |
87 mHomeScreenActive(false), |
81 mIdleStateActive(false), |
88 mIdleStateActive(false), |
82 mEndKeyCaptured(false), |
89 mEndKeyCaptured(false), |
|
90 mSendKeyCaptured(false), |
83 mPublisher(NULL) |
91 mPublisher(NULL) |
84 #ifdef Q_OS_SYMBIAN |
92 #ifdef Q_OS_SYMBIAN |
85 ,keyCapture() |
93 ,keyCapture() |
86 #endif |
94 #endif |
87 { |
95 { |
168 default: |
176 default: |
169 break; |
177 break; |
170 } |
178 } |
171 |
179 |
172 bool result = QStateMachine::eventFilter(watched, event); |
180 bool result = QStateMachine::eventFilter(watched, event); |
|
181 |
173 if (event->type() == QEvent::KeyPress ) { |
182 if (event->type() == QEvent::KeyPress ) { |
174 QKeyEvent* ke = static_cast<QKeyEvent *>(event); |
183 QKeyEvent* ke = static_cast<QKeyEvent *>(event); |
175 result = (ke->key() == Qt::Key_Home); |
184 int key = ke->key(); |
|
185 |
|
186 if (key == Qt::Key_Home ) { |
|
187 result = true; |
|
188 } |
|
189 else if (key == Qt::Key_Yes ) { |
|
190 result = true; |
|
191 if (mSendKeyCaptured == false && mHomeScreenActive == true) { |
|
192 mSendKeyCaptured = true; |
|
193 startDialer(); |
|
194 } |
|
195 } |
176 } |
196 } |
177 return result; |
197 return result; |
178 } |
198 } |
179 |
199 |
|
200 #ifdef COVERAGE_MEASUREMENT |
|
201 #pragma CTC SKIP |
|
202 #endif //COVERAGE_MEASUREMENT |
|
203 /*! |
|
204 \fn void HsStateMachine::startDialer() |
|
205 Starts Dialer application |
|
206 */ |
|
207 void HsStateMachine::startDialer() |
|
208 { |
|
209 // copy-paste code from dialer widget |
|
210 #ifdef Q_OS_SYMBIAN |
|
211 qDebug("HsStateMachine::startDialer()"); |
|
212 |
|
213 QList<CallInfo> calls; |
|
214 QScopedPointer<XQCallInfo> callInfo(XQCallInfo::create()); |
|
215 callInfo->getCalls(calls); |
|
216 QList<QVariant> args; |
|
217 QString service; |
|
218 QString interface; |
|
219 QString operation; |
|
220 |
|
221 if (0 < calls.count()) { |
|
222 qDebug("HS: call ongoing, bring Telephone to foreground"); |
|
223 service = "phoneui"; |
|
224 interface = "com.nokia.symbian.IStart"; |
|
225 operation = "start(int)"; |
|
226 int openDialer(0); |
|
227 args << openDialer; |
|
228 } else { |
|
229 qDebug("HS: no calls, open Dialer"); |
|
230 service = "logs"; |
|
231 interface = "com.nokia.symbian.ILogsView"; |
|
232 operation = "show(QVariantMap)"; |
|
233 QVariantMap map; |
|
234 map.insert("view_index", QVariant(int(LogsServices::ViewAll))); |
|
235 map.insert("show_dialpad", QVariant(true)); |
|
236 map.insert("dialpad_text", QVariant(QString())); |
|
237 args.append(QVariant(map)); |
|
238 } |
|
239 |
|
240 XQApplicationManager appManager; |
|
241 QScopedPointer<XQAiwRequest> request(appManager.create(service, interface, operation, false)); |
|
242 if (request == NULL) { |
|
243 return; |
|
244 } |
|
245 request->setArguments(args); |
|
246 XQRequestInfo info; |
|
247 info.setForeground(true); |
|
248 request->setInfo(info); |
|
249 bool ret = request->send(); |
|
250 qDebug("HS: request sent successfully:", ret); |
|
251 #endif |
|
252 } |
|
253 |
|
254 #ifdef COVERAGE_MEASUREMENT |
|
255 #pragma CTC ENDSKIP |
|
256 #endif //COVERAGE_MEASUREMENT |
180 |
257 |
181 /*! |
258 /*! |
182 Registers framework animations. |
259 Registers framework animations. |
183 */ |
260 */ |
184 void HsStateMachine::registerAnimations() |
261 void HsStateMachine::registerAnimations() |
412 /*! |
490 /*! |
413 Activity requested by another client |
491 Activity requested by another client |
414 */ |
492 */ |
415 void HsStateMachine::activityRequested(const QString &name) |
493 void HsStateMachine::activityRequested(const QString &name) |
416 { |
494 { |
417 if (name == groupAppLibRecentView()) { |
495 if (name == Hs::groupAppLibRecentView) { |
418 this->postEvent( |
496 this->postEvent( |
419 HsMenuEventFactory::createOpenCollectionEvent(0, |
497 HsMenuEventFactory::createOpenCollectionEvent(0, |
420 collectionDownloadedTypeName())); |
498 Hs::collectionDownloadedTypeName)); |
421 } else if (name == activityHsIdleView()) { |
499 } else if (name == Hs::activityHsIdleView) { |
422 emit event_toIdle(); |
500 emit event_toIdle(); |
423 } else if (name == activityAppLibMainView()) { |
501 } else if (name == Hs::activityAppLibMainView) { |
424 emit event_toAppLib(); |
502 emit event_toAppLib(); |
425 } |
503 } |
426 } |
504 } |