1
/***************************************************************************
2
* Copyright (C) 2012~2012 by CSSlayer *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18
***************************************************************************/
20
#ifndef FCITXQTCONNECTION_H
21
#define FCITXQTCONNECTION_H
23
#include "fcitxqt_export.h"
25
#include <QtCore/QObject>
27
class QDBusConnection;
29
class FcitxQtConnectionPrivate;
33
* dbus connection to fcitx
35
class FCITX_QT_EXPORT_API FcitxQtConnection : public QObject {
37
Q_PROPERTY(bool autoReconnect READ autoReconnect WRITE setAutoReconnect)
38
Q_PROPERTY(bool connected READ isConnected)
39
Q_PROPERTY(QDBusConnection* connection READ connection)
40
Q_PROPERTY(QString serviceName READ serviceName)
43
* create a new connection
47
explicit FcitxQtConnection(QObject* parent = 0);
50
* destroy the connection
52
virtual ~FcitxQtConnection();
55
* the connection will not start to work until you call this function
56
* you may want to connect to the signal before you call this function
58
void startConnection();
61
* automatically reconnect if fcitx disappeared
66
void setAutoReconnect(bool a);
69
* check this connection is doing automatical reconnect or not
71
* default value is true
76
* return the current dbus connection to fcitx, notice, the object return
77
* by this function might be deteled if fcitx disappear, or might return 0
78
* if fcitx is not running
80
* @return QDBusConnection*
82
QDBusConnection* connection();
84
* current fcitx dbus service name, can be used for create DBus proxy
86
* @return service name
88
const QString& serviceName();
90
* check its connected or not
96
* this signal will be emitted upon fcitx appears
100
* this signal will be emitted upon fcitx disappears
102
* it will come with connected in pair
107
FcitxQtConnectionPrivate * const d_ptr;
108
Q_DECLARE_PRIVATE(FcitxQtConnection);
111
#endif // FCITXCONNECTION_H