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 | |
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 | |
26 | ObexFileTransfer::ObexFileTransfer(const QDBusObjectPath &path, QObject *parent) |
27 | : QObject(parent) |
28 | , d(new ObexFileTransferPrivate) |
29 | { |
30 | d->m_bluezFileTransfer = new BluezFileTransfer(Strings::orgBluezObex(), path.path(), DBusConnection::orgBluezObex(), this); |
31 | } |
32 | |
33 | ObexFileTransfer::~ObexFileTransfer() = default; |
34 | |
35 | QDBusObjectPath ObexFileTransfer::objectPath() const |
36 | { |
37 | return QDBusObjectPath(d->m_bluezFileTransfer->path()); |
38 | } |
39 | |
40 | PendingCall *ObexFileTransfer::changeFolder(const QString &folder) |
41 | { |
42 | return new PendingCall(d->m_bluezFileTransfer->ChangeFolder(folder), PendingCall::ReturnVoid, this); |
43 | } |
44 | |
45 | PendingCall *ObexFileTransfer::createFolder(const QString &folder) |
46 | { |
47 | return new PendingCall(d->m_bluezFileTransfer->CreateFolder(folder), PendingCall::ReturnVoid, this); |
48 | } |
49 | |
50 | PendingCall *ObexFileTransfer::listFolder() |
51 | { |
52 | return new PendingCall(d->m_bluezFileTransfer->ListFolder(), PendingCall::ReturnFileTransferList, this); |
53 | } |
54 | |
55 | PendingCall *ObexFileTransfer::getFile(const QString &targetFileName, const QString &sourceFileName) |
56 | { |
57 | return new PendingCall(d->m_bluezFileTransfer->GetFile(targetfile: targetFileName, sourcefile: sourceFileName), PendingCall::ReturnTransferWithProperties, this); |
58 | } |
59 | |
60 | PendingCall *ObexFileTransfer::putFile(const QString &sourceFileName, const QString &targetFileName) |
61 | { |
62 | return new PendingCall(d->m_bluezFileTransfer->PutFile(sourcefile: sourceFileName, targetfile: targetFileName), PendingCall::ReturnTransferWithProperties, this); |
63 | } |
64 | |
65 | PendingCall *ObexFileTransfer::copyFile(const QString &sourceFileName, const QString &targetFileName) |
66 | { |
67 | return new PendingCall(d->m_bluezFileTransfer->CopyFile(sourcefile: sourceFileName, targetfile: targetFileName), PendingCall::ReturnVoid, this); |
68 | } |
69 | |
70 | PendingCall *ObexFileTransfer::moveFile(const QString &sourceFileName, const QString &targetFileName) |
71 | { |
72 | return new PendingCall(d->m_bluezFileTransfer->MoveFile(sourcefile: sourceFileName, targetfile: targetFileName), PendingCall::ReturnVoid, this); |
73 | } |
74 | |
75 | PendingCall *ObexFileTransfer::deleteFile(const QString &fileName) |
76 | { |
77 | return new PendingCall(d->m_bluezFileTransfer->Delete(file: fileName), PendingCall::ReturnVoid, this); |
78 | } |
79 | |
80 | } // namespace BluezQt |
81 | |
82 | #include "moc_obexfiletransfer.cpp" |
83 | |