securitydialogs/SecUi/SecUiTestQt/viewfutedataform.h
changeset 66 67b3e3c1fc87
equal deleted inserted replaced
63:989397f9511c 66:67b3e3c1fc87
       
     1 /*
       
     2 * ====================================================
       
     3 *  Name        : viewfutedataform.h
       
     4 *  Part of     : fute/listdemo
       
     5 *  Description : Provides DataForm for general settings 
       
     6 *                or add item data form of an itemview application. 
       
     7 *                One instance of this class even supports 
       
     8 *                populating both forms if operations are done sequentially one after another. 
       
     9 *                In this case application should get handle to HbDataFormModel after populating data form
       
    10 *                (as HbDataFormModel is cleared only in populate* function).
       
    11 *              
       
    12 *  Version     : %version: 1 %
       
    13 *
       
    14 *  Copyright (c) 2009 Nokia.  All rights reserved.
       
    15 *  This material, including documentation and any related computer
       
    16 *  programs, is protected by copyright controlled by Nokia.  All
       
    17 *  rights are reserved.  Copying, including reproducing, storing,
       
    18 *  adapting or translating, any or all of this material requires the
       
    19 *  prior written consent of Nokia.  This material also contains
       
    20 *  confidential information which may not be disclosed to others
       
    21 *  without the prior written consent of Nokia.
       
    22 * ====================================================
       
    23 */
       
    24 
       
    25 #ifndef VIEWFUTEDATAFORM_H
       
    26 #define VIEWFUTEDATAFORM_H
       
    27 
       
    28 #include <QObject>
       
    29 #include <hbdataform.h>
       
    30 
       
    31 #include <hbabstractitemview.h>
       
    32 #include <hbscrollarea.h>
       
    33 #include <hbdataformviewitem.h>
       
    34 #include <hblistviewitem.h>
       
    35 
       
    36 class HbDataFormModel;
       
    37 class HbListWidgetItem;
       
    38 class HbIndexFeedback;
       
    39 class QStandardItem;
       
    40 
       
    41 class ViewFuteDataForm : public HbDataForm
       
    42 {
       
    43     Q_OBJECT
       
    44 
       
    45 public:
       
    46 
       
    47     enum Activity {
       
    48         None,
       
    49         Settings,
       
    50         AddItem
       
    51     };
       
    52 
       
    53     enum SettingsIndex {
       
    54         LaunchInPopup,
       
    55         Frame,
       
    56         Recycling,
       
    57         UniformItem,
       
    58         RichText,
       
    59         SelectionMode,
       
    60         ArrangeMode,
       
    61         ScrollingStyle,
       
    62         ClampingStyle,
       
    63         FrictionEnabled,
       
    64         Orientation,
       
    65         Mirroring,
       
    66         ScrollHint,
       
    67         GraphicsSize,
       
    68         StretchingStyle,
       
    69         MaximumRowCount,
       
    70         MinimumRowCount,
       
    71         InteractiveScrollBar,
       
    72         IndexFeedbackPolicy,
       
    73         Animations,
       
    74         PixmapCache,
       
    75         IconLoadPolicy,
       
    76         SettingsIndexLast
       
    77     };
       
    78 
       
    79     enum AddItemIndex {
       
    80         PrimaryText,
       
    81         SecondaryText,
       
    82         ThirdText,
       
    83         LeftColumn,
       
    84         RightColumn,
       
    85         Type,
       
    86         Background,
       
    87         ItemCount,
       
    88         AddItemIndexLast
       
    89     };
       
    90 
       
    91 
       
    92     explicit ViewFuteDataForm(HbAbstractItemView &view,
       
    93                               QGraphicsItem *parent = 0);
       
    94     virtual ~ViewFuteDataForm();
       
    95 
       
    96     HbDataFormModel *dataModel() const;
       
    97 
       
    98     // Returns next free index
       
    99     int nextIndex() const;
       
   100 
       
   101     // resets internal state of this object including model
       
   102     virtual void initialise();  // reset() is reserved by base class
       
   103 
       
   104     Activity action() const;
       
   105 
       
   106     // S E T T I N G S
       
   107     virtual void populateSettings();
       
   108 
       
   109     // Setting default input data. item: enum value of SettingsIndex or AddItemIndex, if not custom item
       
   110     virtual void setInputData(  Activity    action,
       
   111                                 int         item, 
       
   112                                 QVariant    data);
       
   113 
       
   114     void populateLaunchInPopup();
       
   115     void populateStretchingStyle();
       
   116     void populateGraphicsSize();
       
   117     void populateMaximumRowCount();
       
   118     void populateMinimumRowCount();
       
   119     void populateFrame();
       
   120     void populateRecycling();
       
   121     void populateUniformItem();
       
   122     void populateRichText();
       
   123     virtual void populateSelectionMode();
       
   124     void populateArrangeMode();
       
   125     void populateScrollingStyle();
       
   126     void populateClampingStyle();
       
   127     void populateFrictionEnabled();
       
   128     // needs Qt::Orientation as input data. Data type int. Default value Qt:Portrait
       
   129     void populateOrientation();
       
   130     // needs Qt::LayoutDirection as input data. Data type int. Default value Qt:LeftToRight
       
   131     void populateMirroring();
       
   132     // needs HbAbstractItemView::ScrollHint as input data. Data type int. 
       
   133     //  Default value HbAbstractItemView::EnsureVisible
       
   134     void populateScrollHint();
       
   135     void populateInteractiveScrollBar();
       
   136     void populateIndexFeedbackPolicy();
       
   137     void populateEnabledAnimations();
       
   138     void populatePixmapCacheEnabled();
       
   139     void populateIconLoadPolicy();
       
   140 
       
   141     // S E T T I N G S  results
       
   142     // Pushes results to prototype and view
       
   143     virtual void resolveSettingsResults();
       
   144 
       
   145     bool getLaunchInPopup();
       
   146     // true: default layout
       
   147     HbListViewItem::GraphicsSize getGraphicsSize();
       
   148     HbListViewItem::StretchingStyle getStretchingStyle();
       
   149     int getMaximumRowCount();
       
   150     int getMinimumRowCount();
       
   151 
       
   152     bool getFrame();
       
   153     bool getRecycling();
       
   154     bool getUniformItem();
       
   155     Qt::TextFormat getRichText();
       
   156     virtual HbAbstractItemView::SelectionMode getSelectionMode();
       
   157     bool getArrangeMode();
       
   158     HbScrollArea::ScrollingStyle getScrollingStyle();
       
   159     HbScrollArea::ClampingStyle getClampingStyle();
       
   160     bool getFrictionEnabled();
       
   161     Qt::Orientation getOrientation();
       
   162     Qt::LayoutDirection getMirroring();
       
   163     HbAbstractItemView::ScrollHint getScrollHint();
       
   164     bool getInteractiveScrollBar();
       
   165     int getIndexFeedbackPolicy();
       
   166     HbAbstractItemView::ItemAnimations getEnabledAnimations();
       
   167     bool getPixmapCacheEnaled();
       
   168     HbAbstractItemView::IconLoadPolicy getIconLoadPolicy();
       
   169 
       
   170     // A D D  I T E M
       
   171     virtual void populateAddItem();
       
   172 
       
   173     void populatePrimaryText();
       
   174     void populateSecondaryText();
       
   175     void populateThirdText();
       
   176     void populateLeftColumn();
       
   177     void populateRightColumn();
       
   178     void populateType();
       
   179     void populateBackground();
       
   180 
       
   181     // needs input data as int: default 1
       
   182     void populateAddItemCount();
       
   183 
       
   184     // A D D  I T E M  results: new item created. 
       
   185     // Returns 0, if any data not set
       
   186     virtual QList <HbListWidgetItem *> getListWidgetItems();
       
   187     // or 
       
   188     virtual QList <QStandardItem *> getStandardItems();
       
   189 
       
   190     QString getPrimaryText();
       
   191     QString getSecondaryText();
       
   192     QString getThirdText();
       
   193     QVariant getLeftColumn();
       
   194     QVariant getRightColumn();
       
   195     Hb::ModelItemType getType();
       
   196     QVariant getBackground();
       
   197     int getAddItemCount();
       
   198 
       
   199     void setIndexFeedback(HbIndexFeedback* indexFeedback);
       
   200 
       
   201 private slots:
       
   202     void formatTriggered();
       
   203     void addFormating();
       
   204 
       
   205 protected:
       
   206     // Return count of items added. previousItem: 1 or SettingsIndex
       
   207     virtual int populateCustomSettingsItem(int previousItem);
       
   208 
       
   209     Activity            activity;
       
   210     HbDataFormModel     *settingsFormModel;
       
   211     HbAbstractItemView  *view;
       
   212     HbListWidgetItem    *item;
       
   213     int                 counter;
       
   214     int                 settingsIndexes[SettingsIndexLast];
       
   215     int                 addItemIndexes[AddItemIndexLast];
       
   216     QVariant            settingsData[SettingsIndexLast];
       
   217     QVariant            addItemData[AddItemIndexLast];
       
   218     HbIndexFeedback     *mIndexFeedback;
       
   219 };
       
   220 
       
   221 #endif // VIEWFUTEDATAFORM_H