emailuis/nmailui/inc/nmviewerview.h
changeset 18 578830873419
child 20 ecc8def7944a
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 #ifndef NMVIEWERVIEW_H_
       
    19 #define NMVIEWERVIEW_H_
       
    20 
       
    21 #include "nmbaseview.h"
       
    22 #include "nmactionobserver.h"
       
    23 
       
    24 class QGraphicsLinearLayout;
       
    25 class QWebPage;
       
    26 
       
    27 class HbWidget;
       
    28 class HbMainWindow;
       
    29 
       
    30 
       
    31 class NmApplication;
       
    32 class NmUiEngine;
       
    33 class NmUiStartParam;
       
    34 class NmMailViewerWK;
       
    35 class NmMessage;
       
    36 class NmBaseViewScrollArea;
       
    37 class NmViewerViewNetManager;
       
    38 class NmViewerHeader;
       
    39 class NmMailViewerWK;
       
    40 class NmUiDocumentLoader;
       
    41 class NmOperation;
       
    42 class HbProgressDialog;
       
    43 
       
    44 class NmViewerView : public NmBaseView, public NmActionObserver
       
    45 {
       
    46     Q_OBJECT
       
    47 public:
       
    48     NmViewerView(
       
    49             NmApplication &application,
       
    50             NmUiStartParam* startParam,
       
    51             NmUiEngine &uiEngine,
       
    52             HbMainWindow *mainWindow,
       
    53             QGraphicsItem *parent = NULL);
       
    54     ~NmViewerView();
       
    55     void reloadViewContents(NmUiStartParam* startParam);
       
    56     NmUiViewId nmailViewId() const;
       
    57     NmMailViewerWK* webView();
       
    58 
       
    59 public slots:
       
    60     void orientationChanged(Qt::Orientation orientation);
       
    61     void linkClicked(const QUrl& link);
       
    62     void contentScrollPositionChanged(const QPointF &newPosition);
       
    63     void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event);
       
    64     void handleMousePressEvent(QGraphicsSceneMouseEvent *event);
       
    65     void fetchMessage();
       
    66     
       
    67 private slots: 
       
    68     void setMessageData();
       
    69     void messageFetched(int result);
       
    70     void waitNoteCancelled();
       
    71     void webFrameLoaded(bool loaded);
       
    72     void scaleWebViewWhenLoading(const QSize &size);
       
    73     void scaleWebViewWhenLoaded();
       
    74     
       
    75 public: // From NmActionObserver
       
    76     void handleActionCommand(NmActionResponse &menuResponse);
       
    77 
       
    78 private:
       
    79     void loadMessage();
       
    80     void loadViewLayout();
       
    81     QString formatMessage();
       
    82     bool eventOnTopOfHeaderArea(QGraphicsSceneMouseEvent *event);
       
    83     QString escapeSpecialCharacters(const QString text);
       
    84     void changeMessageReadStatus(bool read);
       
    85     void setMailboxName();
       
    86     void createToolBar();
       
    87 
       
    88 private:
       
    89     NmApplication &mApplication;
       
    90     NmUiEngine &mUiEngine;
       
    91     HbMainWindow *mMainWindow;               // Not owned
       
    92     NmMessage* mMessage;                     // Owned
       
    93     NmBaseViewScrollArea *mScrollArea;     // Not owned
       
    94     HbWidget *mViewerContent;                // Not owned
       
    95     NmMailViewerWK *mWebView;                // Not owned
       
    96     NmViewerHeader *mHeaderWidget;           // Not owned
       
    97     QPointF mHeaderStartScenePos;
       
    98     QGraphicsLinearLayout *mViewerContentLayout; // Not owned
       
    99     NmOperation *mMessageFetchingOperation;   // Not owned
       
   100     QPointF mLatestScrollPos;
       
   101     bool mDisplayingPlainText;
       
   102     QObjectList mWidgetList;
       
   103     NmUiDocumentLoader *mDocumentLoader;
       
   104     HbWidget *mScrollAreaContents;
       
   105     HbWidget *mViewerHeaderContainer;
       
   106     QSize mScreenSize;
       
   107     HbProgressDialog *mWaitDialog;            // owned
       
   108     bool loadingCompleted;
       
   109     QSize mLatestLoadingSize;
       
   110 };
       
   111 
       
   112 #endif /* NMVIEWERVIEW_H_ */