diff --git a/src/app_service/service/profile/service.nim b/src/app_service/service/profile/service.nim index d0f08ab800..18e1890d79 100644 --- a/src/app_service/service/profile/service.nim +++ b/src/app_service/service/profile/service.nim @@ -193,6 +193,7 @@ QtObject: if rpcResponseObj{"error"}.kind != JNull and rpcResponseObj{"error"}.getStr != "": error "Error saving profile showcase preferences", msg = rpcResponseObj{"error"} return + self.requestProfileShowcasePreferences() except Exception as e: error "Error saving profile showcase preferences", msg = e.msg diff --git a/ui/StatusQ/src/writableproxymodel.cpp b/ui/StatusQ/src/writableproxymodel.cpp index 49b9b6f095..57450ad6d2 100644 --- a/ui/StatusQ/src/writableproxymodel.cpp +++ b/ui/StatusQ/src/writableproxymodel.cpp @@ -192,7 +192,7 @@ void WritableProxyModelPrivate::createProxyToSourceRowMap() bool WritableProxyModelPrivate::contains(const QModelIndex& sourceIndex, const QVector& roles) const { if (cache.contains(sourceIndex)) { auto valueMap = cache[sourceIndex]; - return std::all_of(roles.begin(), roles.end(), [&valueMap](int role) { return valueMap.contains(role); }); + return std::any_of(roles.begin(), roles.end(), [&valueMap](int role) { return valueMap.contains(role); }); } if (insertedRows.contains(q.mapFromSource(sourceIndex))) { @@ -289,7 +289,7 @@ void WritableProxyModelPrivate::checkForDirtyRemoval(const QModelIndex& sourceIn { if (cachedData.contains(role) && cachedData[role] == q.sourceModel()->data(sourceIndex, role)) cachedData.remove(role); - } + } if (cachedData.isEmpty()) { cache.remove(sourceIndex); @@ -605,7 +605,7 @@ bool WritableProxyModel::set(int at, const QVariantMap& data) return false; auto index = this->index(at, 0); - auto itemData = this->itemData(index); + QMap itemData; auto roleNames = this->roleNames(); for (auto it = data.begin(); it != data.end(); ++it) diff --git a/ui/app/AppLayouts/Profile/helpers/ProfileShowcaseDirtyState.qml b/ui/app/AppLayouts/Profile/helpers/ProfileShowcaseDirtyState.qml index bef8be27e3..a06cc26a43 100644 --- a/ui/app/AppLayouts/Profile/helpers/ProfileShowcaseDirtyState.qml +++ b/ui/app/AppLayouts/Profile/helpers/ProfileShowcaseDirtyState.qml @@ -36,7 +36,7 @@ QObject { /** * Returns dirty state of the showcase model. */ - readonly property bool dirty: writable.dirty || !visibleModel.synced + readonly property bool dirty: writable.dirty /** * It sets up a searcher filter on top of both the visible and hidden models. @@ -49,9 +49,6 @@ QObject { } function currentState() { - if (visible.synced) { - return writable.currentState() - } return writable.currentState() } diff --git a/ui/app/AppLayouts/Profile/helpers/VisibilityAndPositionDirtyStateModel.qml b/ui/app/AppLayouts/Profile/helpers/VisibilityAndPositionDirtyStateModel.qml index 385417648e..cd132b6134 100644 --- a/ui/app/AppLayouts/Profile/helpers/VisibilityAndPositionDirtyStateModel.qml +++ b/ui/app/AppLayouts/Profile/helpers/VisibilityAndPositionDirtyStateModel.qml @@ -49,18 +49,25 @@ WritableProxyModel { return // hiding, changing visibility level - if (visibility === visibilityHidden - || oldVisibility !== visibilityHidden) { - set(sourceIdx, { showcaseVisibility: visibility }) + if (visibility === visibilityHidden) { + set(sourceIdx, { showcaseVisibility: undefined, showcasePosition: undefined}) return } - // unhiding - const positions = d.getVisibleEntries().map(e => e.showcasePosition) - const position = Math.max(-1, ...positions) + 1 - set(sourceIdx, { showcaseVisibility: visibility, showcasePosition: position }) + if (oldVisibility === visibilityHidden || oldVisibility === undefined) { + // unhiding + const positions = d.getVisibleEntries().map(e => e.showcasePosition) + const position = Math.max(-1, ...positions) + 1 + set(sourceIdx, { showcaseVisibility: visibility, showcasePosition: position }) + return + } + + // changing visibility level + set(sourceIdx, { showcaseVisibility: visibility }) } + syncedRemovals: true + readonly property QtObject d_: QtObject { id: d diff --git a/ui/app/AppLayouts/Profile/views/MyProfileView.qml b/ui/app/AppLayouts/Profile/views/MyProfileView.qml index 9027bfd452..e12f69d93a 100644 --- a/ui/app/AppLayouts/Profile/views/MyProfileView.qml +++ b/ui/app/AppLayouts/Profile/views/MyProfileView.qml @@ -166,7 +166,6 @@ SettingsContentBase { profileHeader.cropRect.y.toFixed(), (profileHeader.cropRect.x + profileHeader.cropRect.width).toFixed(), (profileHeader.cropRect.y + profileHeader.cropRect.height).toFixed()) - reset() } }