summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-10-15 16:37:21 (GMT)
committerMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-10-15 16:37:21 (GMT)
commit1bce6d37e5c0e63404fc77d54b4cd82f23b18956 (patch)
tree95d2195020ff48725b45cc73bcdd2e2921f9d50f
parent92a44490bd3d2b6ff892a4df1729022017e41c02 (diff)
More porting away from kde_file.h
-rw-r--r--lib/thumbnailprovider/thumbnailprovider.cpp20
-rw-r--r--lib/thumbnailprovider/thumbnailwriter.cpp5
2 files changed, 9 insertions, 16 deletions
diff --git a/lib/thumbnailprovider/thumbnailprovider.cpp b/lib/thumbnailprovider/thumbnailprovider.cpp
index d44e0f9..c12fafc 100644
--- a/lib/thumbnailprovider/thumbnailprovider.cpp
+++ b/lib/thumbnailprovider/thumbnailprovider.cpp
@@ -39,7 +39,6 @@
#include <QStandardPaths>
// KDE
-#include <kde_file.h>
#include <KIO/JobUiDelegate>
#include <KIO/PreviewJob>
#include <KStandardDirs>
@@ -161,8 +160,10 @@ ThumbnailProvider::ThumbnailProvider()
// Make sure we have a place to store our thumbnails
QString thumbnailDirNormal = ThumbnailProvider::thumbnailBaseDir(ThumbnailGroup::Normal);
QString thumbnailDirLarge = ThumbnailProvider::thumbnailBaseDir(ThumbnailGroup::Large);
- KStandardDirs::makeDir(thumbnailDirNormal, 0700);
- KStandardDirs::makeDir(thumbnailDirLarge, 0700);
+ QDir().mkpath(thumbnailDirNormal);
+ QDir().mkpath(thumbnailDirLarge);
+ QFile::setPermissions(thumbnailDirNormal, QFileDevice::WriteOwner | QFileDevice::ReadOwner | QFileDevice::ExeOwner);
+ QFile::setPermissions(thumbnailDirLarge, QFileDevice::WriteOwner | QFileDevice::ReadOwner | QFileDevice::ExeOwner);
// Look for images and store the items in our todo list
mCurrentItem = KFileItem();
@@ -310,16 +311,11 @@ void ThumbnailProvider::determineNextIcon()
mOriginalFileSize = mCurrentItem.size();
// Do direct stat instead of using KIO if the file is local (faster)
- bool directStatOk = false;
if (UrlUtils::urlIsFastLocalFile(mCurrentUrl)) {
- KDE_struct_stat buff;
- if (KDE::stat(mCurrentUrl.toLocalFile(), &buff) == 0) {
- directStatOk = true;
- mOriginalTime = buff.st_mtime;
- QMetaObject::invokeMethod(this, "checkThumbnail", Qt::QueuedConnection);
- }
- }
- if (!directStatOk) {
+ QFileInfo fileInfo(mCurrentUrl.toLocalFile());
+ mOriginalTime = fileInfo.lastModified().toTime_t();
+ QMetaObject::invokeMethod(this, "checkThumbnail", Qt::QueuedConnection);
+ } else {
KIO::Job* job = KIO::stat(mCurrentUrl, KIO::HideProgressInfo);
KJobWidgets::setWindow(job, qApp->activeWindow());
LOG("KIO::stat orig" << mCurrentUrl.url());
diff --git a/lib/thumbnailprovider/thumbnailwriter.cpp b/lib/thumbnailprovider/thumbnailwriter.cpp
index 32a1378..044d68f 100644
--- a/lib/thumbnailprovider/thumbnailwriter.cpp
+++ b/lib/thumbnailprovider/thumbnailwriter.cpp
@@ -23,9 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
// Local
-// KDE
-#include <kde_file.h>
-
// Qt
#include <QImage>
#include <QDebug>
@@ -57,7 +54,7 @@ static void storeThumbnailToDiskCache(const QString& path, const QImage& image)
return;
}
- KDE_rename(QFile::encodeName(tmp.fileName()), QFile::encodeName(path));
+ QFile::rename(tmp.fileName(), path);
}
void ThumbnailWriter::queueThumbnail(const QString& path, const QImage& image)