fix(notification): dbus interface

pull/39/head
kate 4 years ago
parent adbe437e61
commit fae9c3bdc1

@ -85,6 +85,11 @@ void Application::setDoNotDisturb(bool enabled)
m_settings->setDoNotDisturb(enabled); m_settings->setDoNotDisturb(enabled);
} }
bool Application::doNotDisturb() const
{
return m_settings->doNotDisturb();
}
int Application::run() int Application::run()
{ {
if (!parseCommandLineArgs()) if (!parseCommandLineArgs())
@ -97,6 +102,8 @@ int Application::run()
m_window = new NotificationWindow; m_window = new NotificationWindow;
connect(m_settings, &Settings::doNotDisturbChanged, this, &Application::doNotDisturbChanged);
return QApplication::exec(); return QApplication::exec();
} }

@ -29,16 +29,21 @@ class NotificationsModel;
class Application : public QApplication class Application : public QApplication
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool doNotDisturb READ doNotDisturb WRITE setDoNotDisturb NOTIFY doNotDisturbChanged)
public: public:
explicit Application(int& argc, char** argv); explicit Application(int& argc, char** argv);
void showWindow(); void showWindow();
void setDoNotDisturb(bool enabled); void setDoNotDisturb(bool enabled);
bool doNotDisturb() const;
int run(); int run();
bool parseCommandLineArgs(); bool parseCommandLineArgs();
signals:
void doNotDisturbChanged();
private: private:
NotificationServer *m_notificationServer; NotificationServer *m_notificationServer;
NotificationsModel *m_model; NotificationsModel *m_model;

@ -5,7 +5,7 @@
<method name="setDoNotDisturb"> <method name="setDoNotDisturb">
<arg name="enabled" type="b" direction="in"/> <arg name="enabled" type="b" direction="in"/>
</method> </method>
<signal name="doNotDisturbChanged"> <signal name="doNotDisturbChanged"></signal>
</signal> <property name="doNotDisturb" type="b" access="read"/>
</interface> </interface>
</node> </node>

Loading…
Cancel
Save