Changeset View
Changeset View
Standalone View
Standalone View
src/kded/receivefilejob.cpp
Show All 38 Lines | |||||
39 | 39 | | |||
40 | ReceiveFileJob::ReceiveFileJob(const BluezQt::Request<QString> &req, BluezQt::ObexTransferPtr transfer, BluezQt::ObexSessionPtr session, ObexAgent *parent) | 40 | ReceiveFileJob::ReceiveFileJob(const BluezQt::Request<QString> &req, BluezQt::ObexTransferPtr transfer, BluezQt::ObexSessionPtr session, ObexAgent *parent) | ||
41 | : KJob(parent) | 41 | : KJob(parent) | ||
42 | , m_speedBytes(0) | 42 | , m_speedBytes(0) | ||
43 | , m_agent(parent) | 43 | , m_agent(parent) | ||
44 | , m_transfer(transfer) | 44 | , m_transfer(transfer) | ||
45 | , m_session(session) | 45 | , m_session(session) | ||
46 | , m_request(req) | 46 | , m_request(req) | ||
47 | , m_accepted(false) | ||||
47 | { | 48 | { | ||
48 | setCapabilities(Killable); | 49 | setCapabilities(Killable); | ||
49 | } | 50 | } | ||
50 | 51 | | |||
51 | QString ReceiveFileJob::deviceAddress() const | 52 | QString ReceiveFileJob::deviceAddress() const | ||
52 | { | 53 | { | ||
53 | return m_deviceAddress; | 54 | return m_deviceAddress; | ||
54 | } | 55 | } | ||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Line(s) | 161 | { | |||
168 | 169 | | |||
169 | FileReceiverSettings::self()->load(); | 170 | FileReceiverSettings::self()->load(); | ||
170 | m_targetPath = FileReceiverSettings::self()->saveUrl().adjusted(QUrl::StripTrailingSlash); | 171 | m_targetPath = FileReceiverSettings::self()->saveUrl().adjusted(QUrl::StripTrailingSlash); | ||
171 | m_targetPath.setPath(m_targetPath.path() + QLatin1Char('/') + m_transfer->name()); | 172 | m_targetPath.setPath(m_targetPath.path() + QLatin1Char('/') + m_transfer->name()); | ||
172 | 173 | | |||
173 | m_tempPath = createTempPath(m_transfer->name()); | 174 | m_tempPath = createTempPath(m_transfer->name()); | ||
174 | qCDebug(BLUEDAEMON) << "TempPath" << m_tempPath; | 175 | qCDebug(BLUEDAEMON) << "TempPath" << m_tempPath; | ||
175 | 176 | | |||
177 | m_accepted = true; | ||||
176 | m_request.accept(m_tempPath); | 178 | m_request.accept(m_tempPath); | ||
177 | } | 179 | } | ||
178 | 180 | | |||
179 | void ReceiveFileJob::slotCancel() | 181 | void ReceiveFileJob::slotCancel() | ||
180 | { | 182 | { | ||
181 | if (m_transfer->status() == BluezQt::ObexTransfer::Queued) { | 183 | if (!m_accepted && m_transfer->status() == BluezQt::ObexTransfer::Queued) { | ||
182 | qCDebug(BLUEDAEMON) << "Cancel Push"; | 184 | qCDebug(BLUEDAEMON) << "Cancel Push"; | ||
183 | m_request.reject(); | 185 | m_request.reject(); | ||
184 | setError(KJob::UserDefinedError); | 186 | setError(KJob::UserDefinedError); | ||
185 | emitResult(); | 187 | emitResult(); | ||
186 | } | 188 | } | ||
187 | } | 189 | } | ||
188 | 190 | | |||
189 | void ReceiveFileJob::moveFinished(KJob *job) | 191 | void ReceiveFileJob::moveFinished(KJob *job) | ||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |