Skip to content

Commit 41cc02f

Browse files
authoredMar 7, 2019
Merge pull request #9381 from elpaso/gpkg-project-storage
Gpkg project storage
2 parents 12ba417 + e217693 commit 41cc02f

11 files changed

+781
-11
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5643,7 +5643,11 @@ void QgisApp::fileOpenAfterLaunch()
56435643
return;
56445644
}
56455645

5646-
if ( !projPath.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) &&
5646+
// Is this a storage based project?
5647+
const bool projectIsFromStorage { QgsApplication::instance()->projectStorageRegistry()->projectStorageFromUri( projPath ) };
5648+
5649+
if ( !projectIsFromStorage &&
5650+
!projPath.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) &&
56475651
!projPath.endsWith( QLatin1String( ".qgz" ), Qt::CaseInsensitive ) )
56485652
{
56495653
visibleMessageBar()->pushMessage( autoOpenMsgTitle,
@@ -5652,7 +5656,7 @@ void QgisApp::fileOpenAfterLaunch()
56525656
return;
56535657
}
56545658

5655-
if ( QFile::exists( projPath ) )
5659+
if ( projectIsFromStorage || QFile::exists( projPath ) )
56565660
{
56575661
// set flag to check on next app launch if the following project opened OK
56585662
settings.setValue( QStringLiteral( "qgis/projOpenedOKAtLaunch" ), QVariant( false ) );

‎src/providers/ogr/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SET (OGR_SRCS
77
qgsgeopackagedataitems.cpp
88
qgsgeopackagerasterwriter.cpp
99
qgsgeopackagerasterwritertask.cpp
10+
qgsgeopackageprojectstorage.cpp
1011
qgsogrdbconnection.cpp
1112
qgsogrdbtablemodel.cpp
1213
qgsogrtransaction.cpp
@@ -27,10 +28,12 @@ IF (WITH_GUI)
2728
SET(OGR_SRCS ${OGR_SRCS}
2829
qgsogrdbsourceselect.cpp
2930
qgsogrsourceselect.cpp
31+
qgsgeopackageprojectstoragedialog.cpp
3032
)
3133
SET(OGR_MOC_HDRS ${OGR_MOC_HDRS}
3234
qgsogrsourceselect.h
3335
qgsogrdbsourceselect.h
36+
qgsgeopackageprojectstoragedialog.h
3437
)
3538
ENDIF ()
3639

‎src/providers/ogr/qgsgeopackagedataitems.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
#include "qgsproviderregistry.h"
4343
#include "qgsproxyprogresstask.h"
4444
#include "qgssqliteutils.h"
45-
45+
#include "qgsprojectstorageregistry.h"
46+
#include "qgsgeopackageprojectstorage.h"
4647

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

@@ -144,6 +145,16 @@ QVector<QgsDataItem *> QgsGeoPackageCollectionItem::createChildren()
144145
}
145146
}
146147
qDeleteAll( layers );
148+
QgsProjectStorage *storage = QgsApplication::projectStorageRegistry()->projectStorageFromType( "geopackage" );
149+
if ( storage )
150+
{
151+
const QStringList projectNames = storage->listProjects( mPath );
152+
for ( const QString &projectName : projectNames )
153+
{
154+
QgsGeoPackageProjectUri projectUri { true, mPath, projectName };
155+
children.append( new QgsProjectItem( this, projectName, QgsGeoPackageProjectStorage::encodeUri( projectUri ) ) );
156+
}
157+
}
147158
return children;
148159
}
149160

0 commit comments

Comments
 (0)
Please sign in to comment.