| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef _DBUSADDONS_FCITXQTWATCHER_H_ |
| 9 |
#define _DBUSADDONS_FCITXQTWATCHER_H_ |
| 10 |
|
| 11 |
#include "fcitx5qt4dbusaddons_export.h" |
| 12 |
|
| 13 |
#include <QDBusConnection> |
| 14 |
#include <QObject> |
| 15 |
|
| 16 |
namespace fcitx { |
| 17 |
|
| 18 |
class FcitxQtWatcherPrivate; |
| 19 |
|
| 20 |
class FCITX5QT4DBUSADDONS_EXPORT FcitxQtWatcher : public QObject { |
| 21 |
Q_OBJECT |
| 22 |
public: |
| 23 |
explicit FcitxQtWatcher(QObject *parent = nullptr); |
| 24 |
explicit FcitxQtWatcher(const QDBusConnection &connection, |
| 25 |
QObject *parent = nullptr); |
| 26 |
~FcitxQtWatcher(); |
| 27 |
void watch(); |
| 28 |
void unwatch(); |
| 29 |
void setConnection(const QDBusConnection &connection); |
| 30 |
QDBusConnection connection() const; |
| 31 |
void setWatchPortal(bool portal); |
| 32 |
bool watchPortal() const; |
| 33 |
bool isWatching() const; |
| 34 |
bool availability() const; |
| 35 |
|
| 36 |
QString serviceName() const; |
| 37 |
|
| 38 |
Q_SIGNALS: |
| 39 |
void availabilityChanged(bool); |
| 40 |
|
| 41 |
private Q_SLOTS: |
| 42 |
void imChanged(const QString &service, const QString &oldOwner, |
| 43 |
const QString &newOwner); |
| 44 |
|
| 45 |
private: |
| 46 |
void setAvailability(bool availability); |
| 47 |
void updateAvailability(); |
| 48 |
|
| 49 |
FcitxQtWatcherPrivate *const d_ptr; |
| 50 |
Q_DECLARE_PRIVATE(FcitxQtWatcher); |
| 51 |
}; |
| 52 |
} // namespace fcitx |
| 53 |
|
| 54 |
#endif // _DBUSADDONS_FCITXQTWATCHER_H_ |