Skip to content
Permalink
Browse files

remove join returns true in case of success

  • Loading branch information
3nids committed Feb 1, 2016
1 parent cae49d7 commit e453c1588de4f9381d3950ed5ba125b2988c3b08
@@ -446,8 +446,9 @@ class QgsVectorLayer : QgsMapLayer
@note since 2.6 returns bool indicating whether the join can be added */
bool addJoin( const QgsVectorJoinInfo& joinInfo );

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

const QList<QgsVectorJoinInfo> vectorJoins() const;

@@ -12,8 +12,9 @@ class QgsVectorLayerJoinBuffer : QObject
@return (since 2.6) whether the join was successfully added */
bool addJoin( const QgsVectorJoinInfo& joinInfo );

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

/** Updates field map with joined attributes
@param fields map to append joined attributes
@@ -2764,10 +2764,14 @@ void QgsVectorLayer::checkJoinLayerRemove( const QString& theLayerId )
removeJoin( theLayerId );
}

void QgsVectorLayer::removeJoin( const QString& joinLayerId )
bool QgsVectorLayer::removeJoin( const QString& joinLayerId )
{
bool res = false;
if ( mJoinBuffer )
mJoinBuffer->removeJoin( joinLayerId );
{
res = mJoinBuffer->removeJoin( joinLayerId );
}
return res;
}

const QList< QgsVectorJoinInfo > QgsVectorLayer::vectorJoins() const
@@ -554,8 +554,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
@note since 2.6 returns bool indicating whether the join can be added */
bool addJoin( const QgsVectorJoinInfo& joinInfo );

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

const QList<QgsVectorJoinInfo> vectorJoins() const;

@@ -94,20 +94,25 @@ bool QgsVectorLayerJoinBuffer::addJoin( const QgsVectorJoinInfo& joinInfo )
}


void QgsVectorLayerJoinBuffer::removeJoin( const QString& joinLayerId )
bool QgsVectorLayerJoinBuffer::removeJoin( const QString& joinLayerId )
{
bool res = false;
for ( int i = 0; i < mVectorJoins.size(); ++i )
{
if ( mVectorJoins.at( i ).joinLayerId == joinLayerId )
{
mVectorJoins.removeAt( i );
res = true;
}
}

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

emit joinedFieldsChanged();
return res;
}

void QgsVectorLayerJoinBuffer::cacheJoinLayer( QgsVectorJoinInfo& joinInfo )
@@ -41,8 +41,9 @@ class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject
@return (since 2.6) whether the join was successfully added */
bool addJoin( const QgsVectorJoinInfo& joinInfo );

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

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

0 comments on commit e453c15

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