Warning, /plasma/latte-dock/containment/package/contents/ui/layouts/loaders/Tasks.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2018 Michail Vourlakos <mvourlakos@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 import QtQuick 2.7 0007 0008 import org.kde.taskmanager 0.1 as TaskManager 0009 0010 import org.kde.latte.core 0.2 as LatteCore 0011 import org.kde.latte.private.containment 0.1 as LatteContainment 0012 0013 Loader { 0014 id: tasksLoader 0015 active: root.scrollAction === LatteContainment.Types.ScrollTasks || root.scrollAction === LatteContainment.Types.ScrollToggleMinimized 0016 sourceComponent: Item { 0017 TaskManager.TasksModel { 0018 id: tasksModel 0019 virtualDesktop: virtualDesktopInfo.currentDesktop 0020 screenGeometry: latteView ? latteView.screenGeometry : Qt.rect(-1, -1, 0, 0) 0021 activity: activityInfo.currentActivity 0022 0023 filterByVirtualDesktop: true 0024 filterByScreen:latteView ? true : false 0025 filterByActivity: true 0026 0027 launchInPlace: true 0028 separateLaunchers: true 0029 groupInline: false 0030 0031 groupMode: TaskManager.TasksModel.GroupApplications 0032 sortMode: TaskManager.TasksModel.SortManual 0033 } 0034 0035 TaskManager.VirtualDesktopInfo { 0036 id: virtualDesktopInfo 0037 } 0038 0039 TaskManager.ActivityInfo { 0040 id: activityInfo 0041 } 0042 0043 Item{ 0044 id: taskList 0045 Repeater{ 0046 model: tasksModel 0047 Item{ 0048 readonly property var m: model 0049 0050 function modelIndex() { 0051 return tasksModel.makeModelIndex(index); 0052 } 0053 } 0054 } 0055 } 0056 0057 function activateNextPrevTask(next) { 0058 var taskIndexList = []; 0059 var activeTaskIndex = tasksModel.activeTask; 0060 0061 for (var i = 0; i < taskList.children.length - 1; ++i) { 0062 var task = taskList.children[i]; 0063 var modelIndex = task.modelIndex(i); 0064 0065 if (task.m.IsLauncher !== true && task.m.IsStartup !== true) { 0066 if (task.m.IsGroupParent === true) { 0067 for (var j = 0; j < tasksModel.rowCount(modelIndex); ++j) { 0068 taskIndexList.push(tasksModel.makeModelIndex(i, j)); 0069 } 0070 } else { 0071 taskIndexList.push(modelIndex); 0072 } 0073 } 0074 } 0075 0076 if (!taskIndexList.length) { 0077 return; 0078 } 0079 0080 var target = taskIndexList[0]; 0081 0082 for (var i = 0; i < taskIndexList.length; ++i) { 0083 if (taskIndexList[i] === activeTaskIndex) 0084 { 0085 if (next && i < (taskIndexList.length - 1)) { 0086 target = taskIndexList[i + 1]; 0087 } else if (!next) { 0088 if (i) { 0089 target = taskIndexList[i - 1]; 0090 } else { 0091 target = taskIndexList[taskIndexList.length - 1]; 0092 } 0093 } 0094 0095 break; 0096 } 0097 } 0098 0099 tasksModel.requestActivate(target); 0100 } 0101 } 0102 }