diff options
-rw-r--r-- | commands/command_edit.cpp | 10 | ||||
-rw-r--r-- | commands/command_edit.h | 2 | ||||
-rw-r--r-- | core/dive.c | 4 | ||||
-rw-r--r-- | core/dive.h | 2 | ||||
-rw-r--r-- | desktop-widgets/divecomponentselection.ui | 14 | ||||
-rw-r--r-- | desktop-widgets/simplewidgets.cpp | 8 |
6 files changed, 40 insertions, 0 deletions
diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp index 345ca0cfe..39b734438 100644 --- a/commands/command_edit.cpp +++ b/commands/command_edit.cpp @@ -685,6 +685,10 @@ PasteState::PasteState(dive *dIn, const dive *data, dive_components what) : d(dI } if (what.weights) copy_weights(&data->weightsystems, &weightsystems); + if (what.number) + number = data->number; + if (what.when) + when = data->when; } PasteState::~PasteState() @@ -725,6 +729,10 @@ void PasteState::swap(dive_components what) std::swap(cylinders, d->cylinders); if (what.weights) std::swap(weightsystems, d->weightsystems); + if (what.number) + std::swap(number, d->number); + if (what.when) + std::swap(when, d->when); } // ***** Paste ***** @@ -767,6 +775,8 @@ void PasteDives::undo() fields.chill = what.chill; fields.divesite = what.divesite; fields.tags = what.tags; + fields.datetime = what.when; + fields.nr = what.number; emit diveListNotifier.divesChanged(divesToNotify, fields); if (what.cylinders) emit diveListNotifier.cylindersReset(divesToNotify); diff --git a/commands/command_edit.h b/commands/command_edit.h index ab842a13c..257461c59 100644 --- a/commands/command_edit.h +++ b/commands/command_edit.h @@ -301,6 +301,8 @@ struct PasteState { tag_entry *tags; struct cylinder_table cylinders; struct weightsystem_table weightsystems; + int number; + timestamp_t when; PasteState(dive *d, const dive *data, dive_components what); // Read data from dive data for dive d ~PasteState(); diff --git a/core/dive.c b/core/dive.c index 8bc66a655..351476bb8 100644 --- a/core/dive.c +++ b/core/dive.c @@ -336,6 +336,10 @@ void selective_copy_dive(const struct dive *s, struct dive *d, struct dive_compo copy_cylinder_types(s, d); if (what.weights) copy_weights(&s->weightsystems, &d->weightsystems); + if (what.number) + d->number = s->number; + if (what.when) + d->when = s->when; } #undef CONDITIONAL_COPY_STRING diff --git a/core/dive.h b/core/dive.h index 9c847ee90..3e5ec1324 100644 --- a/core/dive.h +++ b/core/dive.h @@ -90,6 +90,8 @@ struct dive_components { unsigned int tags : 1; unsigned int cylinders : 1; unsigned int weights : 1; + unsigned int number : 1; + unsigned int when : 1; }; extern bool has_gaschange_event(const struct dive *dive, const struct divecomputer *dc, int idx); diff --git a/desktop-widgets/divecomponentselection.ui b/desktop-widgets/divecomponentselection.ui index 05e989174..16b4d1589 100644 --- a/desktop-widgets/divecomponentselection.ui +++ b/desktop-widgets/divecomponentselection.ui @@ -137,6 +137,20 @@ </property> </widget> </item> + <item row="5" column="1"> + <widget class="QCheckBox" name="number"> + <property name="text"> + <string>Dive Number</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QCheckBox" name="when"> + <property name="text"> + <string>Date / Time</string> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 0b79dfe6d..366b57a84 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -312,6 +312,8 @@ DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *tar UI_FROM_COMPONENT(tags); UI_FROM_COMPONENT(cylinders); UI_FROM_COMPONENT(weights); + UI_FROM_COMPONENT(number); + UI_FROM_COMPONENT(when); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); @@ -332,6 +334,8 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button) COMPONENT_FROM_UI(tags); COMPONENT_FROM_UI(cylinders); COMPONENT_FROM_UI(weights); + COMPONENT_FROM_UI(number); + COMPONENT_FROM_UI(when); selective_copy_dive(current_dive, targetDive, *what, true); QClipboard *clipboard = QApplication::clipboard(); QTextStream text; @@ -376,6 +380,10 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button) text << ws.description << ws.weight.grams / 1000 << "kg\n"; } } + if (what->number) + text << tr("Dive number: ") << current_dive->number << "\n"; + if (what->when) + text << tr("Date / time: ") << get_dive_date_string(current_dive->when) << "\n"; clipboard->setText(cliptext); } } |