corregido bug al intentar abrir un c?mic en un path no existente

- ahora se muestra un error al usuario.
        - y se restaura el estado inicial.
This commit is contained in:
Luis Ángel San Martín
2012-07-29 17:03:58 +02:00
parent 7df6e4d7f7
commit 86914fd634
5 changed files with 40 additions and 17 deletions

View File

@ -31,22 +31,33 @@ void Comic::setup()
connect(this,SIGNAL(imageLoaded(int)),this,SLOT(updateBookmarkImage(int)));
}
//-----------------------------------------------------------------------------
void Comic::load(const QString & path)
bool Comic::load(const QString & path)
{
QFileInfo fi(path);
bm->newComic(path);
emit bookmarksLoaded(*bm);
if(fi.isFile())
{
loadFromFile(path);
}
else
{
if(fi.isDir())
QFileInfo fi(path);
if(fi.exists())
{
loadFromDir(path);
bm->newComic(path);
emit bookmarksLoaded(*bm);
if(fi.isFile())
{
loadFromFile(path);
}
else
{
if(fi.isDir())
{
loadFromDir(path);
}
}
return true;
}
else
{
QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found"));
emit errorOpening();
return false;
}
}
}
//-----------------------------------------------------------------------------
void Comic::loadFromFile(const QString & pathFile)