Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Plasma Phone Components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
26
Issues
26
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
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
Hide 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
import
org
.
kde
.
plasma
.
components
2.0
as
PlasmaComponents
import
org
.
kde
.
kquickcontrolsaddons
2.0
MouseArea
{
Item
{
id
:
button
width
:
Math
.
min
(
parent
.
width
,
parent
.
height
)
height
:
width
property
MouseArea
mouseArea
readonly
property
bool
pressed
:
mouseArea
.
pressed
&&
mouseArea
.
activeButton
==
button
property
alias
iconSource
:
icon
.
source
property
bool
checked
property
bool
checkable
property
bool
clickable
signal
clicked
()
Rectangle
{
radius
:
height
/
2
anchors.fill
:
parent
opacity
:
button
.
pressed
&&
button
.
containsMouse
&&
button
.
clickable
?
0.1
:
0
opacity
:
button
.
pressed
&&
button
.
enabled
?
0.1
:
0
color
:
PlasmaCore
.
ColorScope
.
textColor
Behavior
on
opacity
{
OpacityAnimator
{
//an OpacityAnimator causes stuttering in task switcher dragging
NumberAnimation
{
duration
:
units
.
longDuration
easing.type
:
Easing
.
InOutQuad
}
...
...
@@ -49,11 +51,6 @@ MouseArea {
id
:
icon
anchors.fill
:
parent
colorGroup
:
PlasmaCore
.
ColorScope
.
colorGroup
enabled
:
button
.
enabled
&&
button
.
clickable
}
onClicked
:
{
if
(
checkable
)
{
checked
=
!
checked
;
}
//enabled: button.enabled && button.clickable
}
}
containments/taskpanel/package/contents/ui/main.qml
View file @
ef7a78cf
...
...
@@ -110,12 +110,18 @@ PlasmaCore.ColorScope {
property
bool
isDragging
:
false
property
bool
opening
:
false
drag.filterChildren
:
true
function
managePressed
(
mouse
)
{
property
Button
activeButton
onPressed
:
{
startMouseY
=
oldMouseY
=
mouse
.
y
;
taskSwitcher
.
offset
=
-
taskSwitcher
.
height
taskSwitcher
.
offset
=
-
taskSwitcher
.
height
;
activeButton
=
icons
.
childAt
(
mouse
.
x
,
mouse
.
y
);
}
onPressed
:
managePressed
(
mouse
);
onPositionChanged
:
{
let
newButton
=
icons
.
childAt
(
mouse
.
x
,
mouse
.
y
);
if
(
newButton
!=
activeButton
)
{
activeButton
=
null
;
}
if
(
!
isDragging
&&
Math
.
abs
(
startMouseY
-
oldMouseY
)
<
root
.
height
)
{
oldMouseY
=
mouse
.
y
;
return
;
...
...
@@ -127,6 +133,7 @@ PlasmaCore.ColorScope {
opening
=
oldMouseY
>
mouse
.
y
;
if
(
taskSwitcher
.
visibility
==
Window
.
Hidden
&&
taskSwitcher
.
offset
>
-
taskSwitcher
.
height
+
units
.
gridUnit
&&
taskSwitcher
.
tasksCount
)
{
activeButton
=
null
;
taskSwitcher
.
showFullScreen
();
//no tasks, let's scroll up the homescreen instead
}
else
if
(
taskSwitcher
.
tasksCount
===
0
)
{
...
...
@@ -135,16 +142,21 @@ PlasmaCore.ColorScope {
oldMouseY
=
mouse
.
y
;
}
onReleased
:
{
if
(
!
isDragging
)
{
return
;
}
if
(
taskSwitcher
.
visibility
==
Window
.
Hidden
)
{
if
(
taskSwitcher
.
tasksCount
===
0
)
{
MobileShell
.
HomeScreenControls
.
snapHomeScreenPosition
();
}
if
(
activeButton
)
{
activeButton
.
clicked
();
}
return
;
}
if
(
!
isDragging
)
{
return
;
}
if
(
opening
)
{
taskSwitcher
.
show
();
}
else
{
...
...
@@ -187,19 +199,16 @@ PlasmaCore.ColorScope {
anchors.left
:
parent
.
left
height
:
parent
.
height
width
:
parent
.
width
/
3
mouseArea
:
mainMouseArea
enabled
:
root
.
hasTasks
clickable
:
root
.
hasTasks
&&
!
taskSwitcher
.
visible
iconSource
:
"
box
"
onClicked
:
{
if
(
!
clickable
)
{
if
(
!
enabled
)
{
return
;
}
plasmoid
.
nativeInterface
.
showDesktop
=
false
;
taskSwitcher
.
visible
?
taskSwitcher
.
hide
()
:
taskSwitcher
.
show
();
}
onPressed
:
mainMouseArea
.
managePressed
(
mouse
);
onPositionChanged
:
mainMouseArea
.
positionChanged
(
mouse
);
onReleased
:
mainMouseArea
.
released
(
mouse
);
}
Button
{
...
...
@@ -207,28 +216,16 @@ PlasmaCore.ColorScope {
height
:
parent
.
height
width
:
parent
.
width
/
3
anchors.horizontalCenter
:
parent
.
horizontalCenter
mouseArea
:
mainMouseArea
iconSource
:
"
start-here-kde
"
clickable
:
!
taskSwitcher
.
visible
&&
(
root
.
showingApp
||
MobileShell
.
HomeScreenControls
.
homeScreenPosition
!=
0
)
//checkable: true
enabled
:
!
taskSwitcher
.
visible
&&
(
root
.
showingApp
||
MobileShell
.
HomeScreenControls
.
homeScreenPosition
!=
0
)
onClicked
:
{
if
(
!
clickable
)
{
if
(
!
enabled
)
{
return
;
}
root
.
minimizeAll
();
MobileShell
.
HomeScreenControls
.
resetHomeScreenPosition
();
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 {
height
:
parent
.
height
width
:
parent
.
width
/
3
anchors.right
:
parent
.
right
mouseArea
:
mainMouseArea
iconSource
:
"
paint-none
"
//FIXME:Qt.UserRole+9 is IsWindow Qt.UserRole+15 is IsClosable. We can't reach that enum from QML
clickable
:
plasmoid
.
nativeInterface
.
hasCloseableActiveWindow
&&
!
taskSwitcher
.
visible
enabled
:
plasmoid
.
nativeInterface
.
hasCloseableActiveWindow
&&
!
taskSwitcher
.
visible
onClicked
:
{
if
(
!
clickable
)
{
if
(
!
enabled
)
{
return
;
}
if
(
!
plasmoid
.
nativeInterface
.
hasCloseableActiveWindow
)
{
...
...
@@ -251,9 +248,6 @@ PlasmaCore.ColorScope {
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