Skip to content
Permalink
Browse files

Merge pull request #9381 from elpaso/gpkg-project-storage

Gpkg project storage
  • Loading branch information
elpaso committed Mar 7, 2019
2 parents 12ba417 + e217693 commit 41cc02f691d4be964cfcd940199af65ec55fb32b
@@ -5643,7 +5643,11 @@ void QgisApp::fileOpenAfterLaunch()
return;
}

if ( !projPath.endsWith( QLatin1String( ".qgs" ), 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,
@@ -5652,7 +5656,7 @@ void QgisApp::fileOpenAfterLaunch()
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 ) );
@@ -7,6 +7,7 @@ SET (OGR_SRCS
qgsgeopackagedataitems.cpp
qgsgeopackagerasterwriter.cpp
qgsgeopackagerasterwritertask.cpp
qgsgeopackageprojectstorage.cpp
qgsogrdbconnection.cpp
qgsogrdbtablemodel.cpp
qgsogrtransaction.cpp
@@ -27,10 +28,12 @@ IF (WITH_GUI)
SET(OGR_SRCS ${OGR_SRCS}
qgsogrdbsourceselect.cpp
qgsogrsourceselect.cpp
qgsgeopackageprojectstoragedialog.cpp
)
SET(OGR_MOC_HDRS ${OGR_MOC_HDRS}
qgsogrsourceselect.h
qgsogrdbsourceselect.h
qgsgeopackageprojectstoragedialog.h
)
ENDIF ()

@@ -42,7 +42,8 @@
#include "qgsproviderregistry.h"
#include "qgsproxyprogresstask.h"
#include "qgssqliteutils.h"

#include "qgsprojectstorageregistry.h"
#include "qgsgeopackageprojectstorage.h"

QGISEXTERN bool deleteLayer( const QString &uri, const QString &errCause );

@@ -144,6 +145,16 @@ QVector<QgsDataItem *> QgsGeoPackageCollectionItem::createChildren()
}
}
qDeleteAll( layers );
QgsProjectStorage *storage = QgsApplication::projectStorageRegistry()->projectStorageFromType( "geopackage" );
if ( storage )
{
const QStringList projectNames = storage->listProjects( mPath );
for ( const QString &projectName : projectNames )
{
QgsGeoPackageProjectUri projectUri { true, mPath, projectName };
children.append( new QgsProjectItem( this, projectName, QgsGeoPackageProjectStorage::encodeUri( projectUri ) ) );
}
}
return children;
}

0 comments on commit 41cc02f

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