~ubuntu-branches/ubuntu/vivid/solid/vivid-proposed

« back to all changes in this revision

Viewing changes to src/solid/devices/backends/hal/halbattery.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-03-17 15:46:36 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20150317154636-22j6662gcq5mcqpi
Tags: 5.8.0-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
qlonglong Battery::timeToEmpty() const
111
111
{
112
112
    // NOTE Hal doesn't differentiate between time to empty and full
113
 
    return static_cast<HalDevice *>(m_device)->prop("battery.remaining_time").toLongLong();
 
113
    return remainingTime();
114
114
}
115
115
 
116
116
qlonglong Battery::timeToFull() const
117
117
{
118
 
    return static_cast<HalDevice *>(m_device)->prop("battery.remaining_time").toLongLong();
 
118
    // NOTE Hal doesn't differentiate between time to empty and full
 
119
    return remainingTime();
119
120
}
120
121
 
121
122
Solid::Battery::Technology Battery::technology() const
187
188
    return static_cast<HalDevice *>(m_device)->prop("system.hardware.serial").toString();
188
189
}
189
190
 
 
191
qlonglong Battery::remainingTime() const
 
192
{
 
193
    return static_cast<HalDevice *>(m_device)->prop("battery.remaining_time").toLongLong();
 
194
}
 
195
 
190
196
void Battery::slotPropertyChanged(const QMap<QString, int> &changes)
191
197
{
192
198
    if (changes.contains("battery.present")) {
210
216
    if (changes.contains("battery.remaining_time")) {
211
217
        emit timeToEmptyChanged(timeToEmpty(), m_device->udi());
212
218
        emit timeToFullChanged(timeToFull(), m_device->udi());
 
219
        emit remainingTimeChanged(remainingTime(), m_device->udi());
213
220
    }
214
221
 
215
222
    if (changes.contains("battery.charge_level.current")) {