Skip to content

Commit

Permalink
Load projects from storage at start
Browse files Browse the repository at this point in the history
The check for qgs/qgs was preventing db-stored
project to be opened at start when option
to re-open last project is on
  • Loading branch information
elpaso committed Mar 6, 2019
1 parent 4113505 commit 0e98d1e
Show file tree
Hide file tree
Showing 6 changed files with 717 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/qgisapp.cpp
Expand Up @@ -5643,16 +5643,20 @@ void QgisApp::fileOpenAfterLaunch()
return;
}

if ( !projPath.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) &&
!projPath.endsWith( QLatin1String( ".qgz" ), Qt::CaseInsensitive ) )
// Is this a storage based project?
const bool projectIsFromStorage { QgsApplication::instance()->projectStorageRegistry()->projectStorageFromUri( projPath ) };

if ( !( projectIsFromStorage ||
projPath.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) ||
projPath.endsWith( QLatin1String( ".qgz" ), Qt::CaseInsensitive ) ) )
{
visibleMessageBar()->pushMessage( autoOpenMsgTitle,
tr( "Not valid project file: %1" ).arg( projPath ),
Qgis::Warning );
return;
}

if ( QFile::exists( projPath ) )
if ( projectIsFromStorage || QFile::exists( projPath ) )
{
// set flag to check on next app launch if the following project opened OK
settings.setValue( QStringLiteral( "qgis/projOpenedOKAtLaunch" ), QVariant( false ) );
Expand Down

0 comments on commit 0e98d1e

Please sign in to comment.