Git commit f64bb500df79774b4b8858d3784cc34b234a9fa1 by Nicolas Fella. Committed on 05/04/2023 at 19:24. Pushed by nicolasfella into branch 'master'.
Drop per-activity suspend/shutdown timeout This allows to suspend/shutdown after n minutes on a per-activity basis Previously we agreed that such per-activity config is overkill, except for the inhibitions Consequently remove it M +0 -5 daemon/powerdevilcore.cpp M +1 -1 doc/kcm/index.docbook M +0 -50 kcmodule/activities/activityWidget.ui M +0 -30 kcmodule/activities/activitywidget.cpp https://invent.kde.org/plasma/powerdevil/commit/f64bb500df79774b4b8858d3784cc34b234a9fa1 diff --git a/daemon/powerdevilcore.cpp b/daemon/powerdevilcore.cpp index 5393f753c..f53bb30a5 100644 --- a/daemon/powerdevilcore.cpp +++ b/daemon/powerdevilcore.cpp @@ -395,11 +395,6 @@ void Core::loadProfile(bool force) if (activityConfig.readEntry("mode", "None") == QStringLiteral("SpecialBehavior")) { qCDebug(POWERDEVIL) << "Activity has special behaviors"; KConfigGroup behaviorGroup = activityConfig.group("SpecialBehavior"); - if (behaviorGroup.readEntry("performAction", false)) { - // Let's override the configuration for this action at all times - ActionPool::instance()->loadAction(QStringLiteral("SuspendSession"), behaviorGroup.group("ActionConfig"), this); - qCDebug(POWERDEVIL) << "Activity overrides suspend session action"; // debug hence not sleep - } if (behaviorGroup.readEntry("noSuspend", false)) { qCDebug(POWERDEVIL) << "Activity triggers a suspend inhibition"; // debug hence not sleep diff --git a/doc/kcm/index.docbook b/doc/kcm/index.docbook index 56b2eadc5..c7d8ead67 100644 --- a/doc/kcm/index.docbook +++ b/doc/kcm/index.docbook @@ -149,7 +149,7 @@ Use the settings defined on <guilabel>Energy Saving</guilabel> page. <term>Define a special behavior</term> <listitem> <para> -If this option is chosen, a special behavior for activity can be chosen. If this is a presentation activity, you can check the <guilabel>Never shutdown the screen</guilabel> and <guilabel>Never shutdown the computer or let it go to sleep</guilabel> boxes. It is also possible to define the time interval for the computer to switch to a suspension mode for the power saving activities. +If this option is chosen, a special behavior for activity can be chosen. If this is a presentation activity, you can check the <guilabel>Never shutdown the screen</guilabel> and <guilabel>Never shutdown the computer or let it go to sleep</guilabel> boxes. </para> </listitem> </varlistentry> diff --git a/kcmodule/activities/activityWidget.ui b/kcmodule/activities/activityWidget.ui index c0cb1d29b..9bfe09a9d 100644 --- a/kcmodule/activities/activityWidget.ui +++ b/kcmodule/activities/activityWidget.ui @@ -49,56 +49,6 @@ </property> </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>10</number> - </property> - <item> - <widget class="QCheckBox" name="alwaysBox"> - <property name="text"> - <string>Always</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="alwaysActionBox"/> - </item> - <item> - <widget class="QLabel" name="alwaysAfterLabel"> - <property name="text"> - <string>after</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="alwaysAfterSpin"> - <property name="suffix"> - <string> min</string> - </property> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>360</number> - </property> - </widget> - </item> - <item> - <spacer name="alwaysSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> </layout> </item> </layout> diff --git a/kcmodule/activities/activitywidget.cpp b/kcmodule/activities/activitywidget.cpp index b1db8b68b..8e478cdb4 100644 --- a/kcmodule/activities/activitywidget.cpp +++ b/kcmodule/activities/activitywidget.cpp @@ -22,10 +22,6 @@ #include "ui_activityWidget.h" -#include "../daemon/actions/bundled/suspendsession.h" - -#include "powerdevilpowermanagement.h" - #include <KActivities/Consumer> #include <KConfigGroup> #include <QLayout> @@ -62,8 +58,6 @@ ActivityWidget::ActivityWidget(const QString &activity, QWidget *parent) connect(m_ui->noSettingsRadio, &QAbstractButton::toggled, this, &ActivityWidget::setChanged); connect(m_ui->specialBehaviorRadio, &QAbstractButton::toggled, this, &ActivityWidget::setChanged); - connect(m_ui->alwaysActionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged())); - connect(m_ui->alwaysAfterSpin, SIGNAL(valueChanged(int)), this, SLOT(setChanged())); } ActivityWidget::~ActivityWidget() @@ -76,19 +70,6 @@ void ActivityWidget::load() KConfigGroup activitiesGroup(m_profilesConfig, "Activities"); KConfigGroup config = activitiesGroup.group(m_activity); - using namespace PowerDevil::BundledActions; - - m_ui->alwaysActionBox->clear(); - if (PowerDevil::PowerManagement::instance()->canSuspend()) { - m_ui->alwaysActionBox->addItem(QIcon::fromTheme("system-suspend"), - i18nc("Suspend to RAM", "Sleep"), (uint)SuspendSession::ToRamMode); - } - if (PowerDevil::PowerManagement::instance()->canHibernate()) { - m_ui->alwaysActionBox->addItem(QIcon::fromTheme("system-suspend-hibernate"), - i18n("Hibernate"), (uint)SuspendSession::ToDiskMode); - } - m_ui->alwaysActionBox->addItem(QIcon::fromTheme("system-shutdown"), i18n("Shut down"), (uint)SuspendSession::ShutdownMode); - // Proper loading routine if (config.readEntry("mode", QString()) == "SpecialBehavior") { m_ui->specialBehaviorRadio->setChecked(true); @@ -96,11 +77,6 @@ void ActivityWidget::load() m_ui->noShutdownPCBox->setChecked(behaviorGroup.readEntry("noSuspend", false)); m_ui->noShutdownScreenBox->setChecked(behaviorGroup.readEntry("noScreenManagement", false)); - m_ui->alwaysBox->setChecked(behaviorGroup.readEntry("performAction", false)); - - KConfigGroup actionConfig = behaviorGroup.group("ActionConfig"); - m_ui->alwaysActionBox->setCurrentIndex(m_ui->alwaysActionBox->findData(actionConfig.readEntry("suspendType", 0))); - m_ui->alwaysAfterSpin->setValue(actionConfig.readEntry("idleTime", 600000) / 60 / 1000); } } @@ -116,13 +92,7 @@ void ActivityWidget::save() behaviorGroup.writeEntry("noSuspend", m_ui->noShutdownPCBox->isChecked()); behaviorGroup.writeEntry("noScreenManagement", m_ui->noShutdownScreenBox->isChecked()); - behaviorGroup.writeEntry("performAction", m_ui->alwaysBox->isChecked()); - - KConfigGroup actionConfig = behaviorGroup.group("ActionConfig"); - actionConfig.writeEntry("suspendType", m_ui->alwaysActionBox->itemData(m_ui->alwaysActionBox->currentIndex())); - actionConfig.writeEntry("idleTime", m_ui->alwaysAfterSpin->value() * 60 * 1000); - actionConfig.sync(); behaviorGroup.sync(); } else { config.writeEntry("mode", "None");
