Skip to content

Commit 5e39bac

Browse files
committedApr 7, 2013
Fix #7532, startup forces new project document, even when opening data file
1 parent 68f0a87 commit 5e39bac

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,11 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
722722
// update windows
723723
qApp->processEvents();
724724

725-
fileNewBlank(); // prepare empty project
725+
// check if a project has been loaded already via drag/drop or filesystem loading
726+
if ( !QgsProject::instance() )
727+
{
728+
fileNewBlank(); // prepare empty project
729+
}
726730

727731
} // QgisApp ctor
728732

@@ -3285,8 +3289,21 @@ void QgisApp::fileOpenAfterLaunch()
32853289
{
32863290
// TODO: move auto-open project options to enums
32873291

3292+
// check if a project is already loaded via command line or filesystem
3293+
if ( !QgsProject::instance()->fileName().isNull() )
3294+
{
3295+
return;
3296+
}
3297+
3298+
// check if a data source is already loaded via command line or filesystem
3299+
// empty project with layer loaded, but may not trigger a dirty project at this point
3300+
if ( QgsProject::instance() && QgsMapLayerRegistry::instance()->count() > 0 )
3301+
{
3302+
return;
3303+
}
3304+
32883305
// fileNewBlank() has already been called in QgisApp constructor
3289-
// loaded project is either a new blank one, or one from command line
3306+
// loaded project is either a new blank one, or one from command line/filesystem
32903307
QSettings settings;
32913308
QString autoOpenMsgTitle = tr( "Auto-open Project" );
32923309

@@ -3326,12 +3343,6 @@ void QgisApp::fileOpenAfterLaunch()
33263343
return;
33273344
}
33283345

3329-
// check if a project is already loaded via command line
3330-
if ( !QgsProject::instance()->fileName().isNull() )
3331-
{
3332-
return;
3333-
}
3334-
33353346
if ( projOpen == 0 ) // new project (default)
33363347
{
33373348
// open default template, if defined

0 commit comments

Comments
 (0)
Please sign in to comment.