diff --git a/desktop-widgets/command_edit.cpp b/desktop-widgets/command_edit.cpp index 97fc05c95..638bfb792 100644 --- a/desktop-widgets/command_edit.cpp +++ b/desktop-widgets/command_edit.cpp @@ -6,7 +6,6 @@ #include "core/qthelper.h" // for copy_qstring #include "core/subsurface-string.h" #include "core/tag.h" -#include "desktop-widgets/mapwidget.h" // TODO: Replace desktop-dependency by signal namespace Command { @@ -752,15 +751,6 @@ bool PasteDives::workToBeDone() void PasteDives::undo() { - bool diveSiteListChanged = false; - - // If we had taken ownership of dive sites, readd them to the system - for (OwningDiveSitePtr &ds: ownedDiveSites) { - register_dive_site(ds.release()); - diveSiteListChanged = true; - } - ownedDiveSites.clear(); - QVector divesToNotify; // Remember dives so that we can send signals later divesToNotify.reserve(dives.size()); for (PasteState &state: dives) { @@ -769,24 +759,6 @@ void PasteDives::undo() invalidate_dive_cache(state.d); // Ensure that dive is written in git_save() } - // If dive sites were pasted, collect all overwritten dive sites - // and remove those which don't have users anymore from the core. - // But keep an owning pointer. Thus if this undo command is freed, the - // dive-site will be automatically deleted and on redo() it can be - // readded to the system - if (what.divesite) { - std::vector divesites; - for (const PasteState &d: dives) { - if (std::find(divesites.begin(), divesites.end(), d.divesite) == divesites.end()) - divesites.push_back(d.divesite); - } - for (dive_site *ds: divesites) { - unregister_dive_site(ds); - ownedDiveSites.emplace_back(ds); - diveSiteListChanged = true; - } - } - // Send signals. DiveField fields(DiveField::NONE); fields.notes = what.notes; @@ -802,9 +774,6 @@ void PasteDives::undo() emit diveListNotifier.cylindersReset(divesToNotify); if (what.weights) emit diveListNotifier.weightsystemsReset(divesToNotify); - - if (diveSiteListChanged) - MapWidget::instance()->reload(); } // Redo and undo do the same diff --git a/desktop-widgets/command_edit.h b/desktop-widgets/command_edit.h index 45fde9e59..8532523e2 100644 --- a/desktop-widgets/command_edit.h +++ b/desktop-widgets/command_edit.h @@ -257,7 +257,6 @@ struct PasteState { class PasteDives : public Base { dive_components what; std::vector dives; - std::vector ownedDiveSites; dive *current; public: PasteDives(const dive *d, dive_components what);