diff options
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 681878d0c..0ef645f20 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -873,10 +873,14 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event) parentItem = parentItem->parentItem(); } if (isDCName) { - if (dc_number == 0) + if (dc_number == 0 && count_divecomputers() == 1) + // nothing to do, can't delete or reorder return; // create menu to show when right clicking on dive computer name - m.addAction(tr("Make first divecomputer"), this, SLOT(makeFirstDC())); + if (dc_number > 0) + m.addAction(tr("Make first divecomputer"), this, SLOT(makeFirstDC())); + if (count_divecomputers() > 1) + m.addAction(tr("Delete this divecomputer"), this, SLOT(deleteCurrentDC())); m.exec(event->globalPos()); // don't show the regular profile context menu return; @@ -929,6 +933,15 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event) m.exec(event->globalPos()); } +void ProfileWidget2::deleteCurrentDC() +{ + delete_current_divecomputer(); + mark_divelist_changed(true); + // we need to force it since it's likely the same dive and same dc_number - but that's a different dive computer now + forceReplot = true; + MainWindow::instance()->refreshDisplay(); +} + void ProfileWidget2::makeFirstDC() { make_first_dc(); |