Skip to content

Commit

Permalink
fix for ticket #309 (incorrect error message when loading a vector
Browse files Browse the repository at this point in the history
file from the command line, and a loitoring hourglass).


git-svn-id: http://svn.osgeo.org/qgis/trunk@5874 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Sep 26, 2006
1 parent db84520 commit c61099c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/gui/qgisapp.cpp
Expand Up @@ -2919,20 +2919,21 @@ bool QgisApp::openLayer(const QString & fileName)
{
QFileInfo fileInfo(fileName);
// try to load it as raster
bool ok = addRasterLayer(fileInfo, false);
bool ok = false;
CPLPushErrorHandler(CPLQuietErrorHandler);
if (QgsRasterLayer::isValidRasterFileName(fileName))
ok = addRasterLayer(fileInfo, false);
else // nope - try to load it as a shape/ogr
ok = addLayer(fileInfo);
CPLPopErrorHandler();

if (!ok)
{
// nope - try to load it as a shape/ogr
ok = addLayer(fileInfo);
// we have no idea what this file is...
if (!ok)
{
std::cout << "Unable to load " << fileName.toLocal8Bit().data() << std::endl;
}
std::cout << "Unable to load " << fileName.toLocal8Bit().data() << std::endl;
}
#ifdef WIN32
return true;
#endif

return ok;
}


Expand Down Expand Up @@ -4976,6 +4977,7 @@ bool QgisApp::addRasterLayer(QFileInfo const & rasterFile, bool guiWarning)
+ tr(" is not a valid or recognized raster data source"));
QMessageBox::critical(this, tr("Invalid Data Source"), msg);
}
delete layer;
return false;
}
else
Expand Down

0 comments on commit c61099c

Please sign in to comment.