Skip to content

Commit

Permalink
QML UI: Remember episode list scroll position (bug 1660)
Browse files Browse the repository at this point in the history
When deleting episodes, the vertical scroll position
should not be reset.
  • Loading branch information
thp committed Sep 5, 2012
1 parent a216613 commit a14a7eb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions share/gpodder/ui/qml/EpisodeList.qml
Expand Up @@ -8,6 +8,12 @@ import 'config.js' as Config
Item {
id: episodeList
property string currentFilterText
property string mainState

onMainStateChanged: {
// Don't remember contentY when leaving episode list
listView.lastContentY = 0;
}

property alias model: listView.model
property alias moving: listView.moving
Expand Down Expand Up @@ -51,6 +57,23 @@ Item {
}
}

property real lastContentY: 0

onContentYChanged: {
// Keep Y scroll position when deleting episodes (bug 1660)
if (contentY === 0) {
if (lastContentY > 0) {
contentY = lastContentY;
}
} else {
if (episodeList.mainState === 'episodes') {
// Only store scroll position when the episode list is
// shown (avoids overwriting it in onMainStateChanged)
lastContentY = contentY;
}
}
}

anchors.fill: parent
property int openedIndex: -1
visible: count > 0
Expand Down
1 change: 1 addition & 0 deletions share/gpodder/ui/qml/Main.qml
Expand Up @@ -207,6 +207,7 @@ Image {

EpisodeList {
id: episodeList
mainState: main.state

opacity: 0

Expand Down

0 comments on commit a14a7eb

Please sign in to comment.