messagingapp/msgui/msgapp/inc/msglistview.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 14:56:15 +0300
changeset 23 238255e8b033
child 25 84d9eb65b26f
permissions -rw-r--r--
Revision: 201011 Kit: 201015

/*
 * 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:
 *
 */

#ifndef MSG_LIST_VIEW_H
#define MSG_LIST_VIEW_H

// INCLUDES
#include "msgbaseview.h"

// FORWARD DECLARATIONS
class HbListView;
class HbAbstractViewItem;
class HbListWidget;
class HbListWidgetItem;
class QSortFilterProxyModel;

/**
 * This class provides the message list view for the messaging application.
 * Data source for this view is the conversation list model.
 */
class MsgListView: public MsgBaseView
{
Q_OBJECT

public:
    /**
     * Constructor
     */
    explicit MsgListView(QGraphicsItem *parent = 0);

    /**
     * Destructor
     */
    virtual ~MsgListView();

    /**
     * This function starts effect on ListView
     */
    void activateView();

private slots:
    /*
     * Handler for long tap of a list item.
     * @param viewItem  Lon tapped view item
     * @param point X and Y co-ordinates of long tap
     */
    void longPressed(HbAbstractViewItem* viewItem, const QPointF& point);

    /*
     * Handler for short tap of a list item and Item specific menu
     * Opens the conversation view.
     * @param index Model index of the list item tapped.
     */
    void openConversation(const QModelIndex& index);

    //----------------- View specific Menu Slots---------------------------//

    /**
     * Sorts conversation data model based on subject
     */
    void sortBySubject();

    /**
     * Sorts conversation data model based on timestamp
     */
    void sortByDate();

    /**
     * Sorts conversation data model based on sender
     */
    void sortBySender();

    /**
     * Handler for new message button trigger
     */
    void sendNewMessage();

    /**
     * Handler for closing all the active chats
     */
    void closeActiveChats();

    /**
     * Deletes all the conversations
     */
    void deleteAll();

    /**
     * Lists all the Im Messages separately
     */
    void viewImMessagesSeparately();

    /**
     *Popup the message settings dialog
     */
    void settings();

    // -------------------------Item Specific Menu----------------------- //

    /**
     * Opens the conversation view.
     */
    void openConversation();

    /**
     * Opens the contact information
     */
    void showContact();

    /**
     * Deletes the seleted item from the list of Conversations
     */
    void deleteItem();

    // ------------------------------- End ----------------------------- //

    /**
     * Connect Model to view
     */
    void populateListView();

    /**
     * Handles toolbar extension item clicks.
     * @param item Activated toolbar extension item.
     */
    void handleViewExtnActivated(HbListWidgetItem *item);

private:

    /**
     * createView
     */
    void createView();

    /**
     * Initialize the list view inside the main view
     */
    void setupListView();

    /**
     * Initialize the view specific menu
     */
    void setupMenu();

    /**
     * Initialize the tool bar of the view
     */
    void setupToolBar();

private:
    /**
     * List view
     * Own.
     */
    HbListView* mMsgList;

    /**
     * Proxy model for sorting and filtering.
     * Own.
     */
    QSortFilterProxyModel *mProxyModel;

    /**
     * Container widget of toolbar extension.
     * ToolBar takes ownership.
     */
    HbListWidget *mViewExtnList;

    /**
     * Views in toolbar extension.
     */
    enum viewExtnIds
    {
        DRAFTS_EXTN = 0x00, CONVERSATIONS_EXTN = 0x01
    };

};

#endif // MSG_LIST_VIEW_H