From 463aae7b8a7bea497aa2a325d0e41e8e22e9bf88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 22 Oct 2014 21:34:57 +0200 Subject: [PATCH] delTree has been replaced by QDir::removeRecursively() (Qt5) (Qt4 support has been dropped) --- YACReaderLibrary/library_creator.cpp | 3 ++- YACReaderLibrary/library_window.cpp | 7 +++---- common/custom_widgets.cpp | 23 ----------------------- common/custom_widgets.h | 6 ------ 4 files changed, 5 insertions(+), 34 deletions(-) diff --git a/YACReaderLibrary/library_creator.cpp b/YACReaderLibrary/library_creator.cpp index 4234e7cd..be0de1e9 100644 --- a/YACReaderLibrary/library_creator.cpp +++ b/YACReaderLibrary/library_creator.cpp @@ -99,7 +99,8 @@ void LibraryCreator::processLibrary(const QString & source, const QString & targ if(DataBaseManagement::checkValidDB(target+"/library.ydb")=="") { //se limpia el directorio ./yacreaderlibrary - delTree(target); + QDir d(target); + d.removeRecursively(); _mode = CREATOR; } else // diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 676dfe7f..b694087d 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -1221,8 +1221,8 @@ void LibraryWindow::loadLibrary(const QString & name) if(QMessageBox::question(this,tr("Old library"),tr("Library '%1' has been created with an older version of YACReaderLibrary. It must be created again. Do you want to create the library now?").arg(currentLibrary),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) { QDir d(path+"/.yacreaderlibrary"); - delTree(d); - d.rmdir(path+"/.yacreaderlibrary"); + d.removeRecursively(); + //d.rmdir(path+"/.yacreaderlibrary"); createLibraryDialog->setDataAndStart(currentLibrary,path); //create(path,path+"/.yacreaderlibrary",currentLibrary); } @@ -1741,8 +1741,7 @@ void LibraryWindow::deleteCurrentLibrary() path = path+"/.yacreaderlibrary"; QDir d(path); - delTree(d); - d.rmdir(path); + d.removeRecursively(); if(libraries.isEmpty())//no more libraries available. { comicsView->setModel(NULL); diff --git a/common/custom_widgets.cpp b/common/custom_widgets.cpp index b5b96cfb..5695e144 100644 --- a/common/custom_widgets.cpp +++ b/common/custom_widgets.cpp @@ -1,24 +1 @@ #include "custom_widgets.h" - -#include -#include - -void delTree(QDir dir) -{ - dir.setFilter(QDir::AllDirs|QDir::Files|QDir::Hidden|QDir::NoDotAndDotDot); - QFileInfoList list = dir.entryInfoList(); - for (int i = 0; i < list.size(); ++i) - { - QFileInfo fileInfo = list.at(i); - QString path = fileInfo.filePath(); - if(fileInfo.isDir()) - { - delTree(QDir(fileInfo.absoluteFilePath())); - dir.rmdir(fileInfo.absoluteFilePath()); - } - else - { - dir.remove(fileInfo.absoluteFilePath()); - } - } -} diff --git a/common/custom_widgets.h b/common/custom_widgets.h index 3ca6d5f3..15430ce7 100644 --- a/common/custom_widgets.h +++ b/common/custom_widgets.h @@ -1,12 +1,6 @@ #ifndef __CUSTOM_WIDGETS_H #define __CUSTOM_WIDGETS_H -class QDir; - -void delTree(QDir dir); - - - #endif