emailuis/nmailui/inc/nmmessagesearchlistview.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 15:41:10 +0300
changeset 23 2dc6caa42ec3
child 27 9ba4404ef423
permissions -rw-r--r--
Revision: 201017 Kit: 201019

/*
* Copyright (c) 2010 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 NMMESSAGESEARCHLISTVIEW_H_
#define NMMESSAGESEARCHLISTVIEW_H_

#include "nmbaseview.h"
#include <nmactionobserver.h>
#include <QModelIndex>

class HbAbstractViewItem;
class HbDocumentLoader;
class HbLabel;
class HbLineEdit;
class HbMenu;
class HbPushButton;
class HbTreeView;

class NmActionResponse;
class NmApplication;
class NmMessageListModelItem;
class NmMessageSearchListModel;
class NmUiEngine;
class NmUiStartParam;


class NmMessageSearchListView : public NmBaseView, public NmActionObserver
{
    Q_OBJECT

public:

    NmMessageSearchListView(NmApplication &application,
                            NmUiStartParam *startParam,
                            NmUiEngine &uiEngine,
                            NmMessageSearchListModel &searchListModel,
                            HbDocumentLoader *documentLoader,
                            QGraphicsItem *parent = 0);
    ~NmMessageSearchListView();


public: // From NmBaseView

    NmUiViewId nmailViewId() const;
    void viewReady();


public: // From NmActionObserver

    void handleActionCommand(NmActionResponse &menuResponse);


private: // Data types

    enum NmSearchInputMode {
        NmNormalMode = 0,
        NmHighlightedMode,
        NmDimmedMode
    };


private:

    void loadViewLayout();
    void initTreeView();
    void setViewTitle();
    void noMessagesLabelVisibility(bool visible);
    void setSearchInputMode(NmSearchInputMode mode);


public slots:

    void reloadViewContents(NmUiStartParam *startParam);
    void contextButton(NmActionResponse &result);


private slots:

    void showItemContextMenu(HbAbstractViewItem *index, const QPointF &coords);
    void itemActivated(const QModelIndex &index);
    void handleSelection();
    void itemsAdded(const QModelIndex &parent, int start, int end);
    void itemsRemoved();
    void refreshList();
    void toggleSearch();
    void handleSearchComplete();
    void criteriaChanged(QString text);

private: // Data

    NmApplication &mApplication;
    NmUiEngine &mUiEngine;
    NmMessageSearchListModel &mSearchListModel;
    HbDocumentLoader *mDocumentLoader; // Owned
    QObjectList mWidgetList;
    HbMenu *mItemContextMenu; // Owned
    HbTreeView *mMessageListWidget; // Not owned
    HbLabel *mNoMessagesLabel; // Not owned
    HbLabel *mInfoLabel; // Not owned
    HbLineEdit *mLineEdit; // Not owned
    HbPushButton *mPushButton; // Not owned
    NmMessageListModelItem *mLongPressedItem; // Not owned
	QModelIndex mActivatedIndex;
    bool mViewReady;
    bool mSearchInProgress;
};


#endif /* NMMESSAGESEARCHLISTVIEW_H_ */

// End of file.