BluezQt

obexfiletransfer.cpp
1/*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2014 David Rosca <nowrep@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#include "obexfiletransfer.h"
10#include "pendingcall.h"
11#include "utils.h"
12
13#include "obexfiletransfer1.h"
14
15namespace BluezQt
16{
17typedef org::bluez::obex::FileTransfer1 BluezFileTransfer;
18
19class ObexFileTransferPrivate
20{
21public:
22 ObexFileTransfer *q;
23 BluezFileTransfer *m_bluezFileTransfer;
24};
25
27 : QObject(parent)
28 , d(new ObexFileTransferPrivate)
29{
30 d->m_bluezFileTransfer = new BluezFileTransfer(Strings::orgBluezObex(), path.path(), DBusConnection::orgBluezObex(), this);
31}
32
34
36{
37 return QDBusObjectPath(d->m_bluezFileTransfer->path());
38}
39
41{
42 return new PendingCall(d->m_bluezFileTransfer->ChangeFolder(folder), PendingCall::ReturnVoid, this);
43}
44
46{
47 return new PendingCall(d->m_bluezFileTransfer->CreateFolder(folder), PendingCall::ReturnVoid, this);
48}
49
51{
52 return new PendingCall(d->m_bluezFileTransfer->ListFolder(), PendingCall::ReturnFileTransferList, this);
53}
54
55PendingCall *ObexFileTransfer::getFile(const QString &targetFileName, const QString &sourceFileName)
56{
57 return new PendingCall(d->m_bluezFileTransfer->GetFile(targetFileName, sourceFileName), PendingCall::ReturnTransferWithProperties, this);
58}
59
60PendingCall *ObexFileTransfer::putFile(const QString &sourceFileName, const QString &targetFileName)
61{
62 return new PendingCall(d->m_bluezFileTransfer->PutFile(sourceFileName, targetFileName), PendingCall::ReturnTransferWithProperties, this);
63}
64
65PendingCall *ObexFileTransfer::copyFile(const QString &sourceFileName, const QString &targetFileName)
66{
67 return new PendingCall(d->m_bluezFileTransfer->CopyFile(sourceFileName, targetFileName), PendingCall::ReturnVoid, this);
68}
69
70PendingCall *ObexFileTransfer::moveFile(const QString &sourceFileName, const QString &targetFileName)
71{
72 return new PendingCall(d->m_bluezFileTransfer->MoveFile(sourceFileName, targetFileName), PendingCall::ReturnVoid, this);
73}
74
76{
77 return new PendingCall(d->m_bluezFileTransfer->Delete(fileName), PendingCall::ReturnVoid, this);
78}
79
80} // namespace BluezQt
81
82#include "moc_obexfiletransfer.cpp"
PendingCall * getFile(const QString &targetFileName, const QString &sourceFileName)
Gets the file from the remote device.
PendingCall * createFolder(const QString &folder)
Creates a new folder.
PendingCall * listFolder()
Lists a current folder.
~ObexFileTransfer() override
Destroys an ObexFileTransfer object.
ObexFileTransfer(const QDBusObjectPath &path, QObject *parent=nullptr)
Creates a new ObexFileTransfer object.
QDBusObjectPath objectPath() const
D-Bus object path of the file transfer session.
PendingCall * changeFolder(const QString &folder)
Changes the current folder.
PendingCall * copyFile(const QString &sourceFileName, const QString &targetFileName)
Copies a file within the remote device.
PendingCall * putFile(const QString &sourceFileName, const QString &targetFileName)
Puts the file to the remote device.
PendingCall * deleteFile(const QString &fileName)
Deletes a file/folder within the remote device.
PendingCall * moveFile(const QString &sourceFileName, const QString &targetFileName)
Moves a file within the remote device.
Pending method call.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 13 2024 11:49:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.