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
6439947d
Commit
6439947d
authored
Jun 19, 2015
by
Marco Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
primitive plasmoids reordering
parent
d197736a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
15 deletions
+62
-15
containments/homescreen/package/contents/ui/main.qml
containments/homescreen/package/contents/ui/main.qml
+62
-15
No files found.
containments/homescreen/package/contents/ui/main.qml
View file @
6439947d
...
...
@@ -64,11 +64,6 @@ Item {
var
before
=
null
;
container
.
animationsEnabled
=
false
;
if
(
appletsSpace
.
lastSpacer
.
parent
===
appletsSpace
.
layout
)
{
//Uncomment to make the spacer the last element again
// before = appletsSpace.lastSpacer;
}
if
(
before
)
{
LayoutManager
.
insertBefore
(
before
,
container
);
...
...
@@ -90,7 +85,7 @@ Item {
LayoutManager
.
plasmoid
=
plasmoid
;
LayoutManager
.
root
=
root
;
LayoutManager
.
layout
=
appletsSpace
.
layout
;
LayoutManager
.
lastSpacer
=
appletsSpace
.
lastSpacer
;
//
LayoutManager.lastSpacer = appletsSpace.lastSpacer;
LayoutManager
.
restore
();
applicationsView
.
contentY
=
-
root
.
height
;
...
...
@@ -434,7 +429,7 @@ Item {
//scrolling down
if
(
verticalVelocity
>
0
&&
contentY
<
-
headerItem
.
height
+
root
.
height
&&
contentY
>
(
-
headerItem
.
height
+
root
.
height
/
6
))
{
scrollAnim
.
to
=
-
plasmoid
.
availableScreenRect
.
height
scrollAnim
.
to
=
-
headerItem
.
height
+
plasmoid
.
availableScreenRect
.
height
scrollAnim
.
running
=
true
;
return
;
...
...
@@ -479,7 +474,8 @@ Item {
delegate
:
HomeLauncher
{
visible
:
index
>
3
}
header
:
MouseArea
{
header
:
MouseEventListener
{
id
:
headerItem
z
:
999
property
Item
layout
:
appletsLayout
property
Item
lastSpacer
:
spacer
...
...
@@ -487,12 +483,56 @@ Item {
width
:
root
.
width
height
:
mainLayout
.
Layout
.
minimumHeight
property
int
margin
:
stripe
.
height
+
units
.
gridUnit
*
2
property
Item
draggingApplet
onPressAndHold
:
{
print
(
favoritesView
.
contains
(
mapToItem
(
favoritesView
,
mouse
.
x
,
mouse
.
y
)))
if
(
!
root
.
locked
&&
!
favoritesView
.
contains
(
mapToItem
(
favoritesView
,
mouse
.
x
,
mouse
.
y
)))
{
editOverlay
.
visible
=
true
;
var
pos
=
mapToItem
(
appletsLayout
,
mouse
.
x
,
mouse
.
y
);
draggingApplet
=
appletsSpace
.
layout
.
childAt
(
pos
.
x
,
pos
.
y
);
print
(
"
BUuuH
"
+
draggingApplet
);
print
(
"
MOOO
"
+
draggingApplet
.
applet
.
title
);
if
(
draggingApplet
)
{
dndSpacer
.
Layout
.
minimumHeight
=
draggingApplet
.
height
;
LayoutManager
.
insertBefore
(
draggingApplet
,
dndSpacer
);
draggingApplet
.
parent
=
headerItem
;
pos
=
mapToItem
(
headerItem
,
mouse
.
x
,
mouse
.
y
);
draggingApplet
.
y
=
pos
.
y
-
draggingApplet
.
height
/
2
;
applicationsView
.
interactive
=
false
;
}
}
}
onPositionChanged
:
{
if
(
!
draggingApplet
)
{
return
;
}
var
pos
=
mapToItem
(
headerItem
,
mouse
.
x
,
mouse
.
y
);
draggingApplet
.
y
=
mouse
.
y
-
draggingApplet
.
height
/
2
;
pos
=
mapToItem
(
appletsLayout
,
mouse
.
x
,
mouse
.
y
);
var
itemUnderMouse
=
appletsSpace
.
layout
.
childAt
(
pos
.
x
,
pos
.
y
);
if
(
itemUnderMouse
&&
itemUnderMouse
!=
dndSpacer
)
{
dndSpacer
.
parent
=
colorScope
;
if
(
pos
.
y
<
itemUnderMouse
.
y
+
itemUnderMouse
.
height
/
2
)
{
LayoutManager
.
insertBefore
(
itemUnderMouse
,
dndSpacer
);
}
else
{
LayoutManager
.
insertAfter
(
itemUnderMouse
,
dndSpacer
);
}
}
}
onReleased
:
{
if
(
!
draggingApplet
)
{
return
;
}
LayoutManager
.
insertBefore
(
dndSpacer
,
draggingApplet
);
applicationsView
.
interactive
=
true
;
dndSpacer
.
parent
=
colorScope
;
draggingApplet
=
null
;
}
ColumnLayout
{
...
...
@@ -523,7 +563,14 @@ Item {
}
}
}
Item
{
id
:
spacer
Layout.fillWidth
:
true
Layout.minimumHeight
:
0
Layout.maximumHeight
:
Layout
.
minimumHeight
}
PlasmaCore.ColorScope
{
id
:
colorScope
//TODO: decide what color we want applets
colorGroup
:
PlasmaCore
.
Theme
.
NormalColorGroup
Layout.fillWidth
:
true
...
...
@@ -531,13 +578,13 @@ Item {
Layout.maximumHeight
:
appletsLayout
.
Layout
.
maximumHeight
ColumnLayout
{
id
:
appletsLayout
Item
{
id
:
spacer
Layout.fillWidth
:
true
Layout.fill
Height
:
true
Layout.
minimum
Height
:
plasmoid
.
applets
.
length
%
2
==
0
?
0
:
(
root
.
height
-
margin
)
/
2
Layout.m
ax
imumHeight
:
Layout
.
minimumHeight
}
}
Item
{
id
:
dndSpacer
Layout.fill
Width
:
true
Layout.
fill
Height
:
true
Layout.m
in
imumHeight
:
plasmoid
.
applets
.
length
%
2
==
0
?
0
:
(
root
.
height
-
margin
)
/
2
Layout.maximumHeight
:
Layout
.
minimumHeight
}
}
Item
{
...
...
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