diff --git a/daemon/actions/bundled/handlebuttoneventsconfig.h b/daemon/actions/bundled/handlebuttoneventsconfig.h --- a/daemon/actions/bundled/handlebuttoneventsconfig.h +++ b/daemon/actions/bundled/handlebuttoneventsconfig.h @@ -42,7 +42,6 @@ QList< QPair< QString, QWidget* > > buildUi() override; private: - QCheckBox *m_enableSuspendThenHibernate; QComboBox *m_lidCloseCombo; QCheckBox *m_triggerLidActionWhenExternalMonitorPresent; QComboBox *m_powerButtonCombo; diff --git a/daemon/actions/bundled/handlebuttoneventsconfig.cpp b/daemon/actions/bundled/handlebuttoneventsconfig.cpp --- a/daemon/actions/bundled/handlebuttoneventsconfig.cpp +++ b/daemon/actions/bundled/handlebuttoneventsconfig.cpp @@ -60,13 +60,6 @@ if (m_powerButtonCombo) { configGroup().writeEntry("powerButtonAction", m_powerButtonCombo->itemData(m_powerButtonCombo->currentIndex()).toUInt()); } - if(m_enableSuspendThenHibernate) { - // save true only if the system can suspend and hibernate - configGroup().writeEntry( - "suspendThenHibernate", m_enableSuspendThenHibernate->isChecked()); - } else { - configGroup().writeEntry("suspendThenHibernate", false); - } configGroup().sync(); } @@ -84,16 +77,11 @@ if (m_powerButtonCombo) { m_powerButtonCombo->setCurrentIndex(m_powerButtonCombo->findData(QVariant::fromValue(configGroup().readEntry("powerButtonAction", 0)))); } - if (m_enableSuspendThenHibernate) { - // check if the system can suspend and hibernate before setting the value. - m_enableSuspendThenHibernate->setChecked(configGroup().readEntry("suspendThenHibernate", false)); - } } QList< QPair< QString, QWidget* > > HandleButtonEventsConfig::buildUi() { // Create the boxes - m_enableSuspendThenHibernate = new QCheckBox(i18nc("Hibernate after a delay when suspended", "Hibernate after a delay when suspended")); m_lidCloseCombo = new QComboBox; m_triggerLidActionWhenExternalMonitorPresent = new QCheckBox( i18nc("Execute action on lid close even when external monitor is connected", "Even when an external monitor is connected") @@ -128,7 +116,6 @@ connect(m_lidCloseCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged())); connect(m_triggerLidActionWhenExternalMonitorPresent, SIGNAL(stateChanged(int)), this, SLOT(setChanged())); connect(m_powerButtonCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged())); - connect(m_enableSuspendThenHibernate, SIGNAL(stateChanged(int)), this, SLOT(setChanged())); bool lidFound = false; bool powerFound = true; // HACK This needs proper API!! @@ -164,12 +151,6 @@ m_powerButtonCombo->deleteLater(); m_powerButtonCombo = nullptr; } - if (PowerManagement::instance()->canSuspendThenHibernate()) { - retlist.append(qMakePair< QString, QWidget* >(QLatin1Literal("NONE"), m_enableSuspendThenHibernate)); - } else { - m_enableSuspendThenHibernate->deleteLater(); - m_enableSuspendThenHibernate = nullptr; - } // unified width for the comboboxes @@ -180,9 +161,6 @@ if (m_powerButtonCombo) { comboBoxMaxWidth = qMax(comboBoxMaxWidth, m_powerButtonCombo->sizeHint().width()); } - if (m_enableSuspendThenHibernate) { - comboBoxMaxWidth = qMax(comboBoxMaxWidth, m_enableSuspendThenHibernate->sizeHint().width()); - } if (m_lidCloseCombo) { m_lidCloseCombo->setMinimumWidth(300); m_lidCloseCombo->setMaximumWidth(comboBoxMaxWidth); @@ -191,10 +169,6 @@ m_powerButtonCombo->setMinimumWidth(300); m_powerButtonCombo->setMaximumWidth(comboBoxMaxWidth); } - if(m_enableSuspendThenHibernate) { - m_enableSuspendThenHibernate->setMinimumWidth(300); - m_enableSuspendThenHibernate->setMaximumWidth(comboBoxMaxWidth); - } return retlist; } diff --git a/daemon/actions/bundled/suspendsessionconfig.h b/daemon/actions/bundled/suspendsessionconfig.h --- a/daemon/actions/bundled/suspendsessionconfig.h +++ b/daemon/actions/bundled/suspendsessionconfig.h @@ -44,7 +44,7 @@ private: QSpinBox *m_idleTime; - QCheckBox *m_suspendThenHibernateEnabled; + QCheckBox *m_suspendThenHibernateCheck; KComboBox *m_comboBox; }; diff --git a/daemon/actions/bundled/suspendsessionconfig.cpp b/daemon/actions/bundled/suspendsessionconfig.cpp --- a/daemon/actions/bundled/suspendsessionconfig.cpp +++ b/daemon/actions/bundled/suspendsessionconfig.cpp @@ -54,9 +54,9 @@ { configGroup().writeEntry< uint >("suspendType", m_comboBox->itemData(m_comboBox->currentIndex()).toUInt()); configGroup().writeEntry("idleTime", m_idleTime->value() * 60 * 1000); - if (m_suspendThenHibernateEnabled) { + if (m_suspendThenHibernateCheck) { configGroup().writeEntry( - "suspendThenHibernate", m_suspendThenHibernateEnabled->isChecked()); + "suspendThenHibernate", m_suspendThenHibernateCheck->isChecked()); } else { configGroup().writeEntry("suspendThenHibernate", false); } @@ -71,15 +71,15 @@ uint suspendType = configGroup().readEntry< uint >("suspendType", 0); m_comboBox->setCurrentIndex(m_comboBox->findData(suspendType)); m_idleTime->setValue((configGroup().readEntry("idleTime", 600000) / 60) / 1000); - if (m_suspendThenHibernateEnabled) { - m_suspendThenHibernateEnabled->setChecked(configGroup().readEntry("suspendThenHibernate", false)); + if (m_suspendThenHibernateCheck) { + m_suspendThenHibernateCheck->setChecked(configGroup().readEntry("suspendThenHibernate", false)); } } QList< QPair< QString, QWidget* > > SuspendSessionConfig::buildUi() { - m_suspendThenHibernateEnabled = new QCheckBox( - i18nc("Hibernate after a delay when suspended", "Hibernate after a delay when suspended")); + m_suspendThenHibernateCheck = new QCheckBox( + i18nc("Hibernate after 3 hours when suspended", "Hibernate after 3 hours when suspended")); QWidget *tempWidget = new QWidget; QHBoxLayout *hlay = new QHBoxLayout; m_comboBox = new KComboBox; @@ -114,20 +114,19 @@ connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged())); connect(m_idleTime, SIGNAL(valueChanged(int)), this, SLOT(setChanged())); - connect(m_suspendThenHibernateEnabled, SIGNAL(stateChanged(int)), this, SLOT(setChanged())); + connect(m_suspendThenHibernateCheck, SIGNAL(stateChanged(int)), this, SLOT(setChanged())); if (PowerManagement::instance()->canSuspendThenHibernate()) { - retlist.append(qMakePair< QString, QWidget* >(QLatin1Literal("NONE"), m_suspendThenHibernateEnabled)); + retlist.append(qMakePair< QString, QWidget* >(QLatin1Literal("NONE"), m_suspendThenHibernateCheck)); } else { - m_suspendThenHibernateEnabled->deleteLater(); - m_suspendThenHibernateEnabled = nullptr; + m_suspendThenHibernateCheck->deleteLater(); + m_suspendThenHibernateCheck = nullptr; } - int comboBoxMaxWidth = 300; - if (m_suspendThenHibernateEnabled) { - comboBoxMaxWidth = qMax(comboBoxMaxWidth, m_suspendThenHibernateEnabled->sizeHint().width()); - m_suspendThenHibernateEnabled->setMinimumWidth(300); - m_suspendThenHibernateEnabled->setMaximumWidth(comboBoxMaxWidth); + if (m_suspendThenHibernateCheck) { + int comboBoxMinWidth = 300; + m_suspendThenHibernateCheck->setMinimumWidth(comboBoxMinWidth); + m_suspendThenHibernateCheck->setMaximumWidth(qMax(comboBoxMinWidth, m_suspendThenHibernateCheck->sizeHint().width())); } return retlist; @@ -135,5 +134,5 @@ } } -r + #include "suspendsessionconfig.moc"