2003-11-23 08:35:48 +00:00
|
|
|
// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
|
|
|
|
/* connection.h: Qt wrapper for DBusConnection
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2003 Zack Rusin <zack@kde.org>
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Academic Free License version 1.2
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
#ifndef DBUS_QT_CONNECTION_H
|
|
|
|
|
#define DBUS_QT_CONNECTION_H
|
|
|
|
|
|
2003-11-24 05:21:12 +00:00
|
|
|
#include "message.h"
|
|
|
|
|
|
2003-11-23 08:35:48 +00:00
|
|
|
#include <qobject.h>
|
Coding on dbus is like christmas. Just without christmas tree, presents, santa
clause, shopping, food, cookies, carrols, eggs, bunnies, trick or treating,
smoking crack... I don't quite remember where I was going with this
but we're getting closer.
2003-11-23 20:41:23 +00:00
|
|
|
#include <qstring.h>
|
2003-11-23 08:35:48 +00:00
|
|
|
|
|
|
|
|
#include "dbus/dbus.h"
|
|
|
|
|
|
|
|
|
|
namespace DBusQt {
|
2003-11-24 05:21:12 +00:00
|
|
|
namespace Internal {
|
|
|
|
|
class Integrator;
|
|
|
|
|
}
|
2003-11-23 08:35:48 +00:00
|
|
|
|
|
|
|
|
class Connection : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
Coding on dbus is like christmas. Just without christmas tree, presents, santa
clause, shopping, food, cookies, carrols, eggs, bunnies, trick or treating,
smoking crack... I don't quite remember where I was going with this
but we're getting closer.
2003-11-23 20:41:23 +00:00
|
|
|
Connection( const QString& host = QString::null );
|
2003-11-23 08:35:48 +00:00
|
|
|
|
Coding on dbus is like christmas. Just without christmas tree, presents, santa
clause, shopping, food, cookies, carrols, eggs, bunnies, trick or treating,
smoking crack... I don't quite remember where I was going with this
but we're getting closer.
2003-11-23 20:41:23 +00:00
|
|
|
bool isConnected() const;
|
|
|
|
|
bool isAuthenticated() const;
|
2003-11-23 08:35:48 +00:00
|
|
|
|
2003-11-24 05:21:12 +00:00
|
|
|
Message borrowMessage();
|
|
|
|
|
Message popMessage();
|
|
|
|
|
void stealBorrowMessage( const Message& );
|
|
|
|
|
|
2003-11-23 08:35:48 +00:00
|
|
|
public slots:
|
Coding on dbus is like christmas. Just without christmas tree, presents, santa
clause, shopping, food, cookies, carrols, eggs, bunnies, trick or treating,
smoking crack... I don't quite remember where I was going with this
but we're getting closer.
2003-11-23 20:41:23 +00:00
|
|
|
void open( const QString& );
|
|
|
|
|
void close();
|
2003-11-23 08:35:48 +00:00
|
|
|
void flush();
|
2003-11-24 05:21:12 +00:00
|
|
|
void send( const Message& );
|
|
|
|
|
void sendWithReply( const Message& );
|
|
|
|
|
void sendWithReplyAndBlock( const Message& );
|
2003-11-23 08:35:48 +00:00
|
|
|
|
Coding on dbus is like christmas. Just without christmas tree, presents, santa
clause, shopping, food, cookies, carrols, eggs, bunnies, trick or treating,
smoking crack... I don't quite remember where I was going with this
but we're getting closer.
2003-11-23 20:41:23 +00:00
|
|
|
protected slots:
|
2003-11-24 05:21:12 +00:00
|
|
|
void dispatchRead();
|
2003-11-23 08:35:48 +00:00
|
|
|
|
Coding on dbus is like christmas. Just without christmas tree, presents, santa
clause, shopping, food, cookies, carrols, eggs, bunnies, trick or treating,
smoking crack... I don't quite remember where I was going with this
but we're getting closer.
2003-11-23 20:41:23 +00:00
|
|
|
protected:
|
|
|
|
|
void init( const QString& host );
|
|
|
|
|
virtual void* virtual_hook( int id, void* data );
|
2003-11-24 05:21:12 +00:00
|
|
|
private:
|
|
|
|
|
friend class Internal::Integrator;
|
|
|
|
|
DBusConnection* connection() const;
|
2003-11-25 15:30:03 +00:00
|
|
|
Connection( DBusConnection *connection, QObject *parent );
|
2003-11-23 08:35:48 +00:00
|
|
|
private:
|
|
|
|
|
struct Private;
|
|
|
|
|
Private *d;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|