Skip to content

Commit

Permalink
Make the device library shared.
Browse files Browse the repository at this point in the history
  • Loading branch information
adenexter committed Sep 15, 2016
1 parent ca76bc3 commit ca7009f
Show file tree
Hide file tree
Showing 90 changed files with 249 additions and 1,797 deletions.
Expand Up @@ -12,6 +12,5 @@
<method name="AcquisitionError">
<arg name="error" type="u" direction="in"/>
</method>
<method name="Canceled"/>
</interface>
</node>
31 changes: 26 additions & 5 deletions rpm/nemo-qml-plugin-devicelock.spec
Expand Up @@ -23,18 +23,28 @@ Requires: nemo-devicelock-daemon
%package -n nemo-devicelock-daemon-cli
Summary: The default command line lock code device lock daemon for Nemo Mobile
Group: System/GUI/Other
Requires: %{name} = %{version}
Provides: nemo-devicelock-daemon

%description -n nemo-devicelock-daemon-cli
%{summary}.

%package devel
Summary: Development libraries for device lock QML plugins
Summary: Development libraries for device lock
Group: Development/Libraries
Requires: %{name} = %{version}

%description devel
%{summary}.

%package host-devel
Summary: Development libraries for device lock daemons
Group: Development/Libraries
Requires: %{name}-devel = %{version}

%description host-devel
%{summary}.

%prep
%setup -q -n %{name}-%{version}

Expand All @@ -46,8 +56,13 @@ make %{?jobs:-j%jobs}
rm -rf %{buildroot}
%qmake5_install

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_libdir}/libnemodevicelock.so.*
%dir %{_libdir}/qt5/qml/org/nemomobile/devicelock
%{_libdir}/qt5/qml/org/nemomobile/devicelock/libnemodevicelockplugin.so
%{_libdir}/qt5/qml/org/nemomobile/devicelock/qmldir
Expand All @@ -57,13 +72,19 @@ rm -rf %{buildroot}
%{_bindir}/nemodevicelockd
/lib/systemd/system/nemodevicelock.service
/lib/systemd/system/nemodevicelock.socket
%{_sysconfdir}/dbus-1/system.d/org.nemomobile.devicelock.conf
%config %{_sysconfdir}/dbus-1/system.d/org.nemomobile.devicelock.conf

%files devel
%defattr(-,root,root,-)
%dir %{_includedir}/nemo-devicelock
%{_includedir}/nemo-devicelock/*.h
%{_includedir}/nemo-devicelock/private/*.h
%{_includedir}/nemo-devicelock/host/*.h
%{_libdir}/libnemodevicelock.a
%{_libdir}/libnemodevicelock-host.a
%{_libdir}/libnemodevicelock.so
%{_libdir}/pkgconfig/nemodevicelock.pc
%{_libdir}/pkgconfig/nemodevicelock-host.pc

%files host-devel
%defattr(-,root,root,-)
%dir %{_includedir}/nemo-devicelock/host
%{_includedir}/nemo-devicelock/host/*.h
%{_libdir}/libnemodevicelock-host.a
21 changes: 10 additions & 11 deletions src/daemon/daemon.pro
Expand Up @@ -9,27 +9,26 @@ CONFIG += \
link_pkgconfig

PKGCONFIG += \
dbus-1 \
keepalive \
libsystemd-daemon \
mlite5

INCLUDEPATH += \
$$PWD/../lib \
$$PWD/../lib/private \
$$PWD/../hostlib \
$$PWD/../hostlib/cli \
$$PWD/../hostlib/mce
$$PWD/../ \
$$PWD/../nemo-devicelock/host \
$$PWD/../nemo-devicelock/host/cli

DEPENDPATH += \
$$PWD/../lib \
$$PWD/../hostlib
$$PWD/../nemo-devicelock \
$$PWD/../nemo-devicelock/host

PRE_TARGETDEPS += \ \
$$PWD/../lib/libnemodevicelock.a
$$PWD/../lib/libnemodevicelock-host.a
$$PWD/../nemo-devicelock/host/libnemodevicelock-host.a

LIBS += \
-L$$OUT_PWD/../lib -lnemodevicelock\
-L$$OUT_PWD/../hostlib -lnemodevicelock-host
-L$$OUT_PWD/../nemo-devicelock -lnemodevicelock\
-L$$OUT_PWD/../nemo-devicelock/host -lnemodevicelock-host

SOURCES = \
main.cpp
Expand Down
File renamed without changes.
19 changes: 10 additions & 9 deletions src/lib/authenticator.h → src/nemo-devicelock/authenticator.h
Expand Up @@ -30,14 +30,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
*/

