--- a/camerauis/cameraxui/cxui/src/cxuicapturekeyhandler_symbian_p.cpp Wed Aug 18 09:37:18 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuicapturekeyhandler_symbian_p.cpp Thu Sep 02 20:14:28 2010 +0300
@@ -57,52 +57,55 @@
mPrimaryCameraCaptureKeys.append(CXUI_CAPTURE_KEY_CODE1);
mPrimaryCameraCaptureKeys.append(CXUI_CAPTURE_KEY_CODE2);
- listenKeys(true);
+ startListeningKeys();
CX_DEBUG_EXIT_FUNCTION();
}
CxuiCaptureKeyHandlerPrivate::~CxuiCaptureKeyHandlerPrivate()
{
CX_DEBUG_ENTER_FUNCTION();
- listenKeys(false);
+ stopListeningKeys();
CX_DEBUG_EXIT_FUNCTION();
}
/*!
-* Start or stop listening key events.
-* @param listen Should we start (true) or stop (false) listening key events.
+* Starts listening key events.
*/
-void CxuiCaptureKeyHandlerPrivate::listenKeys(bool listen)
+void CxuiCaptureKeyHandlerPrivate::startListeningKeys()
{
CX_DEBUG_ENTER_FUNCTION();
+ // Protect from multiple calls
+ if (mCapturedKeyUpDownHandles.empty() && mCapturedKeyHandles.empty()) {
- if (listen) {
- // Protect from multiple calls
- if (mCapturedKeyUpDownHandles.empty() && mCapturedKeyHandles.empty()) {
+ int key(0);
+ foreach (key, mPrimaryCameraAutofocusKeys) {
+ CX_DEBUG(("CxuiCaptureKeyHandlerPrivate - hooking autofocus key with scan / key code: %d", key));
+ listenKey(key);
+ }
+ foreach (key, mPrimaryCameraCaptureKeys) {
+ CX_DEBUG(("CxuiCaptureKeyHandlerPrivate - hooking capture key with scan / key code: %d", key));
+ listenKey(key);
+ }
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
- int key(0);
- foreach (key, mPrimaryCameraAutofocusKeys) {
- CX_DEBUG(("CxuiCaptureKeyHandlerPrivate - hooking autofocus key with scan / key code: %d", key));
- listenKey(key);
- }
- foreach (key, mPrimaryCameraCaptureKeys) {
- CX_DEBUG(("CxuiCaptureKeyHandlerPrivate - hooking capture key with scan / key code: %d", key));
- listenKey(key);
- }
- }
- } else {
+/*!
+* Stops listening key events.
+*/
+void CxuiCaptureKeyHandlerPrivate::stopListeningKeys()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ int handle(0);
+ foreach (handle, mCapturedKeyUpDownHandles) {
+ mWindowGroup.CancelCaptureKeyUpAndDowns(handle);
+ }
+ mCapturedKeyUpDownHandles.clear();
- int handle(0);
- foreach (handle, mCapturedKeyUpDownHandles) {
- mWindowGroup.CancelCaptureKeyUpAndDowns(handle);
- }
- mCapturedKeyUpDownHandles.clear();
-
- foreach (handle, mCapturedKeyHandles) {
- mWindowGroup.CancelCaptureKey(handle);
- }
- mCapturedKeyHandles.clear();
+ foreach (handle, mCapturedKeyHandles) {
+ mWindowGroup.CancelCaptureKey(handle);
}
+ mCapturedKeyHandles.clear();
CX_DEBUG_EXIT_FUNCTION();
}