40 mWindowGroup( &CEikonEnv::Static()->RootWin()), |
41 mWindowGroup( &CEikonEnv::Static()->RootWin()), |
41 #else |
42 #else |
42 mWindowGroup( MyTestWindowGroup::Instance()), |
43 mWindowGroup( MyTestWindowGroup::Instance()), |
43 #endif |
44 #endif |
44 mRequestsList(new QList<CaptureRequest*> ()), |
45 mRequestsList(new QList<CaptureRequest*> ()), |
45 mMapper(new QKeyMapperPrivate()) |
46 mMapper(new QKeyMapperPrivate()), |
|
47 tgWrapper(new TargetWrapper()) |
46 { |
48 { |
47 |
49 |
48 } |
50 } |
49 |
51 |
50 KeyCapturePrivate::~KeyCapturePrivate() |
52 KeyCapturePrivate::~KeyCapturePrivate() |
53 qDeleteAll(mRequestsList->begin(), mRequestsList->end()); |
55 qDeleteAll(mRequestsList->begin(), mRequestsList->end()); |
54 mRequestsList->clear(); |
56 mRequestsList->clear(); |
55 } |
57 } |
56 delete mRequestsList; |
58 delete mRequestsList; |
57 delete mMapper; |
59 delete mMapper; |
|
60 delete tgWrapper; |
58 } |
61 } |
59 |
62 |
60 bool KeyCapturePrivate::captureKey(Qt::Key aKey, |
63 bool KeyCapturePrivate::captureKey(Qt::Key aKey, |
61 Qt::KeyboardModifiers aModifiersMask, |
64 Qt::KeyboardModifiers aModifiersMask, |
62 Qt::KeyboardModifiers aModifier) |
65 Qt::KeyboardModifiers aModifier) |
74 } |
77 } |
75 |
78 |
76 bool KeyCapturePrivate::captureLongKey(Qt::Key aKey, |
79 bool KeyCapturePrivate::captureLongKey(Qt::Key aKey, |
77 Qt::KeyboardModifiers aModifiersMask, |
80 Qt::KeyboardModifiers aModifiersMask, |
78 Qt::KeyboardModifiers aModifier, |
81 Qt::KeyboardModifiers aModifier, |
79 XqKeyCapture::LongFlags aLongType) |
82 XQKeyCapture::LongFlags aLongType) |
80 { |
83 { |
81 return doCapture(mMapper->mapQtToS60Key(aKey), aModifiersMask, aModifier, |
84 return doCapture(mMapper->mapQtToS60Key(aKey), aModifiersMask, aModifier, |
82 CaptureRequest::CaptureRequestTypeLong, aLongType); |
85 CaptureRequest::CaptureRequestTypeLong, aLongType); |
83 } |
86 } |
84 |
87 |
85 bool KeyCapturePrivate::captureLongKey(TUint aKey, |
88 bool KeyCapturePrivate::captureLongKey(TUint aKey, |
86 Qt::KeyboardModifiers aModifiersMask, |
89 Qt::KeyboardModifiers aModifiersMask, |
87 Qt::KeyboardModifiers aModifier, |
90 Qt::KeyboardModifiers aModifier, |
88 XqKeyCapture::LongFlags aLongType) |
91 XQKeyCapture::LongFlags aLongType) |
89 { |
92 { |
90 return doCapture(aKey, aModifiersMask, aModifier, |
93 return doCapture(aKey, aModifiersMask, aModifier, |
91 CaptureRequest::CaptureRequestTypeLong, aLongType); |
94 CaptureRequest::CaptureRequestTypeLong, aLongType); |
92 } |
95 } |
93 |
96 |
109 |
112 |
110 bool KeyCapturePrivate::doCapture(TUint aKey, |
113 bool KeyCapturePrivate::doCapture(TUint aKey, |
111 Qt::KeyboardModifiers aModifiersMask, |
114 Qt::KeyboardModifiers aModifiersMask, |
112 Qt::KeyboardModifiers aModifier, |
115 Qt::KeyboardModifiers aModifier, |
113 CaptureRequest::CaptureRequestType aType, |
116 CaptureRequest::CaptureRequestType aType, |
114 XqKeyCapture::LongFlags aLongType) |
117 XQKeyCapture::LongFlags aLongType) |
115 { |
118 { |
116 int err = mLastError; |
119 int err = mLastError; |
117 CaptureRequest *req = new CaptureRequest(aKey, aModifiersMask, aModifier, |
120 CaptureRequest *req = new CaptureRequest(aKey, aModifiersMask, aModifier, |
118 aType, aLongType, mWindowGroup); |
121 aType, aLongType, mWindowGroup); |
119 mLastError = req->request(); |
122 mLastError = req->request(); |
142 } |
145 } |
143 |
146 |
144 bool KeyCapturePrivate::cancelCaptureLongKey(Qt::Key aKey, |
147 bool KeyCapturePrivate::cancelCaptureLongKey(Qt::Key aKey, |
145 Qt::KeyboardModifiers aModifiersMask, |
148 Qt::KeyboardModifiers aModifiersMask, |
146 Qt::KeyboardModifiers aModifier, |
149 Qt::KeyboardModifiers aModifier, |
147 XqKeyCapture::LongFlags aLongType) |
150 XQKeyCapture::LongFlags aLongType) |
148 { |
151 { |
149 return doCancelCapture(mMapper->mapQtToS60Key(aKey), aModifiersMask, |
152 return doCancelCapture(mMapper->mapQtToS60Key(aKey), aModifiersMask, |
150 aModifier, CaptureRequest::CaptureRequestTypeLong, aLongType); |
153 aModifier, CaptureRequest::CaptureRequestTypeLong, aLongType); |
151 } |
154 } |
152 |
155 |
153 bool KeyCapturePrivate::cancelCaptureLongKey(TUint aKey, |
156 bool KeyCapturePrivate::cancelCaptureLongKey(TUint aKey, |
154 Qt::KeyboardModifiers aModifiersMask, |
157 Qt::KeyboardModifiers aModifiersMask, |
155 Qt::KeyboardModifiers aModifier, |
158 Qt::KeyboardModifiers aModifier, |
156 XqKeyCapture::LongFlags aLongType) |
159 XQKeyCapture::LongFlags aLongType) |
157 { |
160 { |
158 return doCancelCapture(aKey, aModifiersMask, aModifier, |
161 return doCancelCapture(aKey, aModifiersMask, aModifier, |
159 CaptureRequest::CaptureRequestTypeLong, aLongType); |
162 CaptureRequest::CaptureRequestTypeLong, aLongType); |
160 } |
163 } |
161 |
164 |
176 |
179 |
177 bool KeyCapturePrivate::doCancelCapture(TUint aKey, |
180 bool KeyCapturePrivate::doCancelCapture(TUint aKey, |
178 Qt::KeyboardModifiers aModifiersMask, |
181 Qt::KeyboardModifiers aModifiersMask, |
179 Qt::KeyboardModifiers aModifier, |
182 Qt::KeyboardModifiers aModifier, |
180 CaptureRequest::CaptureRequestType aType, |
183 CaptureRequest::CaptureRequestType aType, |
181 XqKeyCapture::LongFlags aLongType) |
184 XQKeyCapture::LongFlags aLongType) |
182 { |
185 { |
183 int err = mLastError; |
186 int err = mLastError; |
184 |
187 |
185 for (int i(0), size(mRequestsList->count()); i < size; i++) { |
188 for (int i(0), size(mRequestsList->count()); i < size; i++) { |
186 CaptureRequest *r = mRequestsList->at(i); |
189 CaptureRequest *r = mRequestsList->at(i); |
216 } else { |
219 } else { |
217 mLastErrorString = QString("OK"); |
220 mLastErrorString = QString("OK"); |
218 } |
221 } |
219 } |
222 } |
220 |
223 |
|
224 bool KeyCapturePrivate::initRemote(XQKeyCapture::CapturingFlags flags) |
|
225 { |
|
226 if (flags & XQKeyCapture::CaptureBasic) |
|
227 tgWrapper->setBasicApi(true); |
|
228 |
|
229 if (flags & XQKeyCapture::CaptureCallHandlingExt) |
|
230 tgWrapper->setCallHandlingApi(true); |
|
231 |
|
232 return resetRemote(); |
|
233 } |
|
234 |
|
235 bool KeyCapturePrivate::closeRemote(XQKeyCapture::CapturingFlags flags) |
|
236 { |
|
237 if (flags & XQKeyCapture::CaptureBasic) |
|
238 tgWrapper->setBasicApi(false); |
|
239 |
|
240 if (flags & XQKeyCapture::CaptureCallHandlingExt) |
|
241 tgWrapper->setCallHandlingApi(false); |
|
242 |
|
243 return resetRemote(); |
|
244 } |
|
245 |
|
246 bool KeyCapturePrivate::resetRemote() |
|
247 { |
|
248 int err; |
|
249 QT_TRYCATCH_ERROR(err, tgWrapper->init()); |
|
250 mLastError = err; |
|
251 if (err != mLastError) |
|
252 regenerateError(); |
|
253 |
|
254 return errorId() == KErrNone; |
|
255 } |