1 /*! |
|
2 * Copyright (c) 2010 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: Custom button |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <hbmainwindow.h> |
|
19 #ifdef Q_OS_SYMBIAN |
|
20 #include <featmgr.h> |
|
21 #endif // Q_OS_SYMBIAN |
|
22 #include "dialpad.h" |
|
23 #include "dialpadkeyhandler.h" |
|
24 #include "dialpadvoicemailboxeventfilter.h" |
|
25 #include "dialpadvideomailboxeventfilter.h" |
|
26 #include "dialpadbluetootheventfilter.h" |
|
27 #include "dialpadkeysequenceeventfilter.h" |
|
28 #include "dialpademergencycalleventfilter.h" |
|
29 #include "dialpadhasheventfilter.h" |
|
30 #include "qtphonesrvlog.h" |
|
31 |
|
32 DialpadKeyHandler::DialpadKeyHandler( |
|
33 Dialpad *dialPad, HbMainWindow& mainWindow, QObject *parent) |
|
34 : |
|
35 QObject(parent), |
|
36 mMainWindow(mainWindow), |
|
37 mVmbxFilter(0), |
|
38 mVideoVmbxFilter(0), |
|
39 mBtFilter(0), |
|
40 mKeySequenceFilter(0), |
|
41 mEmergencyCallFilter(0), |
|
42 mHashFilter(0) |
|
43 { |
|
44 PHONE_TRACE; |
|
45 |
|
46 // Variations |
|
47 bool isVideoMailboxSupported = false; |
|
48 #ifdef Q_OS_SYMBIAN |
|
49 isVideoMailboxSupported = FeatureManager::FeatureSupported(KFeatureIdCsVideoTelephony); |
|
50 #endif // Q_OS_SYMBIAN |
|
51 |
|
52 mVmbxFilter.reset(new DialpadVoiceMailboxEventFilter(dialPad)); |
|
53 if (isVideoMailboxSupported) { |
|
54 mVideoVmbxFilter.reset(new DialpadVideoMailboxEventFilter(dialPad)); |
|
55 } |
|
56 mBtFilter.reset(new DialpadBluetoothEventFilter(dialPad)); |
|
57 mKeySequenceFilter.reset(new DialpadKeySequenceEventFilter(dialPad)); |
|
58 mHashFilter.reset(new DialpadHashEventFilter(dialPad)); |
|
59 |
|
60 // Stack different event filters |
|
61 mMainWindow.installEventFilter(mVmbxFilter.data()); |
|
62 if (isVideoMailboxSupported) { |
|
63 mMainWindow.installEventFilter(mVideoVmbxFilter.data()); |
|
64 } |
|
65 mMainWindow.installEventFilter(mBtFilter.data()); |
|
66 mMainWindow.installEventFilter(mKeySequenceFilter.data()); |
|
67 mMainWindow.installEventFilter(mHashFilter.data()); |
|
68 } |
|
69 |
|
70 |
|
71 DialpadKeyHandler::DialpadKeyHandler( |
|
72 Dialpad *dialPad, |
|
73 DialpadKeyHandler::DialpadKeyEventFilters filters, |
|
74 QObject *parent) |
|
75 : |
|
76 QObject(parent), |
|
77 mMainWindow(*(dialPad->mainWindow())), |
|
78 mVmbxFilter(0), |
|
79 mVideoVmbxFilter(0), |
|
80 mBtFilter(0), |
|
81 mKeySequenceFilter(0), |
|
82 mEmergencyCallFilter(0), |
|
83 mHashFilter(0) |
|
84 { |
|
85 PHONE_TRACE; |
|
86 |
|
87 if (filters.testFlag(VoiceMailbox)) { |
|
88 mVmbxFilter.reset(new DialpadVoiceMailboxEventFilter(dialPad)); |
|
89 mMainWindow.installEventFilter(mVmbxFilter.data()); |
|
90 } |
|
91 |
|
92 if (filters.testFlag(VideoMailBox)) { |
|
93 mVideoVmbxFilter.reset( |
|
94 new DialpadVideoMailboxEventFilter(dialPad)); |
|
95 mMainWindow.installEventFilter(mVideoVmbxFilter.data()); |
|
96 } |
|
97 |
|
98 if (filters.testFlag(Bluetooth)) { |
|
99 mBtFilter.reset(new DialpadBluetoothEventFilter(dialPad)); |
|
100 mMainWindow.installEventFilter(mBtFilter.data()); |
|
101 } |
|
102 |
|
103 if (filters.testFlag(KeySequence)) { |
|
104 mKeySequenceFilter.reset( |
|
105 new DialpadKeySequenceEventFilter(dialPad)); |
|
106 mMainWindow.installEventFilter(mKeySequenceFilter.data()); |
|
107 } |
|
108 |
|
109 if (filters.testFlag(EmergencyCall)) { |
|
110 mEmergencyCallFilter.reset( |
|
111 new DialpadEmergencyCallEventFilter(dialPad)); |
|
112 mMainWindow.installEventFilter(mEmergencyCallFilter.data()); |
|
113 } |
|
114 |
|
115 if (filters.testFlag(Hash)) { |
|
116 mHashFilter.reset(new DialpadHashEventFilter(dialPad)); |
|
117 mMainWindow.installEventFilter(mHashFilter.data()); |
|
118 } |
|
119 } |
|
120 |
|
121 |
|
122 DialpadKeyHandler::~DialpadKeyHandler() |
|
123 { |
|
124 mMainWindow.removeEventFilter(mVmbxFilter.data()); |
|
125 mMainWindow.removeEventFilter(mVideoVmbxFilter.data()); |
|
126 mMainWindow.removeEventFilter(mBtFilter.data()); |
|
127 mMainWindow.removeEventFilter(mKeySequenceFilter.data()); |
|
128 mMainWindow.removeEventFilter(mEmergencyCallFilter.data()); |
|
129 mMainWindow.removeEventFilter(mHashFilter.data()); |
|
130 } |
|