Commit 519838e9 authored by Yunhe Guo's avatar Yunhe Guo

[kcms/users] Disable avatar cache

User picture path doesn't change after updating. If cache is enabled,
KCM will show the old picture until the cache expire.

Depends on
frameworks/kirigami!148

BUG: 428669
FIXED-IN: 5.21
parent b754fafd
......@@ -130,6 +130,7 @@ SimpleKCM {
Kirigami.Avatar {
source: usersDetailPage.user.face
cache: false // user picture path doesn't change after updating
name: user.realName
anchors {
fill: parent
......
......@@ -41,6 +41,17 @@ KCM.ScrollViewKCM {
implicitWidth: Kirigami.Units.gridUnit * 30
implicitHeight: Kirigami.Units.gridUnit * 20
// QML cannot update avatar image when override. By increasing this number and
// appending it to image source with '?', we force avatar to reload
property int avatarVersion: 0
Connections {
target: kcm
onApply: {
avatarVersion += 1
}
}
Component.onCompleted: {
kcm.columnWidth = Kirigami.Units.gridUnit * 15
kcm.push("UserDetailsPage.qml", {user: kcm.userModel.getLoggedInUser()})
......@@ -73,7 +84,8 @@ KCM.ScrollViewKCM {
radius: height/2
Kirigami.Avatar {
source: model.decoration
source: model.decoration + '?' + avatarVersion // force reload after saving
cache: false // avoid caching
name: model.display
anchors {
fill: parent
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment