diff --git a/src/libtomahawk/infosystem/InfoSystemCache.cpp b/src/libtomahawk/infosystem/InfoSystemCache.cpp index 3bcbf3984..106b84946 100644 --- a/src/libtomahawk/infosystem/InfoSystemCache.cpp +++ b/src/libtomahawk/infosystem/InfoSystemCache.cpp @@ -25,10 +25,6 @@ #include "utils/Logger.h" #include "Source.h" -#if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 ) - #include "utils/TomahawkCache.h" -#endif - #include #include #include @@ -49,7 +45,7 @@ InfoSystemCache::InfoSystemCache( QObject* parent ) if ( TomahawkSettings::instance()->infoSystemCacheVersion() < INFOSYSTEM_CACHE_VERSION ) { #if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 ) - TomahawkUtils::Cache::instance()->removeDirectoryRecursively( m_cacheBaseDir ); + TomahawkUtils::removeDirectory( m_cacheBaseDir ); #else QDir(m_cacheBaseDir)::removeRecursively(); #endif diff --git a/src/libtomahawk/utils/TomahawkCache.cpp b/src/libtomahawk/utils/TomahawkCache.cpp index fa404f156..b35f9df33 100644 --- a/src/libtomahawk/utils/TomahawkCache.cpp +++ b/src/libtomahawk/utils/TomahawkCache.cpp @@ -48,7 +48,7 @@ Cache::Cache() if ( TomahawkSettings::instance()->genericCacheVersion() < CACHE_VERSION ) { #if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 ) - removeDirectoryRecursively( m_cacheBaseDir ); + TomahawkUtils::removeDirectory( m_cacheBaseDir ); #else QDir( m_cacheBaseDir )::removeRecursively(); #endif @@ -126,33 +126,6 @@ Cache::getData( const QString& identifier, const QString& key ) } -#if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 ) -bool -Cache::removeDirectoryRecursively(const QString& dirName) -{ - bool result = true; - - QDir dir(dirName); - if (dir.exists(dirName)) { - foreach( QFileInfo info, dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst) ) { - if (info.isDir()) { - result = removeDirectoryRecursively(info.absoluteFilePath()); - } - else { - result = QFile::remove(info.absoluteFilePath()); - } - - if (!result) { - return result; - } - } - result = dir.rmdir(dirName); - } - return result; -} -#endif - - void Cache::putData( const QString& identifier, qint64 maxAge, const QString& key, const QVariant& value ) { diff --git a/src/libtomahawk/utils/TomahawkCache.h b/src/libtomahawk/utils/TomahawkCache.h index ccb56759d..682318aed 100644 --- a/src/libtomahawk/utils/TomahawkCache.h +++ b/src/libtomahawk/utils/TomahawkCache.h @@ -81,15 +81,6 @@ public: * @return the data, if found, if not found an invalid QVariant is returned. */ QVariant getData( const QString& identifier, const QString& key ); -#if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 ) - /** - * Recursively deletes all files & directories in a folder - * Only needed in Qt4 - * @param dirName the directory which should be deleted - * @return if the removal was successfull or not - */ - bool removeDirectoryRecursively( const QString& dirName ); -#endif private slots: void pruneTimerFired();