#ifndef AUTHENTICATOR_H
#define AUTHENTICATOR_H
#ifndef NEMODEVICELOCK_AUTHENTICATOR_H
#define NEMODEVICELOCK_AUTHENTICATOR_H

#include <QDBusAbstractAdaptor>
#include <QDBusObjectPath>
#include <QSharedDataPointer>

#include <connection.h>
#include <nemo-devicelock/global.h>
#include <nemo-devicelock/private/connection.h>

namespace NemoDeviceLock {

Expand All @@ -59,7 +60,7 @@ public slots:
};

class SettingsWatcher;
class Authenticator : public QObject, private ConnectionClient
class NEMODEVICELOCK_EXPORT Authenticator : public QObject, private ConnectionClient
{
Q_OBJECT
Q_PROPERTY(Methods availableMethods READ availableMethods NOTIFY availableMethodsChanged)
Expand Down Expand Up @@ -129,12 +130,12 @@ class Authenticator : public QObject, private ConnectionClient
private:
friend class AuthenticatorAdaptor;

void connected();
void disconnected();
inline void connected();
inline void disconnected();

void handleAuthentication(const QVariant &authenticationToken);
void handleFeedback(Feedback feedback, int attemptsRemaining, Methods utilizedMethods);
void handleError(Error error);
inline void handleAuthentication(const QVariant &authenticationToken);
inline void handleFeedback(Feedback feedback, int attemptsRemaining, Methods utilizedMethods);
inline void handleError(Error error);

AuthenticatorAdaptor m_adaptor;
QExplicitlySharedDataPointer<SettingsWatcher> m_settings;
Expand Down
File renamed without changes.
Expand Up @@ -30,16 +30,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
*/

#ifndef AUTHENTICATION_H
#define AUTHENTICATION_H
#ifndef NEMODEVICELOCK_AUTHENTICATION_H
#define NEMODEVICELOCK_AUTHENTICATION_H

#include <authenticator.h>
#include <nemo-devicelock/authenticator.h>

#include <QVariant>

namespace NemoDeviceLock {

class Authorization : public QObject
class NEMODEVICELOCK_EXPORT Authorization : public QObject
{
Q_OBJECT
Q_ENUMS(Status)
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/lib/devicelock.h → src/nemo-devicelock/devicelock.h
Expand Up @@ -13,15 +13,15 @@
**
****************************************************************************/

#ifndef DEVICELOCK_H
#define DEVICELOCK_H
#ifndef NEMODEVICELOCK_DEVICELOCK_H
#define NEMODEVICELOCK_DEVICELOCK_H

#include <clientauthorization.h>
#include <nemo-devicelock/private/clientauthorization.h>

namespace NemoDeviceLock
{

class DeviceLock : public QObject, private ConnectionClient
class NEMODEVICELOCK_EXPORT DeviceLock : public QObject, private ConnectionClient
{
Q_OBJECT
Q_ENUMS(LockState)
Expand Down Expand Up @@ -59,7 +59,7 @@ class DeviceLock : public QObject, private ConnectionClient
void unlockError();

private:
void connected();
inline void connected();

ClientAuthorization m_authorization;
ClientAuthorizationAdaptor m_authorizationAdaptor;
Expand Down
Expand Up @@ -143,6 +143,11 @@ bool DeviceLockSettings::currentCodeIsDigitOnly() const
return m_settings->currentCodeIsDigitOnly;
}

bool DeviceLockSettings::isHomeEncrypted() const
{
return m_settings->isHomeEncrypted;
}

void DeviceLockSettings::changeSetting(
const QVariant &authenticationToken, const QString &key, const QVariant &value)
{
Expand Down
Expand Up @@ -30,17 +30,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
*/

#ifndef DEVICELOCKSETTINGS_H
#define DEVICELOCKSETTINGS_H
#ifndef NEMODEVICELOCK_DEVICELOCKSETTINGS_H
#define NEMODEVICELOCK_DEVICELOCKSETTINGS_H

#include <clientauthorization.h>
#include <nemo-devicelock/private/clientauthorization.h>

namespace NemoDeviceLock
{

class SettingsWatcher;

class DeviceLockSettings : public QObject, private ConnectionClient
class NEMODEVICELOCK_EXPORT DeviceLockSettings : public QObject, private ConnectionClient
{
Q_OBJECT
Q_PROPERTY(NemoDeviceLock::Authorization *authorization READ authorization CONSTANT)
Expand Down Expand Up @@ -95,7 +95,7 @@ class DeviceLockSettings : public QObject, private ConnectionClient
void changeSetting(const QVariant &authenticationToken, const QString &key, const QVariant &value);

private:
void connected();
inline void connected();

ClientAuthorization m_authorization;
ClientAuthorizationAdaptor m_authorizationAdaptor;
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/lib/devicereset.h → src/nemo-devicelock/devicereset.h
Expand Up @@ -30,15 +30,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
*/

#ifndef DEVICERESET_H
#define DEVICERESET_H
#ifndef NEMODEVICELOCK_DEVICERESET_H
#define NEMODEVICELOCK_DEVICERESET_H

#include <clientauthorization.h>
#include <nemo-devicelock/private/clientauthorization.h>

namespace NemoDeviceLock
{

class DeviceReset : public QObject, private ConnectionClient
class NEMODEVICELOCK_EXPORT DeviceReset : public QObject, private ConnectionClient
{
Q_OBJECT
Q_PROPERTY(NemoDeviceLock::Authorization *authorization READ authorization CONSTANT)
Expand All @@ -61,7 +61,7 @@ class DeviceReset : public QObject, private ConnectionClient
void clearDeviceError();

private:
void connected();
inline void connected();

ClientAuthorization m_authorization;
ClientAuthorizationAdaptor m_authorizationAdaptor;
Expand Down
File renamed without changes.
Expand Up @@ -30,17 +30,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
*/

#ifndef ENCRYPTIONSETTINGS_H
#define ENCRYPTIONSETTINGS_H
#ifndef NEMODEVICELOCK_ENCRYPTIONSETTINGS_H
#define NEMODEVICELOCK_ENCRYPTIONSETTINGS_H

#include <clientauthorization.h>
#include <nemo-devicelock/private/clientauthorization.h>

namespace NemoDeviceLock
{

class SettingsWatcher;

class EncryptionSettings : public QObject, private ConnectionClient
class NEMODEVICELOCK_EXPORT EncryptionSettings : public QObject, private ConnectionClient
{
Q_OBJECT
Q_PROPERTY(NemoDeviceLock::Authorization *authorization READ authorization CONSTANT)
Expand All @@ -60,7 +60,7 @@ class EncryptionSettings : public QObject, private ConnectionClient
void encryptHomeError();

private:
void connected();
inline void connected();

ClientAuthorization m_authorization;
ClientAuthorizationAdaptor m_authorizationAdaptor;
Expand Down
Expand Up @@ -32,6 +32,8 @@

#include "fingerprintsettings.h"

#include <QDebug>

QDBusArgument &operator<<(QDBusArgument &argument, const NemoDeviceLock::Fingerprint &fingerprint)
{
argument.beginStructure();
Expand Down Expand Up @@ -205,16 +207,11 @@ void FingerprintSettingsAdaptor::AcquisitionFeedback(uint feedback)
m_settings->acquisitionFeedback(FingerprintSettings::Feedback(feedback));
}

void FingerprintSettingsAdaptor::Error(uint error)
void FingerprintSettingsAdaptor::AcquisitionError(uint error)
{
m_settings->handleError(FingerprintSettings::Error(error));
}

void FingerprintSettingsAdaptor::Canceled()
{
m_settings->handleCanceled();
}

FingerprintSettings::FingerprintSettings(QObject *parent)
: QObject(parent)
, ConnectionClient(
Expand All @@ -223,14 +220,14 @@ FingerprintSettings::FingerprintSettings(QObject *parent)
QStringLiteral("org.nemomobile.devicelock.Fingerprint.Sensor"))
, m_authorization(m_localPath, m_remotePath)
, m_authorizationAdaptor(&m_authorization, this)
, m_settingsAdaptor(this)
, m_samplesRemaining(0)
, m_samplesRequired(0)
, m_hasSensor(false)
, m_isAcquiring(false)
{
connect(m_connection.data(), &Connection::connected, this, &FingerprintSettings::connected);
connect(m_connection.data(), &Connection::disconnected,
this, &FingerprintSettings::handleCanceled);
connect(m_connection.data(), &Connection::disconnected, this, &FingerprintSettings::disconnected);

if (m_connection->isConnected()) {
connected();
Expand Down Expand Up @@ -341,17 +338,6 @@ void FingerprintSettings::handleError(Error error)
emit samplesRemainingChanged();
}

void FingerprintSettings::handleCanceled()
{
m_samplesRemaining = 0;
m_samplesRequired = 0;
m_isAcquiring = false;

emit acquiringChanged();
emit samplesRequiredChanged();
emit samplesRemainingChanged();
}

void FingerprintSettings::connected()
{
registerObject();
Expand All @@ -363,4 +349,15 @@ void FingerprintSettings::connected()
});
}

void FingerprintSettings::disconnected()
{
m_samplesRemaining = 0;
m_samplesRequired = 0;
m_isAcquiring = false;

emit acquiringChanged();
emit samplesRequiredChanged();
emit samplesRemainingChanged();
}

}

0 comments on commit ca7009f

Please sign in to comment.