Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/package/contents/ui/main.qml
Show All 23 Lines | |||||
24 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
25 | 25 | | |||
26 | import org.kde.taskmanager 0.1 as TaskManager | 26 | import org.kde.taskmanager 0.1 as TaskManager | ||
27 | import org.kde.plasma.private.taskmanager 0.1 as TaskManagerApplet | 27 | import org.kde.plasma.private.taskmanager 0.1 as TaskManagerApplet | ||
28 | 28 | | |||
29 | import "code/layout.js" as LayoutManager | 29 | import "code/layout.js" as LayoutManager | ||
30 | import "code/tools.js" as TaskTools | 30 | import "code/tools.js" as TaskTools | ||
31 | 31 | | |||
32 | Item { | 32 | MouseArea { | ||
33 | id: tasks | 33 | id: tasks | ||
34 | 34 | | |||
35 | anchors.fill: parent | 35 | anchors.fill: parent | ||
36 | hoverEnabled: true | ||||
36 | 37 | | |||
37 | property bool vertical: (plasmoid.formFactor === PlasmaCore.Types.Vertical) | 38 | property bool vertical: (plasmoid.formFactor === PlasmaCore.Types.Vertical) | ||
38 | property bool iconsOnly: (plasmoid.pluginName === "org.kde.plasma.icontasks") | 39 | property bool iconsOnly: (plasmoid.pluginName === "org.kde.plasma.icontasks") | ||
39 | 40 | | |||
40 | property QtObject contextMenuComponent: Qt.createComponent("ContextMenu.qml"); | 41 | property QtObject contextMenuComponent: Qt.createComponent("ContextMenu.qml"); | ||
41 | 42 | | |||
43 | property bool needLayoutRefresh: false; | ||||
44 | property variant taskClosedWithMouseMiddleButton: [] | ||||
45 | | ||||
42 | Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation | 46 | Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation | ||
43 | 47 | | |||
44 | Plasmoid.onUserConfiguringChanged: { | 48 | Plasmoid.onUserConfiguringChanged: { | ||
45 | if (plasmoid.userConfiguring) { | 49 | if (plasmoid.userConfiguring) { | ||
46 | groupDialog.visible = false; | 50 | groupDialog.visible = false; | ||
47 | } | 51 | } | ||
48 | } | 52 | } | ||
49 | 53 | | |||
Show All 30 Lines | 62 | //END TODO | |||
80 | } | 84 | } | ||
81 | 85 | | |||
82 | onDragSourceChanged: { | 86 | onDragSourceChanged: { | ||
83 | if (dragSource == null) { | 87 | if (dragSource == null) { | ||
84 | tasksModel.syncLaunchers(); | 88 | tasksModel.syncLaunchers(); | ||
85 | } | 89 | } | ||
86 | } | 90 | } | ||
87 | 91 | | |||
92 | onExited: { | ||||
93 | if (needLayoutRefresh) { | ||||
94 | LayoutManager.layout(taskRepeater) | ||||
95 | needLayoutRefresh = false; | ||||
96 | } | ||||
97 | } | ||||
98 | | ||||
88 | TaskManager.TasksModel { | 99 | TaskManager.TasksModel { | ||
89 | id: tasksModel | 100 | id: tasksModel | ||
90 | 101 | | |||
91 | readonly property int logicalLauncherCount: { | 102 | readonly property int logicalLauncherCount: { | ||
92 | if (plasmoid.configuration.separateLaunchers) { | 103 | if (plasmoid.configuration.separateLaunchers) { | ||
93 | return launcherCount; | 104 | return launcherCount; | ||
94 | } | 105 | } | ||
95 | 106 | | |||
▲ Show 20 Lines • Show All 338 Lines • ▼ Show 20 Line(s) | 439 | Timer { | |||
434 | onTriggered: taskList.layout() | 445 | onTriggered: taskList.layout() | ||
435 | } | 446 | } | ||
436 | 447 | | |||
437 | Repeater { | 448 | Repeater { | ||
438 | id: taskRepeater | 449 | id: taskRepeater | ||
439 | 450 | | |||
440 | delegate: Task {} | 451 | delegate: Task {} | ||
441 | onItemAdded: taskList.layout() | 452 | onItemAdded: taskList.layout() | ||
442 | onItemRemoved: taskList.layout() | 453 | onItemRemoved: { | ||
454 | if (tasks.containsMouse && index != taskRepeater.count && | ||||
455 | item.winIdList.length > 0 && taskClosedWithMouseMiddleButton.indexOf(item.winIdList[0]) > -1) { | ||||
456 | needLayoutRefresh = true; | ||||
457 | } else { | ||||
458 | taskList.layout(); | ||||
459 | } | ||||
460 | taskClosedWithMouseMiddleButton = []; | ||||
461 | } | ||||
443 | } | 462 | } | ||
444 | } | 463 | } | ||
445 | 464 | | |||
446 | GroupDialog { id: groupDialog } | 465 | GroupDialog { id: groupDialog } | ||
447 | 466 | | |||
448 | function hasLauncher(url) { | 467 | function hasLauncher(url) { | ||
449 | return tasksModel.launcherPosition(url) != -1; | 468 | return tasksModel.launcherPosition(url) != -1; | ||
450 | } | 469 | } | ||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |