Skip to content
Permalink
Browse files

Fix #7532, startup forces new project document, even when opening dat…

…a file
  • Loading branch information
dakcarto committed Apr 7, 2013
1 parent 68f0a87 commit 5e39bac1f9da74d8c084462608850f76b4e783a6
Showing with 19 additions and 8 deletions.
  1. +19 −8 src/app/qgisapp.cpp
@@ -722,7 +722,11 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
// update windows
qApp->processEvents();

fileNewBlank(); // prepare empty project
// check if a project has been loaded already via drag/drop or filesystem loading
if ( !QgsProject::instance() )
{
fileNewBlank(); // prepare empty project
}

} // QgisApp ctor

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

// check if a project is already loaded via command line or filesystem
if ( !QgsProject::instance()->fileName().isNull() )
{
return;
}

// check if a data source is already loaded via command line or filesystem
// empty project with layer loaded, but may not trigger a dirty project at this point
if ( QgsProject::instance() && QgsMapLayerRegistry::instance()->count() > 0 )
{
return;
}

// fileNewBlank() has already been called in QgisApp constructor
// loaded project is either a new blank one, or one from command line
// loaded project is either a new blank one, or one from command line/filesystem
QSettings settings;
QString autoOpenMsgTitle = tr( "Auto-open Project" );

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

// check if a project is already loaded via command line
if ( !QgsProject::instance()->fileName().isNull() )
{
return;
}

if ( projOpen == 0 ) // new project (default)
{
// open default template, if defined

0 comments on commit 5e39bac

Please sign in to comment.
You can’t perform that action at this time.