Skip to content

Commit 15fc16d

Browse files
committed
Remove duplicate code - now handled by QgsPathResolver
1 parent bbe5996 commit 15fc16d

File tree

2 files changed

+0
-70
lines changed

2 files changed

+0
-70
lines changed

src/core/qgsmaplayer.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, const QgsPathRe
179179
}
180180

181181
// TODO: this should go to providers
182-
// see also QgsProject::createEmbeddedLayer
183182
if ( provider == QLatin1String( "spatialite" ) )
184183
{
185184
QgsDataSourceUri uri( mDataSource );

src/core/qgsproject.cpp

-69
Original file line numberDiff line numberDiff line change
@@ -1746,75 +1746,6 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
17461746

17471747
mEmbeddedLayers.insert( layerId, qMakePair( projectFilePath, saveFlag ) );
17481748

1749-
// change datasource path from relative to absolute if necessary
1750-
// see also QgsMapLayer::readLayerXML
1751-
if ( !useAbsolutePaths )
1752-
{
1753-
QString provider( mapLayerElem.firstChildElement( QStringLiteral( "provider" ) ).text() );
1754-
QDomElement dsElem( mapLayerElem.firstChildElement( QStringLiteral( "datasource" ) ) );
1755-
QString datasource( dsElem.text() );
1756-
if ( provider == QLatin1String( "spatialite" ) )
1757-
{
1758-
QgsDataSourceUri uri( datasource );
1759-
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + '/' + uri.database() );
1760-
if ( absoluteDs.exists() )
1761-
{
1762-
uri.setDatabase( absoluteDs.absoluteFilePath() );
1763-
datasource = uri.uri();
1764-
}
1765-
}
1766-
else if ( provider == QLatin1String( "ogr" ) )
1767-
{
1768-
QStringList theURIParts( datasource.split( '|' ) );
1769-
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + '/' + theURIParts[0] );
1770-
if ( absoluteDs.exists() )
1771-
{
1772-
theURIParts[0] = absoluteDs.absoluteFilePath();
1773-
datasource = theURIParts.join( QStringLiteral( "|" ) );
1774-
}
1775-
}
1776-
else if ( provider == QLatin1String( "gpx" ) )
1777-
{
1778-
QStringList theURIParts( datasource.split( '?' ) );
1779-
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + '/' + theURIParts[0] );
1780-
if ( absoluteDs.exists() )
1781-
{
1782-
theURIParts[0] = absoluteDs.absoluteFilePath();
1783-
datasource = theURIParts.join( QStringLiteral( "?" ) );
1784-
}
1785-
}
1786-
else if ( provider == QLatin1String( "delimitedtext" ) )
1787-
{
1788-
QUrl urlSource( QUrl::fromEncoded( datasource.toLatin1() ) );
1789-
1790-
if ( !datasource.startsWith( QLatin1String( "file:" ) ) )
1791-
{
1792-
QUrl file( QUrl::fromLocalFile( datasource.left( datasource.indexOf( '?' ) ) ) );
1793-
urlSource.setScheme( QStringLiteral( "file" ) );
1794-
urlSource.setPath( file.path() );
1795-
}
1796-
1797-
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + '/' + urlSource.toLocalFile() );
1798-
if ( absoluteDs.exists() )
1799-
{
1800-
QUrl urlDest = QUrl::fromLocalFile( absoluteDs.absoluteFilePath() );
1801-
urlDest.setQueryItems( urlSource.queryItems() );
1802-
datasource = QString::fromAscii( urlDest.toEncoded() );
1803-
}
1804-
}
1805-
else
1806-
{
1807-
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + '/' + datasource );
1808-
if ( absoluteDs.exists() )
1809-
{
1810-
datasource = absoluteDs.absoluteFilePath();
1811-
}
1812-
}
1813-
1814-
dsElem.removeChild( dsElem.childNodes().at( 0 ) );
1815-
dsElem.appendChild( sProjectDocument.createTextNode( datasource ) );
1816-
}
1817-
18181749
if ( addLayer( mapLayerElem, brokenNodes, embeddedPathResolver ) )
18191750
{
18201751
return true;

0 commit comments

Comments
 (0)