Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ssu] Expose Ssu to QML. Contributes to JB#40252
Also fix deviceMode() SSU DBus API method.
  • Loading branch information
Joona Petrell committed Jan 10, 2018
1 parent ac93ab3 commit 1d2c0b3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions declarative/plugin.cpp
Expand Up @@ -11,6 +11,7 @@
#include <qqml.h>
#include "declarativessufeaturemodel.h"
#include "declarativessudeviceinfo.h"
#include "../libssu/ssu.h"

static QObject *device_info_factory(QQmlEngine *, QJSEngine *)
{
Expand All @@ -27,6 +28,7 @@ class NemoSsuPlugin : public QQmlExtensionPlugin
{
qmlRegisterType<DeclarativeSsuFeatureModel>("Nemo.Ssu", 1, 0, "FeatureModel");
qmlRegisterSingletonType<DeclarativeSsuDeviceInfo>("Nemo.Ssu", 1, 1, "DeviceInfo", device_info_factory);
qmlRegisterType<Ssu>("Nemo.Ssu", 1, 1, "Ssu");
}
};

Expand Down
4 changes: 4 additions & 0 deletions libssu/ssu.h
Expand Up @@ -22,6 +22,9 @@ class Ssu: public QObject

friend class UrlResolverTest;

Q_PROPERTY(bool registered READ isRegistered NOTIFY registrationStatusChanged)
Q_PROPERTY(DeviceModeFlags deviceMode READ deviceMode CONSTANT)
Q_PROPERTY(QString domain READ domain CONSTANT)
public:
/**
* Filters to control the output of the repository lookup methods
Expand Down Expand Up @@ -53,6 +56,7 @@ class Ssu: public QObject
};

Q_DECLARE_FLAGS(DeviceModeFlags, DeviceMode)
Q_FLAGS(DeviceModeFlags)

/**
* A list of types ssu provides shiny values suitable for displaying
Expand Down
3 changes: 2 additions & 1 deletion ssud/ssud.cpp
Expand Up @@ -136,7 +136,8 @@ QString Ssud::domain()
return ssu.domain();
}

Ssu::DeviceModeFlags Ssud::deviceMode()
// called by DBus Adaptor, return integer instead of enum Ssu::DeviceModeFlags
int Ssud::deviceMode()
{
autoclose.start();
return ssu.deviceMode();
Expand Down
2 changes: 1 addition & 1 deletion ssud/ssud.h
Expand Up @@ -35,7 +35,7 @@ public slots:
void unregisterDevice();
QString domain();
/* repository management */
Ssu::DeviceModeFlags deviceMode();
int deviceMode();
void setDeviceMode(int mode);
void setDeviceMode(int mode, int editMode);
QString flavour();
Expand Down

0 comments on commit 1d2c0b3

Please sign in to comment.