Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/previewjob.cpp
Show First 20 Lines • Show All 409 Lines • ▼ Show 20 Line(s) | |||||
410 | void PreviewJob::setIgnoreMaximumSize(bool ignoreSize) | 410 | void PreviewJob::setIgnoreMaximumSize(bool ignoreSize) | ||
411 | { | 411 | { | ||
412 | d_func()->ignoreMaximumSize = ignoreSize; | 412 | d_func()->ignoreMaximumSize = ignoreSize; | ||
413 | } | 413 | } | ||
414 | 414 | | |||
415 | void PreviewJobPrivate::cleanupTempFile() | 415 | void PreviewJobPrivate::cleanupTempFile() | ||
416 | { | 416 | { | ||
417 | if (!tempName.isEmpty()) { | 417 | if (!tempName.isEmpty()) { | ||
418 | Q_ASSERT(!QFileInfo(tempName).isDir()); | | |||
419 | Q_ASSERT(QFileInfo(tempName).isFile()); | | |||
420 | QFile::remove(tempName); | 418 | QFile::remove(tempName); | ||
421 | tempName.clear(); | 419 | tempName.clear(); | ||
422 | } | 420 | } | ||
423 | } | 421 | } | ||
424 | 422 | | |||
425 | void PreviewJobPrivate::determineNextFile() | 423 | void PreviewJobPrivate::determineNextFile() | ||
426 | { | 424 | { | ||
427 | Q_Q(PreviewJob); | 425 | Q_Q(PreviewJob); | ||
▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Line(s) | 602 | if (item.isDir()) { | |||
605 | // Skip remote dirs (bug 208625) | 603 | // Skip remote dirs (bug 208625) | ||
606 | cleanupTempFile(); | 604 | cleanupTempFile(); | ||
607 | determineNextFile(); | 605 | determineNextFile(); | ||
608 | return; | 606 | return; | ||
609 | } | 607 | } | ||
610 | // No plugin support access to this remote content, copy the file | 608 | // No plugin support access to this remote content, copy the file | ||
611 | // to the local machine, then create the thumbnail | 609 | // to the local machine, then create the thumbnail | ||
612 | state = PreviewJobPrivate::STATE_GETORIG; | 610 | state = PreviewJobPrivate::STATE_GETORIG; | ||
613 | QTemporaryFile localFile; | 611 | QTemporaryFile localFile(QStringLiteral("thumbnailXXXXXX")); | ||
614 | localFile.setAutoRemove(false); | 612 | localFile.setAutoRemove(false); | ||
615 | localFile.open(); | 613 | localFile.open(); | ||
616 | tempName = localFile.fileName(); | 614 | tempName = localFile.fileName(); | ||
617 | const QUrl currentURL = item.mostLocalUrl(); | 615 | const QUrl currentURL = item.mostLocalUrl(); | ||
618 | KIO::Job *job = KIO::file_copy(currentURL, QUrl::fromLocalFile(tempName), -1, KIO::Overwrite | KIO::HideProgressInfo /* No GUI */); | 616 | KIO::Job *job = KIO::file_copy(currentURL, QUrl::fromLocalFile(tempName), -1, KIO::Overwrite | KIO::HideProgressInfo /* No GUI */); | ||
619 | job->addMetaData(QStringLiteral("thumbnail"), QStringLiteral("1")); | 617 | job->addMetaData(QStringLiteral("thumbnail"), QStringLiteral("1")); | ||
620 | q->addSubjob(job); | 618 | q->addSubjob(job); | ||
621 | } | 619 | } | ||
▲ Show 20 Lines • Show All 178 Lines • Show Last 20 Lines |