Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[BACKPORT] move database related plugins to Database menu and create
some icons in Layers toolbar (partial fix for #4395)
  • Loading branch information
alexbruy committed Dec 9, 2011
1 parent 079713d commit 1ffe31c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -5286,6 +5286,10 @@ void QgisApp::removePluginDatabaseMenu( QString name, QAction* action )
{
QMenu* menu = getDatabaseMenu( name );
menu->removeAction( action );
if ( menu->actions().count() == 0 )
{
mDatabaseMenu->removeAction( menu->menuAction() );
}

// remove the Database menu from the menuBar if there are no more actions
if ( mDatabaseMenu->actions().count() > 0 )
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/offline_editing/offline_editing_plugin.cpp
Expand Up @@ -115,9 +115,9 @@ void QgsOfflineEditingPlugin::unload()
disconnect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), this, SLOT( updateActions() ) );

// remove the GUI
mQGisIface->removePluginDatabaseMenu( "&Offline Editing", mActionConvertProject );
mQGisIface->removePluginDatabaseMenu( tr( "&Offline Editing" ), mActionConvertProject );
mQGisIface->removeToolBarIcon( mActionConvertProject );
mQGisIface->removePluginDatabaseMenu( "&Offline Editing", mActionSynchronize );
mQGisIface->removePluginDatabaseMenu( tr( "&Offline Editing" ), mActionSynchronize );
mQGisIface->removeToolBarIcon( mActionSynchronize );
delete mActionConvertProject;
delete mActionSynchronize;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/oracle_raster/qgsoracle_plugin.cpp
Expand Up @@ -58,7 +58,7 @@ void QgsOraclePlugin::initGui()
// Connect the action to the run
connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
// Add the icon to the toolbar
mQGisIface->addToolBarIcon( mQActionPointer );
mQGisIface->layerToolBar()->addAction( mQActionPointer );
mQGisIface->insertAddLayerAction( mQActionPointer );

}
Expand Down Expand Up @@ -87,7 +87,7 @@ void QgsOraclePlugin::run()
void QgsOraclePlugin::unload()
{
// remove the GUI
mQGisIface->removeToolBarIcon( mQActionPointer );
mQGisIface->layerToolBar()->removeAction( mQActionPointer );
mQGisIface->removeAddLayerAction( mQActionPointer );
delete mQActionPointer;
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/oracle_raster/qgsoracle_plugin.h
Expand Up @@ -19,6 +19,7 @@
// Qt Includes
#include <QObject>
#include <QAction>
#include <QToolBar>

// QGIS Includes
#include <qgisplugin.h>
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/spit/qgsspitplugin.cpp
Expand Up @@ -70,7 +70,7 @@ void QgsSpitPlugin::initGui()
connect( spitAction, SIGNAL( triggered() ), this, SLOT( spit() ) );
// Add the icon to the toolbar and to the plugin menu
qI->addToolBarIcon( spitAction );
qI->addPluginToMenu( tr( "&Spit" ), spitAction );
qI->addPluginToDatabaseMenu( tr( "&Spit" ), spitAction );

// this is called when the icon theme is changed
connect( qI, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
Expand All @@ -90,7 +90,7 @@ void QgsSpitPlugin::unload()
{
// remove the GUI
qI->removeToolBarIcon( spitAction );
qI->removePluginMenu( tr( "&Spit" ), spitAction );
qI->removePluginDatabaseMenu( tr( "&Spit" ), spitAction );
delete spitAction;
}

Expand Down

0 comments on commit 1ffe31c

Please sign in to comment.