Skip to content

Commit

Permalink
Fix #7532, startup forces new project document, even when opening dat…
Browse files Browse the repository at this point in the history
…a file
  • Loading branch information
dakcarto committed Apr 7, 2013
1 parent 68f0a87 commit 5e39bac
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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" );

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5e39bac

Please sign in to comment.