messagingapp/msgui/msgapp/inc/msglistview.h
changeset 23 238255e8b033
child 25 84d9eb65b26f
equal deleted inserted replaced
5:4697dfb2d7ad 23:238255e8b033
       
     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 MSG_LIST_VIEW_H
       
    19 #define MSG_LIST_VIEW_H
       
    20 
       
    21 // INCLUDES
       
    22 #include "msgbaseview.h"
       
    23 
       
    24 // FORWARD DECLARATIONS
       
    25 class HbListView;
       
    26 class HbAbstractViewItem;
       
    27 class HbListWidget;
       
    28 class HbListWidgetItem;
       
    29 class QSortFilterProxyModel;
       
    30 
       
    31 /**
       
    32  * This class provides the message list view for the messaging application.
       
    33  * Data source for this view is the conversation list model.
       
    34  */
       
    35 class MsgListView: public MsgBaseView
       
    36 {
       
    37 Q_OBJECT
       
    38 
       
    39 public:
       
    40     /**
       
    41      * Constructor
       
    42      */
       
    43     explicit MsgListView(QGraphicsItem *parent = 0);
       
    44 
       
    45     /**
       
    46      * Destructor
       
    47      */
       
    48     virtual ~MsgListView();
       
    49 
       
    50     /**
       
    51      * This function starts effect on ListView
       
    52      */
       
    53     void activateView();
       
    54 
       
    55 private slots:
       
    56     /*
       
    57      * Handler for long tap of a list item.
       
    58      * @param viewItem  Lon tapped view item
       
    59      * @param point X and Y co-ordinates of long tap
       
    60      */
       
    61     void longPressed(HbAbstractViewItem* viewItem, const QPointF& point);
       
    62 
       
    63     /*
       
    64      * Handler for short tap of a list item and Item specific menu
       
    65      * Opens the conversation view.
       
    66      * @param index Model index of the list item tapped.
       
    67      */
       
    68     void openConversation(const QModelIndex& index);
       
    69 
       
    70     //----------------- View specific Menu Slots---------------------------//
       
    71 
       
    72     /**
       
    73      * Sorts conversation data model based on subject
       
    74      */
       
    75     void sortBySubject();
       
    76 
       
    77     /**
       
    78      * Sorts conversation data model based on timestamp
       
    79      */
       
    80     void sortByDate();
       
    81 
       
    82     /**
       
    83      * Sorts conversation data model based on sender
       
    84      */
       
    85     void sortBySender();
       
    86 
       
    87     /**
       
    88      * Handler for new message button trigger
       
    89      */
       
    90     void sendNewMessage();
       
    91 
       
    92     /**
       
    93      * Handler for closing all the active chats
       
    94      */
       
    95     void closeActiveChats();
       
    96 
       
    97     /**
       
    98      * Deletes all the conversations
       
    99      */
       
   100     void deleteAll();
       
   101 
       
   102     /**
       
   103      * Lists all the Im Messages separately
       
   104      */
       
   105     void viewImMessagesSeparately();
       
   106 
       
   107     /**
       
   108      *Popup the message settings dialog
       
   109      */
       
   110     void settings();
       
   111 
       
   112     // -------------------------Item Specific Menu----------------------- //
       
   113 
       
   114     /**
       
   115      * Opens the conversation view.
       
   116      */
       
   117     void openConversation();
       
   118 
       
   119     /**
       
   120      * Opens the contact information
       
   121      */
       
   122     void showContact();
       
   123 
       
   124     /**
       
   125      * Deletes the seleted item from the list of Conversations
       
   126      */
       
   127     void deleteItem();
       
   128 
       
   129     // ------------------------------- End ----------------------------- //
       
   130 
       
   131     /**
       
   132      * Connect Model to view
       
   133      */
       
   134     void populateListView();
       
   135 
       
   136     /**
       
   137      * Handles toolbar extension item clicks.
       
   138      * @param item Activated toolbar extension item.
       
   139      */
       
   140     void handleViewExtnActivated(HbListWidgetItem *item);
       
   141 
       
   142 private:
       
   143 
       
   144     /**
       
   145      * createView
       
   146      */
       
   147     void createView();
       
   148 
       
   149     /**
       
   150      * Initialize the list view inside the main view
       
   151      */
       
   152     void setupListView();
       
   153 
       
   154     /**
       
   155      * Initialize the view specific menu
       
   156      */
       
   157     void setupMenu();
       
   158 
       
   159     /**
       
   160      * Initialize the tool bar of the view
       
   161      */
       
   162     void setupToolBar();
       
   163 
       
   164 private:
       
   165     /**
       
   166      * List view
       
   167      * Own.
       
   168      */
       
   169     HbListView* mMsgList;
       
   170 
       
   171     /**
       
   172      * Proxy model for sorting and filtering.
       
   173      * Own.
       
   174      */
       
   175     QSortFilterProxyModel *mProxyModel;
       
   176 
       
   177     /**
       
   178      * Container widget of toolbar extension.
       
   179      * ToolBar takes ownership.
       
   180      */
       
   181     HbListWidget *mViewExtnList;
       
   182 
       
   183     /**
       
   184      * Views in toolbar extension.
       
   185      */
       
   186     enum viewExtnIds
       
   187     {
       
   188         DRAFTS_EXTN = 0x00, CONVERSATIONS_EXTN = 0x01
       
   189     };
       
   190 
       
   191 };
       
   192 
       
   193 #endif // MSG_LIST_VIEW_H