413 changes: 413 additions & 0 deletions images/themes/default/mActionNewSpatiaLiteLayer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 28 additions & 6 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ void QgisApp::createActions()
// Layer Menu Items

connect( mActionNewVectorLayer, SIGNAL( triggered() ), this, SLOT( newVectorLayer() ) );
connect( mActionNewSpatialiteLayer, SIGNAL( triggered() ), this, SLOT( newSpatialiteLayer() ) );
connect( mActionNewSpatiaLiteLayer, SIGNAL( triggered() ), this, SLOT( newSpatialiteLayer() ) );
connect( mActionShowRasterCalculator, SIGNAL( triggered() ), this, SLOT( showRasterCalculator() ) );
connect( mActionEmbedLayers, SIGNAL( triggered() ) , this, SLOT( embedLayers() ) );
connect( mActionAddOgrLayer, SIGNAL( triggered() ), this, SLOT( addVectorLayer() ) );
Expand Down Expand Up @@ -1467,6 +1467,24 @@ void QgisApp::createToolBars()
QToolButton* tbAllEdits = qobject_cast<QToolButton *>( mDigitizeToolBar->widgetForAction( mActionAllEdits ) );
tbAllEdits->setPopupMode( QToolButton::InstantPopup );

// new layer tool button

bt = new QToolButton();
bt->setPopupMode( QToolButton::MenuButtonPopup );
bt->addAction( mActionNewSpatiaLiteLayer );
bt->addAction( mActionNewVectorLayer );

QAction* defNewLayerAction = mActionNewVectorLayer;
switch ( settings.value( "/UI/defaultNewLayer", 1 ).toInt() )
{
case 0: defNewLayerAction = mActionNewSpatiaLiteLayer; break;
case 1: defNewLayerAction = mActionNewVectorLayer; break;
}
bt->setDefaultAction( defNewLayerAction );
QAction* newLayerAction = mLayerToolBar->insertWidget( mActionRemoveLayer, bt );
newLayerAction->setObjectName( "ActionNewLayer" );
connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) );

// Help Toolbar

QAction* actionWhatsThis = QWhatsThis::createAction( this );
Expand Down Expand Up @@ -1674,7 +1692,7 @@ void QgisApp::setTheme( QString theThemeName )
#ifdef HAVE_POSTGRESQL
mActionAddPgLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddPostgisLayer.svg" ) );
#endif
mActionNewSpatialiteLayer->setIcon( QgsApplication::getThemeIcon( "/mActionNewVectorLayer.svg" ) );
mActionNewSpatiaLiteLayer->setIcon( QgsApplication::getThemeIcon( "/mActionNewSpatiaLiteLayer.svg" ) );
mActionAddSpatiaLiteLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddSpatiaLiteLayer.svg" ) );
#ifdef HAVE_MSSQL
mActionAddMssqlLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddMssqlLayer.svg" ) );
Expand Down Expand Up @@ -6195,10 +6213,10 @@ void QgisApp::duplicateLayers( QList<QgsMapLayer *> lyrList )
QgsVectorLayer* vDupLayer = dynamic_cast<QgsVectorLayer*>( dupLayer );
if ( vLayer && vDupLayer )
{
foreach( const QgsVectorJoinInfo join, vLayer->vectorJoins() )
{
vDupLayer->addJoin( join );
}
foreach ( const QgsVectorJoinInfo join, vLayer->vectorJoins() )
{
vDupLayer->addJoin( join );
}
}

// always set duplicated layers to not visible
Expand Down Expand Up @@ -9018,6 +9036,10 @@ void QgisApp::toolButtonActionTriggered( QAction *action )
settings.setValue( "UI/annotationTool", 3 );
else if ( action == mActionAnnotation )
settings.setValue( "/UI/annotationTool", 4 );
else if ( action == mActionNewSpatiaLiteLayer )
settings.setValue( "/UI/defaultNewLayer", 0 );
else if ( action == mActionNewVectorLayer )
settings.setValue( "/UI/defaultNewLayer", 1 );
bt->setDefaultAction( action );
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionDraw() { return mActionDraw; }

QAction *actionNewVectorLayer() { return mActionNewVectorLayer; }
QAction *actionNewSpatialLiteLayer() { return mActionNewSpatialiteLayer; }
QAction *actionNewSpatialLiteLayer() { return mActionNewSpatiaLiteLayer; }
QAction *actionEmbedLayers() { return mActionEmbedLayers; }
QAction *actionAddOgrLayer() { return mActionAddOgrLayer; }
QAction *actionAddRasterLayer() { return mActionAddRasterLayer; }
Expand Down
9 changes: 4 additions & 5 deletions src/ui/qgisapp.ui
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<x>0</x>
<y>0</y>
<width>1050</width>
<height>21</height>
<height>31</height>
</rect>
</property>
<widget class="QMenu" name="mEditMenu">
Expand Down Expand Up @@ -146,7 +146,7 @@
<string>New</string>
</property>
<addaction name="mActionNewVectorLayer"/>
<addaction name="mActionNewSpatialiteLayer"/>
<addaction name="mActionNewSpatiaLiteLayer"/>
</widget>
<addaction name="mNewLayerMenu"/>
<addaction name="mActionEmbedLayers"/>
Expand Down Expand Up @@ -289,7 +289,6 @@
<addaction name="mActionAddWcsLayer"/>
<addaction name="mActionAddWfsLayer"/>
<addaction name="mActionAddDelimitedText"/>
<addaction name="mActionNewVectorLayer"/>
<addaction name="mActionRemoveLayer"/>
</widget>
<widget class="QToolBar" name="mDigitizeToolBar">
Expand Down Expand Up @@ -1135,10 +1134,10 @@
<string>Ctrl+Shift+N</string>
</property>
</action>
<action name="mActionNewSpatialiteLayer">
<action name="mActionNewSpatiaLiteLayer">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionNewVectorLayer.svg</normaloff>:/images/themes/default/mActionNewVectorLayer.svg</iconset>
<normaloff>:/images/themes/default/mActionNewSpatiaLiteLayer.svg</normaloff>:/images/themes/default/mActionNewSpatiaLiteLayer.svg</iconset>
</property>
<property name="text">
<string>New SpatiaLite Layer ...</string>
Expand Down