mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-21 10:50:30 +03:00
support clicking event for all fakeIconItem area
This commit is contained in:
parent
17db2a8a5d
commit
9d213a6e83
@ -1165,6 +1165,23 @@ void DockView::deactivateApplets()
|
||||
}
|
||||
}
|
||||
|
||||
void DockView::toggleAppletExpanded(const int id)
|
||||
{
|
||||
if (!containment()) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (auto applet, containment()->applets()) {
|
||||
if (applet->id() == id) {
|
||||
PlasmaQuick::AppletQuickItem *ai = applet->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||
|
||||
if (ai) {
|
||||
ai->setExpanded(!ai->isExpanded());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QVariantList DockView::containmentActions()
|
||||
{
|
||||
QVariantList actions;
|
||||
|
@ -163,6 +163,7 @@ public slots:
|
||||
Q_INVOKABLE void removeTasksPlasmoid();
|
||||
Q_INVOKABLE bool setCurrentScreen(const QString id);
|
||||
Q_INVOKABLE bool tasksPresent();
|
||||
Q_INVOKABLE void toggleAppletExpanded(const int id);
|
||||
Q_INVOKABLE void updateEnabledBorders();
|
||||
|
||||
Q_INVOKABLE void closeApplication();
|
||||
|
@ -102,8 +102,7 @@ Item {
|
||||
property Item appletIconItem; //first applet's IconItem, to be activated onExit signal
|
||||
|
||||
//this is used for folderView and icon widgets to fake their visual
|
||||
property bool fakeIconItem: applet && appletIconItem
|
||||
&& (applet.pluginName === "org.kde.plasma.folder" || applet.pluginName === "org.kde.plasma.icon")
|
||||
property bool fakeIconItem: applet && appletIconItem && (applet.pluginName === "org.kde.plasma.folder" || applet.pluginName === "org.kde.plasma.icon")
|
||||
|
||||
property alias containsMouse: appletMouseArea.containsMouse
|
||||
property alias pressed: appletMouseArea.pressed
|
||||
@ -200,7 +199,8 @@ Item {
|
||||
function checkCanBeHovered(){
|
||||
if ( ((applet && (applet.Layout.minimumWidth > root.iconSize) && root.isHorizontal) ||
|
||||
(applet && (applet.Layout.minimumHeight > root.iconSize) && root.isVertical))
|
||||
&& (applet && applet.pluginName !== "org.kde.plasma.panelspacer") ){
|
||||
&& (applet && applet.pluginName !== "org.kde.plasma.panelspacer")
|
||||
&& !container.fakeIconItem){
|
||||
canBeHovered = false;
|
||||
}
|
||||
else{
|
||||
@ -219,7 +219,7 @@ Item {
|
||||
}
|
||||
|
||||
function reconsiderAppletIconItem(){
|
||||
if (appletIconItem)
|
||||
if (container.appletIconItem || !applet)
|
||||
return;
|
||||
|
||||
//! searching to find for that applet the first IconItem
|
||||
@ -568,6 +568,7 @@ Item {
|
||||
}
|
||||
|
||||
function updateLayoutHeight(){
|
||||
|
||||
if(container.isInternalViewSplitter){
|
||||
if(!root.editMode)
|
||||
layoutHeight = 0;
|
||||
@ -613,6 +614,7 @@ Item {
|
||||
}
|
||||
|
||||
function updateLayoutWidth(){
|
||||
|
||||
if(container.isInternalViewSplitter){
|
||||
if(!root.editMode)
|
||||
layoutWidth = 0;
|
||||
@ -736,6 +738,15 @@ Item {
|
||||
]
|
||||
//END states
|
||||
|
||||
///Secret MouseArea to be used by the folder widget
|
||||
Loader{
|
||||
anchors.fill: parent
|
||||
active: container.fakeIconItem && applet.pluginName === "org.kde.plasma.folder"
|
||||
sourceComponent: MouseArea{
|
||||
onClicked: dock.toggleAppletExpanded(applet.id);
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
id: fakeIconItemContainer
|
||||
anchors.centerIn: parent
|
||||
@ -743,8 +754,8 @@ Item {
|
||||
//we setup as maximum for hidden container of some applets that break
|
||||
//the Latte experience the size:96 . This is why after that size
|
||||
//the folder widget changes to fullRepresentation instead of compact one
|
||||
width: Math.min(96, parent.width);
|
||||
height: Math.min(96, parent.height);
|
||||
width: Math.min(96, parent.width)
|
||||
height: width
|
||||
}
|
||||
|
||||
Loader{
|
||||
@ -752,6 +763,7 @@ Item {
|
||||
active: container.fakeIconItem
|
||||
sourceComponent: Latte.IconItem{
|
||||
id: fakeAppletIconItem
|
||||
anchors.fill: parent
|
||||
source: appletIconItem.source
|
||||
}
|
||||
}
|
||||
@ -1028,6 +1040,8 @@ Item {
|
||||
|
||||
function signalUpdateScale(nIndex, nScale, step){
|
||||
if(container && (container.index === nIndex)){
|
||||
reconsiderAppletIconItem();
|
||||
|
||||
if ( ((canBeHovered && !lockZoom ) || container.latteApplet)
|
||||
&& (applet && applet.status !== PlasmaCore.Types.HiddenStatus)
|
||||
//&& (index != currentLayout.hoveredIndex)
|
||||
@ -1217,7 +1231,9 @@ Item {
|
||||
mouse.accepted = false;
|
||||
}
|
||||
|
||||
onReleased: pressed = false;
|
||||
onReleased: {
|
||||
pressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
//BEGIN states
|
||||
@ -1297,7 +1313,7 @@ Item {
|
||||
SequentialAnimation{
|
||||
id: clickedAnimation
|
||||
alwaysRunToEnd: true
|
||||
running: appletMouseArea.pressed
|
||||
running: appletMouseArea.pressed && (root.durationTime > 0)
|
||||
|
||||
onStopped: appletMouseArea.pressed = false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user