Skip to content

Commit

Permalink
[usb-moded-qt5] Filter restricted modes. JB#48441
Browse files Browse the repository at this point in the history
Return filtered list of modes from availableModes. Handle available
modes signal so that it uses filtered list.

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
  • Loading branch information
Tomin1 committed Jan 15, 2020
1 parent 5a73b0d commit 8c4ce45
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rpm/libusb-moded-qt5.spec
Expand Up @@ -10,8 +10,8 @@ Source0: %{name}-%{version}.tar.bz2

Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: usb-moded >= 0.86.0+mer29
BuildRequires: usb-moded-devel >= 0.86.0+mer29
Requires: usb-moded >= 0.86.0+mer39
BuildRequires: usb-moded-devel >= 0.86.0+mer39
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5DBus)
BuildRequires: pkgconfig(usb_moded)
Expand Down
13 changes: 11 additions & 2 deletions src/qusbmoded.cpp
Expand Up @@ -224,7 +224,7 @@ void QUsbModed::setup()
connect(iPrivate->iInterface,
&QUsbModedInterface::sig_usb_available_modes_ind,
this,
&QUsbModed::updateAvailableModes);
&QUsbModed::checkAvailableModesForUser);
connect(iPrivate->iInterface,
SIGNAL(sig_usb_hidden_modes_ind(QString)),
SLOT(onUsbHiddenModesChanged(QString)));
Expand All @@ -241,7 +241,7 @@ void QUsbModed::setup()

iPrivate->iPendingCalls |= USB_MODED_CALL_GET_AVAILABLE_MODES;
connect(new QDBusPendingCallWatcher(
iPrivate->iInterface->get_available_modes(), iPrivate->iInterface),
iPrivate->iInterface->get_available_modes_for_user(), iPrivate->iInterface),
&QDBusPendingCallWatcher::finished,
this,
&QUsbModed::onGetAvailableModesFinished);
Expand Down Expand Up @@ -412,6 +412,15 @@ void QUsbModed::updateAvailableModes(const QString &aModes)
}
}

void QUsbModed::checkAvailableModesForUser()
{
connect(new QDBusPendingCallWatcher(
iPrivate->iInterface->get_available_modes_for_user(), iPrivate->iInterface),
&QDBusPendingCallWatcher::finished,
this,
&QUsbModed::onGetAvailableModesFinished);
}

void QUsbModed::setupCallFinished(int aCallId)
{
ASSERT_(iPrivate->iPendingCalls & aCallId);
Expand Down
1 change: 1 addition & 0 deletions src/qusbmoded.h
Expand Up @@ -109,6 +109,7 @@ private Q_SLOTS:
void setupCallFinished(int callId);
void updateSupportedModes(QString modes);
void updateAvailableModes(const QString &modes);
void checkAvailableModesForUser();
void updateHiddenModes(QString modes);

private:
Expand Down

0 comments on commit 8c4ce45

Please sign in to comment.