Skip to content

Commit

Permalink
Removed "Ask" option from lid and idle watchers (#380)
Browse files Browse the repository at this point in the history
Because it didn't make sense in them.

The "Ask" option is kept untouched in the battery and power watchers.

Closes #254
  • Loading branch information
tsujan authored Aug 20, 2023
1 parent b492062 commit 93e1441
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/batterywatchersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ BatteryWatcherSettings::BatteryWatcherSettings(QWidget *parent) :

{
mUi->setupUi(this);
fillComboBox(mUi->actionComboBox);
fillComboBox(mUi->actionComboBox, true);
fillIconTypeCombo(mUi->iconTypeComboBox);
mUi->chargeLevelSlider->setValue(53);
mChargingIconProducer.updateState(Solid::Battery::Charging);
Expand Down
7 changes: 5 additions & 2 deletions config/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@

#include "helpers.h"

void fillComboBox(QComboBox* comboBox)
void fillComboBox(QComboBox* comboBox, bool ask)
{
comboBox->clear();
comboBox->addItem(QObject::tr("Nothing"), -1);
comboBox->addItem(QObject::tr("Ask"), LXQt::Power::PowerShowLeaveDialog);
if (ask)
{
comboBox->addItem(QObject::tr("Ask"), LXQt::Power::PowerShowLeaveDialog);
}
comboBox->addItem(QObject::tr("Lock screen"), -2); // FIXME
comboBox->addItem(QObject::tr("Suspend"), LXQt::Power::PowerSuspend);
comboBox->addItem(QObject::tr("Hibernate"), LXQt::Power::PowerHibernate);
Expand Down
2 changes: 1 addition & 1 deletion config/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <QComboBox>

void fillComboBox(QComboBox* comboBox);
void fillComboBox(QComboBox* comboBox, bool ask = false);

void setComboBoxToValue(QComboBox* comboBox, int value);

Expand Down
6 changes: 3 additions & 3 deletions config/powerkeyssettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ PowerKeysSettings::PowerKeysSettings(QWidget *parent) :
mUi(new Ui::PowerKeysSettings)
{
mUi->setupUi(this);
fillComboBox(mUi->powerKeyActionComboBox);
fillComboBox(mUi->suspendKeyActionComboBox);
fillComboBox(mUi->hibernateKeyActionComboBox);
fillComboBox(mUi->powerKeyActionComboBox, true);
fillComboBox(mUi->suspendKeyActionComboBox, true);
fillComboBox(mUi->hibernateKeyActionComboBox, true);

connect(mUi->powerKeyActionComboBox, QOverload<int>::of(&QComboBox::activated), this, &PowerKeysSettings::saveSettings);
connect(mUi->suspendKeyActionComboBox, QOverload<int>::of(&QComboBox::activated), this, &PowerKeysSettings::saveSettings);
Expand Down

0 comments on commit 93e1441

Please sign in to comment.