kwin: remove non-operational screen locking prevention action

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-02 20:23:39 +03:00
parent d0f0047daa
commit 318246ea2e
4 changed files with 6 additions and 28 deletions

View file

@ -187,12 +187,6 @@ void KWinScreenEdgesConfig::monitorInit()
monitorAddItem(i18n("No Action"));
monitorAddItem(i18n("Show Desktop"));
monitorAddItem(i18n("Lock Screen"));
monitorAddItem(i18n("Prevent Screen Locking"));
//Prevent Screen Locking is not supported on some edges
m_ui->monitor->setEdgeItemEnabled(Monitor::Top, 4, false);
m_ui->monitor->setEdgeItemEnabled(Monitor::Left, 4, false);
m_ui->monitor->setEdgeItemEnabled(Monitor::Right, 4, false);
m_ui->monitor->setEdgeItemEnabled(Monitor::Bottom, 4, false);
// Search the effect names
KServiceTypeTrader* trader = KServiceTypeTrader::self();
@ -215,7 +209,6 @@ void KWinScreenEdgesConfig::monitorLoadAction(ElectricBorder edge, const QString
QString lowerName = config.readEntry(configName, "None").toLower();
if (lowerName == "showdesktop") monitorChangeEdge(edge, ElectricActionShowDesktop);
else if (lowerName == "lockscreen") monitorChangeEdge(edge, ElectricActionLockScreen);
else if (lowerName == "preventscreenlocking") monitorChangeEdge(edge, ElectricActionPreventScreenLocking);
}
void KWinScreenEdgesConfig::monitorLoad()
@ -282,20 +275,8 @@ void KWinScreenEdgesConfig::monitorSaveAction(int edge, const QString& configNam
config.writeEntry(configName, "ShowDesktop");
else if (item == 2)
config.writeEntry(configName, "LockScreen");
else if (item == 3)
config.writeEntry(configName, "PreventScreenLocking");
else // Anything else
config.writeEntry(configName, "None");
if ((edge == Monitor::TopRight) ||
(edge == Monitor::BottomRight) ||
(edge == Monitor::BottomLeft) ||
(edge == Monitor::TopLeft)) {
KConfig scrnConfig("kscreensaverrc");
KConfigGroup scrnGroup = scrnConfig.group("ScreenSaver");
scrnGroup.writeEntry("Action" + configName, (item == 4) ? 2 /* Prevent Screen Locking */ : 0 /* None */);
scrnGroup.sync();
}
}
void KWinScreenEdgesConfig::monitorSave()

View file

@ -64,11 +64,11 @@ private:
enum EffectActions {
PresentWindowsAll = ELECTRIC_ACTION_COUNT, // Start at the end of built in actions
PresentWindowsCurrent = 5,
PresentWindowsClass = 6,
DesktopGrid = 7,
TabBox = 8,
TabBoxAlternative = 9
PresentWindowsCurrent = 4,
PresentWindowsClass = 5,
DesktopGrid = 6,
TabBox = 7,
TabBoxAlternative = 8
};
bool effectEnabled(const QString& effect, const KConfigGroup& cfg) const;

View file

@ -74,8 +74,7 @@ enum ElectricBorderAction {
ElectricActionNone = 0, // No special action, not set, desktop switch or an effect
ElectricActionShowDesktop = 1, // Show desktop or restore
ElectricActionLockScreen = 2, // Lock screen
ElectricActionPreventScreenLocking = 3,
ELECTRIC_ACTION_COUNT = 4
ELECTRIC_ACTION_COUNT = 3
};
// DesktopMode and WindowsMode are based on the order in which the desktop

View file

@ -576,8 +576,6 @@ static ElectricBorderAction electricBorderAction(const QString& name)
return ElectricActionShowDesktop;
} else if (lowerName == "lockscreen") {
return ElectricActionLockScreen;
} else if (lowerName == "preventscreenlocking") {
return ElectricActionPreventScreenLocking;
}
return ElectricActionNone;
}