Skip to content
Permalink
Browse files
fix for ticket #309 (incorrect error message when loading a vector
file from the command line, and a loitoring hourglass).


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5874 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Sep 26, 2006
1 parent 4d23dd5 commit 102143623dcb54ded6a35ea0b1e2aa7b1cebdee2
Showing with 12 additions and 10 deletions.
  1. +12 −10 src/gui/qgisapp.cpp
@@ -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;
}


@@ -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

0 comments on commit 1021436

Please sign in to comment.