fixed bug deleting folders

This commit is contained in:
Luis Ángel San Martín 2014-10-23 13:28:38 +02:00
parent 1def3ee438
commit bba514b727
2 changed files with 30 additions and 22 deletions

View File

@ -28,8 +28,8 @@ LIBS += -lpoppler-qt4
INCLUDEPATH += ../dependencies/poppler/include/qt4
}
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
QMAKE_LFLAGS_RELEASE += /LTCG
#QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
#QMAKE_LFLAGS_RELEASE += /LTCG
CONFIG -= embed_manifest_exe
}

View File

@ -1493,12 +1493,19 @@ void LibraryWindow::addFolderToCurrentIndex()
void LibraryWindow::deleteSelectedFolder()
{
QModelIndex currentIndex = getCurrentFolderIndex();
QString relativePath = foldersModel->getFolderPath(currentIndex);
QString folderPath = QDir::cleanPath(currentPath()+relativePath);
if(!currentIndex.isValid())
QMessageBox::information(this,tr("No folder selected"), tr("Please, select a folder first"));
else
{
int ret = QMessageBox::question(this,tr("Delete folder"),tr("The selected folder and all its contents will be deleted from your disk. Are you sure?"),QMessageBox::Yes,QMessageBox::No);
QString libraryPath = QDir::cleanPath(currentPath());
if((libraryPath == folderPath) || relativePath.isEmpty() || relativePath == "/")
QMessageBox::critical(this,tr("Error in path"),tr("There was an error accessing the folder's path"));
else
{
int ret = QMessageBox::question(this,tr("Delete folder"),tr("The selected folder and all its contents will be deleted from your disk. Are you sure?") + "\n\nFolder : " + folderPath,QMessageBox::Yes,QMessageBox::No);
if(ret == QMessageBox::Yes)
{
@ -1507,7 +1514,7 @@ void LibraryWindow::deleteSelectedFolder()
indexList << currentIndex;
QList<QString> paths;
paths << QDir::cleanPath(currentPath()+foldersModel->getFolderPath(currentIndex));
paths << folderPath;
FoldersRemover * remover = new FoldersRemover(indexList,paths);
@ -1528,6 +1535,7 @@ void LibraryWindow::deleteSelectedFolder()
thread->start();
}
}
}
}
void LibraryWindow::errorDeletingFolder()