|
1 /* |
|
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: Message editor header widget |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "nmailuiwidgetsheaders.h" |
|
19 /* |
|
20 #include "nmhtmllineedit.h" |
|
21 */ |
|
22 /*! |
|
23 Constructor |
|
24 */ |
|
25 NmHtmlLineEdit::NmHtmlLineEdit(QGraphicsItem *parent) : |
|
26 HbLineEdit(parent) |
|
27 { |
|
28 NM_FUNCTION; |
|
29 |
|
30 // Disable scrolling so that baunch effect works correctly |
|
31 HbAbstractEdit::setScrollable(false); |
|
32 HbAbstractEdit::scrollArea()->setScrollDirections(0); |
|
33 } |
|
34 |
|
35 /*! |
|
36 Destructor |
|
37 */ |
|
38 NmHtmlLineEdit::~NmHtmlLineEdit() |
|
39 { |
|
40 NM_FUNCTION; |
|
41 } |
|
42 |
|
43 /*! |
|
44 Replaces the document used in the editor. |
|
45 |
|
46 This allows |
|
47 */ |
|
48 void NmHtmlLineEdit::setDocument(QTextDocument *document) |
|
49 { |
|
50 NM_FUNCTION; |
|
51 |
|
52 HbAbstractEdit::setDocument(document); |
|
53 } |
|
54 |
|
55 QTextDocument *NmHtmlLineEdit::document() const |
|
56 { |
|
57 NM_FUNCTION; |
|
58 |
|
59 return HbAbstractEdit::document(); |
|
60 } |
|
61 |
|
62 void NmHtmlLineEdit::setTextCursor(const QTextCursor &cursor) |
|
63 { |
|
64 NM_FUNCTION; |
|
65 |
|
66 HbAbstractEdit::setTextCursor(cursor); |
|
67 } |
|
68 |
|
69 QTextCursor NmHtmlLineEdit::textCursor() const |
|
70 { |
|
71 NM_FUNCTION; |
|
72 |
|
73 return HbAbstractEdit::textCursor(); |
|
74 } |
|
75 |
|
76 QString NmHtmlLineEdit::toHtml() const |
|
77 { |
|
78 NM_FUNCTION; |
|
79 |
|
80 return HbAbstractEdit::toHtml(); |
|
81 } |
|
82 |
|
83 void NmHtmlLineEdit::setHtml(const QString &text) |
|
84 { |
|
85 NM_FUNCTION; |
|
86 |
|
87 HbAbstractEdit::setHtml(text); |
|
88 } |
|
89 |
|
90 QString NmHtmlLineEdit::toPlainText () const |
|
91 { |
|
92 NM_FUNCTION; |
|
93 |
|
94 return HbAbstractEdit::toPlainText(); |
|
95 } |
|
96 |
|
97 void NmHtmlLineEdit::setPlainText (const QString &text) |
|
98 { |
|
99 NM_FUNCTION; |
|
100 |
|
101 HbAbstractEdit::setPlainText(text); |
|
102 } |
|
103 |
|
104 /*! |
|
105 * Returns the rectangle for the cursor. |
|
106 */ |
|
107 QRectF NmHtmlLineEdit::rectForCursorPosition() const |
|
108 { |
|
109 NM_FUNCTION; |
|
110 |
|
111 return HbLineEdit::rectForPosition(cursorPosition()); |
|
112 } |