Reenable Ctrl-Click to delet all further dive points in planner

This is needed to make "Edit dive in planner" work reasonable.

Partly undoes f432b764

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2017-01-23 18:11:52 +01:00 committed by Subsurface
parent c1dc0c9ce0
commit c49f044645

View file

@ -6,6 +6,7 @@
#include "qt-models/models.h"
#include "core/device.h"
#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include <QApplication>
/* TODO: Port this to CleanerTableModel to remove a bit of boilerplate and
* use the signal warningMessage() to communicate errors to the MainWindow.
@ -700,16 +701,16 @@ void DivePlannerPointsModel::remove(const QModelIndex &index)
* remove method that will pass the first and last index of the
* removed rows, and remove those in a go.
*/
// int i;
// int rows = rowCount();
// if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
// beginRemoveRows(QModelIndex(), index.row(), rows - 1);
// for (i = rows - 1; i >= index.row(); i--)
// divepoints.remove(i);
// } else {
int i;
int rows = rowCount();
if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
beginRemoveRows(QModelIndex(), index.row(), rows - 1);
for (i = rows - 1; i >= index.row(); i--)
divepoints.remove(i);
} else {
beginRemoveRows(QModelIndex(), index.row(), index.row());
divepoints.remove(index.row());
// }
}
endRemoveRows();
}