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: Derieved HbLineEdit class for custom address editor |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MSGUNIFIEDEDITORLINEEDIT_H |
|
19 #define MSGUNIFIEDEDITORLINEEDIT_H |
|
20 |
|
21 #include <HbLineEdit> |
|
22 #include<QBasicTimer> |
|
23 |
|
24 |
|
25 class MsgUnifiedEditorLineEdit : public HbLineEdit |
|
26 { |
|
27 Q_OBJECT |
|
28 |
|
29 public: |
|
30 /** |
|
31 * Constructor |
|
32 */ |
|
33 MsgUnifiedEditorLineEdit(const QString& label, QGraphicsItem* parent=0); |
|
34 |
|
35 /** |
|
36 * Destructor |
|
37 */ |
|
38 ~MsgUnifiedEditorLineEdit(); |
|
39 |
|
40 /** |
|
41 * seeker method for getting address list |
|
42 */ |
|
43 QStringList addresses(); |
|
44 |
|
45 void setDefaultBehaviour(bool defaultBehaviour = false); |
|
46 QString content() const; |
|
47 |
|
48 signals: |
|
49 void contentsChanged(const QString& text); |
|
50 |
|
51 public slots: |
|
52 void setText(const QString &text); |
|
53 void cut(); |
|
54 void selectAll(); |
|
55 |
|
56 private slots: |
|
57 void selectionChanged(const QTextCursor &oldCursor, const QTextCursor& newCursor); |
|
58 void onContentsChanged(); |
|
59 |
|
60 protected: // from HbLineEdit |
|
61 void inputMethodEvent(QInputMethodEvent *event); |
|
62 void keyPressEvent(QKeyEvent *event); |
|
63 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); |
|
64 void focusInEvent(QFocusEvent* event); |
|
65 void timerEvent (QTimerEvent *event); |
|
66 |
|
67 |
|
68 private: |
|
69 void setHighlight(int currentPos); |
|
70 QString text() const; |
|
71 |
|
72 private: |
|
73 QRegExp mLabelExpr; |
|
74 QString mLabel; |
|
75 QBasicTimer mSelectionSnapTimer; |
|
76 |
|
77 int mSelectionStart; |
|
78 int mSelectionEnd; |
|
79 bool mDefaultBehaviour; |
|
80 }; |
|
81 |
|
82 #endif // MSGUNIFIEDEDITORLINEEDIT_H |
|