@@ -2660,7 +2660,7 @@ void QgisApp::fileOpen()
2660
2660
{
2661
2661
QMessageBox::critical (this ,
2662
2662
tr (" QGIS Project Read Error" ),
2663
- tr (" " ) + " \n " + e.what () );
2663
+ tr (" " ) + " \n " + QString::fromLocal8Bit ( e.what () ) );
2664
2664
qDebug ( " %s:%d %d bad layers found" , __FILE__, __LINE__, e.layers ().size () );
2665
2665
2666
2666
// attempt to find the new locations for missing layers
@@ -2671,7 +2671,7 @@ void QgisApp::fileOpen()
2671
2671
{
2672
2672
QMessageBox::critical (this ,
2673
2673
tr (" QGIS Project Read Error" ),
2674
- tr (" " ) + " \n " + e.what () );
2674
+ tr (" " ) + " \n " + QString::fromLocal8Bit ( e.what () ) );
2675
2675
qDebug ( " %s:%d BAD LAYERS FOUND" , __FILE__, __LINE__ );
2676
2676
}
2677
2677
}
@@ -2742,7 +2742,7 @@ bool QgisApp::addProject(QString projectFile)
2742
2742
2743
2743
if ( QMessageBox::Yes == QMessageBox::critical ( this ,
2744
2744
tr (" QGIS Project Read Error" ),
2745
- tr (" " ) + " \n " + e.what () + " \n " +
2745
+ tr (" " ) + " \n " + QString::fromLocal8Bit ( e.what () ) + " \n " +
2746
2746
tr (" Try to find missing layers?" ),
2747
2747
QMessageBox::Yes | QMessageBox::Default,
2748
2748
QMessageBox::No | QMessageBox::Escape ) )
@@ -2760,7 +2760,7 @@ bool QgisApp::addProject(QString projectFile)
2760
2760
qDebug ( " %s:%d BAD LAYERS FOUND" , __FILE__, __LINE__ );
2761
2761
2762
2762
QMessageBox::critical ( 0x0 ,
2763
- tr (" Unable to open project" ), QString::fromLocal8Bit (e.what ()), QMessageBox::Ok,
2763
+ tr (" Unable to open project" ), QString::fromLocal8Bit ( e.what () ), QMessageBox::Ok,
2764
2764
Qt::NoButton );
2765
2765
2766
2766
mMapCanvas ->freeze (false );
@@ -2855,7 +2855,7 @@ bool QgisApp::fileSave()
2855
2855
{
2856
2856
QMessageBox::critical ( 0x0 ,
2857
2857
tr (" Unable to save project " ) + QgsProject::instance ()->filename (),
2858
- e.what (),
2858
+ QString::fromLocal8Bit ( e.what () ),
2859
2859
QMessageBox::Ok,
2860
2860
Qt::NoButton );
2861
2861
@@ -2912,21 +2912,31 @@ void QgisApp::fileSaveAs()
2912
2912
fullPath.setFile ( newFilePath );
2913
2913
}
2914
2914
2915
-
2916
- QgsProject::instance ()->filename ( fullPath.filePath () );
2917
-
2918
- if ( QgsProject::instance ()->write () )
2915
+ try
2919
2916
{
2920
- setTitleBarText_ (*this ); // update title bar
2921
- statusBar ()->message (tr (" Saved project to:" ) + " " + QgsProject::instance ()->filename () );
2922
- // add this to the list of recently used project files
2923
- saveRecentProjectPath (fullPath.filePath (), settings);
2917
+ QgsProject::instance ()->filename ( fullPath.filePath () );
2918
+
2919
+ if ( QgsProject::instance ()->write () )
2920
+ {
2921
+ setTitleBarText_ (*this ); // update title bar
2922
+ statusBar ()->message (tr (" Saved project to:" ) + " " + QgsProject::instance ()->filename () );
2923
+ // add this to the list of recently used project files
2924
+ saveRecentProjectPath (fullPath.filePath (), settings);
2925
+ }
2926
+ else
2927
+ {
2928
+ QMessageBox::critical (this ,
2929
+ tr (" Unable to save project" ),
2930
+ tr (" Unable to save project to " ) + QgsProject::instance ()->filename () );
2931
+ }
2924
2932
}
2925
- else
2933
+ catch ( std:: exception & e )
2926
2934
{
2927
- QMessageBox::critical (this ,
2928
- tr (" Unable to save project" ),
2929
- tr (" Unable to save project to " ) + QgsProject::instance ()->filename () );
2935
+ QMessageBox::critical ( 0x0 ,
2936
+ tr (" Unable to save project " ) + QgsProject::instance ()->filename (),
2937
+ QString::fromLocal8Bit ( e.what () ),
2938
+ QMessageBox::Ok,
2939
+ Qt::NoButton );
2930
2940
}
2931
2941
} // QgisApp::fileSaveAs
2932
2942
0 commit comments