diff options
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 2 | ||||
-rw-r--r-- | profile-widget/profilewidget2.cpp | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index fd4fe8f82..35140ffbf 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1512,7 +1512,7 @@ void MainWindow::on_actionImportDiveSites_triggered() void MainWindow::editCurrentDive() { // We only allow editing of the profile for manually added dives. - if (!current_dive || !same_string(current_dive->dc.model, "manually added dive") || !userMayChangeAppState()) + if (!current_dive || (!same_string(current_dive->dc.model, "manually added dive") && current_dive->dc.samples) || !userMayChangeAppState()) return; // This shouldn't be possible, but let's make sure no weird "double editing" takes place. diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index e64f07b22..f0c3f1d0a 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -528,8 +528,10 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, bool doClearPict } const struct divecomputer *currentdc = get_dive_dc_const(d, dc); - if (!currentdc || !currentdc->samples) + if (!currentdc || !currentdc->samples) { + setEmptyState(); return; + } // special handling when switching from empty state animSpeed = instant || currentState == EMPTY || printMode ? 0 : qPrefDisplay::animation_speed(); @@ -1359,7 +1361,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event) changeMode->addAction(gettextFromC::tr(divemode_text_ui[PSCR]), [this, seconds](){ addDivemodeSwitch(seconds, PSCR); }); - if (same_string(get_dive_dc_const(d, dc)->model, "manually added dive")) + if (same_string(get_dive_dc_const(d, dc)->model, "manually added dive") || !get_dive_dc_const(d, dc)->samples) m.addAction(tr("Edit the profile"), this, &ProfileWidget2::editCurrentDive); if (DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem)) { |