Skip to content

Commit 7a9e682

Browse files
committedJan 29, 2014
fix #9430: do not enable copy to layer if nothing to copy
1 parent 00680cd commit 7a9e682

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3301,7 +3301,7 @@ void QgisApp::fileNew( bool thePromptToSaveFlag, bool forceBlank )
33013301
// write the projections _proj string_ to project settings
33023302
prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", srs.toProj4() );
33033303
prj->writeEntry( "SpatialRefSys", "/ProjectCrs", srs.authid() );
3304-
prj->writeEntry( "SpatialRefSys", "/ProjectCRSID", (int) srs.srsid() );
3304+
prj->writeEntry( "SpatialRefSys", "/ProjectCRSID", ( int ) srs.srsid() );
33053305
prj->dirty( false );
33063306
if ( srs.mapUnits() != QGis::UnknownUnit )
33073307
{
@@ -5884,6 +5884,7 @@ QgsVectorLayer * QgisApp::pasteToNewMemoryVector()
58845884
if ( !message.isEmpty() )
58855885
{
58865886
QMessageBox::warning( this, tr( "Warning" ), message , QMessageBox::Ok );
5887+
return 0;
58875888
}
58885889

58895890
QgsVectorLayer * layer = new QgsVectorLayer( typeName, "pasted_features", "memory" );
@@ -8475,6 +8476,8 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
84758476
mActionCutFeatures->setEnabled( false );
84768477
mActionCopyFeatures->setEnabled( false );
84778478
mActionPasteFeatures->setEnabled( false );
8479+
mActionPasteAsNewVector->setEnabled( false );
8480+
mActionPasteAsNewMemoryVector->setEnabled( false );
84788481
mActionCopyStyle->setEnabled( false );
84798482
mActionPasteStyle->setEnabled( false );
84808483

@@ -8585,7 +8588,11 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
85858588
updateUndoActions();
85868589
}
85878590

8588-
mActionPasteFeatures->setEnabled( isEditable && canAddFeatures && !clipboard()->empty() );
8591+
bool canPasteFeatures = isEditable && canAddFeatures && !clipboard()->empty();
8592+
mActionPasteFeatures->setEnabled( canPasteFeatures );
8593+
mActionPasteAsNewVector->setEnabled( canPasteFeatures );
8594+
mActionPasteAsNewMemoryVector->setEnabled( canPasteFeatures );
8595+
85898596
mActionAddFeature->setEnabled( isEditable && canAddFeatures );
85908597

85918598
//does provider allow deleting of features?
@@ -8735,6 +8742,8 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
87358742
mActionCopyFeatures->setEnabled( false );
87368743
mActionCutFeatures->setEnabled( false );
87378744
mActionPasteFeatures->setEnabled( false );
8745+
mActionPasteAsNewVector->setEnabled( false );
8746+
mActionPasteAsNewMemoryVector->setEnabled( false );
87388747
mActionRotatePointSymbols->setEnabled( false );
87398748
mActionDeletePart->setEnabled( false );
87408749
mActionDeleteRing->setEnabled( false );

0 commit comments

Comments
 (0)
Please sign in to comment.