File indexing completed on 2024-12-01 12:29:50
0001 /* 0002 * BluezQt - Asynchronous Bluez wrapper library 0003 * 0004 * SPDX-FileCopyrightText: 2014 David Rosca <nowrep@gmail.com> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #include "obexfiletransfer.h" 0010 #include "pendingcall.h" 0011 #include "utils.h" 0012 0013 #include "obexfiletransfer1.h" 0014 0015 namespace BluezQt 0016 { 0017 typedef org::bluez::obex::FileTransfer1 BluezFileTransfer; 0018 0019 class ObexFileTransferPrivate 0020 { 0021 public: 0022 ObexFileTransfer *q; 0023 BluezFileTransfer *m_bluezFileTransfer; 0024 }; 0025 0026 ObexFileTransfer::ObexFileTransfer(const QDBusObjectPath &path, QObject *parent) 0027 : QObject(parent) 0028 , d(new ObexFileTransferPrivate) 0029 { 0030 d->m_bluezFileTransfer = new BluezFileTransfer(Strings::orgBluezObex(), path.path(), DBusConnection::orgBluezObex(), this); 0031 } 0032 0033 ObexFileTransfer::~ObexFileTransfer() 0034 { 0035 delete d; 0036 } 0037 0038 QDBusObjectPath ObexFileTransfer::objectPath() const 0039 { 0040 return QDBusObjectPath(d->m_bluezFileTransfer->path()); 0041 } 0042 0043 PendingCall *ObexFileTransfer::changeFolder(const QString &folder) 0044 { 0045 return new PendingCall(d->m_bluezFileTransfer->ChangeFolder(folder), PendingCall::ReturnVoid, this); 0046 } 0047 0048 PendingCall *ObexFileTransfer::createFolder(const QString &folder) 0049 { 0050 return new PendingCall(d->m_bluezFileTransfer->CreateFolder(folder), PendingCall::ReturnVoid, this); 0051 } 0052 0053 PendingCall *ObexFileTransfer::listFolder() 0054 { 0055 return new PendingCall(d->m_bluezFileTransfer->ListFolder(), PendingCall::ReturnFileTransferList, this); 0056 } 0057 0058 PendingCall *ObexFileTransfer::getFile(const QString &targetFileName, const QString &sourceFileName) 0059 { 0060 return new PendingCall(d->m_bluezFileTransfer->GetFile(targetFileName, sourceFileName), PendingCall::ReturnTransferWithProperties, this); 0061 } 0062 0063 PendingCall *ObexFileTransfer::putFile(const QString &sourceFileName, const QString &targetFileName) 0064 { 0065 return new PendingCall(d->m_bluezFileTransfer->PutFile(sourceFileName, targetFileName), PendingCall::ReturnTransferWithProperties, this); 0066 } 0067 0068 PendingCall *ObexFileTransfer::copyFile(const QString &sourceFileName, const QString &targetFileName) 0069 { 0070 return new PendingCall(d->m_bluezFileTransfer->CopyFile(sourceFileName, targetFileName), PendingCall::ReturnVoid, this); 0071 } 0072 0073 PendingCall *ObexFileTransfer::moveFile(const QString &sourceFileName, const QString &targetFileName) 0074 { 0075 return new PendingCall(d->m_bluezFileTransfer->MoveFile(sourceFileName, targetFileName), PendingCall::ReturnVoid, this); 0076 } 0077 0078 PendingCall *ObexFileTransfer::deleteFile(const QString &fileName) 0079 { 0080 return new PendingCall(d->m_bluezFileTransfer->Delete(fileName), PendingCall::ReturnVoid, this); 0081 } 0082 0083 } // namespace BluezQt 0084 0085 #include "moc_obexfiletransfer.cpp"