Skip to content

Commit

Permalink
[BACKPORT] move database related plugins to Database menu and create
Browse files Browse the repository at this point in the history
some icons in Layers toolbar (partial fix for #4395)
  • Loading branch information
alexbruy committed Dec 9, 2011
1 parent 7bf8254 commit 6280406
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
Original file line number Diff line number Diff line change
Expand Up @@ -5287,6 +5287,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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 @@ -89,7 +89,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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,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 @@ -93,7 +93,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 6280406

Please sign in to comment.