mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-21 10:50:30 +03:00
fix #449,add "cycle through tasks" action
--added the new cycle through tasks behavior to tasks actions
This commit is contained in:
parent
697f375f1a
commit
e0f7b9b220
@ -93,6 +93,7 @@
|
||||
<choice name="Close"/>
|
||||
<choice name="NewInstance"/>
|
||||
<choice name="ToggleMinimized"/>
|
||||
<choice name="CycleThroughTasks"/>
|
||||
</choices>
|
||||
<default>2</default>
|
||||
</entry>
|
||||
@ -102,6 +103,7 @@
|
||||
<choice name="Close"/>
|
||||
<choice name="NewInstance"/>
|
||||
<choice name="ToggleMinimized"/>
|
||||
<choice name="CycleThroughTasks"/>
|
||||
</choices>
|
||||
<default>0</default>
|
||||
</entry>
|
||||
|
@ -75,6 +75,15 @@ public:
|
||||
RightClick
|
||||
};
|
||||
Q_ENUM(ClickAction)
|
||||
|
||||
enum TaskAction {
|
||||
NoneAction = 0,
|
||||
Close,
|
||||
NewInstance,
|
||||
ToggleMinimized,
|
||||
CycleThroughTasks
|
||||
};
|
||||
Q_ENUM(TaskAction)
|
||||
};
|
||||
|
||||
}//end of namespace
|
||||
|
@ -909,59 +909,43 @@ MouseArea{
|
||||
|
||||
if (modifierAccepted(mouse)){
|
||||
if( !mainItemContainer.isLauncher){
|
||||
if (root.modifierClickAction == TaskManagerApplet.Backend.NewInstance) {
|
||||
if (root.modifierClickAction == Latte.Dock.NewInstance) {
|
||||
tasksModel.requestNewInstance(modelIndex());
|
||||
} else if (root.modifierClickAction == TaskManagerApplet.Backend.Close) {
|
||||
} else if (root.modifierClickAction == Latte.Dock.Close) {
|
||||
tasksModel.requestClose(modelIndex());
|
||||
} else if (root.modifierClickAction == TaskManagerApplet.Backend.ToggleMinimized) {
|
||||
} else if (root.modifierClickAction == Latte.Dock.ToggleMinimized) {
|
||||
tasksModel.requestToggleMinimized(modelIndex());
|
||||
} else if ( root.modifierClickAction == Latte.Dock.CycleThroughTasks) {
|
||||
console.log("2...");
|
||||
if (isGroupParent)
|
||||
tasksWindows.activateNextTask();
|
||||
else
|
||||
activateTask();
|
||||
}
|
||||
} else {
|
||||
mouseEntered = false;
|
||||
wrapper.runLauncherAnimation();
|
||||
}
|
||||
}else if (mouse.button == Qt.MidButton){
|
||||
} else if (mouse.button == Qt.MidButton){
|
||||
if( !mainItemContainer.isLauncher){
|
||||
if (root.middleClickAction == TaskManagerApplet.Backend.NewInstance) {
|
||||
if (root.middleClickAction == Latte.Dock.NewInstance) {
|
||||
tasksModel.requestNewInstance(modelIndex());
|
||||
} else if (root.middleClickAction == TaskManagerApplet.Backend.Close) {
|
||||
} else if (root.middleClickAction == Latte.Dock.Close) {
|
||||
tasksModel.requestClose(modelIndex());
|
||||
} else if (root.middleClickAction == TaskManagerApplet.Backend.ToggleMinimized) {
|
||||
} else if (root.middleClickAction == Latte.Dock.ToggleMinimized) {
|
||||
tasksModel.requestToggleMinimized(modelIndex());
|
||||
} else if ( root.middleClickAction == Latte.Dock.CycleThroughTasks) {
|
||||
if (isGroupParent)
|
||||
tasksWindows.activateNextTask();
|
||||
else
|
||||
activateTask();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mouseEntered = false;
|
||||
wrapper.runLauncherAnimation();
|
||||
}
|
||||
}
|
||||
else if (mouse.button == Qt.LeftButton){
|
||||
if( mainItemContainer.isLauncher){
|
||||
mouseEntered = false;
|
||||
wrapper.runLauncherAnimation();
|
||||
}
|
||||
else{
|
||||
if (model.IsGroupParent) {
|
||||
if (Latte.WindowSystem.compositingActive) {
|
||||
root.presentWindows(model.LegacyWinIdList);
|
||||
} else {
|
||||
if ((windowsPreviewDlg.visualParent === mainItemContainer)&&(windowsPreviewDlg.visible)) {
|
||||
windowsPreviewDlg.hide(3);
|
||||
} else {
|
||||
preparePreviewWindow(false);
|
||||
windowsPreviewDlg.show(mainItemContainer);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (IsMinimized === true) {
|
||||
var i = modelIndex();
|
||||
tasksModel.requestToggleMinimized(i);
|
||||
tasksModel.requestActivate(i);
|
||||
} else if (IsActive === true) {
|
||||
tasksModel.requestToggleMinimized(modelIndex());
|
||||
} else {
|
||||
tasksModel.requestActivate(modelIndex());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else if (mouse.button == Qt.LeftButton){
|
||||
activateTask();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1008,6 +992,36 @@ MouseArea{
|
||||
tasksWindows.activateNextTask();
|
||||
}
|
||||
|
||||
function activateTask() {
|
||||
if( mainItemContainer.isLauncher){
|
||||
mouseEntered = false;
|
||||
wrapper.runLauncherAnimation();
|
||||
}
|
||||
else{
|
||||
if (model.IsGroupParent) {
|
||||
if (Latte.WindowSystem.compositingActive) {
|
||||
root.presentWindows(model.LegacyWinIdList);
|
||||
} else {
|
||||
if ((windowsPreviewDlg.visualParent === mainItemContainer)&&(windowsPreviewDlg.visible)) {
|
||||
windowsPreviewDlg.hide(3);
|
||||
} else {
|
||||
preparePreviewWindow(false);
|
||||
windowsPreviewDlg.show(mainItemContainer);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (IsMinimized === true) {
|
||||
var i = modelIndex();
|
||||
tasksModel.requestToggleMinimized(i);
|
||||
tasksModel.requestActivate(i);
|
||||
} else if (IsActive === true) {
|
||||
tasksModel.requestToggleMinimized(modelIndex());
|
||||
} else {
|
||||
tasksModel.requestActivate(modelIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function preparePreviewWindow(hideClose){
|
||||
windowsPreviewDlg.visualParent = mainItemContainer;
|
||||
|
@ -176,7 +176,8 @@ PlasmaComponents.Page {
|
||||
PlasmaComponents.ComboBox {
|
||||
id: middleClickAction
|
||||
Layout.fillWidth: true
|
||||
model: [i18nc("The click action", "None"), i18n("Close Window or Group"), i18n("New Instance"), i18n("Minimize/Restore Window or Group")]
|
||||
model: [i18nc("The click action", "None"), i18n("Close Window or Group"),
|
||||
i18n("New Instance"), i18n("Minimize/Restore Window or Group"), i18n("Cycle Through Tasks")]
|
||||
|
||||
currentIndex: plasmoid.configuration.middleClickAction
|
||||
onCurrentIndexChanged: plasmoid.configuration.middleClickAction = currentIndex
|
||||
@ -217,7 +218,8 @@ PlasmaComponents.Page {
|
||||
PlasmaComponents.ComboBox {
|
||||
id: modifierClickAction
|
||||
Layout.fillWidth: true
|
||||
model: [i18nc("The click action", "None"), i18n("Close Window or Group"), i18n("New Instance"), i18n("Minimize/Restore Window or Group")]
|
||||
model: [i18nc("The click action", "None"), i18n("Close Window or Group"),
|
||||
i18n("New Instance"), i18n("Minimize/Restore Window or Group"), i18n("Cycle Through Tasks")]
|
||||
|
||||
currentIndex: plasmoid.configuration.modifierClickAction
|
||||
onCurrentIndexChanged: plasmoid.configuration.modifierClickAction = currentIndex
|
||||
|
Loading…
x
Reference in New Issue
Block a user