author | hgs |
Fri, 03 Sep 2010 13:59:20 +0300 | |
changeset 46 | 2fa1fa551b0b |
parent 38 | bc103bfb69cf |
permissions | -rw-r--r-- |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/*! |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
46 | 14 |
* Description: Number grid and dial key. |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
18 |
#include <QSignalMapper> |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
19 |
|
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <hbapplication.h> |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <hblineedit.h> |
33 | 22 |
#include <hbevent.h> |
46 | 23 |
#include <hbmainwindow.h> |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
|
33 | 25 |
#include "dialpadnumericbutton.h" |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include "dialpadkeypad.h" |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include "dialpadbutton.h" |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include "dialpadinputfield.h" |
46 | 29 |
#include "dialpadnumericbuttongrid.h" |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
|
46 | 31 |
static const int DialpadKeypadRowCount = 5; |
32
1f002146abb4
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
32 |
static const QLatin1String handsetIcon("qtg_mono_call"); |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
|
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
DialpadKeypad::DialpadKeypad( |
13
e32024264ebb
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
12
diff
changeset
|
35 |
const HbMainWindow& mainWindow, |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
DialpadInputField& inputField, |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
QGraphicsItem* parent) : |
46 | 38 |
HbWidget(parent), |
13
e32024264ebb
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
12
diff
changeset
|
39 |
mMainWindow(mainWindow), |
46 | 40 |
mInputField(inputField) |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
{ |
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
42 |
// create clicked signal mapper |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
mKeyClickedSignalMapper = new QSignalMapper(this); |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
connect(mKeyClickedSignalMapper,SIGNAL(mapped(int)), |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
SLOT(handleKeyClicked(int))); |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
|
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
47 |
// connect backspace signals |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
connect(&mInputField.backspaceButton(),SIGNAL(clicked()), |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
mKeyClickedSignalMapper,SLOT(map())); |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
mKeyClickedSignalMapper->setMapping(&mInputField.backspaceButton(), |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
Qt::Key_Backspace); |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
|
46 | 53 |
// create call button |
54 |
mCallButton = new DialpadButton(this); |
|
55 |
mCallButton->setObjectName("callButton"); |
|
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
56 |
mCallButton->setButtonType(DialpadButton::CallButton); |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
57 |
mCallButton->setIcon(HbIcon(handsetIcon)); |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
58 |
connect(mCallButton,SIGNAL(clicked()), |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
59 |
mKeyClickedSignalMapper,SLOT(map())); |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
60 |
connect(mCallButton,SIGNAL(longPress(QPointF)), |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
61 |
mKeyClickedSignalMapper,SLOT(map())); |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
62 |
mKeyClickedSignalMapper->setMapping(mCallButton, |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
63 |
Qt::Key_Yes); |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
|
46 | 65 |
// create numeric button grid |
66 |
mNumericButtonGrid = new DialpadNumericButtonGrid(mMainWindow,this); |
|
67 |
QObject::connect(mNumericButtonGrid, |
|
68 |
SIGNAL(buttonPressed(const QKeyEvent&)), |
|
69 |
this, SLOT(sendKeyPressEvent(const QKeyEvent&))); |
|
70 |
QObject::connect(mNumericButtonGrid, |
|
71 |
SIGNAL(buttonReleased(const QKeyEvent&)), |
|
72 |
this, SLOT(sendKeyReleaseEvent(const QKeyEvent&))); |
|
73 |
QObject::connect(mNumericButtonGrid, |
|
74 |
SIGNAL(buttonLongPressed(const QKeyEvent&)), |
|
75 |
this, SLOT(sendLongPressEvent(const QKeyEvent&))); |
|
76 |
QObject::connect(mNumericButtonGrid, |
|
77 |
SIGNAL(pressedButtonChanged(const QKeyEvent&, |
|
78 |
const QKeyEvent&)), |
|
79 |
this, SLOT(handleKeyChangeEvent(const QKeyEvent&, |
|
80 |
const QKeyEvent&))); |
|
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
} |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
|
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
83 |
DialpadKeypad::~DialpadKeypad() |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
84 |
{ |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
85 |
} |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
86 |
|
46 | 87 |
bool DialpadKeypad::isCallButtonEnabled() const |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
{ |
46 | 89 |
return mCallButton->isEnabled(); |
90 |
} |
|
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
|
46 | 92 |
void DialpadKeypad::setCallButtonEnabled(bool enabled) |
93 |
{ |
|
94 |
mCallButton->setEnabled(enabled); |
|
95 |
} |
|
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
96 |
|
46 | 97 |
void DialpadKeypad::resetButtons() |
98 |
{ |
|
99 |
mNumericButtonGrid->resetButtons(); |
|
100 |
mCallButton->setDown(false); |
|
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
} |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
|
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
void DialpadKeypad::handleKeyClicked(int key) |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
{ |
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
105 |
// concerns only yes and backspace keys |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
106 |
postKeyEvent(QEvent::KeyPress, key); |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
postKeyEvent(QEvent::KeyRelease, key); |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
} |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
|
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
void DialpadKeypad::postKeyEvent(QEvent::Type type, int key) |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
{ |
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
112 |
// send simulated key to application |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
QKeyEvent *keyEvent = new QKeyEvent(type, key, Qt::NoModifier); |
13
e32024264ebb
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
12
diff
changeset
|
114 |
HbApplication::postEvent(const_cast<HbMainWindow*>(&mMainWindow),keyEvent); |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
} |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
|
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
void DialpadKeypad::sendKeyEventToEditor(QEvent::Type type, int key) |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
{ |
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
119 |
// send key event to editor |
46 | 120 |
QKeyEvent keyEvent(type, key, Qt::NoModifier, |
121 |
mNumericButtonGrid->inputCharacter(key)); |
|
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
HbApplication::sendEvent(&mInputField.editor(), &keyEvent); |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
} |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
|
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
125 |
void DialpadKeypad::sendKeyPressEvent(const QKeyEvent& event) |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
126 |
{ |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
127 |
mPressedNumericKey = event.key(); |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
128 |
postKeyEvent(QEvent::KeyPress, event.key()); |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
129 |
} |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
130 |
|
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
131 |
void DialpadKeypad::sendKeyReleaseEvent(const QKeyEvent& event) |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
132 |
{ |
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
133 |
if (mPressedNumericKey) { |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
134 |
// short press, update editor here |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
135 |
sendKeyEventToEditor(QEvent::KeyPress, event.key()); |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
136 |
} |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
137 |
|
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
138 |
postKeyEvent(QEvent::KeyRelease, event.key()); |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
139 |
} |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
140 |
|
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
141 |
void DialpadKeypad::sendLongPressEvent(const QKeyEvent& event) |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
142 |
{ |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
143 |
sendKeyEventToEditor(QEvent::KeyPress, event.key()); |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
mPressedNumericKey = 0; |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
} |
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
|
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
147 |
void DialpadKeypad::handleKeyChangeEvent( |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
148 |
const QKeyEvent& releaseEvent, |
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
149 |
const QKeyEvent& pressEvent) |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
150 |
{ |
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
151 |
Q_UNUSED(pressEvent) |
12
ae8abd0db65c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
|
31
a2467631ae02
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
27
diff
changeset
|
153 |
postKeyEvent(QEvent::KeyRelease, releaseEvent.key()); |
46 | 154 |
mNumericButtonGrid->resetButtons(); |
33 | 155 |
} |
156 |
||
157 |
void DialpadKeypad::setGeometry(const QRectF &rect) |
|
158 |
{ |
|
46 | 159 |
HbWidget::setGeometry(rect); |
33 | 160 |
|
46 | 161 |
// make button heights uniform |
162 |
qreal buttonHeight = rect.height()/DialpadKeypadRowCount; |
|
33 | 163 |
|
46 | 164 |
mNumericButtonGrid->setPos(QPointF(0,0)); |
165 |
QSizeF gridSize(rect.size()); |
|
166 |
gridSize.setHeight(gridSize.height()-buttonHeight); |
|
167 |
mNumericButtonGrid->resize(gridSize); |
|
33 | 168 |
|
46 | 169 |
mCallButton->setPos(QPointF(0,gridSize.height())); |
170 |
mCallButton->resize(rect.width(),buttonHeight); |
|
33 | 171 |
} |