40 class HbListView; |
40 class HbListView; |
41 class HbCheckBox; |
41 class HbCheckBox; |
42 |
42 |
43 class HbSelectionDialogPrivate : public HbDialogPrivate |
43 class HbSelectionDialogPrivate : public HbDialogPrivate |
44 { |
44 { |
45 Q_DECLARE_PUBLIC(HbSelectionDialog) |
45 Q_DECLARE_PUBLIC(HbSelectionDialog) |
46 public: |
46 public: |
47 HbSelectionDialogPrivate(); |
47 HbSelectionDialogPrivate(); |
48 ~HbSelectionDialogPrivate(); |
48 ~HbSelectionDialogPrivate(); |
49 void setSelectionMode(HbAbstractItemView::SelectionMode mode); |
49 void setSelectionMode(HbAbstractItemView::SelectionMode mode); |
50 |
50 |
51 private: |
51 private: |
52 void init(); |
52 void init(); |
53 |
53 |
54 void setStringItems(const QStringList &items,int currentIndex); |
54 void setStringItems(const QStringList &items,int currentIndex); |
55 QStringList stringItems() const; |
55 QStringList stringItems() const; |
56 |
56 |
57 void setWidgetItems(const QList<HbListWidgetItem*> &items,bool transferOwnership,int currentIndex); |
57 void setWidgetItems(const QList<HbListWidgetItem*> &items,bool transferOwnership,int currentIndex); |
58 QList<HbListWidgetItem*> widgetItems() const; |
58 QList<HbListWidgetItem*> widgetItems() const; |
59 |
59 |
60 void setSelectedItems(const QList<QVariant> items); |
60 void setSelectedItems(const QList<QVariant> items); |
61 QList<QVariant> selectedItems() const; |
61 QList<QVariant> selectedItems() const; |
62 |
62 |
63 void setModel(QAbstractItemModel* model); |
63 void setModel(QAbstractItemModel* model); |
64 QAbstractItemModel* model() const; |
64 QAbstractItemModel* model() const; |
65 QItemSelectionModel* selectionModel() const; |
65 QItemSelectionModel* selectionModel() const; |
66 QModelIndexList selectedModelIndexes() const; |
66 QModelIndexList selectedModelIndexes() const; |
67 void clearItems(bool keepItems); |
67 void clearItems(bool keepItems); |
68 void showActions(HbAbstractItemView::SelectionMode selectionMode); |
68 void showActions(HbAbstractItemView::SelectionMode selectionMode); |
|
69 QString selectionTitle() const; |
|
70 void setSelectionTitle(const QString& title); |
69 public: |
71 public: |
70 bool bOwnItems; |
72 bool bOwnItems; |
71 HbAbstractItemView::SelectionMode mSelectionMode; |
73 HbAbstractItemView::SelectionMode mSelectionMode; |
72 void close(); |
74 void close(); |
|
75 void _p_SelectionChanged(); |
73 private: |
76 private: |
74 HbAction *action1; |
77 QPointer<HbAction> action1; |
75 HbAction *action2; |
78 QPointer<HbAction> action2; |
76 }; |
79 }; |
77 |
80 |
78 class HbSelectionDialogMarkWidget : public HbWidget |
81 class HbSelectionDialogMarkWidget : public HbWidget |
79 { |
82 { |
80 Q_OBJECT |
83 Q_OBJECT |
81 public: |
84 public: |
82 QGraphicsItem *mBackgroundItem; |
85 QGraphicsObject *mBackgroundItem; |
83 HbCheckBox* chkMark; |
86 HbCheckBox* chkMark; |
84 HbTextItem* lbCounter; |
87 QGraphicsObject* mLbCounter; |
85 HbSelectionDialogMarkWidget(QGraphicsItem *parent = 0); |
88 HbSelectionDialogMarkWidget(QGraphicsItem *parent = 0); |
86 ~HbSelectionDialogMarkWidget(); |
89 ~HbSelectionDialogMarkWidget(); |
87 void createPrimitives(); |
90 void createPrimitives(); |
88 void updatePrimitives(); |
91 void updatePrimitives(); |
89 QVariant itemChange( GraphicsItemChange change, const QVariant &value ); |
92 void recreatePrimitives(); |
90 QGraphicsItem* primitive(HbStyle::Primitive primitive) const; |
93 void initPrimitiveData(HbStylePrimitiveData *primitiveData, const QGraphicsObject *primitive); |
|
94 QVariant itemChange( GraphicsItemChange change, const QVariant &value ); |
|
95 QGraphicsItem *primitive(const QString &itemName) const; |
|
96 void updateCounter(const QString& text); |
|
97 QString mCounterText; |
91 }; |
98 }; |
92 |
99 |
93 class HB_AUTOTEST_EXPORT HbSelectionDialogContentWidget :public HbWidget |
100 class HB_AUTOTEST_EXPORT HbSelectionDialogContentWidget :public HbWidget |
94 { |
101 { |
95 Q_OBJECT |
102 Q_OBJECT |
96 Q_PROPERTY( bool multiSelection READ multiSelection WRITE setMultiSelection ) |
103 Q_PROPERTY( bool multiSelection READ multiSelection WRITE setMultiSelection ) |
97 private: |
104 private: |
98 int selectedItemCount() const; |
105 int selectedItemCount() const; |
99 int totalItemCount() const; |
106 int totalItemCount() const; |
100 public: |
107 public: |
101 void createListWidget(); |
108 void createListWidget(); |
102 void createListView(); |
109 void createListView(); |
103 void connectSlots(); |
110 void connectSlots(); |
104 HbListView* mListView; |
111 HbListView* mListView; |
105 HbSelectionDialogPrivate* d; |
112 HbSelectionDialogPrivate* d; |
106 HbSelectionDialogContentWidget(HbSelectionDialogPrivate *priv); |
113 HbSelectionDialogContentWidget(HbSelectionDialogPrivate *priv); |
107 enum { Type = Hb::ItemType_SelectionDialogContentWidget }; |
114 enum { Type = Hb::ItemType_SelectionDialogContentWidget }; |
108 int type() const { return Type; } |
115 int type() const { return Type; } |
109 void showMarkWidget(bool bShow); |
116 void showMarkWidget(bool bShow); |
110 bool multiSelection(){return bMultiSelection;}; |
117 bool multiSelection(){return bMultiSelection;}; |
111 void setMultiSelection(bool bValue){bMultiSelection = bValue;}; |
118 void setMultiSelection(bool bValue){bMultiSelection = bValue;}; |
112 bool bMultiSelection; |
119 bool bMultiSelection; |
113 void updateCounter(); |
120 void updateCounter(); |
|
121 void setModel(QAbstractItemModel* model); |
|
122 QString selectionTitle() const; |
|
123 void setSelectionTitle(const QString& title); |
114 private: |
124 private: |
115 HbSelectionDialogMarkWidget* markWidget; |
125 HbSelectionDialogMarkWidget* markWidget; |
|
126 QString mSelectionTitle; |
116 private slots: |
127 private slots: |
117 void _q_listWidgetItemSelected(HbListWidgetItem *item); |
128 void _q_listWidgetItemSelected(HbListWidgetItem *item); |
118 void _q_listItemSelected(QModelIndex index); |
129 void _q_listItemSelected(QModelIndex index); |
119 void _q_checkboxclicked(int value); |
130 void _q_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); |
|
131 void _q_checkboxclicked(int value); |
|
132 void modelChanged(const QModelIndex &parent, int start,int end); |
120 }; |
133 }; |
121 |
134 |
122 |
135 class HbMarkWidget : public HbWidget |
|
136 { |
|
137 public: |
|
138 HbCheckBox* chkMark; |
|
139 HbTextItem* lbCounter; |
|
140 }; |
123 #endif //HBSELECTIONDIALOGPRIVATE_H |
141 #endif //HBSELECTIONDIALOGPRIVATE_H |