Changeset View
Changeset View
Standalone View
Standalone View
plugins/share/shareplugin.cpp
Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Line(s) | 159 | if(url.isLocalFile()) { | |||
---|---|---|---|---|---|
161 | packet.setPayload(ioFile, ioFile->size()); | 161 | packet.setPayload(ioFile, ioFile->size()); | ||
162 | packet.set<QString>(QStringLiteral("filename"), QUrl(url).fileName()); | 162 | packet.set<QString>(QStringLiteral("filename"), QUrl(url).fileName()); | ||
163 | } else { | 163 | } else { | ||
164 | packet.set<QString>(QStringLiteral("url"), url.toString()); | 164 | packet.set<QString>(QStringLiteral("url"), url.toString()); | ||
165 | } | 165 | } | ||
166 | sendPacket(packet); | 166 | sendPacket(packet); | ||
167 | } | 167 | } | ||
168 | 168 | | |||
169 | void SharePlugin::openFile(const QUrl& url) | ||||
170 | { | ||||
171 | NetworkPacket packet(PACKET_TYPE_SHARE_REQUEST); | ||||
172 | if(url.isLocalFile()) { | ||||
173 | QSharedPointer<QIODevice> ioFile(new QFile(url.toLocalFile())); | ||||
174 | packet.setPayload(ioFile, ioFile->size()); | ||||
175 | packet.set<QString>(QStringLiteral("filename"), QUrl(url).fileName()); | ||||
176 | packet.set<bool>(QStringLiteral("open"), true); | ||||
177 | } | ||||
178 | sendPacket(packet); | ||||
179 | } | ||||
180 | | ||||
181 | | ||||
169 | QString SharePlugin::dbusPath() const | 182 | QString SharePlugin::dbusPath() const | ||
170 | { | 183 | { | ||
171 | return "/modules/kdeconnect/devices/" + device()->id() + "/share"; | 184 | return "/modules/kdeconnect/devices/" + device()->id() + "/share"; | ||
172 | } | 185 | } | ||
173 | 186 | | |||
174 | #include "shareplugin.moc" | 187 | #include "shareplugin.moc" |