relative_path_from_symlink_2.diff
src/core/qgsvectorlayer.cpp (working copy) | ||
---|---|---|
2518 | 2518 |
QgsDebugMsg( "Beautifying layer name " + name() ); |
2519 | 2519 | |
2520 | 2520 |
// adjust the display name for postgres layers |
2521 |
QRegExp reg( "\"[^\"]+\"\\.\"([^\"]+)\" \\(([^)]+)\\)" ); |
|
2522 |
if ( reg.indexIn( name() ) >= 0 ) |
|
2521 |
QRegExp reg( "\"([^\"]+)\"\\.\"([^\"]+)\" \\(([^)]+)\\)" ); |
|
2522 |
reg.indexIn( name() ); |
|
2523 |
QStringList stuff = reg.capturedTexts(); |
|
2524 |
QString lName = /* stuff[1] + "." + */ stuff[2] + "." + stuff[3]; |
|
2525 | ||
2526 |
static const bool avoidDuplicateLayerNames = true; |
|
2527 |
if ( avoidDuplicateLayerNames ) |
|
2523 | 2528 |
{ |
2524 | 2529 |
QStringList stuff = reg.capturedTexts(); |
2525 | 2530 |
QString lName = stuff[1]; |
2526 | 2531 | |
2527 | 2532 |
const QMap<QString, QgsMapLayer*> &layers = QgsMapLayerRegistry::instance()->mapLayers(); |
2528 | ||
2529 |
QMap<QString, QgsMapLayer*>::const_iterator it; |
|
2530 |
for ( it = layers.constBegin(); it != layers.constEnd() && ( *it )->name() != lName; it++ ) |
|
2531 |
; |
|
2532 | ||
2533 |
if ( it != layers.constEnd() ) |
|
2534 |
lName += "." + stuff[2]; |
|
2535 | ||
2536 |
if ( !lName.isEmpty() ) |
|
2537 |
setLayerName( lName ); |
|
2533 |
bool originalName; |
|
2534 |
do { |
|
2535 |
originalName=true; |
|
2536 |
QMap<QString, QgsMapLayer*>::const_iterator it; |
|
2537 |
for ( it = layers.constBegin(); it != layers.constEnd(); ++it) |
|
2538 |
{ |
|
2539 |
if ( ( *it )->name() == lName ) |
|
2540 |
{ |
|
2541 |
lName = ( *it )->name() + "_"; // append an underscore... |
|
2542 |
originalName=false; |
|
2543 |
break; |
|
2544 |
} |
|
2545 |
} |
|
2546 |
} while (!originalName); |
|
2538 | 2547 |
} |
2539 | 2548 | |
2540 |
QgsDebugMsg( "Beautifying layer name " + name() ); |
|
2549 |
setLayerName( lName ); |
|
2550 |
QgsDebugMsg( "Beautified layer name " + lName ); |
|
2541 | 2551 | |
2542 | 2552 |
// deal with unnecessary schema qualification to make v.in.ogr happy |
2543 | 2553 |
mDataSource = mDataProvider->dataSourceUri(); |
src/core/qgsproject.cpp (working copy) | ||
---|---|---|
38 | 38 |
#include <QDomNode> |
39 | 39 |
#include <QObject> |
40 | 40 |
#include <QTextStream> |
41 |
#include <QDir> |
|
41 | 42 | |
42 | 43 | |
43 | 44 |
static const char *const ident_ = "$Id$"; |
... | ... | |
1408 | 1409 |
return src; |
1409 | 1410 |
} |
1410 | 1411 | |
1411 |
QString srcPath = src; |
|
1412 |
QString projPath = fileName(); |
|
1412 |
QDir srcDir(src); |
|
1413 |
QString srcPath = srcDir.canonicalPath(); |
|
1414 |
if ( srcPath.isEmpty() ) srcPath = src; /* wasn't a real file.. */ |
|
1413 | 1415 | |
1416 |
QDir projPathDir(fileName()); |
|
1417 |
Q_ASSERT( projPathDir.exists() ); |
|
1418 |
QString projPath = projPathDir.canonicalPath(); |
|
1419 | ||
1414 | 1420 |
#if defined( Q_OS_WIN ) |
1415 | 1421 |
const Qt::CaseSensitivity cs = Qt::CaseInsensitive; |
1416 | 1422 |