Skip to content
Permalink
Browse files

Add reloadConnections to the app and expose to iface

  • Loading branch information
elpaso committed Sep 15, 2017
1 parent 91a9890 commit c1f765aadb542ac5aab57b233a3917249fd31e6f
@@ -155,6 +155,15 @@ Add a project
virtual void newProject( bool promptToSaveFlag = false ) = 0;
%Docstring
Start a blank project
%End

virtual void reloadConnections( ) = 0;
%Docstring
Triggered when connections have changed.
This calls reloadConnections in the main application and triggers a signal that is
forwarder to the GUI elements that needs to be updated (i.e. the source
select dialogs and the browser widgets)
.. versionadded:: 3.0
%End

virtual QgsMapLayer *activeLayer() = 0;
@@ -1257,14 +1266,6 @@ Get timeout for timed messages: default of 5 seconds
added in version 2.7
%End

void connectionsChanged();
%Docstring
Emitted when connections have changed, this signal is forwarded
to the GUI elements that needs to be updated (i.e. the source
select dialogs and the browser widgets)
.. versionadded:: 3.0
%End

};

/************************************************************************
@@ -933,9 +933,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh

mInternalClipboard = new QgsClipboard; // create clipboard
connect( mInternalClipboard, &QgsClipboard::changed, this, &QgisApp::clipboardChanged );
mQgisInterface = new QgisAppInterface( this ); // create the interfce
// Forward signal
connect( mQgisInterface, &QgisInterface::connectionsChanged, this, &QgisApp::connectionsChanged );
mQgisInterface = new QgisAppInterface( this ); // create the interface

#ifdef Q_OS_MAC
// action for Window menu (create before generating WindowTitleChange event))
@@ -9668,6 +9666,11 @@ bool QgisApp::setActiveLayer( QgsMapLayer *layer )
return true;
}

void QgisApp::reloadConnections()
{
emit( connectionsChanged( ) );
}


QgsVectorLayer *QgisApp::addVectorLayer( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey )
{
@@ -792,7 +792,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow


/**
* \brief dataSourceManager Open the DataSourceManager dialog/dock
* \brief dataSourceManager Open the DataSourceManager dialog
* \param pageName the page name, usually the provider name or "browser" (for the browser panel)
* or "ogr" (vector layers) or "raster" (raster layers)
*/
@@ -858,6 +858,11 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! set the active layer
bool setActiveLayer( QgsMapLayer * );

/** Reload connections emitting the connectionsChanged signal
* \since QGIS 3.0
*/
void reloadConnections();

protected:

//! Handle state changes (WindowTitleChange)
@@ -171,6 +171,11 @@ void QgisAppInterface::newProject( bool promptToSaveFlag )
qgis->fileNew( promptToSaveFlag );
}

void QgisAppInterface::reloadConnections()
{
qgis->reloadConnections( );
}

QgsMapLayer *QgisAppInterface::activeLayer()
{
return qgis->activeLayer();
@@ -81,6 +81,14 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
//! Start a new blank project
void newProject( bool promptToSaveFlag = false ) override;

/**
* Triggered by plugins when connections have changed.
* This is forwarded to the GUI elements that needs to be updated (i.e. the source
* select dialogs and the browser widgets)
* \since QGIS 3.0
*/
void reloadConnections( ) override;

//! Get pointer to the active layer (layer selected in the legend)
QgsMapLayer *activeLayer() override;

@@ -165,6 +165,15 @@ class GUI_EXPORT QgisInterface : public QObject
//! Start a blank project
virtual void newProject( bool promptToSaveFlag = false ) = 0;

/**
* Triggered when connections have changed.
* This calls reloadConnections in the main application and triggers a signal that is
* forwarder to the GUI elements that needs to be updated (i.e. the source
* select dialogs and the browser widgets)
* \since QGIS 3.0
*/
virtual void reloadConnections( ) = 0;

//! Get pointer to the active layer (layer selected in the legend)
virtual QgsMapLayer *activeLayer() = 0;

@@ -797,14 +806,6 @@ class GUI_EXPORT QgisInterface : public QObject
*/
void layerSavedAs( QgsMapLayer *l, const QString &path );

/**
* Emitted when connections have changed, this signal is forwarded
* to the GUI elements that needs to be updated (i.e. the source
* select dialogs and the browser widgets)
* \since QGIS 3.0
*/
void connectionsChanged();

};
Q_NOWARN_DEPRECATED_POP

0 comments on commit c1f765a

Please sign in to comment.
You can’t perform that action at this time.