From 4fe9b39cdbb5839830281820621059cefc26a03a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 19 May 2019 18:40:04 +0200 Subject: Core: let count_divecomputers() operate on an arbitrary dive Currently, count_divecomputers only works on the current_dive. Instead, let it take a pointer to an arbitrary dive. This is in preparation for being smarter in the undo code concerning which dive computer to show on deletion. Signed-off-by: Berthold Stoeger --- profile-widget/profilewidget2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'profile-widget') diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index c233b2b44..90c6e37ce 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -1430,13 +1430,13 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event) parentItem = parentItem->parentItem(); } if (isDCName) { - if (dc_number == 0 && count_divecomputers() == 1) + if (dc_number == 0 && count_divecomputers(current_dive) == 1) // nothing to do, can't delete or reorder return; // create menu to show when right clicking on dive computer name if (dc_number > 0) m.addAction(tr("Make first dive computer"), this, SLOT(makeFirstDC())); - if (count_divecomputers() > 1) { + if (count_divecomputers(current_dive) > 1) { m.addAction(tr("Delete this dive computer"), this, SLOT(deleteCurrentDC())); m.addAction(tr("Split this dive computer into own dive"), this, SLOT(splitCurrentDC())); } -- cgit v1.2.3-70-g09d2