Skip to content

Commit

Permalink
Show only provider fields as join target candidates (ticket #4136)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Aug 12, 2011
1 parent 7d73cd8 commit 494c65b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/app/qgsaddjoindialog.cpp
Expand Up @@ -52,11 +52,15 @@ QgsAddJoinDialog::QgsAddJoinDialog( QgsVectorLayer* layer, QWidget * parent, Qt:
on_mJoinLayerComboBox_currentIndexChanged( mJoinLayerComboBox->currentIndex() );

//insert possible target fields
const QgsFieldMap& layerFieldMap = mLayer->pendingFields();
QgsFieldMap::const_iterator fieldIt = layerFieldMap.constBegin();
for ( ; fieldIt != layerFieldMap.constEnd(); ++fieldIt )
QgsVectorDataProvider* provider = mLayer->dataProvider();
if ( provider )
{
mTargetFieldComboBox->addItem( fieldIt.value().name(), fieldIt.key() );
const QgsFieldMap& layerFieldMap = provider->fields();
QgsFieldMap::const_iterator fieldIt = layerFieldMap.constBegin();
for ( ; fieldIt != layerFieldMap.constEnd(); ++fieldIt )
{
mTargetFieldComboBox->addItem( fieldIt.value().name(), fieldIt.key() );
}
}

mCacheInMemoryCheckBox->setChecked( true );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -1068,7 +1068,7 @@ void QgsVectorLayerProperties::on_mButtonAddJoin_clicked()
info.memoryCache = d.cacheInMemory();
if ( layer )
{
//create attribute index if possible. Todo: ask user if this should be done (e.g. in QgsAddJoinDialog)
//create attribute index if possible
if ( d.createAttributeIndex() )
{
QgsVectorLayer* joinLayer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( info.joinLayerId ) );
Expand Down

0 comments on commit 494c65b

Please sign in to comment.