|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <QGraphicsWebView> |
|
20 |
|
21 // User includes |
|
22 #include "wlanloginwebview.h" |
|
23 #include "wlanloginwebpage.h" |
|
24 |
|
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "wlanloginwebviewTraces.h" |
|
28 #endif |
|
29 |
|
30 /*! |
|
31 \class WlanLoginWebView |
|
32 \brief WLAN Login web view class implementation. |
|
33 */ |
|
34 |
|
35 // External function prototypes |
|
36 |
|
37 // Local constants |
|
38 |
|
39 // ======== LOCAL FUNCTIONS ======== |
|
40 |
|
41 // ======== MEMBER FUNCTIONS ======== |
|
42 |
|
43 /*! |
|
44 Constructor |
|
45 */ |
|
46 WlanLoginWebView::WlanLoginWebView(): |
|
47 QGraphicsWebView(), |
|
48 mWebPage(NULL), |
|
49 mMousePressed(false) |
|
50 { |
|
51 OstTraceFunctionEntry0( WLANLOGINWEBVIEW_WLANLOGINWEBVIEW_ENTRY ); |
|
52 |
|
53 installEventFilter(this); //Event filter for preventing text selection when scrolling |
|
54 |
|
55 mWebPage = new WlanLoginWebPage(this); |
|
56 setPage(mWebPage); |
|
57 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); |
|
58 |
|
59 OstTraceFunctionExit0( WLANLOGINWEBVIEW_WLANLOGINWEBVIEW_EXIT ); |
|
60 } |
|
61 |
|
62 |
|
63 /*! |
|
64 Destructor |
|
65 |
|
66 */ |
|
67 WlanLoginWebView::~WlanLoginWebView() |
|
68 { |
|
69 OstTraceFunctionEntry0( WLANLOGINWEBVIEW_DESTRUCTOR_ENTRY ); |
|
70 OstTraceFunctionExit0( WLANLOGINWEBVIEW_DESTRUCTOR_EXIT ); |
|
71 } |
|
72 |
|
73 /*! |
|
74 This eventfilter filters QEvent::GraphicsSceneMouseMove events from Web View while |
|
75 mouse (finger) is pressed down. If filtering is not done it causes text selection on |
|
76 the web page when page is scrolled with finger. |
|
77 |
|
78 @param [in] event Pointer to received event |
|
79 |
|
80 */ |
|
81 bool WlanLoginWebView::eventFilter(QObject *, QEvent *event) |
|
82 { |
|
83 switch (event->type()) { |
|
84 case QEvent::GraphicsSceneMousePress: |
|
85 mMousePressed = true; |
|
86 break; |
|
87 case QEvent::GraphicsSceneMouseRelease: |
|
88 mMousePressed = false; |
|
89 break; |
|
90 case QEvent::GraphicsSceneMouseMove: |
|
91 if (mMousePressed) |
|
92 return true; |
|
93 break; |
|
94 default: |
|
95 break; |
|
96 } |
|
97 return false; |
|
98 } |
|
99 |