216 mFindAction->setObjectName( "leftAction" ); |
218 mFindAction->setObjectName( "leftAction" ); |
217 mFindAction->setText( hbTrId("txt_fmgr_opt_find") ); |
219 mFindAction->setText( hbTrId("txt_fmgr_opt_find") ); |
218 mFindAction->setDisabled( mIsFindDisabled ); |
220 mFindAction->setDisabled( mIsFindDisabled ); |
219 toolBar()->addAction( mFindAction ); |
221 toolBar()->addAction( mFindAction ); |
220 toolBar()->setOrientation( Qt::Horizontal ); |
222 toolBar()->setOrientation( Qt::Horizontal ); |
221 |
223 |
222 mSortNameAction = new HbAction( this ); |
224 // Add the action that will open the toolbar extension. |
223 mSortNameAction->setText( hbTrId( "txt_fmgr_setlabel_sort_by_name" ) ); |
225 HbAction *sortExtensionAction = toolBar()->addAction( hbTrId("txt_fmgr_opt_sort") ); |
224 |
226 |
225 mSortTimeAction = new HbAction( this ); |
227 // Create the toolbar extension. |
226 mSortTimeAction->setText( hbTrId( "txt_fmgr_setlabel_sort_by_time" ) ); |
228 mSortExtension = new HbToolBarExtension(); |
227 |
229 |
228 mSortSizeAction = new HbAction( this ); |
230 // Create a list widget. |
229 mSortSizeAction->setText( hbTrId( "txt_fmgr_setlabel_sort_by_size" ) ); |
231 HbListWidget *sortExtensionList = new HbListWidget(); |
230 |
232 sortExtensionList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
231 mSortTypeAction = new HbAction( this ); |
233 |
232 mSortTypeAction->setText( hbTrId( "txt_fmgr_setlabel_sort_by_type" ) ); |
234 // Make the list single selection. |
233 |
235 sortExtensionList->setSelectionMode(HbAbstractItemView::SingleSelection); |
234 mSortExtension = new HbToolBarExtension(); |
236 |
235 mSortExtension->addAction( mSortNameAction ); |
237 // Add list items. |
236 mSortExtension->addAction( mSortTimeAction ); |
238 mSortItemName = new HbListWidgetItem; |
237 mSortExtension->addAction( mSortSizeAction ); |
239 mSortItemName->setText( hbTrId( "txt_fmgr_setlabel_sort_by_name" ) ); |
238 mSortExtension->addAction( mSortTypeAction ); |
240 |
239 |
241 mSortItemTime = new HbListWidgetItem; |
240 HbAction* extensionAction = toolBar()->addExtension( mSortExtension ); |
242 mSortItemTime->setText( hbTrId( "txt_fmgr_setlabel_sort_by_time" ) ); |
241 extensionAction->setText( hbTrId("txt_fmgr_opt_sort")); |
243 |
242 |
244 mSortItemSize = new HbListWidgetItem; |
|
245 mSortItemSize->setText( hbTrId( "txt_fmgr_setlabel_sort_by_size" ) ); |
|
246 |
|
247 mSortItemType = new HbListWidgetItem; |
|
248 mSortItemType->setText( hbTrId( "txt_fmgr_setlabel_sort_by_type" ) ); |
|
249 |
|
250 sortExtensionList->addItem( mSortItemName ); |
|
251 sortExtensionList->addItem( mSortItemTime ); |
|
252 sortExtensionList->addItem( mSortItemSize ); |
|
253 sortExtensionList->addItem( mSortItemType ); |
|
254 // Add the list widget to the toolbar extension object. |
|
255 mSortExtension->setContentWidget(sortExtensionList); |
|
256 |
|
257 // Add the toolbar extension to the toolbar action that will open it. |
|
258 sortExtensionAction->setToolBarExtension(mSortExtension); |
|
259 |
|
260 connect(sortExtensionList, SIGNAL(activated(HbListWidgetItem*)), |
|
261 this,SLOT(on_sortToolBarList_Activated(HbListWidgetItem*)), Qt::QueuedConnection ); |
243 connect( mFindAction, SIGNAL( triggered() ), |
262 connect( mFindAction, SIGNAL( triggered() ), |
244 this, SLOT( on_leftAction_triggered() ) ); |
263 this, SLOT( on_leftAction_triggered() ) ); |
245 connect( mSortNameAction, SIGNAL( triggered() ), |
|
246 this, SLOT( on_sortNameAction_triggered() ), Qt::QueuedConnection ); |
|
247 connect( mSortTimeAction, SIGNAL( triggered() ), |
|
248 this, SLOT( on_sortTimeAction_triggered() ), Qt::QueuedConnection ); |
|
249 connect( mSortSizeAction, SIGNAL( triggered() ), |
|
250 this, SLOT( on_sortSizeAction_triggered() ), Qt::QueuedConnection ); |
|
251 connect( mSortTypeAction, SIGNAL( triggered() ), |
|
252 this, SLOT( on_sortTypeAction_triggered() ), Qt::QueuedConnection ); |
|
253 } |
264 } |
254 |
265 |
255 void FmFileView::setStyle( FmFileBrowseWidget::Style style ) |
266 void FmFileView::setStyle( FmFileBrowseWidget::Style style ) |
256 { |
267 { |
257 /* |
268 /* |
452 void FmFileView::on_driveChanged() |
463 void FmFileView::on_driveChanged() |
453 { |
464 { |
454 mWidget->on_driveChanged(); |
465 mWidget->on_driveChanged(); |
455 } |
466 } |
456 |
467 |
|
468 void FmFileView::on_sortToolBarList_Activated(HbListWidgetItem* item ) |
|
469 { |
|
470 mSortExtension->close(); |
|
471 if( item == mSortItemName ){ |
|
472 on_sortNameAction_triggered(); |
|
473 } else if( item == mSortItemTime ){ |
|
474 on_sortTimeAction_triggered(); |
|
475 } else if( item == mSortItemSize ){ |
|
476 on_sortSizeAction_triggered(); |
|
477 } else if( item == mSortItemType ){ |
|
478 on_sortTypeAction_triggered(); |
|
479 } |
|
480 |
|
481 } |
|
482 |
457 void FmFileView::on_sortNameAction_triggered() |
483 void FmFileView::on_sortNameAction_triggered() |
458 { |
484 { |
459 mWidget->sortFiles( FmFileBrowseWidget::ESortByName ); |
485 mWidget->sortFiles( FmFileBrowseWidget::ESortByName ); |
460 } |
486 } |
461 |
487 |