Fix the sentense 'collapse' to 'collapse others' and scroll to it.

This patch changes the string 'collapse' to a more meaningfull
'collapse others', it also scrolls the view to the first selec
ted index, since after collapsing the others, things could be
in the wrong position.,

Fixes #233

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2013-11-15 10:51:39 -02:00 committed by Dirk Hohndel
parent 6bf12bde03
commit 1e63579cc6

View file

@ -536,7 +536,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
if (currentLayout == DiveTripModel::TREE) { if (currentLayout == DiveTripModel::TREE) {
popup.addAction(tr("expand all"), this, SLOT(expandAll())); popup.addAction(tr("expand all"), this, SLOT(expandAll()));
popup.addAction(tr("collapse all"), this, SLOT(collapseAll())); popup.addAction(tr("collapse all"), this, SLOT(collapseAll()));
collapseAction = popup.addAction(tr("collapse"), this, SLOT(collapseAll())); collapseAction = popup.addAction(tr("collapse others"), this, SLOT(collapseAll()));
if (d) { if (d) {
popup.addAction(tr("remove dive(s) from trip"), this, SLOT(removeFromTrip())); popup.addAction(tr("remove dive(s) from trip"), this, SLOT(removeFromTrip()));
popup.addAction(tr("create new trip above"), this, SLOT(newTripAbove())); popup.addAction(tr("create new trip above"), this, SLOT(newTripAbove()));
@ -560,6 +560,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
if (actionTaken == collapseAction && collapseAction) { if (actionTaken == collapseAction && collapseAction) {
this->setAnimated(false); this->setAnimated(false);
selectDive(current_dive, true); selectDive(current_dive, true);
scrollTo(selectedIndexes().first());
this->setAnimated(true); this->setAnimated(true);
} }
event->accept(); event->accept();