Skip to content

Commit

Permalink
Merge branch 'jb40495-low-battery-level' into 'master'
Browse files Browse the repository at this point in the history
[lipstick] Show battery level in the 'low battery' notification. Fixes JB#40495

See merge request mer-core/lipstick!144
  • Loading branch information
blam committed Jun 29, 2020
2 parents 59c5e7b + fd91cce commit 82e7e76
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 82e7e76

Please sign in to comment.