emailuis/nmailui/inc/nmmessagelistview.h
changeset 18 578830873419
child 23 2dc6caa42ec3
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 NMMESSAGELISTVIEW_H_
       
    19 #define NMMESSAGELISTVIEW_H_
       
    20 
       
    21 #include "nmbaseview.h"
       
    22 #include <nmactionobserver.h>
       
    23 
       
    24 class HbTreeView;
       
    25 class HbLabel;
       
    26 class HbMenu;
       
    27 class NmUiEngine;
       
    28 class HbDocumentLoader;
       
    29 class NmApplication;
       
    30 class NmUiStartParam;
       
    31 class NmMessageListModel;
       
    32 class NmMailboxListModel;
       
    33 class HbAbstractViewItem;
       
    34 class NmActionResponse;
       
    35 class NmMessageListModelItem;
       
    36 class QModelIndex;
       
    37 class HbIconItem;
       
    38 
       
    39 class NmMessageListView : public NmBaseView, public NmActionObserver
       
    40 {
       
    41     Q_OBJECT
       
    42 public:
       
    43     NmMessageListView(
       
    44         NmApplication &application,
       
    45         NmUiStartParam *startParam,
       
    46         NmUiEngine &uiEngine,
       
    47         NmMailboxListModel &mailboxListModel,
       
    48         NmMessageListModel &messageListModel,
       
    49         HbDocumentLoader *documentLoader,
       
    50         QGraphicsItem *parent = 0);
       
    51     ~NmMessageListView();
       
    52     NmUiViewId nmailViewId() const;
       
    53 
       
    54 public: // From NmActionObserver
       
    55     void handleActionCommand(NmActionResponse &menuResponse);
       
    56 
       
    57 public slots:
       
    58     void reloadViewContents(NmUiStartParam *startParam);
       
    59 
       
    60 private slots:
       
    61     void showItemContextMenu(HbAbstractViewItem *index, const QPointF &coords);
       
    62     void itemActivated(const QModelIndex &index);
       
    63     void createOptionsMenu();
       
    64     void itemsAdded(const QModelIndex &parent, int start, int end);
       
    65     void itemsRemoved();
       
    66     void showNoMessagesText();
       
    67     void handleSyncStateEvent(NmSyncState syncState, const NmId & mailboxId);
       
    68     void handleConnectionEvent(NmConnectState connectState, const NmId &mailboxId);
       
    69 
       
    70 private:
       
    71     void refreshList();
       
    72     void loadViewLayout();
       
    73     void initTreeView();
       
    74     void setMailboxName();
       
    75     void createToolBar();
       
    76 
       
    77 private:
       
    78     NmApplication &mApplication;
       
    79     HbTreeView *mMessageListWidget;         // Not owned
       
    80     QObjectList mWidgetList;
       
    81     NmUiEngine &mUiEngine;
       
    82     NmMailboxListModel &mMailboxListModel;
       
    83     NmMessageListModel &mMessageListModel;
       
    84     HbDocumentLoader *mDocumentLoader;      // Owned
       
    85     HbMenu *mItemContextMenu;               // Owned
       
    86     NmMessageListModelItem *mLongPressedItem;  // Not owned
       
    87     HbLabel *mNoMessagesLabel;              // Not owned
       
    88     HbLabel *mFolderLabel;                  // Not owned
       
    89     HbLabel *mSyncIcon;                     // Not owned
       
    90 };
       
    91 
       
    92 #endif /* NMMESSAGELISTVIEW_H_ */