77 // |
77 // |
78 void CBrowserSelectElementDlg::ConstructL( const TDesC& aTitle ) |
78 void CBrowserSelectElementDlg::ConstructL( const TDesC& aTitle ) |
79 { |
79 { |
80 // Create the active object for this object |
80 // Create the active object for this object |
81 iAsyncExit = CBrowserDialogsProviderAsyncExit::NewL( *this ); |
81 iAsyncExit = CBrowserDialogsProviderAsyncExit::NewL( *this ); |
82 |
|
83 // Resource |
82 // Resource |
84 TInt resource = R_AVKON_SOFTKEYS_OK_CANCEL__MARK; |
83 iResource = R_AVKON_SOFTKEYS_OK_CANCEL__MARK; |
|
84 // Enable find pane |
|
85 TBool bIsFindPaneEnabled = (iBrCtlSelectOptionType & 0x100) ? ETrue : EFalse ; |
|
86 |
|
87 if(bIsFindPaneEnabled) |
|
88 { |
|
89 iBrCtlSelectOptionType = (TBrCtlSelectOptionType )(iBrCtlSelectOptionType & 0xEFF) ; |
|
90 } |
|
91 |
85 if (iBrCtlSelectOptionType == ESelectTypeSingle ) |
92 if (iBrCtlSelectOptionType == ESelectTypeSingle ) |
86 { |
93 { |
87 // It was decided that Radio Buttons add little value and unnecessary |
94 // It was decided that Radio Buttons add little value and unnecessary |
88 // complexity to the code, ESelectTypeSingle is no longer supported. |
95 // complexity to the code, ESelectTypeSingle is no longer supported. |
89 iBrCtlSelectOptionType = ESelectTypeNone; |
96 iBrCtlSelectOptionType = ESelectTypeNone; |
90 } |
97 } |
91 else if ( iBrCtlSelectOptionType == ESelectTypeOkOnly ) |
98 else if ( iBrCtlSelectOptionType == ESelectTypeOkOnly ) |
92 { |
99 { |
93 resource = R_AVKON_SOFTKEYS_OK_EMPTY__OK; |
100 iResource = R_AVKON_SOFTKEYS_OK_EMPTY__OK; |
94 } |
101 } |
95 |
102 |
96 // Construct listbox and popup |
103 // Construct listbox and popup |
97 if ( iBrCtlSelectOptionType != ESelectTypeNone ) |
104 if ( iBrCtlSelectOptionType != ESelectTypeNone ) |
98 { |
105 { |
99 iListBox = |
106 iListBox = |
100 new ( ELeave ) CBrowserSelectElementListBox( |
107 new ( ELeave ) CBrowserSelectElementListBox( |
101 iBrCtlSelectOptionType, |
108 iBrCtlSelectOptionType, |
102 iOptionsOrg ); |
109 iOptionsOrg ); |
103 CAknPopupList::ConstructL( iListBox, resource, |
110 CAknPopupList::ConstructL( iListBox, iResource, |
104 AknPopupLayouts::EMenuWindow ); |
111 AknPopupLayouts::EMenuWindow ); |
105 iListBox->ConstructL( *this ); |
112 iListBox->ConstructL( *this ); |
106 iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
113 iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
107 iListBox->CreateScrollBarFrameL( ETrue ); |
114 iListBox->CreateScrollBarFrameL( ETrue ); |
108 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL |
115 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL |
118 { |
125 { |
119 CDesCArrayFlat* items = |
126 CDesCArrayFlat* items = |
120 new ( ELeave ) CDesCArrayFlat ( KGranularityMedium ); |
127 new ( ELeave ) CDesCArrayFlat ( KGranularityMedium ); |
121 |
128 |
122 CleanupStack::PushL(items); |
129 CleanupStack::PushL(items); |
|
130 iResource = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; |
123 for ( TInt i = 0; i<iOptionsOrg.Count(); i++ ) |
131 for ( TInt i = 0; i<iOptionsOrg.Count(); i++ ) |
124 { |
132 { |
125 items->AppendL( iOptionsOrg.At(i).Text() ); |
133 items->AppendL( iOptionsOrg.At(i).Text() ); |
126 } |
134 } |
127 |
135 |
128 // create listbox |
136 // create listbox |
129 iHistoryList = new ( ELeave ) CAknSinglePopupMenuStyleListBox; |
137 iHistoryList = new ( ELeave ) CAknSinglePopupMenuStyleListBox; |
130 |
138 |
131 // create popup |
139 // create popup |
132 CAknPopupList::ConstructL( iHistoryList, |
140 CAknPopupList::ConstructL( iHistoryList, iResource, AknPopupLayouts::EMenuWindow ); |
133 R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT, |
141 |
134 AknPopupLayouts::EMenuWindow ); |
|
135 |
|
136 |
|
137 |
|
138 iHistoryList->ConstructL( this, EAknListBoxSelectionList ); |
142 iHistoryList->ConstructL( this, EAknListBoxSelectionList ); |
139 iHistoryList->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
143 iHistoryList->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
140 iHistoryList->CreateScrollBarFrameL( ETrue ); |
144 iHistoryList->CreateScrollBarFrameL( ETrue ); |
141 iHistoryList->ScrollBarFrame()->SetScrollBarVisibilityL |
145 iHistoryList->ScrollBarFrame()->SetScrollBarVisibilityL |
142 ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
146 ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
143 |
147 |
144 CTextListBoxModel* model = iHistoryList->Model(); |
148 CTextListBoxModel* model = iHistoryList->Model(); |
145 TBool hasItems = iOptionsOrg.Count(); |
149 TBool hasItems = iOptionsOrg.Count(); |
146 if ( hasItems ) |
150 if ( hasItems ) |
147 { |
151 { |
148 model->SetItemTextArray( items ); |
152 model->SetItemTextArray( items ); |
149 model->SetOwnershipType( ELbmOwnsItemArray ); |
153 model->SetOwnershipType( ELbmOwnsItemArray ); |
150 CleanupStack::Pop( items );//ownership is taken by model |
154 CleanupStack::Pop( items );//ownership is taken by model |
158 if ( hasItems ) |
162 if ( hasItems ) |
159 { |
163 { |
160 iHistoryList->SetCurrentItemIndex( 0 ); |
164 iHistoryList->SetCurrentItemIndex( 0 ); |
161 } |
165 } |
162 SetTitleL( aTitle ); |
166 SetTitleL( aTitle ); |
163 EnableFind(); |
167 if (bIsFindPaneEnabled) |
164 } |
168 { |
|
169 EnableFind(); |
|
170 STATIC_CAST( CAknFilteredTextListBoxModel*, |
|
171 ListBox()->Model())->Filter()->SetObserver( this ); |
|
172 } |
|
173 } |
|
174 |
165 } |
175 } |
166 |
176 |
167 //----------------------------------------------------------------------------- |
177 //----------------------------------------------------------------------------- |
168 // CBrowserSelectElementDlg::HandleListBoxEventL |
178 // CBrowserSelectElementDlg::HandleListBoxEventL |
169 //----------------------------------------------------------------------------- |
179 //----------------------------------------------------------------------------- |
200 { |
210 { |
201 if ( ( aControl == ListBox() && |
211 if ( ( aControl == ListBox() && |
202 aEventType == MCoeControlObserver::EEventRequestCancel ) ) |
212 aEventType == MCoeControlObserver::EEventRequestCancel ) ) |
203 { |
213 { |
204 AttemptExitL( EFalse ); |
214 AttemptExitL( EFalse ); |
205 } |
215 } |
206 //Some text has been written to findbox, in filtered selectioncase |
|
207 //highlight selectable item. |
|
208 else if ( aControl == ((CCoeControl*)FindBox()) && |
216 else if ( aControl == ((CCoeControl*)FindBox()) && |
209 aEventType == MCoeControlObserver::EEventStateChanged) |
217 aEventType == MCoeControlObserver::EEventStateChanged ) |
210 { |
218 { |
211 STATIC_CAST ( CBrowserSelectElementListBox*, |
219 CEikButtonGroupContainer * cbaGroup = CEikButtonGroupContainer::Current(); |
|
220 /*Some text has been written to findbox, in filtered selectioncase |
|
221 highlight selectable item. */ |
|
222 if ( iBrCtlSelectOptionType != ESelectTypeNone) |
|
223 { |
|
224 STATIC_CAST ( CBrowserSelectElementListBox*, |
212 ListBox() )->HighlightSelectableItem(); |
225 ListBox() )->HighlightSelectableItem(); |
|
226 } |
|
227 if ( iBrCtlSelectOptionType == ESelectTypeOkOnly ) return; |
|
228 if ( STATIC_CAST( CAknFilteredTextListBoxModel*, ListBox()->Model())->Filter()->FilteredNumberOfItems() == 0 ) |
|
229 { |
|
230 cbaGroup->SetCommandSetL(R_AVKON_SOFTKEYS_CANCEL); |
|
231 cbaGroup->DrawNow(); |
|
232 } |
|
233 else |
|
234 { |
|
235 cbaGroup->SetCommandSetL(iResource); |
|
236 cbaGroup->DrawNow(); |
|
237 } |
213 } |
238 } |
214 } |
239 } |
215 |
240 |
216 //----------------------------------------------------------------------------- |
241 //----------------------------------------------------------------------------- |
217 // CBrowserSelectElementDlg::AttemptExitL |
242 // CBrowserSelectElementDlg::AttemptExitL |