diff --git a/src/libtomahawk/AtticaManager.cpp b/src/libtomahawk/AtticaManager.cpp index 27275532c..55b5e11b3 100644 --- a/src/libtomahawk/AtticaManager.cpp +++ b/src/libtomahawk/AtticaManager.cpp @@ -550,30 +550,5 @@ AtticaManager::doResolverRemove( const QString& id ) const !resolverDir.absolutePath().contains( id ) ) return; - removeDirectory( resolverDir.absolutePath() ); -} - - -// taken from util/fileutils.cpp in kdevplatform -bool -AtticaManager::removeDirectory( const QString& dir ) -{ - const QDir aDir(dir); - - tLog() << "Deleting DIR:" << dir; - bool has_err = false; - if (aDir.exists()) { - foreach(const QFileInfo& entry, aDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::NoSymLinks)) { - QString path = entry.absoluteFilePath(); - if (entry.isDir()) { - has_err = !removeDirectory(path) || has_err; - } else if (!QFile::remove(path)) { - has_err = true; - } - } - if (!aDir.rmdir(aDir.absolutePath())) { - has_err = true; - } - } - return !has_err; + TomahawkUtils::removeDirectory( resolverDir.absolutePath() ); } diff --git a/src/libtomahawk/AtticaManager.h b/src/libtomahawk/AtticaManager.h index ac0299af9..cb7179853 100644 --- a/src/libtomahawk/AtticaManager.h +++ b/src/libtomahawk/AtticaManager.h @@ -75,7 +75,6 @@ public: virtual ~AtticaManager() {} #endif - static bool removeDirectory( const QString& dir ); #ifdef LIBATTICA_FOUND bool resolversLoaded() const; diff --git a/src/libtomahawk/tomahawksettings.cpp b/src/libtomahawk/tomahawksettings.cpp index 155457ba5..6719f63b2 100644 --- a/src/libtomahawk/tomahawksettings.cpp +++ b/src/libtomahawk/tomahawksettings.cpp @@ -218,7 +218,7 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion ) setAllScriptResolvers( listedResolvers ); setEnabledScriptResolvers( enabledResolvers ); tDebug() << "UPGRADING AND DELETING:" << resolverDir.absolutePath(); - AtticaManager::removeDirectory( resolverDir.absolutePath() ); + TomahawkUtils::removeDirectory( resolverDir.absolutePath() ); } } } diff --git a/src/libtomahawk/utils/tomahawkutils.cpp b/src/libtomahawk/utils/tomahawkutils.cpp index 09f47cf28..e6a2ae830 100644 --- a/src/libtomahawk/utils/tomahawkutils.cpp +++ b/src/libtomahawk/utils/tomahawkutils.cpp @@ -665,5 +665,29 @@ setHeaderHeight( int height ) s_headerHeight = height; } +// taken from util/fileutils.cpp in kdevplatform +bool +removeDirectory( const QString& dir ) +{ + const QDir aDir(dir); + + tLog() << "Deleting DIR:" << dir; + bool has_err = false; + if (aDir.exists()) { + foreach(const QFileInfo& entry, aDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::NoSymLinks)) { + QString path = entry.absoluteFilePath(); + if (entry.isDir()) { + has_err = !removeDirectory(path) || has_err; + } else if (!QFile::remove(path)) { + has_err = true; + } + } + if (!aDir.rmdir(aDir.absolutePath())) { + has_err = true; + } + } + return !has_err; +} + } // ns diff --git a/src/libtomahawk/utils/tomahawkutils.h b/src/libtomahawk/utils/tomahawkutils.h index 513a855d8..30656d01c 100644 --- a/src/libtomahawk/utils/tomahawkutils.h +++ b/src/libtomahawk/utils/tomahawkutils.h @@ -104,6 +104,8 @@ namespace TomahawkUtils DLLEXPORT int headerHeight(); DLLEXPORT void setHeaderHeight( int height ); + + DLLEXPORT bool removeDirectory( const QString& dir ); } #endif // TOMAHAWKUTILS_H