Commit 0aa7fd01 authored by David Edmundson's avatar David Edmundson
Browse files

Fix sidebar view regression of not prompting about unsaved changes

Summary:
When you switch module with unsaved changes the other modes prompt if
you want to save the changes. Sidebar mode did not.

BUG: 392160

Test Plan:
Made a change, clicked another module. Got a prompt.

Clicked apply, it applied then changed

Tried again

Clicked cancel, it didn't change

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D12686
parent 2450a255
......@@ -413,10 +413,12 @@ int SidebarMode::activeCategory() const
void SidebarMode::setActiveCategory(int cat)
{
const QModelIndex idx = d->searchModel->index(cat, 0);
d->activeCategoryIndex = idx;
const int newCategoryRow = d->searchModel->mapToSource(idx).row();
if (d->activeCategory ==newCategoryRow) {
if (d->activeCategory == newCategoryRow) {
return;
}
if( !d->moduleView->resolveChanges() ) {
return;
}
......@@ -440,6 +442,10 @@ void SidebarMode::setActiveSubCategory(int cat)
return;
}
if( !d->moduleView->resolveChanges() ) {
return;
}
d->activeSubCategory = cat;
d->moduleView->closeModules();
d->moduleView->loadModule( d->subCategoryModel->index(cat, 0) );
......
......@@ -151,7 +151,6 @@ Kirigami.ScrollablePage {
icon: model.decoration
label: model.display
separatorVisible: false
highlighted: focus
Accessible.role: Accessible.ListItem
Accessible.name: model.display
onClicked: {
......@@ -174,7 +173,7 @@ Kirigami.ScrollablePage {
onCurrentIndexChanged: categoryView.positionViewAtIndex(index, ListView.Contain);
}
}
checked: systemsettings.activeCategory == index
highlighted: systemsettings.activeCategory == index
}
}
}
......@@ -118,17 +118,13 @@ Kirigami.ScrollablePage {
icon: model.decoration
label: model.display
separatorVisible: false
highlighted: focus
onClicked: systemsettings.activeSubCategory = index
onFocusChanged: {
if (focus) {
onCurrentIndexChanged: subCategoryView.positionViewAtIndex(index, ListView.Contain);
}
}
checked: systemsettings.activeSubCategory == index
//checkable: false
//FIXME: Qt 5.7 doesn't have checkable, this way fails at runtime but still works correctly on 5.7
Component.onCompleted: delegate.checkable = true;
highlighted: systemsettings.activeSubCategory == index
}
}
}
Supports Markdown
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