Skip to content

Commit 7a2ce49

Browse files
committed
[addlayerbutton] Connect and forward all signals from browser to app
1 parent c188911 commit 7a2ce49

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

src/app/qgisapp.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,10 @@ void QgisApp::dataSourceManager( QString pageName )
16041604
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::addDatabaseLayers, this, &QgisApp::addDatabaseLayers );
16051605
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::replaceSelectedVectorLayer, this, &QgisApp::replaceSelectedVectorLayer );
16061606
connect( mDataSourceManagerDialog, static_cast<void ( QgsDataSourceManagerDialog::* )()>( &QgsDataSourceManagerDialog::addRasterLayer ), this, static_cast<void ( QgisApp::* )()>( &QgisApp::addRasterLayer ) );
1607+
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::handleDropUriList, this, &QgisApp::handleDropUriList );
1608+
connect( this, &QgisApp::newProject, mDataSourceManagerDialog, &QgsDataSourceManagerDialog::updateProjectHome );
1609+
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::openFile, this, &QgisApp::openFile );
1610+
16071611
}
16081612
// Try to open the dialog on a particular page
16091613
if ( ! pageName.isEmpty( ) )

src/app/qgisapp.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,14 +594,12 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
594594
//! Unregister a previously registered custom drop handler.
595595
void unregisterCustomDropHandler( QgsCustomDropHandler *handler );
596596

597-
public slots:
598-
//! Process the list of URIs that have been dropped in QGIS
599-
void handleDropUriList( const QgsMimeDataUtils::UriList &lst );
600-
601597
//! Returns the active map layer.
602598
QgsMapLayer *activeLayer();
603599

604600
public slots:
601+
//! Process the list of URIs that have been dropped in QGIS
602+
void handleDropUriList( const QgsMimeDataUtils::UriList &lst );
605603
//! Convenience function to open either a project or a layer file.
606604
void openFile( const QString &fileName );
607605
void layerTreeViewDoubleClicked( const QModelIndex &index );

src/app/qgsdatasourcemanagerdialog.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsMapCanvas *mapCanvas,
4848
mBrowserWidget->setFeatures( QDockWidget::NoDockWidgetFeatures );
4949
ui->mOptionsStackedWidget->addWidget( mBrowserWidget );
5050
mPageNames.append( QStringLiteral( "browser" ) );
51+
// Forward all browser signals
52+
connect( mBrowserWidget, &QgsBrowserDockWidget::handleDropUriList, this, &QgsDataSourceManagerDialog::handleDropUriList );
53+
connect( mBrowserWidget, &QgsBrowserDockWidget::openFile, this, &QgsDataSourceManagerDialog::openFile );
54+
connect( this, &QgsDataSourceManagerDialog::updateProjectHome, mBrowserWidget, &QgsBrowserDockWidget::updateProjectHome );
5155

5256
// VECTOR Layers (completely different interface: it's not a provider)
5357
QgsOpenVectorLayerDialog *ovl = new QgsOpenVectorLayerDialog( this, Qt::Widget, QgsProviderRegistry::WidgetMode::Embedded );

src/app/qgsdatasourcemanagerdialog.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <QDialog>
2222
#include "qgsoptionsdialogbase.h"
2323
#include "qgsguiutils.h"
24+
#include "qgsmimedatautils.h"
2425
#include "qgshelp.h"
2526

2627
class QgsBrowserDockWidget;
@@ -72,6 +73,12 @@ class QgsDataSourceManagerDialog : public QgsOptionsDialogBase
7273
void showProgress( int progress, int totalSteps );
7374
void showStatusMessage( const QString &message );
7475
void addDatabaseLayers( QStringList const &layerPathList, QString const &providerKey );
76+
//! Emitted when a file needs to be opened
77+
void openFile( const QString & );
78+
//! Emitted when drop uri list needs to be handled from the browser
79+
void handleDropUriList( const QgsMimeDataUtils::UriList & );
80+
//! Update project home directory
81+
void updateProjectHome();
7582

7683
private:
7784
//! Return the dialog from the provider

0 commit comments

Comments
 (0)