Skip to content
Permalink
Browse files
Applied patch #725 which also fixes ticket #698
(This patch fixes crash (ticket #698) and also adds some i18n stuff (missing tr(), and encoding conversation where nedded). Included patches for HEAD and also for 0.8.x)



git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@7019 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jun 11, 2007
1 parent fd47af0 commit 3dedb154aacdbbba10e952ba6bffe32906cce6de
Showing with 29 additions and 19 deletions.
  1. +27 −17 src/gui/qgisapp.cpp
  2. +2 −2 src/gui/qgsproject.cpp
@@ -2660,7 +2660,7 @@ void QgisApp::fileOpen()
{
QMessageBox::critical(this,
tr("QGIS Project Read Error"),
tr("") + "\n" + e.what() );
tr("") + "\n" + QString::fromLocal8Bit( e.what() ) );
qDebug( "%s:%d %d bad layers found", __FILE__, __LINE__, e.layers().size() );

// attempt to find the new locations for missing layers
@@ -2671,7 +2671,7 @@ void QgisApp::fileOpen()
{
QMessageBox::critical(this,
tr("QGIS Project Read Error"),
tr("") + "\n" + e.what() );
tr("") + "\n" + QString::fromLocal8Bit( e.what() ) );
qDebug( "%s:%d BAD LAYERS FOUND", __FILE__, __LINE__ );
}
}
@@ -2742,7 +2742,7 @@ bool QgisApp::addProject(QString projectFile)

if ( QMessageBox::Yes == QMessageBox::critical( this,
tr("QGIS Project Read Error"),
tr("") + "\n" + e.what() + "\n" +
tr("") + "\n" + QString::fromLocal8Bit( e.what() ) + "\n" +
tr("Try to find missing layers?"),
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No | QMessageBox::Escape ) )
@@ -2760,7 +2760,7 @@ bool QgisApp::addProject(QString projectFile)
qDebug( "%s:%d BAD LAYERS FOUND", __FILE__, __LINE__ );

QMessageBox::critical( 0x0,
tr("Unable to open project"), QString::fromLocal8Bit(e.what()), QMessageBox::Ok,
tr("Unable to open project"), QString::fromLocal8Bit( e.what() ), QMessageBox::Ok,
Qt::NoButton );

mMapCanvas->freeze(false);
@@ -2855,7 +2855,7 @@ bool QgisApp::fileSave()
{
QMessageBox::critical( 0x0,
tr("Unable to save project ") + QgsProject::instance()->filename(),
e.what(),
QString::fromLocal8Bit( e.what() ),
QMessageBox::Ok,
Qt::NoButton );

@@ -2912,21 +2912,31 @@ void QgisApp::fileSaveAs()
fullPath.setFile( newFilePath );
}


QgsProject::instance()->filename( fullPath.filePath() );

if ( QgsProject::instance()->write() )
try
{
setTitleBarText_(*this); // update title bar
statusBar()->message(tr("Saved project to:") + " " + QgsProject::instance()->filename() );
// add this to the list of recently used project files
saveRecentProjectPath(fullPath.filePath(), settings);
QgsProject::instance()->filename( fullPath.filePath() );

if ( QgsProject::instance()->write() )
{
setTitleBarText_(*this); // update title bar
statusBar()->message(tr("Saved project to:") + " " + QgsProject::instance()->filename() );
// add this to the list of recently used project files
saveRecentProjectPath(fullPath.filePath(), settings);
}
else
{
QMessageBox::critical(this,
tr("Unable to save project"),
tr("Unable to save project to ") + QgsProject::instance()->filename() );
}
}
else
catch ( std::exception & e )
{
QMessageBox::critical(this,
tr("Unable to save project"),
tr("Unable to save project to ") + QgsProject::instance()->filename() );
QMessageBox::critical( 0x0,
tr("Unable to save project ") + QgsProject::instance()->filename(),
QString::fromLocal8Bit( e.what() ),
QMessageBox::Ok,
Qt::NoButton );
}
} // QgisApp::fileSaveAs

@@ -1016,7 +1016,7 @@ bool QgsProject::read()
imp_->file.close(); // even though we got an error, let's make
// sure it's closed anyway

throw QgsIOException("Unable to open " + imp_->file.name());
throw QgsIOException( QObject::tr("Unable to open ") + imp_->file.name());

return false; // XXX raise exception? Ok now superfluous
// XXX because of exception.
@@ -1137,7 +1137,7 @@ bool QgsProject::read()
// doesn't *have* layers -- nor a GUI for that matter -- we'll just
// leave in the whining and boldly stomp on.

throw QgsException("Cannot get extents from " + imp_->file.name());
throw QgsException( QObject::tr("Cannot get extents from ") + imp_->file.name());

// return false;
}

0 comments on commit 3dedb15

Please sign in to comment.