Skip to content

Commit

Permalink
[lipstick] Show battery level in the 'low battery' notification. Fixe…
Browse files Browse the repository at this point in the history
…s JB#40495
  • Loading branch information
blam committed Jun 29, 2020
1 parent 59c5e7b commit fd91cce
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/notifications/batterynotifier.cpp
Expand Up @@ -427,8 +427,9 @@ void BatteryNotifier::sendNotification(BatteryNotifier::NotificationType type)
qtTrId("qtn_ener_exit_psnote"),
""},
{"x-nemo.battery.lowbattery", // NotificationLowBattery
//% "Low battery"
qtTrId("qtn_ener_lowbatt"),
//: Shown when the battery is low. %1 = current battery level as a percentage
//% "Low battery: %1%"
qtTrId("qtn_ener_lowbatt_with_percentage"),
""},
{"x-nemo.battery.notenoughpower", // NotificationNotEnoughPower
//% "Not enough power to charge"
Expand All @@ -450,10 +451,14 @@ void BatteryNotifier::sendNotification(BatteryNotifier::NotificationType type)
}
}

const QString &message = type == NotificationLowBattery
? info.message.arg(m_currentState.m_batteryLevel)
: info.message;

/* Add fresh notification item */
QVariantHash hints;
hints.insert(LipstickNotification::HINT_CATEGORY, info.category);
hints.insert(LipstickNotification::HINT_PREVIEW_BODY, info.message);
hints.insert(LipstickNotification::HINT_PREVIEW_BODY, message);
hints.insert(LipstickNotification::HINT_VISIBILITY, QLatin1String("public"));
QueuedNotification queuedNotification;
queuedNotification.m_type = type;
Expand Down

0 comments on commit fd91cce

Please sign in to comment.