Skip to content

Commit

Permalink
Merge branch 'jb44479' into 'master'
Browse files Browse the repository at this point in the history
[lipstick] Add busy notifications for usb-mode selection. Contributes to JB#44479

See merge request mer-core/lipstick!106
  • Loading branch information
llewelld committed Feb 22, 2019
2 parents dfcffb5 + 6a18938 commit b33ad9f
Show file tree
Hide file tree
Showing 9 changed files with 349 additions and 155 deletions.
4 changes: 2 additions & 2 deletions rpm/lipstick-qt5.spec
Expand Up @@ -5,7 +5,7 @@ Name: lipstick-qt5
%define icondirectory %{_datadir}/icons/hicolor/86x86/apps

Summary: QML toolkit for homescreen creation
Version: 0.32.18
Version: 0.33.1
Release: 1
Group: System/Libraries
License: LGPLv2.1
Expand Down Expand Up @@ -38,7 +38,7 @@ BuildRequires: pkgconfig(ngf-qt5)
BuildRequires: pkgconfig(contextkit-statefs) >= 0.2.7
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(wayland-server)
BuildRequires: pkgconfig(usb-moded-qt5) >= 1.7
BuildRequires: pkgconfig(usb-moded-qt5) >= 1.8
BuildRequires: pkgconfig(systemsettings)
BuildRequires: pkgconfig(nemodevicelock)
BuildRequires: qt5-qttools-linguist
Expand Down
1 change: 1 addition & 0 deletions src/homeapplication.cpp
Expand Up @@ -181,6 +181,7 @@ HomeApplication::HomeApplication(int &argc, char **argv, const QString &qmlPath)
m_qmlEngine->rootContext()->setContextProperty("LipstickSettings", LipstickSettings::instance());
m_qmlEngine->rootContext()->setContextProperty("volumeControl", m_volumeControl);
m_qmlEngine->rootContext()->setContextProperty("connectivityMonitor", m_connectivityMonitor);
m_qmlEngine->rootContext()->setContextProperty("usbModeSelector", m_usbModeSelector);

connect(this, SIGNAL(homeReady()), this, SLOT(sendStartupNotifications()));
}
Expand Down
10 changes: 9 additions & 1 deletion src/notifications/batterynotifier.cpp
Expand Up @@ -109,7 +109,9 @@ void BatteryNotifier::prepareNotification()
toRemove << NotificationRemoveCharger
<< NotificationChargingComplete
<< NotificationLowBattery;
if (m_chargingCompletion == NeedsCharging) {
// In the case of USB devices, charging notifications on
// connection are handled by USBModeSelector rather than here.
if (m_chargingCompletion == NeedsCharging && !isUsbDevice()) {
toSend << NotificationCharging;
}
} else {
Expand Down Expand Up @@ -343,3 +345,9 @@ BatteryNotifier::ChargerType BatteryNotifier::getCharger() const
? ChargerNo
: ChargerUnknown)));
}

bool BatteryNotifier::isUsbDevice() const
{
QString name(propertyString(m_chargerType));
return (name == "dcp" || name == "cdp" || name == "usb");
}
7 changes: 7 additions & 0 deletions src/notifications/batterynotifier.h
Expand Up @@ -125,6 +125,13 @@ private slots:
ChargingState getState() const;
ChargerType getCharger() const;

/*! Determines whether the current device is a USB device that will by
* handled by usb_moded.
*
* \returns true if the device will be handled by usb_moded, false o/w.
*/
bool isUsbDevice() const;

//! Low battery notifier for getting notifications about low battery state
LowBatteryNotifier *m_lowBatteryNotifier;

Expand Down

0 comments on commit b33ad9f

Please sign in to comment.