Debian Codegraph @

qt5/dbusaddons/fcitxqtconnection_p.h

raw
1 /***************************************************************************
2 * Copyright (C) 2012~2012 by CSSlayer *
3 * *
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. *
8 * *
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. *
13 * *
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 ***************************************************************************/
19
20 #ifndef FCITXQTCONNECTION_P_H
21 #define FCITXQTCONNECTION_P_H
22
23 #include "fcitxqtconnection.h"
24 #include <QtCore/QFileSystemWatcher>
25 #include <QtCore/QWeakPointer>
26
27 class QDBusConnection;
28 class QDBusServiceWatcher;
29
30 class FcitxQtConnectionPrivate : public QObject {
31 Q_OBJECT
32 public:
33 FcitxQtConnectionPrivate(FcitxQtConnection *conn);
34 virtual ~FcitxQtConnectionPrivate();
35 FcitxQtConnection *const q_ptr;
36 Q_DECLARE_PUBLIC(FcitxQtConnection);
37
38 private Q_SLOTS:
39 void imChanged(const QString &service, const QString &oldowner,
40 const QString &newowner);
41 void dbusDisconnected();
42 void cleanUp();
43 void newServiceAppear();
44 void socketFileChanged();
45
46 private:
47 bool isConnected();
48
49 static QByteArray localMachineId();
50 const QString &socketFile();
51 void createConnection();
52 QString address();
53 int displayNumber();
54 void initialize();
55 void finalize();
56
57 int m_displayNumber;
58 QString m_serviceName;
59 QDBusConnection *m_connection;
60 QDBusServiceWatcher *m_serviceWatcher;
61 QFileSystemWatcher *m_watcher;
62 QString m_socketFile;
63 bool m_autoReconnect;
64 bool m_connectedOnce;
65 bool m_initialized;
66 };
67
68 #endif // FCITXCONNECTION_P_H