379 void HbSelectionDialogPrivate::_p_SelectionChanged() |
378 void HbSelectionDialogPrivate::_p_SelectionChanged() |
380 { |
379 { |
381 Q_Q(HbSelectionDialog); |
380 Q_Q(HbSelectionDialog); |
382 if(mSelectionMode == HbAbstractItemView::MultiSelection) |
381 if(mSelectionMode == HbAbstractItemView::MultiSelection) |
383 { |
382 { |
|
383 if(action1){ |
|
384 QItemSelectionModel *model = 0; |
|
385 model = selectionModel(); |
|
386 if(model->selectedRows().count()==0) |
|
387 action1->setEnabled(false); |
|
388 else |
|
389 action1->setEnabled(true); |
|
390 } |
384 emit q->selectionChanged(); |
391 emit q->selectionChanged(); |
385 } |
392 } |
386 } |
393 } |
387 |
394 |
388 void HbSelectionDialogPrivate::showActions(HbAbstractItemView::SelectionMode selectionMode) |
395 void HbSelectionDialogPrivate::showActions(HbAbstractItemView::SelectionMode selectionMode) |
389 { |
396 { |
390 Q_Q(HbSelectionDialog); |
397 Q_Q(HbSelectionDialog); |
391 if(selectionMode == HbAbstractItemView::SingleSelection || selectionMode == HbAbstractItemView::NoSelection){ |
398 if(selectionMode == HbAbstractItemView::SingleSelection || selectionMode == HbAbstractItemView::NoSelection){ |
392 |
|
393 if(action1) { |
399 if(action1) { |
394 q->disconnect(action1,SIGNAL(triggered()),q,SLOT(accept())); |
400 q->disconnect(action1,SIGNAL(triggered()),q,SLOT(accept())); |
395 q->removeAction(action1); |
401 q->removeAction(action1); |
396 } |
402 } |
397 if(action2 == NULL){ |
403 if(action2 == NULL){ |
398 action2 =new HbAction(hbTrId("txt_common_button_cancel"),q); |
404 action2 =new HbAction(hbTrId("txt_common_button_cancel"),q); |
399 q->connect(action2,SIGNAL(triggered()),q,SLOT(reject())); |
|
400 } |
405 } |
401 if(q->actions().contains(action2) == false){ |
406 if(q->actions().contains(action2) == false){ |
|
407 q->connect(action2,SIGNAL(triggered()),q,SLOT(reject())); |
402 q->insertAction(0,action2); |
408 q->insertAction(0,action2); |
403 } |
409 } |
404 } |
410 } |
405 else{ |
411 else{ |
406 |
412 |
407 if(action2 == NULL){ |
413 if(action2 == NULL){ |
408 action2 =new HbAction(hbTrId("txt_common_button_cancel"),q); |
414 action2 =new HbAction(hbTrId("txt_common_button_cancel"),q); |
|
415 } |
|
416 if(q->actions().contains(action2) == false){ |
409 q->connect(action2,SIGNAL(triggered()),q,SLOT(reject())); |
417 q->connect(action2,SIGNAL(triggered()),q,SLOT(reject())); |
410 q->insertAction(0,action2); |
418 q->insertAction(0,action2); |
411 } |
419 } |
412 if(q->actions().contains(action2) == false) |
|
413 q->insertAction(0,action2); |
|
414 |
|
415 if(action1 == NULL){ |
420 if(action1 == NULL){ |
416 action1 =new HbAction(hbTrId("txt_common_button_ok"),q); |
421 action1 =new HbAction(hbTrId("txt_common_button_ok"),q); |
|
422 } |
|
423 if(q->actions().contains(action1) == false) |
|
424 { |
417 q->connect(action1,SIGNAL(triggered()),q,SLOT(accept())); |
425 q->connect(action1,SIGNAL(triggered()),q,SLOT(accept())); |
418 } |
|
419 if(q->actions().contains(action1) == false) |
|
420 { |
|
421 q->insertAction(q->actions().first(),action1); |
426 q->insertAction(q->actions().first(),action1); |
422 } |
427 } |
423 } |
428 } |
424 |
429 |
425 } |
430 } |