1 /* This file is part of the KDE project
2 Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
3 Copyright (C) 2007 Daniel Gollub <dgollub@suse.de>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
23 #include "bluezcalljob.h"
26 #include <QStringList>
30 BluezCallJob::BluezCallJob(const QDBusConnection
&connection
, const QString
&dest
,
31 const QString
&path
, const QString
&interface
,
32 const QString
&methodName
, const QList
<QVariant
> ¶ms
)
33 : KJob(), m_connection(connection
), m_dest(dest
), m_path(path
),
34 m_iface(interface
), m_method(methodName
),
38 BluezCallJob::~BluezCallJob()
41 void BluezCallJob::start()
43 QTimer::singleShot(0, this, SLOT(doStart()));
46 void BluezCallJob::kill(bool /*quietly */)
49 void BluezCallJob::doStart()
51 QDBusMessage msg
= QDBusMessage::createMethodCall(m_dest
, m_path
,
53 msg
.setArguments(m_params
);
55 if (!m_connection
.callWithCallback(msg
, this, SLOT(callReply(const QDBusMessage
&)), SLOT(callError(const QDBusError
&)))) {
57 setErrorText(m_connection
.lastError().name() + ": " + m_connection
.lastError().message());
62 void BluezCallJob::callError(const QDBusError
&error
)
65 setErrorText(error
.name() + ": " + error
.message());
70 void BluezCallJob::callReply(const QDBusMessage
& /*reply */)
76 #include "bluezcalljob.moc"