Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / solid / bluez / bluezcalljob.cpp
blobfb88e54a53c0ffc2a5843a4eabc79a1deba7b694
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 <QTimer>
24 #include <QStringList>
25 #include <kdebug.h>
27 #include "bluezcalljob.h"
30 BluezCallJob::BluezCallJob(const QDBusConnection &connection, const QString &dest,
31 const QString &path, const QString &interface,
32 const QString &methodName, const QList<QVariant> &params)
33 : KJob(), m_connection(connection), m_dest(dest), m_path(path),
34 m_iface(interface), m_method(methodName),
35 m_params(params)
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,
52 m_iface, m_method);
53 msg.setArguments(m_params);
55 if (!m_connection.callWithCallback(msg, this, SLOT(callReply(const QDBusMessage &)), SLOT(callError(const QDBusError &)))) {
56 setError(1);
57 setErrorText(m_connection.lastError().name() + ": " + m_connection.lastError().message());
58 emitResult();
62 void BluezCallJob::callError(const QDBusError &error)
64 setError(1);
65 setErrorText(error.name() + ": " + error.message());
67 emitResult();
70 void BluezCallJob::callReply(const QDBusMessage & /*reply */)
72 setError(0);
73 emitResult();
76 #include "bluezcalljob.moc"