Changeset View
Changeset View
Standalone View
Standalone View
kded/daemon.cpp
1 | /************************************************************************************* | 1 | /************************************************************************************* | ||
---|---|---|---|---|---|
2 | * Copyright (C) 2012 by Alejandro Fiestas Olivares <afiestas@kde.org> * | 2 | * Copyright (C) 2012 by Alejandro Fiestas Olivares <afiestas@kde.org> * | ||
3 | * Copyright 2016 by Sebastian Kügler <sebas@kde.org> * | 3 | * Copyright 2016 by Sebastian Kügler <sebas@kde.org> * | ||
4 | * Copyright (c) 2018 Kai Uwe Broulik <kde@broulik.de> * | ||||
5 | * Work sponsored by the LiMux project of * | ||||
6 | * the city of Munich. * | ||||
4 | * * | 7 | * * | ||
5 | * This program is free software; you can redistribute it and/or * | 8 | * This program is free software; you can redistribute it and/or * | ||
6 | * modify it under the terms of the GNU General Public License * | 9 | * modify it under the terms of the GNU General Public License * | ||
7 | * as published by the Free Software Foundation; either version 2 * | 10 | * as published by the Free Software Foundation; either version 2 * | ||
8 | * of the License, or (at your option) any later version. * | 11 | * of the License, or (at your option) any later version. * | ||
9 | * * | 12 | * * | ||
10 | * This program is distributed in the hope that it will be useful, * | 13 | * This program is distributed in the hope that it will be useful, * | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
▲ Show 20 Lines • Show All 157 Lines • ▼ Show 20 Line(s) | 162 | { | |||
169 | // It's possible that the Serializer returned a nullptr | 172 | // It's possible that the Serializer returned a nullptr | ||
170 | if (!config || !KScreen::Config::canBeApplied(config, KScreen::Config::ValidityFlag::RequireAtLeastOneEnabledScreen)) { | 173 | if (!config || !KScreen::Config::canBeApplied(config, KScreen::Config::ValidityFlag::RequireAtLeastOneEnabledScreen)) { | ||
171 | applyIdealConfig(); | 174 | applyIdealConfig(); | ||
172 | return; | 175 | return; | ||
173 | } | 176 | } | ||
174 | doApplyConfig(config); | 177 | doApplyConfig(config); | ||
175 | } | 178 | } | ||
176 | 179 | | |||
180 | void KScreenDaemon::applyLayoutPreset(const QString &presetName) | ||||
181 | { | ||||
182 | const QMetaEnum actionEnum = QMetaEnum::fromType<KScreen::OsdAction::Action>(); | ||||
183 | Q_ASSERT(actionEnum.isValid()); | ||||
184 | | ||||
185 | bool ok; | ||||
186 | auto action = static_cast<KScreen::OsdAction::Action>(actionEnum.keyToValue(qPrintable(presetName), &ok)); | ||||
187 | if (!ok) { | ||||
188 | qCWarning(KSCREEN_KDED) << "Cannot apply unknown screen layout preset named" << presetName; | ||||
189 | return; | ||||
190 | } | ||||
191 | applyOsdAction(action); | ||||
192 | } | ||||
193 | | ||||
177 | void KScreenDaemon::applyOsdAction(KScreen::OsdAction::Action action) | 194 | void KScreenDaemon::applyOsdAction(KScreen::OsdAction::Action action) | ||
178 | { | 195 | { | ||
179 | switch (action) { | 196 | switch (action) { | ||
180 | case KScreen::OsdAction::NoAction: | 197 | case KScreen::OsdAction::NoAction: | ||
181 | qCDebug(KSCREEN_KDED) << "OSD: no action"; | 198 | qCDebug(KSCREEN_KDED) << "OSD: no action"; | ||
182 | return; | 199 | return; | ||
183 | case KScreen::OsdAction::SwitchToInternal: | 200 | case KScreen::OsdAction::SwitchToInternal: | ||
184 | qCDebug(KSCREEN_KDED) << "OSD: switch to internal"; | 201 | qCDebug(KSCREEN_KDED) << "OSD: switch to internal"; | ||
▲ Show 20 Lines • Show All 259 Lines • Show Last 20 Lines |