~renatofilho/buteo-syncfw-qml/service-available-property

« back to all changes in this revision

Viewing changes to Buteo/buteo-sync-qml.h

  • Committer: CI Train Bot
  • Author(s): Renato Araujo Oliveira Filho
  • Date: 2015-09-29 19:16:44 UTC
  • mfrom: (2.1.9 release)
  • Revision ID: ci-train-bot@canonical.com-20150929191644-7kbkmz35wpe2rxhh
Added coverage.
Use async dbus call for "syncProfilesByKey".
Approved by: Ken VanDine, PS Jenkins bot, Michael Sheldon

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
 
1
/*
2
2
 * Copyright (C) 2015 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
18
18
#include <QtQml/QQmlParserStatus>
19
19
#include <QtDBus/QDBusInterface>
20
20
#include <QtDBus/QDBusServiceWatcher>
 
21
#include <QtDBus/QDBusPendingCallWatcher>
21
22
 
22
23
class ButeoSyncFW : public QObject, public QQmlParserStatus
23
24
{
24
25
    Q_OBJECT
25
26
    Q_INTERFACES(QQmlParserStatus)
26
27
 
27
 
    Q_PROPERTY(bool syncing READ syncing NOTIFY syncStatus)
28
 
    Q_PROPERTY(QStringList visibleSyncProfiles READ visibleSyncProfiles NOTIFY profileChanged)
 
28
    Q_PROPERTY(bool syncing READ syncing NOTIFY syncStatusChanged)
 
29
    Q_PROPERTY(int profilesCount READ profilesCount NOTIFY profilesChanged)
 
30
    Q_PROPERTY(QStringList visibleSyncProfiles READ visibleSyncProfiles NOTIFY profilesChanged)
29
31
 
30
32
public:
31
33
    ButeoSyncFW(QObject *parent = 0);
32
34
 
33
35
    bool syncing() const;
34
36
    QStringList visibleSyncProfiles() const;
 
37
    int profilesCount() const;
35
38
 
36
39
    // QQmlParserStatus
37
40
    void classBegin();
110
113
    void syncStatus(QString aProfileId, int aStatus,
111
114
                    QString aMessage, int aStatusDetails);
112
115
 
 
116
    /*!
 
117
     * syncStatus notify signal
 
118
     */
 
119
    void syncStatusChanged();
 
120
    void profilesChanged();
 
121
 
113
122
public slots:
114
123
    /*!
115
124
     * \brief Requests to starts synchronizing using a profile Id
124
133
     * \return True if a profile with the Id was found. Otherwise
125
134
     *  false and no status change signals will follow from this request.
126
135
     */
127
 
    bool startSync(const QString &aProfileId) const;
 
136
    bool startSync(const QString &aProfileId);
128
137
 
129
138
    /*!
130
139
     * \brief Requests to starts synchronizing using a profile category
135
144
     *
136
145
     * \see ButeoSyncFW::startSync
137
146
     */
138
 
    bool startSyncByCategory(const QString &category) const;
 
147
    bool startSyncByCategory(const QString &category);
139
148
 
140
149
    /*!
141
150
     * \brief Stops synchronizing the profile with the given Id.
171
180
 
172
181
private slots:
173
182
    void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
 
183
    void onSyncProfilesByKeyFinished(QDBusPendingCallWatcher *watcher);
 
184
    void onAllVisibleSyncProfilesFinished(QDBusPendingCallWatcher *watcher);
 
185
    void onSyncStatusChanged();
 
186
    void reloadProfiles();
174
187
 
175
188
private:
176
189
    QScopedPointer<QDBusInterface> m_iface;
177
190
    QScopedPointer<QDBusServiceWatcher> m_serviceWatcher;
 
191
    QScopedPointer<QDBusPendingCallWatcher> m_reloadProfilesWatcher;
 
192
    QMultiMap<QString, QPair<QString, bool> > m_profilesByCategory;
 
193
    bool m_waitSyncStart;
178
194
 
179
195
    void initialize();
180
196
    void deinitialize();
 
197
    QStringList profiles(const QString &category = QString(), bool onlyEnabled=false) const;
 
198
    QMultiMap<QString, QPair<QString, bool> > paserProfiles(const QStringList &profiles) const;
181
199
};