on xenial help sign in
Fix DownloadTracker properties.
eb081ffMichał Sawicz
plugins/Ubuntu/DownloadDaemonListener/download_tracker.cpp+14−2
@@ -37,19 +37,31 @@ bool DownloadTracker::isServiceReady()
37 return ready;
37 return ready;
38}
38}
39
39
40+QString DownloadTracker::dbusPath() const
41+{
42+ return m_dbusPath;
43+}
44+
40void DownloadTracker::setDbusPath(QString& path)
45void DownloadTracker::setDbusPath(QString& path)
41{
46{
42− if(path != ""){
47+ if(path != "" && m_dbusPath != path){
43 this->m_dbusPath = path;
48 this->m_dbusPath = path;
44 this->startService();
49 this->startService();
50+ Q_EMIT dbusPathChanged(this->m_dbusPath);
45 }
51 }
46}
52}
47
53
54+QString DownloadTracker::service() const
55+{
56+ return m_service;
57+}
58+
48void DownloadTracker::setService(QString& service)
59void DownloadTracker::setService(QString& service)
49{
60{
50− if(service != ""){
61+ if(service != "" && m_service != service){
51 this->m_service = service;
62 this->m_service = service;
52 this->startService();
63 this->startService();
64+ Q_EMIT serviceChanged(this->m_service);
53 }
65 }
54}
66}
55
67
plugins/Ubuntu/DownloadDaemonListener/download_tracker.h+8−2
@@ -31,18 +31,24 @@ class DownloadTracker : public QObject
31{
31{
32 Q_OBJECT
32 Q_OBJECT
33 Q_DISABLE_COPY(DownloadTracker)
33 Q_DISABLE_COPY(DownloadTracker)
34− Q_PROPERTY(QString service WRITE setService)
34+ Q_PROPERTY(QString service READ service WRITE setService NOTIFY serviceChanged)
35− Q_PROPERTY(QString dbusPath WRITE setDbusPath)
35+ Q_PROPERTY(QString dbusPath READ dbusPath WRITE setDbusPath NOTIFY dbusPathChanged)
36 Q_PROPERTY(bool serviceReady READ isServiceReady)
36 Q_PROPERTY(bool serviceReady READ isServiceReady)
37
37
38public:
38public:
39 explicit DownloadTracker(QObject *parent = 0);
39 explicit DownloadTracker(QObject *parent = 0);
40
40
41+ QString service() const;
42+ QString dbusPath() const;
43+
41 void setDbusPath(QString& path);
44 void setDbusPath(QString& path);
42 void setService(QString& service);
45 void setService(QString& service);
43 bool isServiceReady();
46 bool isServiceReady();
44
47
45Q_SIGNALS:
48Q_SIGNALS:
49+ void serviceChanged(const QString &service);
50+ void dbusPathChanged(const QString &dbusPath);
51+
46 void canceled(bool success);
52 void canceled(bool success);
47 void error(const QString &error);
53 void error(const QString &error);
48 void finished(const QString &path);
54 void finished(const QString &path);