D16425: Added new Suspend then Hibernate option

Ambareesh Balaji noreply at phabricator.kde.org
Wed May 29 22:49:49 BST 2019


abalaji added inline comments.

INLINE COMMENTS

> suspendsession.cpp:137
>              Q_EMIT aboutToSuspend();
> -            suspendJob = backend()->suspend(PowerDevil::BackendInterface::ToRam);
> +            if (m_suspendThenHibernateEnabled) {
> +                suspendJob = backend()->suspend(PowerDevil::BackendInterface::SuspendThenHibernate);

How about avoiding the duplicate `suspendJob = backend()->suspend()` calls by doing:

  suspendJob = backend()->suspend(m_suspendThenHibernateEnabled 
   ? PowerDevil::BackendInterface::SuspendThenHibernate : PowerDevil::BackendInterface::ToRam);

> suspendsession.cpp:177
>  {
>      if (config.isValid() && config.hasKey("idleTime") && config.hasKey("suspendType")) {
>          // Add the idle timeout

Factor the `config.isValid()` out of the two `if` statements

> suspendsessionconfig.cpp:57
>      configGroup().writeEntry("idleTime", m_idleTime->value() * 60 * 1000);
> +    if (m_suspendThenHibernateEnabled) {
> +        configGroup().writeEntry<bool>(

Again

  configGroup().writeEntry<bool>("suspendThenHibernate", m_suspendThenHibernateEnabled != nullptr && m_suspendThenHibernateEnabled->isChecked());

> suspendsessionconfig.cpp:106
>      hlay->addWidget(m_comboBox);
> +    hlay->addWidget(m_idleTime);
>      hlay->addStretch();

Stray line swap

> suspendsessionconfig.cpp:121
> +    } else {
> +        m_suspendThenHibernateEnabled->deleteLater();
> +        m_suspendThenHibernateEnabled = nullptr;

Not sure if this is necessary, just `delete m_suspendThenHibernateEnabled` might be enough.

REPOSITORY
  R122 Powerdevil

BRANCH
  arcpatch-D16425_1

REVISION DETAIL
  https://phabricator.kde.org/D16425

To: avaldes, broulik, ngraham
Cc: reverendhomer, meven, soriano, abalaji, graesslin, ngraham, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190529/2f3aa969/attachment-0001.html>


More information about the Plasma-devel mailing list