Changeset View
Changeset View
Standalone View
Standalone View
plugins/share/shareplugin.cpp
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 70 | if (np.type() == PACKAGE_TYPE_PING) { | |||
---|---|---|---|---|---|
82 | return true; | 82 | return true; | ||
83 | 83 | | |||
84 | } | 84 | } | ||
85 | */ | 85 | */ | ||
86 | 86 | | |||
87 | qCDebug(KDECONNECT_PLUGIN_SHARE) << "File transfer"; | 87 | qCDebug(KDECONNECT_PLUGIN_SHARE) << "File transfer"; | ||
88 | 88 | | |||
89 | if (np.hasPayload()) { | 89 | if (np.hasPayload()) { | ||
90 | //qCDebug(KDECONNECT_PLUGIN_SHARE) << "receiving file"; | | |||
91 | const QString filename = np.get<QString>(QStringLiteral("filename"), QString::number(QDateTime::currentMSecsSinceEpoch())); | 90 | const QString filename = np.get<QString>(QStringLiteral("filename"), QString::number(QDateTime::currentMSecsSinceEpoch())); | ||
92 | const QUrl dir = destinationDir().adjusted(QUrl::StripTrailingSlash); | 91 | const QUrl dir = destinationDir().adjusted(QUrl::StripTrailingSlash); | ||
93 | QUrl destination(dir.toString() + '/' + filename); | 92 | QUrl destination(dir); | ||
93 | destination.setPath(dir.path() + '/' + filename, QUrl::DecodedMode); | ||||
94 | if (destination.isLocalFile() && QFile::exists(destination.toLocalFile())) { | 94 | if (destination.isLocalFile() && QFile::exists(destination.toLocalFile())) { | ||
95 | destination = QUrl(dir.toString() + '/' + KIO::suggestName(dir, filename)); | 95 | destination.setPath(dir.path() + '/' + KIO::suggestName(dir, filename), QUrl::DecodedMode); | ||
96 | } | 96 | } | ||
97 | // qCDebug(KDECONNECT_PLUGIN_SHARE) << "receiving file" << filename << "in" << dir << "into" << destination; | ||||
97 | 98 | | |||
98 | FileTransferJob* job = np.createPayloadTransferJob(destination); | 99 | FileTransferJob* job = np.createPayloadTransferJob(destination); | ||
99 | job->setOriginName(device()->name() + ": " + filename); | 100 | job->setOriginName(device()->name() + ": " + filename); | ||
100 | connect(job, &KJob::result, this, &SharePlugin::finished); | 101 | connect(job, &KJob::result, this, &SharePlugin::finished); | ||
101 | KIO::getJobTracker()->registerJob(job); | 102 | KIO::getJobTracker()->registerJob(job); | ||
102 | job->start(); | 103 | job->start(); | ||
103 | } else if (np.has(QStringLiteral("text"))) { | 104 | } else if (np.has(QStringLiteral("text"))) { | ||
104 | QString text = np.get<QString>(QStringLiteral("text")); | 105 | QString text = np.get<QString>(QStringLiteral("text")); | ||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |