wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebview.cpp
author hgs
Mon, 23 Aug 2010 13:30:09 +0300
changeset 53 bdc64aa9b954
parent 39 7b3e49e4608a
permissions -rw-r--r--
201033
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:
hgs
parents:
diff changeset
    15
* 
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
// System includes
hgs
parents:
diff changeset
    19
#include <QGraphicsWebView>
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
// User includes
hgs
parents:
diff changeset
    22
#include "wlanloginwebview.h"
hgs
parents:
diff changeset
    23
#include "wlanloginwebpage.h"
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
#include "OstTraceDefinitions.h"
hgs
parents:
diff changeset
    26
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents:
diff changeset
    27
#include "wlanloginwebviewTraces.h"
hgs
parents:
diff changeset
    28
#endif
hgs
parents:
diff changeset
    29
hgs
parents:
diff changeset
    30
/*!
hgs
parents:
diff changeset
    31
    \class WlanLoginWebView
hgs
parents:
diff changeset
    32
    \brief WLAN Login web view class implementation.
hgs
parents:
diff changeset
    33
*/
hgs
parents:
diff changeset
    34
hgs
parents:
diff changeset
    35
// External function prototypes
hgs
parents:
diff changeset
    36
hgs
parents:
diff changeset
    37
// Local constants
hgs
parents:
diff changeset
    38
hgs
parents:
diff changeset
    39
// ======== LOCAL FUNCTIONS ========
hgs
parents:
diff changeset
    40
hgs
parents:
diff changeset
    41
// ======== MEMBER FUNCTIONS ========
hgs
parents:
diff changeset
    42
hgs
parents:
diff changeset
    43
/*!
hgs
parents:
diff changeset
    44
    Constructor       
hgs
parents:
diff changeset
    45
 */
53
hgs
parents: 39
diff changeset
    46
WlanLoginWebView::WlanLoginWebView(): 
hgs
parents: 39
diff changeset
    47
    QGraphicsWebView(),
39
hgs
parents:
diff changeset
    48
    mWebPage(NULL),
hgs
parents:
diff changeset
    49
    mMousePressed(false)
hgs
parents:
diff changeset
    50
{
hgs
parents:
diff changeset
    51
    OstTraceFunctionEntry0( WLANLOGINWEBVIEW_WLANLOGINWEBVIEW_ENTRY );
hgs
parents:
diff changeset
    52
hgs
parents:
diff changeset
    53
    installEventFilter(this); //Event filter for preventing text selection when scrolling
hgs
parents:
diff changeset
    54
    
hgs
parents:
diff changeset
    55
    mWebPage = new WlanLoginWebPage(this);
hgs
parents:
diff changeset
    56
    setPage(mWebPage);
hgs
parents:
diff changeset
    57
    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
hgs
parents:
diff changeset
    58
           
hgs
parents:
diff changeset
    59
    OstTraceFunctionExit0( WLANLOGINWEBVIEW_WLANLOGINWEBVIEW_EXIT );
hgs
parents:
diff changeset
    60
}
hgs
parents:
diff changeset
    61
hgs
parents:
diff changeset
    62
hgs
parents:
diff changeset
    63
/*!
hgs
parents:
diff changeset
    64
    Destructor
hgs
parents:
diff changeset
    65
        
hgs
parents:
diff changeset
    66
 */
hgs
parents:
diff changeset
    67
WlanLoginWebView::~WlanLoginWebView()
hgs
parents:
diff changeset
    68
{
hgs
parents:
diff changeset
    69
    OstTraceFunctionEntry0( WLANLOGINWEBVIEW_DESTRUCTOR_ENTRY );
hgs
parents:
diff changeset
    70
    OstTraceFunctionExit0( WLANLOGINWEBVIEW_DESTRUCTOR_EXIT );
hgs
parents:
diff changeset
    71
}
hgs
parents:
diff changeset
    72
hgs
parents:
diff changeset
    73
/*!
hgs
parents:
diff changeset
    74
    This eventfilter filters QEvent::GraphicsSceneMouseMove events from Web View while
hgs
parents:
diff changeset
    75
    mouse (finger) is pressed down. If filtering is not done it causes text selection on
hgs
parents:
diff changeset
    76
    the web page when page is scrolled with finger.
hgs
parents:
diff changeset
    77
    
hgs
parents:
diff changeset
    78
    @param [in] event Pointer to received event
hgs
parents:
diff changeset
    79
        
hgs
parents:
diff changeset
    80
 */
hgs
parents:
diff changeset
    81
bool WlanLoginWebView::eventFilter(QObject *, QEvent *event)
hgs
parents:
diff changeset
    82
{ 
hgs
parents:
diff changeset
    83
     switch (event->type()) {
hgs
parents:
diff changeset
    84
         case QEvent::GraphicsSceneMousePress:
hgs
parents:
diff changeset
    85
                 mMousePressed = true;            
hgs
parents:
diff changeset
    86
             break;
hgs
parents:
diff changeset
    87
         case QEvent::GraphicsSceneMouseRelease:
hgs
parents:
diff changeset
    88
                 mMousePressed = false;
hgs
parents:
diff changeset
    89
             break;
hgs
parents:
diff changeset
    90
         case QEvent::GraphicsSceneMouseMove:
hgs
parents:
diff changeset
    91
             if (mMousePressed)
hgs
parents:
diff changeset
    92
                 return true;
hgs
parents:
diff changeset
    93
             break;
hgs
parents:
diff changeset
    94
     default:
hgs
parents:
diff changeset
    95
         break;
hgs
parents:
diff changeset
    96
     }      
hgs
parents:
diff changeset
    97
     return false;
hgs
parents:
diff changeset
    98
}
hgs
parents:
diff changeset
    99