Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Desktop
Commits
2dca1706
Commit
2dca1706
authored
Apr 12, 2022
by
Bharadwaj Raju
Committed by
Nate Graham
Apr 12, 2022
Browse files
Folder View: save desktop containment icon positions on a per-resolution basis
BUG: 360478
FIXED-IN: 5.25
parent
7ca4695e
Pipeline
#163080
passed with stage
in 4 minutes and 29 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
containments/desktop/package/contents/ui/FolderView.qml
View file @
2dca1706
...
...
@@ -30,6 +30,7 @@ FocusScope {
property
alias
currentIndex
:
gridView
.
currentIndex
property
alias
url
:
dir
.
url
property
alias
status
:
dir
.
status
property
alias
perStripe
:
positioner
.
perStripe
property
alias
positions
:
positioner
.
positions
property
alias
errorString
:
dir
.
errorString
property
alias
dragging
:
dir
.
dragging
...
...
@@ -828,20 +829,6 @@ FocusScope {
}
}
onFlowChanged
:
{
// FIXME TODO: Preserve positions.
if
(
positioner
.
enabled
)
{
positioner
.
reset
();
}
}
onLayoutDirectionChanged
:
{
// FIXME TODO: Preserve positions.
if
(
positioner
.
enabled
)
{
positioner
.
reset
();
}
}
onCurrentIndexChanged
:
{
positionViewAtIndex
(
currentIndex
,
GridView
.
Contain
);
}
...
...
containments/desktop/package/contents/ui/FolderViewLayer.qml
View file @
2dca1706
...
...
@@ -29,6 +29,8 @@ FocusScope {
property
alias
overflowing
:
folderView
.
overflowing
property
alias
flow
:
folderView
.
flow
property
string
resolution
:
Math
.
round
(
plasmoid
.
screenGeometry
.
width
)
+
"
x
"
+
Math
.
round
(
plasmoid
.
screenGeometry
.
height
)
readonly
property
bool
lockedByKiosk
:
!
KAuthorized
.
authorize
(
"
editable_desktop_icons
"
)
focus
:
true
...
...
@@ -178,6 +180,26 @@ FocusScope {
}
}
function
getPositions
()
{
try
{
var
allPositions
=
JSON
.
parse
(
plasmoid
.
configuration
.
positions
);
}
catch
(
err
)
{
var
allPositions
=
{};
allPositions
[
resolution
]
=
plasmoid
.
configuration
.
positions
;
}
return
allPositions
[
resolution
]
||
""
;
}
function
savePositions
(
positions
)
{
try
{
var
allPositions
=
JSON
.
parse
(
plasmoid
.
configuration
.
positions
);
}
catch
(
err
)
{
var
allPositions
=
{};
}
allPositions
[
resolution
]
=
positions
;
plasmoid
.
configuration
.
positions
=
JSON
.
stringify
(
allPositions
,
Object
.
keys
(
allPositions
).
sort
());
}
Connections
{
target
:
plasmoid
.
configuration
...
...
@@ -211,7 +233,7 @@ FocusScope {
}
function
onPositionsChanged
()
{
folderView
.
positions
=
plasmoid
.
configuration
.
p
ositions
;
folderView
.
positions
=
getP
ositions
()
;
}
}
...
...
@@ -241,12 +263,16 @@ FocusScope {
}
onPositionsChanged
:
{
plasmoid
.
configuration
.
positions
=
folderView
.
positions
;
savePositions
(
folderView
.
positions
);
}
onPerStripeChanged
:
{
folderView
.
positions
=
getPositions
();
}
Component.onCompleted
:
{
folderView
.
sortMode
=
plasmoid
.
configuration
.
sortMode
;
folderView
.
positions
=
plasmoid
.
configuration
.
p
ositions
;
folderView
.
positions
=
getP
ositions
()
;
}
}
...
...
containments/desktop/plugins/folder/positioner.cpp
View file @
2dca1706
...
...
@@ -854,6 +854,7 @@ void Positioner::applyPositions()
}
if
(
pos
>
m_perStripe
)
{
qDebug
()
<<
"Some items did not fit, rearranging"
;
name
=
positions
.
at
(
offset
);
if
(
!
sourceIndices
.
contains
(
name
))
{
...
...
Bharadwaj Raju
@bharadwaj-raju
mentioned in commit
8f85c465
·
Apr 17, 2022
mentioned in commit
8f85c465
mentioned in commit 8f85c4658adfdf7a01c591afd79baa9eed8b79dd
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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