Skip to content

Commit e453c15

Browse files
committed
remove join returns true in case of success
1 parent cae49d7 commit e453c15

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

python/core/qgsvectorlayer.sip

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,9 @@ class QgsVectorLayer : QgsMapLayer
446446
@note since 2.6 returns bool indicating whether the join can be added */
447447
bool addJoin( const QgsVectorJoinInfo& joinInfo );
448448

449-
/** Removes a vector layer join */
450-
void removeJoin( const QString& joinLayerId );
449+
/** Removes a vector layer join
450+
@returns true if join was found and successfully removed */
451+
bool removeJoin( const QString& joinLayerId );
451452

452453
const QList<QgsVectorJoinInfo> vectorJoins() const;
453454

python/core/qgsvectorlayerjoinbuffer.sip

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ class QgsVectorLayerJoinBuffer : QObject
1212
@return (since 2.6) whether the join was successfully added */
1313
bool addJoin( const QgsVectorJoinInfo& joinInfo );
1414

15-
/** Removes a vector layer join*/
16-
void removeJoin( const QString& joinLayerId );
15+
/** Removes a vector layer join
16+
@returns true if join was found and successfully removed */
17+
bool removeJoin( const QString& joinLayerId );
1718

1819
/** Updates field map with joined attributes
1920
@param fields map to append joined attributes

src/core/qgsvectorlayer.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,10 +2764,14 @@ void QgsVectorLayer::checkJoinLayerRemove( const QString& theLayerId )
27642764
removeJoin( theLayerId );
27652765
}
27662766

2767-
void QgsVectorLayer::removeJoin( const QString& joinLayerId )
2767+
bool QgsVectorLayer::removeJoin( const QString& joinLayerId )
27682768
{
2769+
bool res = false;
27692770
if ( mJoinBuffer )
2770-
mJoinBuffer->removeJoin( joinLayerId );
2771+
{
2772+
res = mJoinBuffer->removeJoin( joinLayerId );
2773+
}
2774+
return res;
27712775
}
27722776

27732777
const QList< QgsVectorJoinInfo > QgsVectorLayer::vectorJoins() const

src/core/qgsvectorlayer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
554554
@note since 2.6 returns bool indicating whether the join can be added */
555555
bool addJoin( const QgsVectorJoinInfo& joinInfo );
556556

557-
/** Removes a vector layer join */
558-
void removeJoin( const QString& joinLayerId );
557+
/** Removes a vector layer join
558+
@returns true if join was found and successfully removed */
559+
bool removeJoin( const QString& joinLayerId );
559560

560561
const QList<QgsVectorJoinInfo> vectorJoins() const;
561562

src/core/qgsvectorlayerjoinbuffer.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,25 @@ bool QgsVectorLayerJoinBuffer::addJoin( const QgsVectorJoinInfo& joinInfo )
9494
}
9595

9696

97-
void QgsVectorLayerJoinBuffer::removeJoin( const QString& joinLayerId )
97+
bool QgsVectorLayerJoinBuffer::removeJoin( const QString& joinLayerId )
9898
{
99+
bool res = false;
99100
for ( int i = 0; i < mVectorJoins.size(); ++i )
100101
{
101102
if ( mVectorJoins.at( i ).joinLayerId == joinLayerId )
102103
{
103104
mVectorJoins.removeAt( i );
105+
res = true;
104106
}
105107
}
106108

107109
if ( QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( joinLayerId ) ) )
110+
{
108111
disconnect( vl, SIGNAL( updatedFields() ), this, SLOT( joinedLayerUpdatedFields() ) );
112+
}
109113

110114
emit joinedFieldsChanged();
115+
return res;
111116
}
112117

113118
void QgsVectorLayerJoinBuffer::cacheJoinLayer( QgsVectorJoinInfo& joinInfo )

src/core/qgsvectorlayerjoinbuffer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject
4141
@return (since 2.6) whether the join was successfully added */
4242
bool addJoin( const QgsVectorJoinInfo& joinInfo );
4343

44-
/** Removes a vector layer join*/
45-
void removeJoin( const QString& joinLayerId );
44+
/** Removes a vector layer join
45+
@returns true if join was found and successfully removed */
46+
bool removeJoin( const QString& joinLayerId );
4647

4748
/** Updates field map with joined attributes
4849
@param fields map to append joined attributes

0 commit comments

Comments
 (0)