summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/command_edit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/command_edit.cpp')
-rw-r--r--desktop-widgets/command_edit.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/desktop-widgets/command_edit.cpp b/desktop-widgets/command_edit.cpp
index ff0bd871a..2c9d56ba5 100644
--- a/desktop-widgets/command_edit.cpp
+++ b/desktop-widgets/command_edit.cpp
@@ -25,15 +25,25 @@ static std::vector<dive *> getDives(bool currentDiveOnly)
return res;
}
-template<typename T>
-EditBase<T>::EditBase(T newValue, bool currentDiveOnly) :
- value(std::move(newValue)),
+EditDivesBase::EditDivesBase(bool currentDiveOnly) :
dives(getDives(currentDiveOnly)),
selectedDives(getDiveSelection()),
current(current_dive)
{
}
+int EditDivesBase::numDives() const
+{
+ return dives.size();
+}
+
+template<typename T>
+EditBase<T>::EditBase(T newValue, bool currentDiveOnly) :
+ EditDivesBase(currentDiveOnly),
+ value(std::move(newValue))
+{
+}
+
// This is quite hackish: we can't use virtual functions in the constructor and
// therefore can't initialize the list of dives [the values of the dives are
// accessed by virtual functions]. Therefore, we (mis)use the fact that workToBeDone()
@@ -439,9 +449,7 @@ DiveField EditMode::fieldId() const
// ***** Tag based commands *****
EditTagsBase::EditTagsBase(const QStringList &newListIn, bool currentDiveOnly) :
- dives(getDives(currentDiveOnly)),
- selectedDives(getDiveSelection()),
- current(current_dive),
+ EditDivesBase(currentDiveOnly),
newList(newListIn)
{
}