homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hssearchview.h
author hgs
Wed, 06 Oct 2010 16:06:24 +0300
changeset 97 66b5fe3c07fd
parent 90 3ac3aaebaee5
child 98 e6f74eb7f69f
permissions -rw-r--r--
201039_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
69
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
 * All rights reserved.
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
 *
hgs
parents:
diff changeset
     9
 * Initial Contributors:
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
 *
hgs
parents:
diff changeset
    12
 * Contributors:
hgs
parents:
diff changeset
    13
 *
hgs
parents:
diff changeset
    14
 * Description: Search view.
hgs
parents:
diff changeset
    15
 *
hgs
parents:
diff changeset
    16
 */
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#ifndef HSSEARCHVIEW_H
hgs
parents:
diff changeset
    19
#define HSSEARCHVIEW_H
hgs
parents:
diff changeset
    20
81
hgs
parents: 71
diff changeset
    21
#include <QInputContext>
69
hgs
parents:
diff changeset
    22
#include <QModelIndex>
hgs
parents:
diff changeset
    23
#include <QScopedPointer>
hgs
parents:
diff changeset
    24
#include <HbShrinkingVkbHost>
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
#include "hsmenustates_global.h"
hgs
parents:
diff changeset
    27
#include "hsmenuviewbuilder.h"
71
hgs
parents: 69
diff changeset
    28
#include "hssearchviewbuilder.h"
90
hgs
parents: 81
diff changeset
    29
#include "hssearchfilterproxymodel.h"
69
hgs
parents:
diff changeset
    30
hgs
parents:
diff changeset
    31
class HsMainWindow;
hgs
parents:
diff changeset
    32
class HbAbstractViewItem;
hgs
parents:
diff changeset
    33
class HbLineEdit;
hgs
parents:
diff changeset
    34
class HbSearchPanel;
hgs
parents:
diff changeset
    35
hgs
parents:
diff changeset
    36
HS_STATES_TEST_CLASS(MenuStatesTest)
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
class HsSearchView : public QObject
hgs
parents:
diff changeset
    39
{
hgs
parents:
diff changeset
    40
    Q_OBJECT
hgs
parents:
diff changeset
    41
hgs
parents:
diff changeset
    42
    HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest)
hgs
parents:
diff changeset
    43
hgs
parents:
diff changeset
    44
public:
hgs
parents:
diff changeset
    45
hgs
parents:
diff changeset
    46
    HsSearchView(
hgs
parents:
diff changeset
    47
            HsMenuViewBuilder &builder,
hgs
parents:
diff changeset
    48
            HsStateContext stateContext,
hgs
parents:
diff changeset
    49
            HsMainWindow &mainWindow);
hgs
parents:
diff changeset
    50
    ~HsSearchView();
hgs
parents:
diff changeset
    51
hgs
parents:
diff changeset
    52
    void setSearchPanelVisible(bool visible);
81
hgs
parents: 71
diff changeset
    53
    bool isActive() const;
71
hgs
parents: 69
diff changeset
    54
private:
hgs
parents: 69
diff changeset
    55
69
hgs
parents:
diff changeset
    56
    QModelIndex firstVisibleItemIndex(const HbListView *view) const;
hgs
parents:
diff changeset
    57
    void searchBegins();
hgs
parents:
diff changeset
    58
hgs
parents:
diff changeset
    59
    void connectSearchItemViewsSignals();
hgs
parents:
diff changeset
    60
    void disconnectSearchItemViewsSignals();
hgs
parents:
diff changeset
    61
hgs
parents:
diff changeset
    62
    void connectSearchPanelSignals();
hgs
parents:
diff changeset
    63
hgs
parents:
diff changeset
    64
    void disconnectSearchPanelSignals();
hgs
parents:
diff changeset
    65
hgs
parents:
diff changeset
    66
    void searchFinished();
81
hgs
parents: 71
diff changeset
    67
    void sendEvent(const QEvent::Type eventType);
hgs
parents: 71
diff changeset
    68
    void openVkb();
69
hgs
parents:
diff changeset
    69
hgs
parents:
diff changeset
    70
signals:
hgs
parents:
diff changeset
    71
    void activated(const QModelIndex &index);
hgs
parents:
diff changeset
    72
    void longPressed(HbAbstractViewItem *item, const QPointF &coords);
81
hgs
parents: 71
diff changeset
    73
    void searchComplete(const QModelIndex &firstMatching);
69
hgs
parents:
diff changeset
    74
public slots:
hgs
parents:
diff changeset
    75
    void hideSearchPanel();
71
hgs
parents: 69
diff changeset
    76
hgs
parents: 69
diff changeset
    77
private slots:
69
hgs
parents:
diff changeset
    78
    void activatedProxySlot(const QModelIndex &index);
hgs
parents:
diff changeset
    79
    void longPressedProxySlot(
hgs
parents:
diff changeset
    80
            HbAbstractViewItem *item, const QPointF &coords);
hgs
parents:
diff changeset
    81
hgs
parents:
diff changeset
    82
private slots:
hgs
parents:
diff changeset
    83
    void findItem(QString criteriaStr);
71
hgs
parents: 69
diff changeset
    84
    void setNoResultsVisibility();
81
hgs
parents: 71
diff changeset
    85
    void hideVkb();
71
hgs
parents: 69
diff changeset
    86
69
hgs
parents:
diff changeset
    87
private:
hgs
parents:
diff changeset
    88
    void setOriginatingContext();
hgs
parents:
diff changeset
    89
    void initSearchPanel(HbSearchPanel &searchPanel);
hgs
parents:
diff changeset
    90
    HbLineEdit *searchPanelLineEdit(HbSearchPanel &searchPanel) const;
hgs
parents:
diff changeset
    91
hgs
parents:
diff changeset
    92
private:
hgs
parents:
diff changeset
    93
hgs
parents:
diff changeset
    94
    QModelIndex mSearchViewInitialIndex;
hgs
parents:
diff changeset
    95
    QModelIndex mIndexToScrollAfterSearchDone;
hgs
parents:
diff changeset
    96
    QModelIndex mSearchViewLongPressedIndex;
90
hgs
parents: 81
diff changeset
    97
    HsSearchFilterProxyModel *mProxyModel; // owned
69
hgs
parents:
diff changeset
    98
    HbView *mSearchView;
hgs
parents:
diff changeset
    99
    HbListView *mSearchListView;
hgs
parents:
diff changeset
   100
    HbSearchPanel *mSearchPanel;
hgs
parents:
diff changeset
   101
    const HsStateContext mStateContext;
hgs
parents:
diff changeset
   102
    HsOperationalContext mAfterSearchContext;
hgs
parents:
diff changeset
   103
    HsMenuViewBuilder &mBuilder;
hgs
parents:
diff changeset
   104
    HsMainWindow &mMainWindow;
hgs
parents:
diff changeset
   105
    HbListView *mListView;
hgs
parents:
diff changeset
   106
    QScopedPointer<HbShrinkingVkbHost> mVkbHost;
71
hgs
parents: 69
diff changeset
   107
    HsSearchViewBuilder mSearchViewBuilder;
hgs
parents: 69
diff changeset
   108
    bool mEmptyResultText;
90
hgs
parents: 81
diff changeset
   109
    QString mCriteria;
hgs
parents: 81
diff changeset
   110
69
hgs
parents:
diff changeset
   111
};
hgs
parents:
diff changeset
   112
hgs
parents:
diff changeset
   113
#endif /* HSSEARCHVIEW_H_ */