@@ -1746,75 +1746,6 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
1746
1746
1747
1747
mEmbeddedLayers .insert ( layerId, qMakePair ( projectFilePath, saveFlag ) );
1748
1748
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
-
1818
1749
if ( addLayer ( mapLayerElem, brokenNodes, embeddedPathResolver ) )
1819
1750
{
1820
1751
return true ;
0 commit comments