libtaskmanager: fix task reordering in a group

Give model index a parent so a task in a group will not be mistaken
for a launcher item.
wilder-5.26
Fushan Wen 4 years ago
parent 98cadd48c2
commit 73657e9185
No known key found for this signature in database
GPG Key ID: 2E48D1487C91DCAA
  1. 8
      libtaskmanager/tasksmodel.cpp

@ -1611,7 +1611,7 @@ bool TasksModel::move(int row, int newPos, const QModelIndex &parent)
return false;
}
const QModelIndex &idx = index(row, 0);
const QModelIndex &idx = index(row, 0, parent);
bool isLauncherMove = false;
// Figure out if we're moving a launcher so we can run barrier checks.
@ -1631,7 +1631,7 @@ bool TasksModel::move(int row, int newPos, const QModelIndex &parent)
return false;
}
if (d->separateLaunchers) {
if (d->separateLaunchers && !parent.isValid() /* Exclude tasks in a group */) {
const int firstTask = (d->launcherTasksModel ? (d->launchInPlace ? d->launcherTasksModel->rowCount() : launcherCount()) : 0);
// Don't allow launchers to be moved past the last launcher.
@ -1778,8 +1778,8 @@ bool TasksModel::move(int row, int newPos, const QModelIndex &parent)
* - after moving: [pinned 1 (launcher item)] [unpinned] [pinned 1 (window)]
* So also check the indexes before and after the unpinned task.
*/
const QModelIndex beforeIdx = d->concatProxyModel->index(d->sortedPreFilterRows.at(newPos - 1), 0);
const QModelIndex afterIdx = d->concatProxyModel->index(d->sortedPreFilterRows.at(newPos + 1), 0);
const QModelIndex beforeIdx = d->concatProxyModel->index(d->sortedPreFilterRows.at(newPos - 1), 0, parent);
const QModelIndex afterIdx = d->concatProxyModel->index(d->sortedPreFilterRows.at(newPos + 1), 0, parent);
if (appsMatch(beforeIdx, afterIdx)) {
// after adjusting: [unpinned] [pinned 1 (launcher item)] [pinned 1]

Loading…
Cancel
Save