@@ -819,6 +819,7 @@ void QgisApp::createActions()
819
819
// File Menu Items
820
820
821
821
connect ( mActionNewProject , SIGNAL ( triggered () ), this , SLOT ( fileNew () ) );
822
+ connect ( mActionNewBlankProject , SIGNAL ( triggered () ), this , SLOT ( fileNewBlank () ) );
822
823
connect ( mActionOpenProject , SIGNAL ( triggered () ), this , SLOT ( fileOpen () ) );
823
824
connect ( mActionSaveProject , SIGNAL ( triggered () ), this , SLOT ( fileSave () ) );
824
825
connect ( mActionSaveProjectAs , SIGNAL ( triggered () ), this , SLOT ( fileSaveAs () ) );
@@ -2881,15 +2882,20 @@ void QgisApp::fileExit()
2881
2882
}
2882
2883
2883
2884
2884
-
2885
2885
void QgisApp::fileNew ()
2886
2886
{
2887
2887
fileNew ( true ); // prompts whether to save project
2888
2888
} // fileNew()
2889
2889
2890
2890
2891
+ void QgisApp::fileNewBlank ()
2892
+ {
2893
+ fileNew ( true , true );
2894
+ }
2895
+
2896
+
2891
2897
// as file new but accepts flags to indicate whether we should prompt to save
2892
- void QgisApp::fileNew ( bool thePromptToSaveFlag )
2898
+ void QgisApp::fileNew ( bool thePromptToSaveFlag, bool forceBlank )
2893
2899
{
2894
2900
if ( mMapCanvas && mMapCanvas ->isDrawing () )
2895
2901
{
@@ -2906,16 +2912,19 @@ void QgisApp::fileNew( bool thePromptToSaveFlag )
2906
2912
2907
2913
// load template instead of loading defaults - or should this be done *after* loading defaults?
2908
2914
QSettings settings;
2909
- QString projectTemplate = settings.value ( " /qgis/newProjectTemplateFile" , " " ).toString ();
2910
- if ( settings.value ( " /qgis/newProjectTemplate" , QVariant ( false ) ).toBool () &&
2911
- ! projectTemplate.isEmpty () )
2915
+ if ( ! forceBlank )
2912
2916
{
2913
- QgsDebugMsg ( QString ( " tryingload template: %1 - %2" ).arg ( settings.value ( " /qgis/newProjectTemplate" , QVariant ( false ) ).toBool () ).arg ( projectTemplate ) );
2914
- if ( addProject ( projectTemplate ) )
2917
+ QString projectTemplate = settings.value ( " /qgis/newProjectTemplateFile" , " " ).toString ();
2918
+ if ( settings.value ( " /qgis/newProjectTemplate" , QVariant ( false ) ).toBool () &&
2919
+ ! projectTemplate.isEmpty () )
2915
2920
{
2916
- // set null filename so we don't override the template
2917
- QgsProject::instance ()->setFileName ( QString () );
2918
- return ;
2921
+ QgsDebugMsg ( QString ( " loading template: %1 - %2" ).arg ( settings.value ( " /qgis/newProjectTemplate" , QVariant ( false ) ).toBool () ).arg ( projectTemplate ) );
2922
+ if ( addProject ( projectTemplate ) )
2923
+ {
2924
+ // set null filename so we don't override the template
2925
+ QgsProject::instance ()->setFileName ( QString () );
2926
+ return ;
2927
+ }
2919
2928
}
2920
2929
}
2921
2930
0 commit comments