Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Plasma
Plasma Phone Components
Commits
ef7a78cf
Commit
ef7a78cf
authored
Jul 31, 2020
by
Marco Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
single mousearea on bottom
parent
0c6d19e8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
45 deletions
+36
-45
containments/taskpanel/package/contents/ui/Button.qml
containments/taskpanel/package/contents/ui/Button.qml
+9
-12
containments/taskpanel/package/contents/ui/main.qml
containments/taskpanel/package/contents/ui/main.qml
+27
-33
No files found.
containments/taskpanel/package/contents/ui/Button.qml
View file @
ef7a78cf
...
@@ -24,22 +24,24 @@ import org.kde.plasma.core 2.0 as PlasmaCore
...
@@ -24,22 +24,24 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import
org
.
kde
.
plasma
.
components
2.0
as
PlasmaComponents
import
org
.
kde
.
plasma
.
components
2.0
as
PlasmaComponents
import
org
.
kde
.
kquickcontrolsaddons
2.0
import
org
.
kde
.
kquickcontrolsaddons
2.0
MouseArea
{
Item
{
id
:
button
id
:
button
width
:
Math
.
min
(
parent
.
width
,
parent
.
height
)
width
:
Math
.
min
(
parent
.
width
,
parent
.
height
)
height
:
width
height
:
width
property
MouseArea
mouseArea
readonly
property
bool
pressed
:
mouseArea
.
pressed
&&
mouseArea
.
activeButton
==
button
property
alias
iconSource
:
icon
.
source
property
alias
iconSource
:
icon
.
source
property
bool
checked
signal
clicked
()
property
bool
checkable
property
bool
clickable
Rectangle
{
Rectangle
{
radius
:
height
/
2
radius
:
height
/
2
anchors.fill
:
parent
anchors.fill
:
parent
opacity
:
button
.
pressed
&&
button
.
containsMouse
&&
button
.
click
able
?
0.1
:
0
opacity
:
button
.
pressed
&&
button
.
en
able
d
?
0.1
:
0
color
:
PlasmaCore
.
ColorScope
.
textColor
color
:
PlasmaCore
.
ColorScope
.
textColor
Behavior
on
opacity
{
Behavior
on
opacity
{
OpacityAnimator
{
//an OpacityAnimator causes stuttering in task switcher dragging
NumberAnimation
{
duration
:
units
.
longDuration
duration
:
units
.
longDuration
easing.type
:
Easing
.
InOutQuad
easing.type
:
Easing
.
InOutQuad
}
}
...
@@ -49,11 +51,6 @@ MouseArea {
...
@@ -49,11 +51,6 @@ MouseArea {
id
:
icon
id
:
icon
anchors.fill
:
parent
anchors.fill
:
parent
colorGroup
:
PlasmaCore
.
ColorScope
.
colorGroup
colorGroup
:
PlasmaCore
.
ColorScope
.
colorGroup
enabled
:
button
.
enabled
&&
button
.
clickable
//enabled: button.enabled && button.clickable
}
onClicked
:
{
if
(
checkable
)
{
checked
=
!
checked
;
}
}
}
}
}
containments/taskpanel/package/contents/ui/main.qml
View file @
ef7a78cf
...
@@ -110,12 +110,18 @@ PlasmaCore.ColorScope {
...
@@ -110,12 +110,18 @@ PlasmaCore.ColorScope {
property
bool
isDragging
:
false
property
bool
isDragging
:
false
property
bool
opening
:
false
property
bool
opening
:
false
drag.filterChildren
:
true
drag.filterChildren
:
true
function
managePressed
(
mouse
)
{
property
Button
activeButton
onPressed
:
{
startMouseY
=
oldMouseY
=
mouse
.
y
;
startMouseY
=
oldMouseY
=
mouse
.
y
;
taskSwitcher
.
offset
=
-
taskSwitcher
.
height
taskSwitcher
.
offset
=
-
taskSwitcher
.
height
;
activeButton
=
icons
.
childAt
(
mouse
.
x
,
mouse
.
y
);
}
}
onPressed
:
managePressed
(
mouse
);
onPositionChanged
:
{
onPositionChanged
:
{
let
newButton
=
icons
.
childAt
(
mouse
.
x
,
mouse
.
y
);
if
(
newButton
!=
activeButton
)
{
activeButton
=
null
;
}
if
(
!
isDragging
&&
Math
.
abs
(
startMouseY
-
oldMouseY
)
<
root
.
height
)
{
if
(
!
isDragging
&&
Math
.
abs
(
startMouseY
-
oldMouseY
)
<
root
.
height
)
{
oldMouseY
=
mouse
.
y
;
oldMouseY
=
mouse
.
y
;
return
;
return
;
...
@@ -127,6 +133,7 @@ PlasmaCore.ColorScope {
...
@@ -127,6 +133,7 @@ PlasmaCore.ColorScope {
opening
=
oldMouseY
>
mouse
.
y
;
opening
=
oldMouseY
>
mouse
.
y
;
if
(
taskSwitcher
.
visibility
==
Window
.
Hidden
&&
taskSwitcher
.
offset
>
-
taskSwitcher
.
height
+
units
.
gridUnit
&&
taskSwitcher
.
tasksCount
)
{
if
(
taskSwitcher
.
visibility
==
Window
.
Hidden
&&
taskSwitcher
.
offset
>
-
taskSwitcher
.
height
+
units
.
gridUnit
&&
taskSwitcher
.
tasksCount
)
{
activeButton
=
null
;
taskSwitcher
.
showFullScreen
();
taskSwitcher
.
showFullScreen
();
//no tasks, let's scroll up the homescreen instead
//no tasks, let's scroll up the homescreen instead
}
else
if
(
taskSwitcher
.
tasksCount
===
0
)
{
}
else
if
(
taskSwitcher
.
tasksCount
===
0
)
{
...
@@ -135,16 +142,21 @@ PlasmaCore.ColorScope {
...
@@ -135,16 +142,21 @@ PlasmaCore.ColorScope {
oldMouseY
=
mouse
.
y
;
oldMouseY
=
mouse
.
y
;
}
}
onReleased
:
{
onReleased
:
{
if
(
!
isDragging
)
{
return
;
}
if
(
taskSwitcher
.
visibility
==
Window
.
Hidden
)
{
if
(
taskSwitcher
.
visibility
==
Window
.
Hidden
)
{
if
(
taskSwitcher
.
tasksCount
===
0
)
{
if
(
taskSwitcher
.
tasksCount
===
0
)
{
MobileShell
.
HomeScreenControls
.
snapHomeScreenPosition
();
MobileShell
.
HomeScreenControls
.
snapHomeScreenPosition
();
}
}
if
(
activeButton
)
{
activeButton
.
clicked
();
}
return
;
return
;
}
}
if
(
!
isDragging
)
{
return
;
}
if
(
opening
)
{
if
(
opening
)
{
taskSwitcher
.
show
();
taskSwitcher
.
show
();
}
else
{
}
else
{
...
@@ -187,19 +199,16 @@ PlasmaCore.ColorScope {
...
@@ -187,19 +199,16 @@ PlasmaCore.ColorScope {
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
height
:
parent
.
height
height
:
parent
.
height
width
:
parent
.
width
/
3
width
:
parent
.
width
/
3
mouseArea
:
mainMouseArea
enabled
:
root
.
hasTasks
enabled
:
root
.
hasTasks
clickable
:
root
.
hasTasks
&&
!
taskSwitcher
.
visible
iconSource
:
"
box
"
iconSource
:
"
box
"
onClicked
:
{
onClicked
:
{
if
(
!
click
able
)
{
if
(
!
en
able
d
)
{
return
;
return
;
}
}
plasmoid
.
nativeInterface
.
showDesktop
=
false
;
plasmoid
.
nativeInterface
.
showDesktop
=
false
;
taskSwitcher
.
visible
?
taskSwitcher
.
hide
()
:
taskSwitcher
.
show
();
taskSwitcher
.
visible
?
taskSwitcher
.
hide
()
:
taskSwitcher
.
show
();
}
}
onPressed
:
mainMouseArea
.
managePressed
(
mouse
);
onPositionChanged
:
mainMouseArea
.
positionChanged
(
mouse
);
onReleased
:
mainMouseArea
.
released
(
mouse
);
}
}
Button
{
Button
{
...
@@ -207,28 +216,16 @@ PlasmaCore.ColorScope {
...
@@ -207,28 +216,16 @@ PlasmaCore.ColorScope {
height
:
parent
.
height
height
:
parent
.
height
width
:
parent
.
width
/
3
width
:
parent
.
width
/
3
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
mouseArea
:
mainMouseArea
iconSource
:
"
start-here-kde
"
iconSource
:
"
start-here-kde
"
clickable
:
!
taskSwitcher
.
visible
&&
(
root
.
showingApp
||
MobileShell
.
HomeScreenControls
.
homeScreenPosition
!=
0
)
enabled
:
!
taskSwitcher
.
visible
&&
(
root
.
showingApp
||
MobileShell
.
HomeScreenControls
.
homeScreenPosition
!=
0
)
//checkable: true
onClicked
:
{
onClicked
:
{
if
(
!
click
able
)
{
if
(
!
en
able
d
)
{
return
;
return
;
}
}
root
.
minimizeAll
();
root
.
minimizeAll
();
MobileShell
.
HomeScreenControls
.
resetHomeScreenPosition
();
MobileShell
.
HomeScreenControls
.
resetHomeScreenPosition
();
plasmoid
.
nativeInterface
.
allMinimizedChanged
();
plasmoid
.
nativeInterface
.
allMinimizedChanged
();
//plasmoid.nativeInterface.showDesktop = checked;
}
onPressed
:
mainMouseArea
.
managePressed
(
mouse
);
onPositionChanged
:
mainMouseArea
.
positionChanged
(
mouse
);
onReleased
:
mainMouseArea
.
released
(
mouse
);
Connections
{
target
:
root
.
taskSwitcher
onCurrentTaskIndexChanged
:
{
if
(
root
.
taskSwitcher
.
currentTaskIndex
<
0
)
{
showDesktopButton
.
checked
=
false
;
}
}
}
}
}
}
...
@@ -236,11 +233,11 @@ PlasmaCore.ColorScope {
...
@@ -236,11 +233,11 @@ PlasmaCore.ColorScope {
height
:
parent
.
height
height
:
parent
.
height
width
:
parent
.
width
/
3
width
:
parent
.
width
/
3
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
mouseArea
:
mainMouseArea
iconSource
:
"
paint-none
"
iconSource
:
"
paint-none
"
//FIXME:Qt.UserRole+9 is IsWindow Qt.UserRole+15 is IsClosable. We can't reach that enum from QML
enabled
:
plasmoid
.
nativeInterface
.
hasCloseableActiveWindow
&&
!
taskSwitcher
.
visible
clickable
:
plasmoid
.
nativeInterface
.
hasCloseableActiveWindow
&&
!
taskSwitcher
.
visible
onClicked
:
{
onClicked
:
{
if
(
!
click
able
)
{
if
(
!
en
able
d
)
{
return
;
return
;
}
}
if
(
!
plasmoid
.
nativeInterface
.
hasCloseableActiveWindow
)
{
if
(
!
plasmoid
.
nativeInterface
.
hasCloseableActiveWindow
)
{
...
@@ -251,9 +248,6 @@ PlasmaCore.ColorScope {
...
@@ -251,9 +248,6 @@ PlasmaCore.ColorScope {
taskSwitcher
.
model
.
requestClose
(
index
);
taskSwitcher
.
model
.
requestClose
(
index
);
}
}
}
}
onPressed
:
mainMouseArea
.
managePressed
(
mouse
);
onPositionChanged
:
mainMouseArea
.
positionChanged
(
mouse
);
onReleased
:
mainMouseArea
.
released
(
mouse
);
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment