From a1f5eb08b18e60d80f410799199597ebcd285ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Mon, 30 Jul 2012 17:42:01 +0200 Subject: [PATCH] Verificaci?n de que el directorio de destino cuando se crea una libreria existe, es realmente un directorio y se puede escribir en ?l. --- YACReaderLibrary/create_library_dialog.cpp | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/YACReaderLibrary/create_library_dialog.cpp b/YACReaderLibrary/create_library_dialog.cpp index 4a608590..240ebeab 100644 --- a/YACReaderLibrary/create_library_dialog.cpp +++ b/YACReaderLibrary/create_library_dialog.cpp @@ -4,7 +4,7 @@ #include #include #include - +#include CreateLibraryDialog::CreateLibraryDialog(QWidget * parent) :QDialog(parent) @@ -93,12 +93,19 @@ void CreateLibraryDialog::setupUI() void CreateLibraryDialog::create() { - progressBar->show(); - message->show(); - currentFileLabel->setText("Importing : \n\n\n\n\n"); - this->adjustSize(); - accept->setEnabled(false); - emit(createLibrary(QDir::cleanPath(path->text()),QDir::cleanPath(path->text())+"/.yacreaderlibrary",nameEdit->text())); + + QFileInfo f(path->text()); + if(f.exists() && f.isDir() && f.isWritable()) + { + progressBar->show(); + message->show(); + currentFileLabel->setText("Importing : \n\n\n\n\n"); + this->adjustSize(); + accept->setEnabled(false); + emit(createLibrary(QDir::cleanPath(path->text()),QDir::cleanPath(path->text())+"/.yacreaderlibrary",nameEdit->text())); + } + else + QMessageBox::critical(NULL,tr("Path not found"),tr("The selected path does not exist or is not a valid path. Be sure that you have write access to this folder")); } void CreateLibraryDialog::findPath() @@ -125,7 +132,7 @@ void CreateLibraryDialog::close() nameEdit->clear(); currentFileLabel->setText(""); this->adjustSize(); - accept->setEnabled(true); + accept->setEnabled(false); QDialog::close(); }