File indexing completed on 2024-09-15 04:48:49
0001 /* 0002 * SPDX-FileCopyrightText: 2013 Alejandro Fiestas Fiestas <afiestas@kde.org> 0003 * SPDX-FileCopyrightText: 2014-2015 David Rosca <nowrep@gmail.com> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include <QTime> 0011 #include <QUrl> 0012 0013 #include <KJob> 0014 0015 #include <BluezQt/ObexTransfer> 0016 #include <BluezQt/Request> 0017 0018 class ObexAgent; 0019 0020 class ReceiveFileJob : public KJob 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 explicit ReceiveFileJob(const BluezQt::Request<QString> &req, BluezQt::ObexTransferPtr transfer, BluezQt::ObexSessionPtr session, ObexAgent *parent); 0026 0027 QString deviceAddress() const; 0028 0029 void start() override; 0030 bool doKill() override; 0031 0032 private Q_SLOTS: 0033 void init(); 0034 void showNotification(); 0035 void slotCancel(); 0036 void slotAccept(); 0037 void moveFinished(KJob *job); 0038 0039 void statusChanged(BluezQt::ObexTransfer::Status status); 0040 void transferredChanged(quint64 transferred); 0041 0042 private: 0043 QString createTempPath(const QString &fileName) const; 0044 0045 QTime m_time; 0046 qulonglong m_speedBytes; 0047 QString m_tempPath; 0048 QString m_deviceName; 0049 QString m_deviceAddress; 0050 QUrl m_targetPath; 0051 0052 ObexAgent *m_agent; 0053 BluezQt::ObexTransferPtr m_transfer; 0054 BluezQt::ObexSessionPtr m_session; 0055 BluezQt::Request<QString> m_request; 0056 bool m_accepted = false; 0057 };