emailuis/nmailui/src/nmviewerwebview.cpp
changeset 18 578830873419
child 30 759dc5235cdb
equal deleted inserted replaced
4:e7aa27f58ae1 18:578830873419
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "nmuiheaders.h"
       
    19 
       
    20 /*!
       
    21     Constructor
       
    22 */
       
    23 NmMailViewerWK::NmMailViewerWK()
       
    24 	:QGraphicsWebView()
       
    25 {
       
    26 }
       
    27 
       
    28 /*!
       
    29     Destructor
       
    30 */
       
    31 NmMailViewerWK::~NmMailViewerWK()
       
    32 {
       
    33     mContent.clear();
       
    34 }
       
    35 
       
    36 /*!
       
    37 
       
    38 */
       
    39 void NmMailViewerWK::setParentView(NmViewerView *parentView)
       
    40 {
       
    41     mParentView = parentView;
       
    42 }
       
    43 
       
    44 /*!
       
    45     addContent. Function adds content into web view.
       
    46 */
       
    47 void NmMailViewerWK::addContent(QString key, QVariant val) {
       
    48     mContent[key] = val;
       
    49 }
       
    50 
       
    51 /*!
       
    52     loadResource. Function returns resource from added content (added with addContent)
       
    53 */
       
    54 QVariant NmMailViewerWK::loadResource(int type, const QUrl &name)
       
    55 {
       
    56     if (type == QTextDocument::ImageResource) {
       
    57         QString key = '<' + name.path() + '>';
       
    58         if (!mContent.contains(key)) {
       
    59             key = name.path();
       
    60         }
       
    61         if (mContent.contains(key)) {
       
    62             return mContent[key];
       
    63         }
       
    64         return 0;
       
    65     }
       
    66     return 0;
       
    67 }
       
    68 
       
    69 /*!
       
    70     sendMousePressEvent. Function is used to relay mouse event to base class
       
    71 */
       
    72 void NmMailViewerWK::sendMousePressEvent(QGraphicsSceneMouseEvent *event)
       
    73 {
       
    74     if (event){
       
    75         QGraphicsWebView::mousePressEvent(event);
       
    76     }
       
    77 }
       
    78 
       
    79 /*!
       
    80     sendMouseReleaseEvent. Function is used to relay mouse event to base class
       
    81 */
       
    82 void NmMailViewerWK::sendMouseReleaseEvent(QGraphicsSceneMouseEvent *event)
       
    83 {
       
    84     if (event) {
       
    85         QGraphicsWebView::mouseReleaseEvent(event);
       
    86     }
       
    87 }
       
    88 
       
    89 
       
    90