author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 23 Jun 2010 18:12:20 +0300 | |
changeset 45 | 6b911d05207e |
parent 37 | ba76fc04e6c2 |
child 46 | bc5a64e5bc3c |
permissions | -rw-r--r-- |
37 | 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: Phone UI's Qt view. |
|
15 |
* |
|
16 |
*/ |
|
17 |
#include <hbinstance.h> |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
18 |
#include <qsignalmapper> |
37 | 19 |
#include <hbaction.h> |
20 |
#include <hbtoolbar.h> |
|
21 |
#include <hbvolumesliderpopup.h> |
|
22 |
#include <hbnamespace.h> |
|
23 |
#include <bubblemanager2.h> |
|
24 |
#include <hblineedit.h> |
|
25 |
#include <hbmenu.h> |
|
26 |
||
27 |
#include <xqserviceutil.h> |
|
28 |
#include <xqkeycapture.h> |
|
29 |
#include <dialpad.h> |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
30 |
#include <dialpadkeyhandler.h> |
37 | 31 |
|
32 |
#include "phoneuiqtview.h" |
|
33 |
#include "phoneaction.h" |
|
34 |
#include "qtphonelog.h" |
|
35 |
||
36 |
PhoneUIQtView::PhoneUIQtView (HbMainWindow &window, QGraphicsItem *parent) : |
|
37 |
HbView (parent), |
|
38 |
m_window(window), |
|
39 |
m_volumeSlider (0), |
|
40 |
m_expandSignalMapper(0), |
|
41 |
m_participantListSignalMapper(0), |
|
42 |
m_volumeCommandId(0), |
|
43 |
m_keyCapture(0), |
|
44 |
m_networkInfo(0) |
|
45 |
{ |
|
46 |
// Set network name |
|
47 |
m_networkInfo = new QSystemNetworkInfo(this); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
48 |
QString networkName = m_networkInfo->networkName(QSystemNetworkInfo::WcdmaMode); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
49 |
if(networkName.isEmpty()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
50 |
networkName = m_networkInfo->networkName(QSystemNetworkInfo::GsmMode); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
51 |
} |
37 | 52 |
connect(m_networkInfo, SIGNAL (networkNameChanged(QSystemNetworkInfo::NetworkMode,QString)), this, SLOT(networkNameChanged(QSystemNetworkInfo::NetworkMode, QString))); |
53 |
setTitle(networkName); |
|
54 |
||
55 |
// Capturing long press of end key |
|
56 |
m_keyCapture = new XqKeyCapture(); |
|
57 |
m_keyCapture->captureLongKey(Qt::Key_No); |
|
58 |
m_keyCapture->captureKey(Qt::Key_No); |
|
59 |
||
60 |
// Dialpad |
|
61 |
m_dialpad = new Dialpad(m_window); |
|
62 |
m_dialpad->setCallButtonEnabled(false); |
|
63 |
m_dialpad->setTapOutsideDismiss(true); |
|
64 |
connect(&m_dialpad->editor(),SIGNAL(contentsChanged()), |
|
65 |
SLOT(onEditorContentChanged())); |
|
66 |
connect(m_dialpad,SIGNAL(aboutToClose()),this, |
|
67 |
SLOT(dialpadClosed())); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
68 |
// enable key sequence handling during a call |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
69 |
new DialpadKeyHandler(m_dialpad, DialpadKeyHandler::KeySequence, this); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
70 |
|
37 | 71 |
// Call handling widget |
72 |
m_bubbleManager = new BubbleManager (this); |
|
73 |
setWidget(m_bubbleManager); |
|
74 |
||
75 |
// Set event filter |
|
76 |
m_window.installEventFilter(this); |
|
77 |
||
78 |
m_signalMapper = new QSignalMapper (this); |
|
79 |
connect(m_signalMapper, SIGNAL (mapped (int)), this, SIGNAL (command (int))); |
|
80 |
connect(&m_window,SIGNAL(orientationChanged(Qt::Orientation)), |
|
81 |
this,SLOT(handleOrientationChange(Qt::Orientation))); |
|
82 |
||
83 |
m_menuSignalMapper = new QSignalMapper(this); |
|
84 |
connect(m_menuSignalMapper, SIGNAL(mapped(int)), this, SIGNAL(command(int))); |
|
85 |
||
86 |
m_bubbleManager->handleOrientationChange(m_window.orientation()); |
|
87 |
||
88 |
// change exit softkey to back button |
|
89 |
m_backAction = new HbAction(Hb::BackNaviAction, this); |
|
90 |
connect(m_backAction, SIGNAL(triggered()), this, SLOT(backButtonClicked())); |
|
91 |
setNavigationAction(m_backAction); |
|
92 |
||
93 |
createToolBarActions(); |
|
94 |
} |
|
95 |
||
96 |
PhoneUIQtView::~PhoneUIQtView () |
|
97 |
{ |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
98 |
qDeleteAll(m_toolbarActions); |
37 | 99 |
m_window.removeEventFilter(this); |
100 |
delete m_volumeSlider; |
|
101 |
delete m_dialpad; |
|
102 |
} |
|
103 |
||
104 |
BubbleManagerIF& PhoneUIQtView::bubbleManager() |
|
105 |
{ |
|
106 |
return *m_bubbleManager; |
|
107 |
} |
|
108 |
||
109 |
void PhoneUIQtView::addBubbleCommand ( |
|
110 |
int bubbleId, |
|
111 |
const PhoneAction& action ) |
|
112 |
{ |
|
113 |
HbAction* bubbleAction = new HbAction (); |
|
114 |
bubbleAction->setText (action.text()); |
|
115 |
bubbleAction->setIcon (action.icon()); |
|
116 |
setActionRole(action,*bubbleAction); |
|
117 |
m_bubbleManager->addAction (bubbleId, bubbleAction); |
|
118 |
||
119 |
QList<int> bubbles = m_bubbleMap.keys(); |
|
120 |
bool found(false); |
|
121 |
||
122 |
for ( int i=0; i<bubbles.size(); ++i ) { |
|
123 |
if (bubbleId==bubbles[i]){ |
|
124 |
connect(bubbleAction, SIGNAL (triggered ()), m_bubbleMap.value(bubbleId), SLOT (map ())); |
|
125 |
m_bubbleMap.value(bubbleId)->setMapping(bubbleAction, action.command()); |
|
126 |
m_bubbleActionMap.value(bubbleId)->append(bubbleAction); |
|
127 |
found = true; |
|
128 |
} |
|
129 |
} |
|
130 |
||
131 |
if (!found) { |
|
132 |
QSignalMapper *mapper = new QSignalMapper(); |
|
133 |
connect(mapper, SIGNAL (mapped (int)), this, SIGNAL (command (int))); |
|
134 |
connect(bubbleAction, SIGNAL (triggered ()), mapper, SLOT (map ())); |
|
135 |
mapper->setMapping (bubbleAction, action.command()); |
|
136 |
QList<HbAction *> *actionList = new QList<HbAction *>(); |
|
137 |
actionList->append( bubbleAction ); |
|
138 |
m_bubbleActionMap.insert(bubbleId,actionList); |
|
139 |
m_bubbleMap.insert(bubbleId,mapper); |
|
140 |
} |
|
141 |
} |
|
142 |
||
143 |
void PhoneUIQtView::addParticipantListAction( |
|
144 |
int commandId, |
|
145 |
const QString& text, |
|
146 |
const HbIcon& icon) |
|
147 |
{ |
|
148 |
HbAction* action = new HbAction (); |
|
149 |
action->setText (text); |
|
150 |
action->setIcon (icon); |
|
151 |
m_bubbleManager->addParticipantListAction(action); |
|
152 |
||
153 |
if (!m_participantListSignalMapper) { |
|
154 |
m_participantListSignalMapper = new QSignalMapper(); |
|
155 |
connect(m_participantListSignalMapper, SIGNAL (mapped (int)), this, SIGNAL (command (int))); |
|
156 |
} |
|
157 |
||
158 |
connect(action, SIGNAL (triggered ()), m_participantListSignalMapper, SLOT (map ())); |
|
159 |
m_participantListSignalMapper->setMapping (action, commandId); |
|
160 |
m_participantListActions.append( action ); |
|
161 |
} |
|
162 |
||
163 |
void PhoneUIQtView::clearParticipantListActions() |
|
164 |
{ |
|
165 |
||
166 |
if (m_participantListSignalMapper) { |
|
167 |
m_bubbleManager->clearParticipantListActions(); |
|
168 |
||
169 |
foreach (HbAction *action, m_participantListActions ) { |
|
170 |
m_participantListSignalMapper->removeMappings(action); |
|
171 |
} |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
172 |
qDeleteAll(m_participantListActions); |
37 | 173 |
m_participantListActions.clear(); |
174 |
delete m_participantListSignalMapper; |
|
175 |
m_participantListSignalMapper = 0; |
|
176 |
} |
|
177 |
||
178 |
} |
|
179 |
||
180 |
void PhoneUIQtView::clearBubbleCommands (int bubbleId) |
|
181 |
{ |
|
182 |
m_bubbleManager->clearActions (bubbleId); |
|
183 |
QSignalMapper *mapper = m_bubbleMap.value(bubbleId); |
|
184 |
||
185 |
if (mapper) { |
|
186 |
QList<HbAction *> *actions = m_bubbleActionMap.value(bubbleId); |
|
187 |
||
188 |
foreach (HbAction *action, *actions ) { |
|
189 |
mapper->removeMappings(action); |
|
190 |
delete action; |
|
191 |
} |
|
192 |
||
193 |
actions->clear(); |
|
194 |
m_bubbleMap.remove(bubbleId); |
|
195 |
m_bubbleActionMap.remove(bubbleId); |
|
196 |
delete mapper; |
|
197 |
delete actions; |
|
198 |
} |
|
199 |
||
200 |
} |
|
201 |
||
202 |
void PhoneUIQtView::setToolbarActions(const QList<PhoneAction*>& actions) |
|
203 |
{ |
|
204 |
// clear current toolbar actions |
|
205 |
for (int i=0;i<toolBar()->actions().count();++i) { |
|
206 |
m_signalMapper->removeMappings( |
|
207 |
static_cast<HbAction*>(toolBar()->actions().at(i))); |
|
208 |
} |
|
209 |
||
210 |
QList<QAction*> toolBarActions = toolBar()->actions(); |
|
211 |
||
212 |
if (toolBarActions.size()<actions.size()) { |
|
213 |
for (int i=toolBarActions.size(); i<actions.size(); ++i) { |
|
214 |
toolBar()->addAction(m_toolbarActions.at(i)); |
|
215 |
} |
|
216 |
} else if (toolBarActions.size()>actions.size()) { |
|
217 |
for (int i=toolBarActions.size(); 0<i; --i) { |
|
218 |
if (i>actions.size()) { |
|
219 |
HbAction* action = static_cast<HbAction*>(toolBarActions.at(i-1)); |
|
220 |
toolBar()->removeAction(action); |
|
221 |
} |
|
222 |
} |
|
223 |
} |
|
224 |
||
225 |
for (int i=0; i<toolBar()->actions().size(); ++i) { |
|
226 |
||
227 |
if (i<actions.count()) { |
|
228 |
HbAction* action = static_cast<HbAction*>(toolBar()->actions().at(i)); |
|
229 |
action->setText(actions.at(i)->text()); |
|
230 |
action->setIcon(actions.at(i)->icon()); |
|
231 |
action->setDisabled(actions.at(i)->isDisabled()); |
|
232 |
||
233 |
m_signalMapper->setMapping(action, actions.at(i)->command()); |
|
234 |
} |
|
235 |
} |
|
236 |
||
237 |
if ( m_window.orientation() == Qt::Horizontal ) { |
|
238 |
toolBar()->setOrientation(Qt::Horizontal); |
|
239 |
} |
|
240 |
// update toolbar |
|
241 |
toolBar()->update(); |
|
242 |
} |
|
243 |
||
244 |
void PhoneUIQtView::hideToolbar () |
|
245 |
{ |
|
246 |
toolBar()->hide (); |
|
247 |
} |
|
248 |
||
249 |
void PhoneUIQtView::showToolbar () |
|
250 |
{ |
|
251 |
setFocus(); |
|
252 |
toolBar()->show(); |
|
253 |
} |
|
254 |
||
255 |
int PhoneUIQtView::volumeSliderValue () |
|
256 |
{ |
|
257 |
if (m_volumeSlider) { |
|
258 |
return m_volumeSlider->value (); |
|
259 |
} else { |
|
260 |
return -1; |
|
261 |
} |
|
262 |
} |
|
263 |
||
264 |
void PhoneUIQtView::removeVolumeSlider () |
|
265 |
{ |
|
266 |
if (m_volumeSlider) { |
|
267 |
if (m_volumeSlider->isVisible()) { |
|
268 |
m_volumeSlider->hide(); |
|
269 |
} |
|
270 |
m_volumeSlider->deleteLater(); |
|
271 |
m_volumeSlider = 0; |
|
272 |
} |
|
273 |
} |
|
274 |
||
275 |
void PhoneUIQtView::volumeSliderClosed () |
|
276 |
{ |
|
277 |
removeVolumeSlider(); |
|
278 |
} |
|
279 |
||
280 |
void PhoneUIQtView::setVolumeSliderValue ( |
|
281 |
int value, int commandId, int maxVolumeValue, int minVolumeValue) |
|
282 |
{ |
|
283 |
m_volumeCommandId = commandId; |
|
284 |
||
285 |
if (!m_volumeSlider) { |
|
286 |
m_volumeSlider = new HbVolumeSliderPopup (); |
|
287 |
m_volumeSlider->setDismissPolicy(HbDialog::TapOutside); |
|
288 |
m_volumeSlider->setTimeout (10000); // TODO: 10 seconds for now, replace with correct value when spec is ready and says what it is |
|
289 |
connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeSliderChanged(int))); |
|
290 |
connect(m_volumeSlider, SIGNAL(aboutToClose()), this, SLOT(volumeSliderClosed())); |
|
291 |
} |
|
292 |
||
293 |
||
294 |
if (m_volumeSlider->minimum() != minVolumeValue || |
|
295 |
m_volumeSlider->maximum() != maxVolumeValue ) { |
|
296 |
m_volumeSlider->setRange (minVolumeValue, maxVolumeValue); |
|
297 |
} |
|
298 |
||
299 |
if (value != m_volumeSlider->value()) |
|
300 |
m_volumeSlider->setValue (value); |
|
301 |
||
302 |
if (false == m_volumeSlider->isVisible()) { |
|
303 |
m_volumeSlider->show(); |
|
304 |
} |
|
305 |
} |
|
306 |
||
307 |
void PhoneUIQtView::volumeSliderChanged(int value) |
|
308 |
{ |
|
309 |
Q_UNUSED (value); |
|
310 |
emit command (m_volumeCommandId); |
|
311 |
} |
|
312 |
||
313 |
void PhoneUIQtView::setExpandAction(int bubbleId, int commandId) |
|
314 |
{ |
|
315 |
removeExpandAction(bubbleId); |
|
316 |
||
317 |
HbAction* action = new HbAction(); |
|
318 |
m_bubbleManager->setExpandAction(bubbleId, action); |
|
319 |
||
320 |
if (!m_expandSignalMapper) { |
|
321 |
m_expandSignalMapper = new QSignalMapper(this); |
|
322 |
connect(m_expandSignalMapper, SIGNAL (mapped (int)), |
|
323 |
this, SIGNAL (command (int))); |
|
324 |
} |
|
325 |
||
326 |
connect(action, SIGNAL (triggered ()), m_expandSignalMapper, SLOT (map ())); |
|
327 |
m_expandSignalMapper->setMapping(action, commandId); |
|
328 |
||
329 |
m_expandActionMap.insert(bubbleId,action); |
|
330 |
} |
|
331 |
||
332 |
void PhoneUIQtView::removeExpandAction(int bubbleId) |
|
333 |
{ |
|
334 |
if (m_expandActionMap.contains(bubbleId)) { |
|
335 |
m_bubbleManager->setExpandAction(bubbleId, 0); |
|
336 |
HbAction* action = m_expandActionMap.value(bubbleId); |
|
337 |
m_expandSignalMapper->removeMappings(action); |
|
338 |
m_expandActionMap.remove(bubbleId); |
|
339 |
delete action; |
|
340 |
} |
|
341 |
} |
|
342 |
||
343 |
void PhoneUIQtView::showDialpad() |
|
344 |
{ |
|
345 |
if (false == m_dialpad->isVisible()) { |
|
346 |
setDialpadPosition(); |
|
347 |
m_dialpad->openDialpad(); |
|
348 |
} |
|
349 |
} |
|
350 |
||
351 |
void PhoneUIQtView::hideDialpad() |
|
352 |
{ |
|
353 |
if (true == m_dialpad->isVisible()) |
|
354 |
m_dialpad->closeDialpad(); |
|
355 |
} |
|
356 |
||
357 |
bool PhoneUIQtView::isDialpadVisible() |
|
358 |
{ |
|
359 |
return m_dialpad->isVisible(); |
|
360 |
} |
|
361 |
||
362 |
QString PhoneUIQtView::dialpadText() |
|
363 |
{ |
|
364 |
return m_dialpad->editor().text(); |
|
365 |
} |
|
366 |
||
367 |
void PhoneUIQtView::clearAndHideDialpad() |
|
368 |
{ |
|
369 |
m_dialpad->editor().setText(QString("")); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
370 |
m_dialpad->closeDialpad(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
371 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
372 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
373 |
void PhoneUIQtView::clearDialpad() |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
374 |
{ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
375 |
m_dialpad->editor().setText(QString("")); |
37 | 376 |
} |
377 |
||
378 |
void PhoneUIQtView::bringToForeground() |
|
379 |
{ |
|
380 |
m_window.show(); |
|
381 |
} |
|
382 |
||
383 |
void PhoneUIQtView::setMenuActions(const QList<PhoneAction*>& actions) |
|
384 |
{ |
|
385 |
||
386 |
for (int i=menu()->actions().count(); 0<i; --i) { |
|
387 |
HbAction* action = static_cast<HbAction*>(menu()->actions().at(i-1)); |
|
388 |
m_menuSignalMapper->removeMappings(action); |
|
389 |
menu()->removeAction(action); |
|
390 |
delete action; |
|
391 |
} |
|
392 |
||
393 |
for (int i=0; i<actions.count(); ++i) { |
|
394 |
HbAction* action = new HbAction(); |
|
395 |
action->setText(actions.at(i)->text()); |
|
396 |
menu()->addAction(action); |
|
397 |
connect(action, SIGNAL(triggered()), m_menuSignalMapper, SLOT(map())); |
|
398 |
m_menuSignalMapper->setMapping(action, actions.at(i)->command()); |
|
399 |
} |
|
400 |
||
401 |
} |
|
402 |
||
403 |
HbMenu &PhoneUIQtView::menuReference() |
|
404 |
{ |
|
405 |
return *menu(); |
|
406 |
} |
|
407 |
||
408 |
void PhoneUIQtView::handleOrientationChange(Qt::Orientation orientation) |
|
409 |
{ |
|
410 |
if (orientation==Qt::Horizontal) { |
|
411 |
toolBar()->setOrientation(Qt::Horizontal); |
|
412 |
} |
|
413 |
||
414 |
m_bubbleManager->handleOrientationChange(orientation); |
|
415 |
||
416 |
setDialpadPosition(); |
|
417 |
} |
|
418 |
||
419 |
void PhoneUIQtView::backButtonClicked() |
|
420 |
{ |
|
421 |
XQServiceUtil::toBackground(true); |
|
422 |
} |
|
423 |
||
424 |
void PhoneUIQtView::onEditorContentChanged() |
|
425 |
{ |
|
426 |
m_dialpad->setCallButtonEnabled( |
|
427 |
m_dialpad->editor().text().length()); |
|
428 |
} |
|
429 |
||
430 |
void PhoneUIQtView::dialpadClosed() |
|
431 |
{ |
|
432 |
emit dialpadIsAboutToClose(); |
|
433 |
} |
|
434 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
435 |
bool PhoneUIQtView::eventFilter(QObject *watched, QEvent * event) |
37 | 436 |
{ |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
437 |
Q_UNUSED(watched); |
37 | 438 |
PHONE_DEBUG2("PhoneUIQtView::eventFilter event type:", event->type()); |
439 |
if(event->type() == QEvent::KeyPress) { |
|
440 |
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event); |
|
441 |
PHONE_DEBUG2("PhoneUIQtView::eventFilter pressed key:", keyEvent->key()); |
|
442 |
PHONE_DEBUG2("PhoneUIQtView::eventFilter isAutoRepeat:", keyEvent->isAutoRepeat()); |
|
443 |
emit keyPressed(keyEvent); |
|
444 |
keyEvent->accept(); |
|
445 |
||
446 |
return false; |
|
447 |
} else if(event->type() == QEvent::KeyRelease) { |
|
448 |
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event); |
|
449 |
PHONE_DEBUG2("PhoneUIQtView::eventFilter released key:", keyEvent->key()); |
|
450 |
emit keyReleased(keyEvent); |
|
451 |
keyEvent->accept(); |
|
452 |
||
453 |
return false; |
|
454 |
} else if (event->type() == QEvent::WindowActivate){ |
|
455 |
PHONE_DEBUG("PhoneUIQtView::eventFilter WindowActivate"); |
|
456 |
emit windowActivated(); |
|
457 |
return false; |
|
458 |
} else if (event->type() == QEvent::WindowDeactivate){ |
|
459 |
PHONE_DEBUG("PhoneUIQtView::eventFilter WindowDeactivate"); |
|
460 |
emit windowDeactivated(); |
|
461 |
return false; |
|
462 |
}else{ |
|
463 |
return false; |
|
464 |
} |
|
465 |
} |
|
466 |
||
467 |
void PhoneUIQtView::setDialpadPosition() |
|
468 |
{ |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
469 |
QRectF screenRect(m_window.layoutRect()); |
37 | 470 |
|
471 |
if (m_window.orientation() == Qt::Horizontal) { |
|
472 |
// dialpad takes half of the screen |
|
473 |
m_dialpad->setPos(QPointF(screenRect.width()/2, |
|
474 |
this->scenePos().y())); |
|
475 |
m_dialpad->setPreferredSize(screenRect.width()/2, |
|
476 |
(screenRect.height()-scenePos().y())); |
|
477 |
} else { |
|
478 |
// dialpad takes 65% of the screen height |
|
479 |
qreal screenHeight = screenRect.height(); |
|
480 |
m_dialpad->setPos(QPointF(0, |
|
481 |
screenHeight/2.25)); |
|
482 |
m_dialpad->setPreferredSize(screenRect.width(), |
|
483 |
screenHeight-screenHeight/2.25); |
|
484 |
} |
|
485 |
} |
|
486 |
||
487 |
void PhoneUIQtView::setActionRole(const PhoneAction& pa, HbAction& action) |
|
488 |
{ |
|
489 |
if (pa.actionRole()==PhoneAction::Accept) { |
|
490 |
action.setSoftKeyRole(QAction::PositiveSoftKey); |
|
491 |
} else if (pa.actionRole()==PhoneAction::Decline) { |
|
492 |
action.setSoftKeyRole(QAction::NegativeSoftKey); |
|
493 |
} |
|
494 |
} |
|
495 |
||
496 |
void PhoneUIQtView::createToolBarActions() |
|
497 |
{ |
|
498 |
for (int i=0;i<4;++i) { |
|
499 |
HbAction* action = new HbAction(); |
|
500 |
connect(action, SIGNAL(triggered()), m_signalMapper, SLOT(map())); |
|
501 |
m_toolbarActions.append(action); |
|
502 |
} |
|
503 |
} |
|
504 |
||
505 |
void PhoneUIQtView::shutdownPhoneApp() |
|
506 |
{ |
|
507 |
PHONE_DEBUG("PhoneUIQtView::shutdownPhoneApp"); |
|
508 |
QCoreApplication::quit(); |
|
509 |
} |
|
510 |
||
511 |
void PhoneUIQtView::setBackButtonVisible(bool visible) |
|
512 |
{ |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
513 |
m_backAction->setEnabled(visible); |
37 | 514 |
} |
515 |
||
516 |
void PhoneUIQtView::networkNameChanged(QSystemNetworkInfo::NetworkMode mode, const QString &netName) |
|
517 |
{ |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
518 |
if((mode == QSystemNetworkInfo::GsmMode) || |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
519 |
(mode == QSystemNetworkInfo::WcdmaMode)) { |
37 | 520 |
setTitle(netName); |
521 |
} |
|
522 |
} |