mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
[oracle] Don't report import failures when user has cancelled import
On behalf of Faunalia, sponsored by ENEL
This commit is contained in:
parent
82be399fcb
commit
a31a1d3f13
@ -216,13 +216,15 @@ bool QgsOracleConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction
|
||||
|
||||
qApp->setOverrideCursor( Qt::WaitCursor );
|
||||
|
||||
QProgressDialog *progress = new QProgressDialog( tr( "Copying features..." ), tr( "Abort" ), 0, 0, 0 );
|
||||
QProgressDialog *progress = new QProgressDialog( tr( "Copying features..." ), tr( "Abort" ), 0, 0, nullptr );
|
||||
progress->setWindowTitle( tr( "Import layer" ) );
|
||||
progress->setWindowModality( Qt::WindowModal );
|
||||
progress->show();
|
||||
|
||||
QStringList importResults;
|
||||
bool hasError = false;
|
||||
bool cancelled = false;
|
||||
|
||||
QgsMimeDataUtils::UriList lst = QgsMimeDataUtils::decodeUriList( data );
|
||||
Q_FOREACH ( const QgsMimeDataUtils::Uri& u, lst )
|
||||
{
|
||||
@ -248,9 +250,11 @@ bool QgsOracleConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction
|
||||
QgsDebugMsgLevel( "URI " + uri.uri(), 3 );
|
||||
QgsVectorLayerImport::ImportError err;
|
||||
QString importError;
|
||||
err = QgsVectorLayerImport::importLayer( srcLayer, uri.uri(), "oracle", &srcLayer->crs(), false, &importError, false, 0, progress );
|
||||
err = QgsVectorLayerImport::importLayer( srcLayer, uri.uri(), "oracle", &srcLayer->crs(), false, &importError, false, nullptr, progress );
|
||||
if ( err == QgsVectorLayerImport::NoError )
|
||||
importResults.append( tr( "%1: OK!" ).arg( u.name ) );
|
||||
else if ( err == QgsVectorLayerImport::ErrUserCancelled )
|
||||
cancelled = true;
|
||||
else
|
||||
{
|
||||
importResults.append( QString( "%1: %2" ).arg( u.name ).arg( importError ) );
|
||||
@ -270,7 +274,12 @@ bool QgsOracleConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction
|
||||
|
||||
qApp->restoreOverrideCursor();
|
||||
|
||||
if ( hasError )
|
||||
if ( cancelled )
|
||||
{
|
||||
QMessageBox::information( nullptr, tr( "Import to Oracle database" ), tr( "Import cancelled." ) );
|
||||
refresh();
|
||||
}
|
||||
else if ( hasError )
|
||||
{
|
||||
QgsMessageOutput *output = QgsMessageOutput::createMessageOutput();
|
||||
output->setTitle( tr( "Import to Oracle database" ) );
|
||||
@ -283,6 +292,11 @@ bool QgsOracleConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction
|
||||
refresh();
|
||||
}
|
||||
|
||||
if ( state() == Populated )
|
||||
refresh();
|
||||
else
|
||||
populate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user