messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 09:45:25 +0300
changeset 52 12db4185673b
parent 34 84197e66a4bd
child 70 a15d9966050f
permissions -rw-r--r--
Revision: 201031 Kit: 201033

/*
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
 * Description: Main view of unified viewer
 *
 */

#ifndef UNIFIED_VIEWER_H
#define UNIFIED_VIEWER_H

#ifdef BUILD_UNI_VIEWER_DLL
#define UNI_VIEWER_DLL Q_DECL_EXPORT
#else
#define UNI_VIEWER_DLL Q_DECL_IMPORT
#endif

#include <sqldb.h>
#include "msgbaseview.h"

#include "convergedmessage.h"

class UniViewerFeeder;
class ConvergedMessage;
class HbScrollArea;
class UniScrollArea;
class UniContentsWidget;
class MessageDeleteAction;
class HbAction;
/**
 * Main view of unified viewer.
 */
class UNI_VIEWER_DLL UnifiedViewer : public MsgBaseView
{
Q_OBJECT

public:
    /**
     * Constructor
     */
    UnifiedViewer(const qint32 messageId,
                  QGraphicsItem *parent = 0);

    /**
     * Destructor
     */
    ~UnifiedViewer();

    /**
     * Populates the content on the widget
     */
    void populateContent(const qint32 messageId, bool update, int msgCount);

protected:

    /**
     * reimplemented from base class to provide proper geometry for scrolling.
     * @see HbWidget
     */
    void resizeEvent(QGraphicsSceneResizeEvent * event);

private:
    /**
     * Check if this message can be forwarded
     * @return true, if possible to forward
     */
    bool isForwardOk();

    /**
     * Creates tool bar actions
     * @see HbView
     */
    void createToolBar();
    
    /**
     * Launch Editor for forward, reply, replyall actions
     * @param operation, Editor operation e.g. forward, reply etc
     */
    void launchEditor(MsgBaseView::UniEditorOperation operation);

public slots:

    /**
     * Clears the content on the widget
     */
    void clearContent();

    // Used for internal testing will be removed
    void handleFwdAction();
    
    /**
     * Handle delete 
     */     
    void handleDeleteAction();

private slots:
    /**
     * This slot is called when sendMessage signal is emitted for a highlighted
     * phone number, from body widget.
     */
    void sendMessage(const QString& phoneNumber, const QString& alias = QString());

    /**
     * This slot is called when delete message dialog is launched.
     * @param val selected action value.
     */
    void onDialogDeleteMsg(int val);
    
    /**
     * Handle reply
     */
    void handleReplyAction();
    
    /**
     * Handle reply-all
     */
    void handleReplyAllAction();

private:

    /**
     * Feeder object
     * Owned
     */
    UniViewerFeeder *mViewFeeder;

    /**
     * HbScrollArea object
     * Owned
     */
    UniScrollArea* mScrollArea;

    /**
     * UniContentsWidget object
     * Owned
     */
    UniContentsWidget* mContentsWidget;

    /**
     * Contact id
     */
    qint32 mContactId;

    /**
     * Message id
     */
    qint32 mMessageId;
	
    /**
     * Message count
     */
    int mMsgCount;
};

#endif
// EOF