~ubuntu-branches/ubuntu/maverick/bluedevil/maverick-proposed

« back to all changes in this revision

Viewing changes to src/actionplugins/sendfile/helper/obexagent.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2010-08-07 09:04:19 UTC
  • Revision ID: james.westby@ubuntu.com-20100807090419-68k54ucso2htcf5z
Tags: upstream-1.0~rc2
ImportĀ upstreamĀ versionĀ 1.0~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   This file is part of the KDE project                                  *
 
3
 *                                                                         *
 
4
 *   Copyright (C) 2010 Alejandro Fiestas Olivares <alex@ufocoders.com>    *
 
5
 *   Copyright (C) 2010 UFO Coders <info@ufocoders.com>                    *
 
6
 *                                                                         *
 
7
 *   This program is free software; you can redistribute it and/or modify  *
 
8
 *   it under the terms of the GNU General Public License as published by  *
 
9
 *   the Free Software Foundation; either version 2 of the License, or     *
 
10
 *   (at your option) any later version.                                   *
 
11
 *                                                                         *
 
12
 *   This program is distributed in the hope that it will be useful,       *
 
13
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
14
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
15
 *   GNU General Public License for more details.                          *
 
16
 *                                                                         *
 
17
 *   You should have received a copy of the GNU General Public License     *
 
18
 *   along with this program; if not, write to the                         *
 
19
 *   Free Software Foundation, Inc.,                                       *
 
20
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
 
21
 ***************************************************************************/
 
22
 
 
23
#include "obexagent.h"
 
24
#include "obex_transfer.h"
 
25
 
 
26
#include <QtCore/QDebug>
 
27
 
 
28
#include <QDBusConnection>
 
29
#include <QDBusPendingCall>
 
30
#include <QDBusMessage>
 
31
 
 
32
ObexAgent::ObexAgent(QObject* parent): QDBusAbstractAdaptor(parent)
 
33
{
 
34
    m_killed = false;
 
35
    if (!QDBusConnection::sessionBus().registerObject("/BlueDevil_sendAgent", parent)) {
 
36
        qDebug() << "The dbus object can't be registered";
 
37
        return;
 
38
    }
 
39
}
 
40
 
 
41
void ObexAgent::Release() const
 
42
{
 
43
}
 
44
 
 
45
QString ObexAgent::Request(QDBusObjectPath transfer)
 
46
{
 
47
    OrgOpenobexTransferInterface *transferObj = new OrgOpenobexTransferInterface("org.openobex.client", transfer.path(), QDBusConnection::sessionBus());
 
48
 
 
49
    if (m_killed == true) {
 
50
        transferObj->Cancel();
 
51
    }
 
52
 
 
53
    emit request(transferObj);
 
54
    return QString();
 
55
}
 
56
 
 
57
void ObexAgent::Progress(QDBusObjectPath transfer, quint64 transferred)
 
58
{
 
59
    Q_UNUSED(transfer);
 
60
    Q_UNUSED(transferred);
 
61
 
 
62
    emit progress(transfer, transferred);
 
63
}
 
64
 
 
65
 
 
66
void ObexAgent::Complete(QDBusObjectPath transfer)
 
67
{
 
68
    Q_UNUSED(transfer);
 
69
 
 
70
    emit completed(transfer);
 
71
}
 
72
 
 
73
void ObexAgent::Error(QDBusObjectPath transfer, const QString& message)
 
74
{
 
75
    Q_UNUSED(transfer);
 
76
    Q_UNUSED(message);
 
77
 
 
78
    emit error(transfer, message);
 
79
}
 
80
 
 
81
void ObexAgent::setKilled()
 
82
{
 
83
    m_killed = true;
 
84
}
 
 
b'\\ No newline at end of file'