Changeset View
Changeset View
Standalone View
Standalone View
daemon/actions/bundled/brightnesscontrol.cpp
Show All 32 Lines | |||||
33 | 33 | | |||
34 | #include <KActionCollection> | 34 | #include <KActionCollection> | ||
35 | #include <KConfigGroup> | 35 | #include <KConfigGroup> | ||
36 | #include <KLocalizedString> | 36 | #include <KLocalizedString> | ||
37 | #include <KGlobalAccel> | 37 | #include <KGlobalAccel> | ||
38 | namespace PowerDevil { | 38 | namespace PowerDevil { | ||
39 | namespace BundledActions { | 39 | namespace BundledActions { | ||
40 | 40 | | |||
41 | static const QString s_globalAccelComponent = QStringLiteral("kded5"); | | |||
42 | | ||||
43 | BrightnessControl::BrightnessControl(QObject* parent) | 41 | BrightnessControl::BrightnessControl(QObject* parent) | ||
44 | : Action(parent) | 42 | : Action(parent) | ||
45 | { | 43 | { | ||
46 | // DBus | 44 | // DBus | ||
47 | new BrightnessControlAdaptor(this); | 45 | new BrightnessControlAdaptor(this); | ||
48 | 46 | | |||
49 | setRequiredPolicies(PowerDevil::PolicyAgent::ChangeScreenSettings); | 47 | setRequiredPolicies(PowerDevil::PolicyAgent::ChangeScreenSettings); | ||
50 | 48 | | |||
51 | connect(core()->backend(), &PowerDevil::BackendInterface::brightnessChanged, this, &PowerDevil::BundledActions::BrightnessControl::onBrightnessChangedFromBackend); | 49 | connect(core()->backend(), &PowerDevil::BackendInterface::brightnessChanged, this, &PowerDevil::BundledActions::BrightnessControl::onBrightnessChangedFromBackend); | ||
52 | 50 | | |||
53 | KActionCollection* actionCollection = new KActionCollection( this ); | 51 | KActionCollection* actionCollection = new KActionCollection( this ); | ||
54 | actionCollection->setComponentDisplayName(i18nc("Name for powerdevil shortcuts category", "Power Management")); | 52 | actionCollection->setComponentDisplayName(i18nc("Name for powerdevil shortcuts category", "Power Management")); | ||
55 | 53 | | |||
56 | QAction* globalAction = actionCollection->addAction(QLatin1String("Increase Screen Brightness")); | 54 | QAction* globalAction = actionCollection->addAction(QLatin1String("Increase Screen Brightness")); | ||
57 | globalAction->setText(i18nc("@action:inmenu Global shortcut", "Increase Screen Brightness")); | 55 | globalAction->setText(i18nc("@action:inmenu Global shortcut", "Increase Screen Brightness")); | ||
58 | globalAction->setProperty("componentName", s_globalAccelComponent); | | |||
59 | KGlobalAccel::setGlobalShortcut(globalAction, Qt::Key_MonBrightnessUp); | 56 | KGlobalAccel::setGlobalShortcut(globalAction, Qt::Key_MonBrightnessUp); | ||
60 | connect(globalAction, SIGNAL(triggered(bool)), SLOT(increaseBrightness())); | 57 | connect(globalAction, SIGNAL(triggered(bool)), SLOT(increaseBrightness())); | ||
61 | 58 | | |||
62 | globalAction = actionCollection->addAction(QLatin1String("Decrease Screen Brightness")); | 59 | globalAction = actionCollection->addAction(QLatin1String("Decrease Screen Brightness")); | ||
63 | globalAction->setText(i18nc("@action:inmenu Global shortcut", "Decrease Screen Brightness")); | 60 | globalAction->setText(i18nc("@action:inmenu Global shortcut", "Decrease Screen Brightness")); | ||
64 | globalAction->setProperty("componentName", s_globalAccelComponent); | | |||
65 | KGlobalAccel::setGlobalShortcut(globalAction, Qt::Key_MonBrightnessDown); | 61 | KGlobalAccel::setGlobalShortcut(globalAction, Qt::Key_MonBrightnessDown); | ||
66 | connect(globalAction, SIGNAL(triggered(bool)), SLOT(decreaseBrightness())); | 62 | connect(globalAction, SIGNAL(triggered(bool)), SLOT(decreaseBrightness())); | ||
67 | } | 63 | } | ||
68 | 64 | | |||
69 | void BrightnessControl::onProfileUnload() | 65 | void BrightnessControl::onProfileUnload() | ||
70 | { | 66 | { | ||
71 | // | 67 | // | ||
72 | } | 68 | } | ||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |