diff -r 8d5d7fcf9b59 -r 6aefa3341fcc vmbx/vmbxcpplugin/src/customedit.cpp --- a/vmbx/vmbxcpplugin/src/customedit.cpp Wed Jul 21 18:26:52 2010 +0300 +++ b/vmbx/vmbxcpplugin/src/customedit.cpp Fri Jul 23 12:32:49 2010 +0300 @@ -1,4 +1,4 @@ - /* +/* * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available @@ -15,8 +15,6 @@ * */ -#include - #include "customedit.h" #include "loggerutil.h" @@ -26,7 +24,10 @@ CustomEdit::CustomEdit(QGraphicsItem *parent) : HbLineEdit(parent) { - _DBGLOG("CustomEdit::CustomEdit()") + _DBGLOG("CustomEdit::CustomEdit() >") + const bool ret = connect(&mItemClickedTimer, SIGNAL(timeout()), + this, SLOT(emitEditItemClicked())); + _DBGLOG2("CustomEdit::CustomEdit() <", ret) } /*! @@ -35,25 +36,39 @@ CustomEdit::~CustomEdit() { _DBGLOG("CustomEdit::CustomEdit()") + disconnect(&mItemClickedTimer, SIGNAL(timeout()), + this, SLOT(emitEditItemClicked())); } /*! - mousePressEvent + focusInEvent */ void CustomEdit::focusInEvent(QFocusEvent *event) { _DBGLOG("CustomEdit::focusInEvent() >") if (!event->gotFocus()) { + _DBGLOG("CustomEdit::focusInEvent() ignore") event->ignore(); - _DBGLOG("CustomEdit::focusInEvent() ignore") - return; } else { - emit editItemClicked(); + _DBGLOG("CustomEdit::focusInEvent() emit clicked") + // When focus comes to the controller, a 100 ms timer is started. + // a signal is emitted after this 100 ms, and focus transfer to other controller, + // after the other controller finished,to avoid focus gained again. + mItemClickedTimer.start(100); event->accept(); - _DBGLOG("CustomEdit::focusInEvent() emit clicked") } _DBGLOG("CustomEdit::focusInEvent() <") } - + +/*! + emitEditItemClicked +*/ +void CustomEdit::emitEditItemClicked() +{ + _DBGLOG("CustomEdit::emitEditItemClicked() >") + emit editItemClicked(); + mItemClickedTimer.stop(); + _DBGLOG("CustomEdit::emitEditItemClicked() <") +} // End of file