Changeset View
Changeset View
Standalone View
Standalone View
mtp/kio_mtp.cpp
Show First 20 Lines • Show All 293 Lines • ▼ Show 20 Line(s) | 292 | } else { | |||
---|---|---|---|---|---|
294 | if (storage) { | 294 | if (storage) { | ||
295 | 295 | | |||
296 | // storage | 296 | // storage | ||
297 | if (pathItems.size() < 3) { | 297 | if (pathItems.size() < 3) { | ||
298 | entry = getEntry(storage); | 298 | entry = getEntry(storage); | ||
299 | } | 299 | } | ||
300 | // folder/file | 300 | // folder/file | ||
301 | else { | 301 | else { | ||
302 | entry = getEntry(storage->getFileMetadata(convertPath(url.path()))); | 302 | const KMTPFile file = storage->getFileMetadata(convertPath(url.path())); | ||
303 | if (file.isValid()) { | ||||
304 | entry = getEntry(file); | ||||
305 | } else { | ||||
306 | error(ERR_DOES_NOT_EXIST, url.path()); | ||||
307 | return; | ||||
308 | } | ||||
303 | } | 309 | } | ||
304 | } else { | 310 | } else { | ||
305 | error(ERR_DOES_NOT_EXIST, url.path()); | 311 | error(ERR_DOES_NOT_EXIST, url.path()); | ||
306 | return; | 312 | return; | ||
307 | } | 313 | } | ||
308 | } | 314 | } | ||
309 | } else { | 315 | } else { | ||
310 | error(ERR_DOES_NOT_EXIST, url.path()); | 316 | error(ERR_DOES_NOT_EXIST, url.path()); | ||
Show All 24 Lines | 326 | { | |||
335 | 341 | | |||
336 | const QStringList pathItems = url.path().split(QLatin1Char('/'), QString::SkipEmptyParts); | 342 | const QStringList pathItems = url.path().split(QLatin1Char('/'), QString::SkipEmptyParts); | ||
337 | if (pathItems.size() > 2) { | 343 | if (pathItems.size() > 2) { | ||
338 | const KMTPDeviceInterface *mtpDevice = m_kmtpDaemon.deviceFromName(pathItems.first()); | 344 | const KMTPDeviceInterface *mtpDevice = m_kmtpDaemon.deviceFromName(pathItems.first()); | ||
339 | if (mtpDevice) { | 345 | if (mtpDevice) { | ||
340 | const KMTPStorageInterface *storage = mtpDevice->storageFromDescription(pathItems.at(1)); | 346 | const KMTPStorageInterface *storage = mtpDevice->storageFromDescription(pathItems.at(1)); | ||
341 | if (storage) { | 347 | if (storage) { | ||
342 | const KMTPFile file = storage->getFileMetadata(convertPath(url.path())); | 348 | const KMTPFile file = storage->getFileMetadata(convertPath(url.path())); | ||
349 | if (file.isValid()) { | ||||
343 | // NOTE the difference between calling mimetype and mimeType | 350 | // NOTE the difference between calling mimetype and mimeType | ||
344 | mimeType(file.filetype()); | 351 | mimeType(file.filetype()); | ||
345 | return; | 352 | return; | ||
346 | } | 353 | } | ||
347 | } | 354 | } | ||
355 | } | ||||
348 | } else { | 356 | } else { | ||
349 | mimeType(QStringLiteral("inode/directory")); | 357 | mimeType(QStringLiteral("inode/directory")); | ||
350 | return; | 358 | return; | ||
351 | } | 359 | } | ||
352 | 360 | | |||
353 | error(ERR_DOES_NOT_EXIST, url.path()); | 361 | error(ERR_DOES_NOT_EXIST, url.path()); | ||
354 | } | 362 | } | ||
355 | 363 | | |||
▲ Show 20 Lines • Show All 511 Lines • Show Last 20 Lines |