BluezQt

obexfiletransfer.cpp
1 /*
2  * BluezQt - Asynchronous Bluez wrapper library
3  *
4  * SPDX-FileCopyrightText: 2014 David Rosca <[email protected]>
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 
15 namespace BluezQt
16 {
17 typedef org::bluez::obex::FileTransfer1 BluezFileTransfer;
18 
19 class ObexFileTransferPrivate
20 {
21 public:
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 {
35  delete d;
36 }
37 
39 {
40  return QDBusObjectPath(d->m_bluezFileTransfer->path());
41 }
42 
44 {
45  return new PendingCall(d->m_bluezFileTransfer->ChangeFolder(folder), PendingCall::ReturnVoid, this);
46 }
47 
49 {
50  return new PendingCall(d->m_bluezFileTransfer->CreateFolder(folder), PendingCall::ReturnVoid, this);
51 }
52 
54 {
55  return new PendingCall(d->m_bluezFileTransfer->ListFolder(), PendingCall::ReturnFileTransferList, this);
56 }
57 
58 PendingCall *ObexFileTransfer::getFile(const QString &targetFileName, const QString &sourceFileName)
59 {
60  return new PendingCall(d->m_bluezFileTransfer->GetFile(targetFileName, sourceFileName), PendingCall::ReturnTransferWithProperties, this);
61 }
62 
63 PendingCall *ObexFileTransfer::putFile(const QString &sourceFileName, const QString &targetFileName)
64 {
65  return new PendingCall(d->m_bluezFileTransfer->PutFile(sourceFileName, targetFileName), PendingCall::ReturnTransferWithProperties, this);
66 }
67 
68 PendingCall *ObexFileTransfer::copyFile(const QString &sourceFileName, const QString &targetFileName)
69 {
70  return new PendingCall(d->m_bluezFileTransfer->CopyFile(sourceFileName, targetFileName), PendingCall::ReturnVoid, this);
71 }
72 
73 PendingCall *ObexFileTransfer::moveFile(const QString &sourceFileName, const QString &targetFileName)
74 {
75  return new PendingCall(d->m_bluezFileTransfer->MoveFile(sourceFileName, targetFileName), PendingCall::ReturnVoid, this);
76 }
77 
79 {
80  return new PendingCall(d->m_bluezFileTransfer->Delete(fileName), PendingCall::ReturnVoid, this);
81 }
82 
83 } // namespace BluezQt
PendingCall * moveFile(const QString &sourceFileName, const QString &targetFileName)
Moves a file within the remote device.
PendingCall * putFile(const QString &sourceFileName, const QString &targetFileName)
Puts the file to the remote device.
PendingCall * getFile(const QString &targetFileName, const QString &sourceFileName)
Gets the file from the remote device.
PendingCall * copyFile(const QString &sourceFileName, const QString &targetFileName)
Copies a file within the remote device.
PendingCall * listFolder()
Lists a current folder.
PendingCall * changeFolder(const QString &folder)
Changes the current folder.
QString path() const const
PendingCall * deleteFile(const QString &fileName)
Deletes a file/folder within the remote device.
ObexFileTransfer(const QDBusObjectPath &path, QObject *parent=nullptr)
Creates a new ObexFileTransfer object.
~ObexFileTransfer() override
Destroys an ObexFileTransfer object.
QDBusObjectPath objectPath() const
D-Bus object path of the file transfer session.
PendingCall * createFolder(const QString &folder)
Creates a new folder.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Sep 25 2022 04:19:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.