Update
This commit is contained in:
parent
4f0984ea2e
commit
025b8d326b
|
@ -37,7 +37,7 @@ Item {
|
||||||
&& Plasmoid.configuration.customButtonImage.length != 0)
|
&& Plasmoid.configuration.customButtonImage.length != 0)
|
||||||
property QtObject dashWindow: null
|
property QtObject dashWindow: null
|
||||||
|
|
||||||
Plasmoid.status: dashWindow && dashWindow.visible ? PlasmaCore.Types.RequiresAttentionStatus : PlasmaCore.Types.PassiveStatus
|
// Plasmoid.status: dashWindow && dashWindow.visible ? PlasmaCore.Types.RequiresAttentionStatus : PlasmaCore.Types.PassiveStatus
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
id: buttonIcon
|
id: buttonIcon
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ PlasmaCore.Dialog {
|
||||||
objectName: "popupWindow"
|
objectName: "popupWindow"
|
||||||
//flags: Qt.Dialog | Qt.FramelessWindowHint
|
//flags: Qt.Dialog | Qt.FramelessWindowHint
|
||||||
flags: Qt.WindowStaysOnTopHint
|
flags: Qt.WindowStaysOnTopHint
|
||||||
// location: PlasmaCore.Types.BottomEdge
|
|
||||||
location:{
|
location:{
|
||||||
if (Plasmoid.configuration.displayPosition === 1)
|
if (Plasmoid.configuration.displayPosition === 1)
|
||||||
return PlasmaCore.Types.Floating
|
return PlasmaCore.Types.Floating
|
||||||
|
@ -45,6 +45,7 @@ PlasmaCore.Dialog {
|
||||||
else
|
else
|
||||||
return Plasmoid.location
|
return Plasmoid.location
|
||||||
}
|
}
|
||||||
|
|
||||||
hideOnWindowDeactivate: true
|
hideOnWindowDeactivate: true
|
||||||
|
|
||||||
property int iconSize:{ switch(Plasmoid.configuration.appsIconSize){
|
property int iconSize:{ switch(Plasmoid.configuration.appsIconSize){
|
||||||
|
@ -117,79 +118,57 @@ PlasmaCore.Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
function popupPosition(width, height) {
|
function popupPosition(width, height) {
|
||||||
/*
|
|
||||||
var screenAvail = kicker.availableScreenRect;
|
var screenAvail = kicker.availableScreenRect;
|
||||||
var screenGeom = kicker.screenGeometry;
|
var screen = kicker.screenGeometry;
|
||||||
var screen = Qt.rect(screenAvail.x + screenGeom.x,
|
var panelH = kicker.height
|
||||||
screenAvail.y + screenGeom.y,
|
var panelW = kicker.width
|
||||||
screenAvail.width,
|
var horizMidPoint = screen.x + (screen.width / 2);
|
||||||
screenAvail.height);
|
var vertMidPoint = screen.y + (screen.height / 2);
|
||||||
|
var appletTopLeft = parent.mapToGlobal(0, 0);
|
||||||
var offset = Kirigami.Units.smallSpacing;
|
|
||||||
|
|
||||||
// Fall back to bottom-left of screen area when the applet is on the desktop or floating.
|
|
||||||
var x = offset;
|
|
||||||
var y = screen.height - height - offset;
|
|
||||||
var horizMidPoint;
|
|
||||||
var vertMidPoint;
|
|
||||||
|
|
||||||
horizMidPoint = screen.x + (screen.width / 2);
|
|
||||||
vertMidPoint = screen.y + (screen.height / 2);
|
|
||||||
x = horizMidPoint - width / 2;
|
|
||||||
y = screen.y + screen.height - height - offset - panelSvg.margins.top;
|
|
||||||
|
|
||||||
return Qt.point(x, y);
|
|
||||||
*/
|
|
||||||
var screenAvail = kicker.availableScreenRect;
|
|
||||||
var screenGeom = kicker.screenGeometry;
|
|
||||||
var screen = Qt.rect(screenAvail.x + screenGeom.x,
|
|
||||||
screenAvail.y + screenGeom.y,
|
|
||||||
screenAvail.width,
|
|
||||||
screenAvail.height);
|
|
||||||
|
|
||||||
|
|
||||||
var offset = Kirigami.Units.smallSpacing;
|
|
||||||
|
|
||||||
// Fall back to bottom-left of screen area when the applet is on the desktop or floating.
|
|
||||||
var x = offset;
|
|
||||||
var y = screen.height - height - offset;
|
|
||||||
var appletTopLeft;
|
|
||||||
var horizMidPoint;
|
|
||||||
var vertMidPoint;
|
|
||||||
|
|
||||||
|
var offset = Kirigami.Units.smallSpacing * 2;
|
||||||
|
|
||||||
if (Plasmoid.configuration.displayPosition === 1) {
|
if (Plasmoid.configuration.displayPosition === 1) {
|
||||||
horizMidPoint = screen.x + (screen.width / 2);
|
horizMidPoint = screen.x + (screen.width / 2);
|
||||||
vertMidPoint = screen.y + (screen.height / 2);
|
vertMidPoint = screen.y + (screen.height / 2);
|
||||||
x = horizMidPoint - width / 2;
|
x = horizMidPoint - width / 2;
|
||||||
y = vertMidPoint - height / 2;
|
y = vertMidPoint - height / 2;
|
||||||
} else if (Plasmoid.configuration.displayPosition === 2) {
|
}
|
||||||
|
|
||||||
|
else if (Plasmoid.configuration.displayPosition === 2) {
|
||||||
horizMidPoint = screen.x + (screen.width / 2);
|
horizMidPoint = screen.x + (screen.width / 2);
|
||||||
vertMidPoint = screen.y + (screen.height / 2);
|
vertMidPoint = screen.y + (screen.height / 2);
|
||||||
x = horizMidPoint - width / 2;
|
x = horizMidPoint - width / 2;
|
||||||
y = screen.y + screen.height - height - offset - panelSvg.margins.top;
|
y = screen.y + screen.height - height - offset - panelH - Kirigami.Units.gridUnit;
|
||||||
} else if (Plasmoid.location === PlasmaCore.Types.BottomEdge) {
|
|
||||||
horizMidPoint = screen.x + (screen.width / 2);
|
|
||||||
appletTopLeft = parent.mapToGlobal(0, 0);
|
|
||||||
x = (appletTopLeft.x < horizMidPoint) ? screen.x + offset : (screen.x + screen.width) - width - offset;
|
|
||||||
y = screen.y + screen.height - height - offset - panelSvg.margins.top;
|
|
||||||
} else if (Plasmoid.location === PlasmaCore.Types.TopEdge) {
|
|
||||||
horizMidPoint = screen.x + (screen.width / 2);
|
|
||||||
var appletBottomLeft = parent.mapToGlobal(0, parent.height);
|
|
||||||
x = (appletBottomLeft.x < horizMidPoint) ? screen.x + offset : (screen.x + screen.width) - width - offset;
|
|
||||||
//y = screen.y + parent.height + panelSvg.margins.bottom + offset;
|
|
||||||
y = screen.y + panelSvg.margins.bottom + offset;
|
|
||||||
} else if (Plasmoid.location === PlasmaCore.Types.LeftEdge) {
|
|
||||||
vertMidPoint = screen.y + (screen.height / 2);
|
|
||||||
appletTopLeft = parent.mapToGlobal(0, 0);
|
|
||||||
x = appletTopLeft.x*2 + parent.width + panelSvg.margins.right + offset;
|
|
||||||
y = screen.y + (appletTopLeft.y < vertMidPoint) ? screen.y + offset : (screen.y + screen.height) - height - offset;
|
|
||||||
} else if (Plasmoid.location === PlasmaCore.Types.RightEdge) {
|
|
||||||
vertMidPoint = screen.y + (screen.height / 2);
|
|
||||||
appletTopLeft = parent.mapToGlobal(0, 0);
|
|
||||||
x = appletTopLeft.x - panelSvg.margins.left - offset - width;
|
|
||||||
y = screen.y + (appletTopLeft.y < vertMidPoint) ? screen.y + offset : (screen.y + screen.height) - height - offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
switch (plasmoid.location) {
|
||||||
|
case PlasmaCore.Types.BottomEdge:
|
||||||
|
var y = appletTopLeft.y - height - offset
|
||||||
|
var x = appletTopLeft.x
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PlasmaCore.Types.TopEdge:
|
||||||
|
x = appletTopLeft.x < screen.width - width ? appletTopLeft.x + panelW - Kirigami.Units.gridUnit / 3 : screen.width - width;
|
||||||
|
y = appletTopLeft.y + kicker.height + Kirigami.Units.gridUnit
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PlasmaCore.Types.LeftEdge:
|
||||||
|
x = appletTopLeft.x + panelW + Kirigami.Units.gridUnit / 2;
|
||||||
|
y = appletTopLeft.y < screen.height - height ? appletTopLeft.y : appletTopLeft.y - height + iconUser.height / 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PlasmaCore.Types.RightEdge:
|
||||||
|
x = appletTopLeft.x - width - Kirigami.Units.gridUnit / 2;
|
||||||
|
y = appletTopLeft.y < screen.height - height ? appletTopLeft.y : screen.height - height - Kirigami.Units.gridUnit / 5;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Qt.point(x, y);
|
return Qt.point(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue