Skip to content
Permalink
Browse files

Expose gpkg embedded project to the browser

  • Loading branch information
elpaso committed Mar 6, 2019
1 parent 46d5c48 commit 5d404cbd53628fe3d1055b310579ced4ffb5a8f9
@@ -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;
}

@@ -26,6 +26,7 @@
#include "qgsmessagelog.h"
#include "qgssqliteutils.h"
#include "qgsreadwritecontext.h"
#include "qgsapplication.h"


static bool _parseMetadataDocument( const QJsonDocument &doc, QgsProjectStorage::Metadata &metadata )
@@ -216,10 +217,9 @@ bool QgsGeoPackageProjectStorage::writeProject( const QString &uri, QIODevice *d

// read from device and write to the table
QByteArray content = device->readAll();

QString metadataExpr = QStringLiteral( "{\"last_modified_time\": \"%1\", \"last_modified_user\": \"%2\" }" ).arg(
"2019-01-01",
"username"
QTime().toString(),
QgsApplication::instance()->userLoginName()
);
QString sql;
if ( listProjects( uri ).contains( projectUri.projectName ) )
@@ -1,9 +1,9 @@
/***************************************************************************
qgsgeopackageprojectstoragedialog.cpp
---------------------
begin : April 2018
copyright : (C) 2018 by Martin Dobias
email : wonder dot sk at gmail dot com
begin : March 2019
copyright : (C) 2019 by Alessandro Pasotti
email : elpaso at itopen dot it
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *

0 comments on commit 5d404cb

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