Skip to content
Permalink
Browse files

[oracle] Fix missing items in oracle connections in browser

On behalf of Faunalia, sponsored by ENEL
  • Loading branch information
nyalldawson committed Jul 6, 2016
1 parent a31a1d3 commit f1a15e3a0b9515087e4721821720f44a2d22f7cb
@@ -668,6 +668,8 @@ void QgsDataItem::setState( State state )
mPopulated = state == Populated;

emit stateChanged( this, oldState );
if ( state == Populated )
emitDataChanged();
}

// ---------------------------------------------------------------------
@@ -30,7 +30,7 @@ QGISEXTERN bool deleteLayer( const QString& uri, QString& errCause );
// ---------------------------------------------------------------------------
QgsOracleConnectionItem::QgsOracleConnectionItem( QgsDataItem* parent, QString name, QString path )
: QgsDataCollectionItem( parent, name, path )
, mColumnTypeThread( 0 )
, mColumnTypeThread( nullptr )
{
mIconName = "mIconConnect.png";
}
@@ -47,14 +47,12 @@ void QgsOracleConnectionItem::stop()
mColumnTypeThread->stop();
mColumnTypeThread->wait();
delete mColumnTypeThread;
mColumnTypeThread = 0;
mColumnTypeThread = nullptr;
}
}

void QgsOracleConnectionItem::refresh()
{
QApplication::setOverrideCursor( Qt::WaitCursor );

stop();

Q_FOREACH ( QgsDataItem *child, mChildren )
@@ -66,17 +64,28 @@ void QgsOracleConnectionItem::refresh()
{
addChildItem( item, true );
}
}

QApplication::restoreOverrideCursor();
void QgsOracleConnectionItem::setAllAsPopulated()
{
Q_FOREACH ( QgsDataItem *child, mChildren )
{
child->setState( Populated );
}
setState( Populated );
}

QVector<QgsDataItem*> QgsOracleConnectionItem::createChildren()
{
setState( Populating );

mOwnerMap.clear();

stop();

if ( deferredDelete() )
return QVector<QgsDataItem*>();

if ( !mColumnTypeThread )
{
mColumnTypeThread = new QgsOracleColumnTypeThread( mName,
@@ -98,21 +107,26 @@ QVector<QgsDataItem*> QgsOracleConnectionItem::createChildren()
}

if ( mColumnTypeThread )
{
mColumnTypeThread->start();
}
else
{
setAllAsPopulated();
}

return QVector<QgsDataItem*>();
}

void QgsOracleConnectionItem::threadStarted()
{
QgsDebugMsgLevel( "Entering.", 3 );
qApp->setOverrideCursor( Qt::BusyCursor );
}

void QgsOracleConnectionItem::threadFinished()
{
QgsDebugMsgLevel( "Entering.", 3 );
qApp->restoreOverrideCursor();
setAllAsPopulated();
}

void QgsOracleConnectionItem::setLayerType( QgsOracleLayerProperty layerProperty )
@@ -132,6 +146,7 @@ void QgsOracleConnectionItem::setLayerType( QgsOracleLayerProperty layerProperty
if ( !ownerItem )
{
ownerItem = new QgsOracleOwnerItem( this, layerProperty.ownerName, mPath + "/" + layerProperty.ownerName );
ownerItem->setState( Populating );
QgsDebugMsgLevel( "add owner item: " + layerProperty.ownerName, 3 );
addChildItem( ownerItem, true );
mOwnerMap[ layerProperty.ownerName ] = ownerItem;
@@ -370,6 +385,8 @@ QgsOracleOwnerItem::QgsOracleOwnerItem( QgsDataItem* parent, QString name, QStri
: QgsDataCollectionItem( parent, name, path )
{
mIconName = "mIconDbOwner.png";
//not fertile, since children are created by QgsOracleConnectionItem
mCapabilities &= ~( Fertile );
}

QVector<QgsDataItem*> QgsOracleOwnerItem::createChildren()
@@ -85,6 +85,7 @@ class QgsOracleConnectionItem : public QgsDataCollectionItem
void stop();
QMap<QString, QgsOracleOwnerItem * > mOwnerMap;
QgsOracleColumnTypeThread *mColumnTypeThread;
void setAllAsPopulated();
};

class QgsOracleOwnerItem : public QgsDataCollectionItem

0 comments on commit f1a15e3

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