Commit f40a15c0 authored by Fushan Wen's avatar Fushan Wen
Browse files

wallpapers/image: allow wallpaper plugin to force enable the apply button

Currently there is no way to enable the apply button if the wallpaper
config is not changed, but the image wallpaper plugin needs to force
enable the apply button after an image is removed temporarily. This
allows to force enable the apply button by adding a boolean to kcm, to
let `isSaveNeeded` depend on the boolean, so when the boolean is true,
the apply button can be enabled without the need to have any change in
wallpaper config.

BUG: 438585
FIXED-IN: 5.26


(cherry picked from commit 2f31a338)
parent 3bfad8d3
Pipeline #238537 passed with stage
in 4 minutes and 32 seconds
......@@ -94,13 +94,21 @@ void ScreenLockerKcm::defaults()
void ScreenLockerKcm::updateState()
{
m_forceUpdateState = false;
settingsChanged();
Q_EMIT isDefaultsAppearanceChanged();
}
void ScreenLockerKcm::forceUpdateState()
{
m_forceUpdateState = true;
settingsChanged();
Q_EMIT isDefaultsAppearanceChanged();
}
bool ScreenLockerKcm::isSaveNeeded() const
{
return m_appearanceSettings->isSaveNeeded();
return m_forceUpdateState || m_appearanceSettings->isSaveNeeded();
}
bool ScreenLockerKcm::isDefaults() const
......
......@@ -68,6 +68,7 @@ public Q_SLOTS:
void save() override;
void defaults() override;
void updateState();
void forceUpdateState();
Q_SIGNALS:
void currentWallpaperChanged();
......@@ -82,6 +83,7 @@ private:
AppearanceSettings *m_appearanceSettings;
QString m_currentWallpaper;
bool m_forceUpdateState = false;
};
#endif
......@@ -68,6 +68,7 @@ Kirigami.Page {
WallpaperConfig {
sourceFile: kcm.wallpaperConfigFile
onConfigurationChanged: kcm.updateState()
onConfigurationForceChanged: kcm.forceUpdateState()
}
}
}
......@@ -33,6 +33,7 @@ QtControls.StackView {
Layout.fillWidth: true
property string sourceFile
signal configurationChanged
signal configurationForceChanged
onSourceFileChanged: {
if (sourceFile) {
const props = {}
......@@ -62,6 +63,11 @@ QtControls.StackView {
changedSignal.connect(createSignalHandler(key))
}
}
const configurationChangedSignal = newItem.configurationChanged
if (configurationChangedSignal) {
configurationChangedSignal.connect(main.configurationForceChanged) // BUG 438585
}
} else {
replace(empty)
}
......
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