Changeset View
Changeset View
Standalone View
Standalone View
daemon/powerdevilcore.cpp
Show First 20 Lines • Show All 660 Lines • ▼ Show 20 Line(s) | 656 | if (m_criticalBatteryTimer->isActive()) { | |||
---|---|---|---|---|---|
661 | emitRichNotification(QStringLiteral("pluggedin"), | 661 | emitRichNotification(QStringLiteral("pluggedin"), | ||
662 | i18n("AC Adapter Plugged In"), | 662 | i18n("AC Adapter Plugged In"), | ||
663 | i18n("The computer will no longer go to sleep.")); | 663 | i18n("The computer will no longer go to sleep.")); | ||
664 | } else { | 664 | } else { | ||
665 | emitRichNotification(QStringLiteral("pluggedin"), i18n("Running on AC power"), i18n("The power adapter has been plugged in.")); | 665 | emitRichNotification(QStringLiteral("pluggedin"), i18n("Running on AC power"), i18n("The power adapter has been plugged in.")); | ||
666 | } | 666 | } | ||
667 | } else if (state == BackendInterface::Unplugged) { | 667 | } else if (state == BackendInterface::Unplugged) { | ||
668 | emitRichNotification(QStringLiteral("unplugged"), i18n("Running on Battery Power"), i18n("The power adapter has been unplugged.")); | 668 | emitRichNotification(QStringLiteral("unplugged"), i18n("Running on Battery Power"), i18n("The power adapter has been unplugged.")); | ||
669 | // Make sure to notify of low battery right away when unplugging AC | ||||
670 | emitBatteryChargePercentNotification(currentChargePercent(), 1000 /* so current is always lower than previous */); | ||||
669 | } | 671 | } | ||
670 | } | 672 | } | ||
671 | 673 | | |||
672 | void Core::onBatteryChargePercentChanged(int percent, const QString &udi) | 674 | void Core::onBatteryChargePercentChanged(int percent, const QString &udi) | ||
673 | { | 675 | { | ||
674 | if (m_peripheralBatteriesPercent.contains(udi)) { | 676 | if (m_peripheralBatteriesPercent.contains(udi)) { | ||
675 | const int previousPercent = m_peripheralBatteriesPercent.value(udi); | 677 | const int previousPercent = m_peripheralBatteriesPercent.value(udi); | ||
676 | m_peripheralBatteriesPercent[udi] = percent; | 678 | m_peripheralBatteriesPercent[udi] = percent; | ||
▲ Show 20 Lines • Show All 254 Lines • Show Last 20 Lines |