mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[bugfix] Collapse all connection item leaves in the browser a start
To prevent unwanted connections to be initiated when QGIS launches
This commit is contained in:
parent
cf0ffefc1a
commit
28c9fee756
@ -26,8 +26,12 @@ class QgsBrowserTreeView : QTreeView
|
||||
|
||||
virtual void setModel( QAbstractItemModel *model );
|
||||
void setBrowserModel( QgsBrowserModel *model );
|
||||
%Docstring
|
||||
Set the browser model
|
||||
%End
|
||||
QgsBrowserModel *browserModel( );
|
||||
%Docstring
|
||||
Return the browser model
|
||||
:rtype: QgsBrowserModel
|
||||
%End
|
||||
virtual void showEvent( QShowEvent *e );
|
||||
|
@ -87,6 +87,7 @@ void QgsBrowserTreeView::restoreState()
|
||||
{
|
||||
QgsDebugMsgLevel( "do not expand index for path " + path, 4 );
|
||||
QModelIndex parentIndex = model()->parent( expandIndex );
|
||||
// Still we need to store the parent in order to expand it
|
||||
if ( parentIndex.isValid() )
|
||||
expandIndexSet.insert( parentIndex );
|
||||
}
|
||||
|
@ -35,7 +35,9 @@ class GUI_EXPORT QgsBrowserTreeView : public QTreeView
|
||||
QgsBrowserTreeView( QWidget *parent SIP_TRANSFERTHIS = 0 );
|
||||
|
||||
virtual void setModel( QAbstractItemModel *model ) override;
|
||||
//! Set the browser model
|
||||
void setBrowserModel( QgsBrowserModel *model );
|
||||
//! Return the browser model
|
||||
QgsBrowserModel *browserModel( ) { return mBrowserModel; }
|
||||
virtual void showEvent( QShowEvent *e ) override;
|
||||
virtual void hideEvent( QHideEvent *e ) override;
|
||||
|
@ -83,6 +83,7 @@ QgsAfsConnectionItem::QgsAfsConnectionItem( QgsDataItem *parent, const QString &
|
||||
, mUrl( url )
|
||||
{
|
||||
mIconName = QStringLiteral( "mIconConnect.png" );
|
||||
mCapabilities |= Collapse;
|
||||
}
|
||||
|
||||
QVector<QgsDataItem *> QgsAfsConnectionItem::createChildren()
|
||||
|
@ -26,7 +26,7 @@
|
||||
QgsAmsRootItem::QgsAmsRootItem( QgsDataItem *parent, QString name, QString path )
|
||||
: QgsDataCollectionItem( parent, name, path )
|
||||
{
|
||||
mCapabilities |= Fast;
|
||||
mCapabilities |= Fast | Collapse;
|
||||
mIconName = QStringLiteral( "mIconAms.svg" );
|
||||
populate();
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ QgsDb2ConnectionItem::QgsDb2ConnectionItem( QgsDataItem *parent, const QString n
|
||||
: QgsDataCollectionItem( parent, name, path )
|
||||
{
|
||||
mIconName = QStringLiteral( "mIconConnect.png" );
|
||||
mCapabilities |= Collapse;
|
||||
populate();
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ QgsMssqlConnectionItem::QgsMssqlConnectionItem( QgsDataItem *parent, QString nam
|
||||
, mAllowGeometrylessTables( true )
|
||||
, mColumnTypeThread( nullptr )
|
||||
{
|
||||
mCapabilities |= Fast;
|
||||
mCapabilities |= Fast | Collapse;
|
||||
mIconName = QStringLiteral( "mIconConnect.png" );
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ QgsOracleConnectionItem::QgsOracleConnectionItem( QgsDataItem *parent, QString n
|
||||
, mColumnTypeThread( nullptr )
|
||||
{
|
||||
mIconName = "mIconConnect.png";
|
||||
mCapabilities |= Collapse;
|
||||
}
|
||||
|
||||
QgsOracleConnectionItem::~QgsOracleConnectionItem()
|
||||
|
@ -29,6 +29,7 @@ QgsOWSConnectionItem::QgsOWSConnectionItem( QgsDataItem *parent, QString name, Q
|
||||
: QgsDataCollectionItem( parent, name, path )
|
||||
{
|
||||
mIconName = QStringLiteral( "mIconConnect.png" );
|
||||
mCapabilities |= Collapse;
|
||||
}
|
||||
|
||||
QgsOWSConnectionItem::~QgsOWSConnectionItem()
|
||||
|
@ -39,6 +39,7 @@ QgsPGConnectionItem::QgsPGConnectionItem( QgsDataItem *parent, QString name, QSt
|
||||
: QgsDataCollectionItem( parent, name, path )
|
||||
{
|
||||
mIconName = QStringLiteral( "mIconConnect.png" );
|
||||
mCapabilities |= Collapse;
|
||||
}
|
||||
|
||||
QVector<QgsDataItem *> QgsPGConnectionItem::createChildren()
|
||||
|
@ -75,6 +75,7 @@ QgsSLConnectionItem::QgsSLConnectionItem( QgsDataItem *parent, QString name, QSt
|
||||
{
|
||||
mDbPath = QgsSpatiaLiteConnection::connectionPath( name );
|
||||
mToolTip = mDbPath;
|
||||
mCapabilities |= Collapse;
|
||||
}
|
||||
|
||||
static QgsLayerItem::LayerType _layerTypeFromDb( const QString &dbType )
|
||||
|
@ -29,6 +29,7 @@ QgsWCSConnectionItem::QgsWCSConnectionItem( QgsDataItem *parent, QString name, Q
|
||||
, mUri( uri )
|
||||
{
|
||||
mIconName = QStringLiteral( "mIconWcs.svg" );
|
||||
mCapabilities |= Collapse;
|
||||
}
|
||||
|
||||
QgsWCSConnectionItem::~QgsWCSConnectionItem()
|
||||
@ -43,23 +44,23 @@ QVector<QgsDataItem *> QgsWCSConnectionItem::createChildren()
|
||||
uri.setEncodedUri( mUri );
|
||||
QgsDebugMsg( "mUri = " + mUri );
|
||||
|
||||
mCapabilities.setUri( uri );
|
||||
mWcsCapabilities.setUri( uri );
|
||||
|
||||
// Attention: supportedLayers() gives tree leafes, not top level
|
||||
if ( !mCapabilities.lastError().isEmpty() )
|
||||
if ( !mWcsCapabilities.lastError().isEmpty() )
|
||||
{
|
||||
//children.append( new QgsErrorItem( this, tr( "Failed to retrieve layers" ), mPath + "/error" ) );
|
||||
// TODO: show the error without adding child
|
||||
return children;
|
||||
}
|
||||
|
||||
Q_FOREACH ( const QgsWcsCoverageSummary &coverageSummary, mCapabilities.capabilities().contents.coverageSummary )
|
||||
Q_FOREACH ( const QgsWcsCoverageSummary &coverageSummary, mWcsCapabilities.capabilities().contents.coverageSummary )
|
||||
{
|
||||
// Attention, the name may be empty
|
||||
QgsDebugMsg( QString::number( coverageSummary.orderId ) + ' ' + coverageSummary.identifier + ' ' + coverageSummary.title );
|
||||
QString pathName = coverageSummary.identifier.isEmpty() ? QString::number( coverageSummary.orderId ) : coverageSummary.identifier;
|
||||
|
||||
QgsWCSLayerItem *layer = new QgsWCSLayerItem( this, coverageSummary.title, mPath + '/' + pathName, mCapabilities.capabilities(), uri, coverageSummary );
|
||||
QgsWCSLayerItem *layer = new QgsWCSLayerItem( this, coverageSummary.title, mPath + '/' + pathName, mWcsCapabilities.capabilities(), uri, coverageSummary );
|
||||
|
||||
children.append( layer );
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class QgsWCSConnectionItem : public QgsDataCollectionItem
|
||||
|
||||
virtual QList<QAction *> actions() override;
|
||||
|
||||
QgsWcsCapabilities mCapabilities;
|
||||
QgsWcsCapabilities mWcsCapabilities;
|
||||
QVector<QgsWcsCoverageSummary> mLayerProperties;
|
||||
|
||||
public slots:
|
||||
|
@ -46,9 +46,10 @@ QgsWfsLayerItem::~QgsWfsLayerItem()
|
||||
QgsWfsConnectionItem::QgsWfsConnectionItem( QgsDataItem *parent, QString name, QString path, QString uri )
|
||||
: QgsDataCollectionItem( parent, name, path )
|
||||
, mUri( uri )
|
||||
, mCapabilities( nullptr )
|
||||
, mWfsCapabilities( nullptr )
|
||||
{
|
||||
mIconName = QStringLiteral( "mIconWfs.svg" );
|
||||
mCapabilities |= Collapse;
|
||||
}
|
||||
|
||||
QgsWfsConnectionItem::~QgsWfsConnectionItem()
|
||||
|
@ -58,7 +58,7 @@ class QgsWfsConnectionItem : public QgsDataCollectionItem
|
||||
private:
|
||||
QString mUri;
|
||||
|
||||
QgsWfsCapabilities *mCapabilities = nullptr;
|
||||
QgsWfsCapabilities *mWfsCapabilities = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user