aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-16 19:21:54 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-16 20:27:54 -0800
commit314cf4c628ac6e709de93f18be384fe819b46f81 (patch)
tree2797068c52f47caaa1b1f5b1d1bdfdd8e2dca70b /qt-ui/divelistview.cpp
parentad0aa8cc497fb954b3fd08aa603d24c384fd16de (diff)
downloadsubsurface-314cf4c628ac6e709de93f18be384fe819b46f81.tar.gz
Removed duplicated method.
This patch removes a duplicated method: get_divenr and get_index_for_dive. The two are exactly the same ( if my c is not broken, but I may be broken since I'm working like crazy for almost 30h nonstop. ), so please take a good look before applying this one. [Dirk Hohndel: Tomaz took the slightly broken of the two implementations, so I switched that out for the correct one] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 44bb78cae..91201c5b5 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -227,9 +227,9 @@ void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(model());
QAbstractItemModel *oldModel = m->sourceModel();
- if (oldModel)
+ if (oldModel){
oldModel->deleteLater();
-
+ }
DiveTripModel *tripModel = new DiveTripModel(this);
tripModel->setLayout(layout);
@@ -347,12 +347,12 @@ void DiveListView::selectionChanged(const QItemSelection& selected, const QItemS
if (child && child->divetrip)
selectedTrips.remove(child->divetrip);
while (child) {
- deselect_dive(get_index_for_dive(child));
+ deselect_dive(get_divenr(child));
child = child->next;
}
}
} else {
- deselect_dive(get_index_for_dive(dive));
+ deselect_dive(get_divenr(dive));
}
}
Q_FOREACH(const QModelIndex& index, newSelected.indexes()) {
@@ -368,7 +368,7 @@ void DiveListView::selectionChanged(const QItemSelection& selected, const QItemS
if (child && child->divetrip)
selectedTrips.insert(child->divetrip);
while (child) {
- select_dive(get_index_for_dive(child));
+ select_dive(get_divenr(child));
child = child->next;
}
selection.select(index.child(0,0), index.child(model->rowCount(index) -1 , 0));
@@ -378,7 +378,7 @@ void DiveListView::selectionChanged(const QItemSelection& selected, const QItemS
expand(index);
}
} else {
- select_dive(get_index_for_dive(dive));
+ select_dive(get_divenr(dive));
}
}
QTreeView::selectionChanged(selectionModel()->selection(), newDeselected);