diff -r 383b67fbdb11 -r 36d93b4dc635 ui/detailscustomwidget/detailscustomwidgets/glxdetailstextedit.cpp --- a/ui/detailscustomwidget/detailscustomwidgets/glxdetailstextedit.cpp Mon Aug 23 18:06:16 2010 +0530 +++ b/ui/detailscustomwidget/detailscustomwidgets/glxdetailstextedit.cpp Sat Sep 04 11:36:24 2010 +0530 @@ -1,60 +1,62 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This is custom widget for details view in photos for displaying the description of image . -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This is custom widget for details view in photos for displaying the description of image . + * + */ +#include +#include +#include +#include + +#include +#include +#include #include "glxdetailstextedit.h" -#include -#include - - //-------------------------------------------------------------------------------------------------------------------------------------------- -//focusInEvent +//gestureEvent //-------------------------------------------------------------------------------------------------------------------------------------------- -void GlxDetailsTextEdit::focusInEvent (QFocusEvent *event) - { - if(event->reason() == Qt::MouseFocusReason ) - { - event->setAccepted(TRUE); - emit labelPressed(); +void GlxDetailsTextEdit::gestureEvent(QGestureEvent* event) +{ + HbLineEdit::gestureEvent(event); + HbTapGesture *tap = qobject_cast (event->gesture(Qt::TapGesture)); + if (tap && (tap->state() == Qt::GestureFinished || tap->state() == Qt::GestureUpdated)) { + QInputContext *ic = qApp->inputContext(); + if (ic) { + QEvent *openEvent = new QEvent(QEvent::CloseSoftwareInputPanel); + ic->filterEvent(openEvent); + delete openEvent; + + if (!mEditorReadOnly && tap->state() == Qt::GestureFinished) { + //Only emit the signal in case of editor is not ready only + emit editorTapped(); + } } - } - - -//-------------------------------------------------------------------------------------------------------------------------------------------- -//focusOutEvent -//-------------------------------------------------------------------------------------------------------------------------------------------- -void GlxDetailsTextEdit::focusOutEvent (QFocusEvent *event) - { - event->setAccepted(TRUE); - } - +} //-------------------------------------------------------------------------------------------------------------------------------------------- //GlxDetailsTextEdit //-------------------------------------------------------------------------------------------------------------------------------------------- -GlxDetailsTextEdit::GlxDetailsTextEdit(QGraphicsItem *parent) : HbTextEdit( parent ) +GlxDetailsTextEdit::GlxDetailsTextEdit(QGraphicsItem *parent) : + HbLineEdit(parent), mEditorReadOnly(0) { - setAlignment(Qt::AlignLeft); - mDesc = new HbEditorInterface(this); - clearContextMenuFlag(Hb::ShowTextContextMenuOnLongPress); - mDesc->setInputConstraints (HbEditorConstraintIgnoreFocus); + setAlignment(Qt::AlignLeft); + clearContextMenuFlag(Hb::ShowTextContextMenuOnLongPress); + grabGesture(Qt::TapGesture); } //-------------------------------------------------------------------------------------------------------------------------------------------- @@ -62,14 +64,21 @@ //-------------------------------------------------------------------------------------------------------------------------------------------- GlxDetailsTextEdit::~GlxDetailsTextEdit() { - delete mDesc; - mDesc = NULL; + mEditorReadOnly = FALSE; } //-------------------------------------------------------------------------------------------------------------------------------------------- //setItemText //-------------------------------------------------------------------------------------------------------------------------------------------- -void GlxDetailsTextEdit::setItemText( const QString &text ) +void GlxDetailsTextEdit::setItemText(const QString &text) { - setPlainText( text ); + setPlainText(text); } + +//-------------------------------------------------------------------------------------------------------------------------------------------- +//setTextItemReadOnly +//-------------------------------------------------------------------------------------------------------------------------------------------- +void GlxDetailsTextEdit::setTextItemReadOnly(bool value) +{ + mEditorReadOnly = value; +}