52
|
1 |
/*
|
62
|
2 |
* Copyright (c) 2009 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: This is custom widget for details view in photos for displaying the description of image .
|
|
15 |
*
|
|
16 |
*/
|
52
|
17 |
|
62
|
18 |
#include <QDebug>
|
|
19 |
#include <QEvent>
|
|
20 |
#include <QInputContext>
|
|
21 |
#include <QGraphicsObject>
|
|
22 |
|
|
23 |
#include <hbeditorinterface>
|
|
24 |
#include <hbtapgesture.h>
|
|
25 |
#include <hbapplication.h>
|
52
|
26 |
|
|
27 |
#include "glxdetailstextedit.h"
|
|
28 |
|
|
29 |
//--------------------------------------------------------------------------------------------------------------------------------------------
|
62
|
30 |
//gestureEvent
|
52
|
31 |
//--------------------------------------------------------------------------------------------------------------------------------------------
|
62
|
32 |
void GlxDetailsTextEdit::gestureEvent(QGestureEvent* event)
|
|
33 |
{
|
|
34 |
HbLineEdit::gestureEvent(event);
|
|
35 |
HbTapGesture *tap = qobject_cast<HbTapGesture *> (event->gesture(Qt::TapGesture));
|
|
36 |
if (tap && (tap->state() == Qt::GestureFinished || tap->state() == Qt::GestureUpdated)) {
|
|
37 |
QInputContext *ic = qApp->inputContext();
|
|
38 |
if (ic) {
|
|
39 |
QEvent *openEvent = new QEvent(QEvent::CloseSoftwareInputPanel);
|
|
40 |
ic->filterEvent(openEvent);
|
|
41 |
delete openEvent;
|
|
42 |
|
|
43 |
if (!mEditorReadOnly && tap->state() == Qt::GestureFinished) {
|
|
44 |
//Only emit the signal in case of editor is not ready only
|
|
45 |
emit editorTapped();
|
|
46 |
}
|
52
|
47 |
}
|
|
48 |
}
|
62
|
49 |
}
|
52
|
50 |
|
|
51 |
//--------------------------------------------------------------------------------------------------------------------------------------------
|
|
52 |
//GlxDetailsTextEdit
|
|
53 |
//--------------------------------------------------------------------------------------------------------------------------------------------
|
62
|
54 |
GlxDetailsTextEdit::GlxDetailsTextEdit(QGraphicsItem *parent) :
|
|
55 |
HbLineEdit(parent), mEditorReadOnly(0)
|
52
|
56 |
{
|
62
|
57 |
setAlignment(Qt::AlignLeft);
|
|
58 |
clearContextMenuFlag(Hb::ShowTextContextMenuOnLongPress);
|
|
59 |
grabGesture(Qt::TapGesture);
|
52
|
60 |
}
|
|
61 |
|
|
62 |
//--------------------------------------------------------------------------------------------------------------------------------------------
|
|
63 |
//~GlxDetailsTextEdit
|
|
64 |
//--------------------------------------------------------------------------------------------------------------------------------------------
|
|
65 |
GlxDetailsTextEdit::~GlxDetailsTextEdit()
|
|
66 |
{
|
62
|
67 |
mEditorReadOnly = FALSE;
|
52
|
68 |
}
|
|
69 |
|
|
70 |
//--------------------------------------------------------------------------------------------------------------------------------------------
|
|
71 |
//setItemText
|
|
72 |
//--------------------------------------------------------------------------------------------------------------------------------------------
|
62
|
73 |
void GlxDetailsTextEdit::setItemText(const QString &text)
|
52
|
74 |
{
|
62
|
75 |
setPlainText(text);
|
52
|
76 |
}
|
62
|
77 |
|
|
78 |
//--------------------------------------------------------------------------------------------------------------------------------------------
|
|
79 |
//setTextItemReadOnly
|
|
80 |
//--------------------------------------------------------------------------------------------------------------------------------------------
|
|
81 |
void GlxDetailsTextEdit::setTextItemReadOnly(bool value)
|
|
82 |
{
|
|
83 |
mEditorReadOnly = value;
|
|
84 |
}
|