Skip to content

Commit

Permalink
Applied patch #725 which also fixes ticket #698
Browse files Browse the repository at this point in the history
(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/trunk@7018 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jun 11, 2007
1 parent 1f2f9a3 commit 198aef5
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2729,7 +2729,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__, static_cast<int>(e.layers().size()) );

// attempt to find the new locations for missing layers
Expand All @@ -2740,7 +2740,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__ );
}
}
Expand Down Expand Up @@ -2793,7 +2793,7 @@ bool QgisApp::addProject(QString projectFile)

if ( QMessageBox::Ok == 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::Ok | QMessageBox::Cancel ) )
{
Expand All @@ -2810,7 +2810,7 @@ bool QgisApp::addProject(QString projectFile)
qDebug( "%s:%d BAD LAYERS FOUND", __FILE__, __LINE__ );

QMessageBox::critical( this,
tr("Unable to open project"), QString::fromLocal8Bit(e.what()) );
tr("Unable to open project"), QString::fromLocal8Bit( e.what() ) );

mMapCanvas->freeze(false);
mMapCanvas->refresh();
Expand Down Expand Up @@ -2898,7 +2898,7 @@ bool QgisApp::fileSave()
{
QMessageBox::critical( this,
tr("Unable to save project ") + QgsProject::instance()->filename(),
e.what() );
QString::fromLocal8Bit( e.what() ) );
}
return true;
} // QgisApp::fileSave
Expand Down Expand Up @@ -2949,21 +2949,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

Expand Down

0 comments on commit 198aef5

Please sign in to comment.