Commit 592dc9e0 authored by Eike Hein's avatar Eike Hein

Add support for moving group members within a group.

Summary: BUG:383405

Reviewers: #plasma, davidedmundson, argonel

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7267
parent 2be88cc4
......@@ -1430,9 +1430,9 @@ void TasksModel::requestToggleGrouping(const QModelIndex &index)
}
}
bool TasksModel::move(int row, int newPos)
bool TasksModel::move(int row, int newPos, const QModelIndex &parent)
{
if (d->sortMode != SortManual || row == newPos || newPos < 0 || newPos >= rowCount()) {
if (d->sortMode != SortManual || row == newPos || newPos < 0 || newPos >= rowCount(parent)) {
return false;
}
......@@ -1523,7 +1523,7 @@ bool TasksModel::move(int row, int newPos)
endMoveRows();
} else {
beginMoveRows(QModelIndex(), row, row, QModelIndex(), (newPos > row) ? newPos + 1 : newPos);
beginMoveRows(parent, row, row, parent, (newPos > row) ? newPos + 1 : newPos);
// Translate to sort map indices.
const QModelIndex &groupingRowIndex = mapToSource(index(row, 0));
......@@ -1535,7 +1535,8 @@ bool TasksModel::move(int row, int newPos)
d->sortedPreFilterRows.move(row, newPos);
// If we moved a group parent, consolidate sort map for children.
if (groupMode() != GroupDisabled && d->groupingProxyModel->rowCount(groupingRowIndex)) {
if (!parent.isValid() && groupMode() != GroupDisabled
&& d->groupingProxyModel->rowCount(groupingRowIndex)) {
d->consolidateManualSortMapForGroup(groupingRowIndex);
}
......
......@@ -769,8 +769,8 @@ public:
Q_INVOKABLE void requestToggleGrouping(const QModelIndex &index);
/**
* Moves a (top-level) task to a new position in the list. The insert
* position is bounded to the list start and end.
* Moves a task to a new position in the list. The insert position is
* is bounded to the list start and end.
*
* syncLaunchers() should be called after a set of move operations to
* update the launcherList property to reflect the new order.
......@@ -784,7 +784,8 @@ public:
* @param index An index in this tasks model.
* @param newPos The new list position to move the task to.
*/
Q_INVOKABLE bool move(int row, int newPos);
Q_INVOKABLE bool move(int row, int newPos,
const QModelIndex &parent = QModelIndex());
/**
* Updates the launcher list to reflect the new order after calls to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment