17
bool QgsProjectBadLayerGuiHandler::mIgnore = false;
17
19
void QgsProjectBadLayerGuiHandler::handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom )
20
21
QgsDebugMsg( QString( "%1 bad layers found" ).arg( layers.size() ) );
22
23
// make sure we have arrow cursor (and not a wait cursor)
23
24
QApplication::setOverrideCursor( Qt::ArrowCursor );
25
if ( QMessageBox::Ok == QMessageBox::critical( NULL,
26
tr( "QGIS Project Read Error" ),
27
tr( "Unable to open one or more project layers\nTry to find missing layers?" ),
28
QMessageBox::Ok | QMessageBox::Cancel ) )
26
QMessageBox messageBox;
28
QAbstractButton *ignoreButton =
29
messageBox.addButton( tr( "Ignore" ), QMessageBox::ActionRole );
31
QAbstractButton *okButton = messageBox.addButton( QMessageBox :: Ok );
33
messageBox.addButton( QMessageBox :: Cancel );
35
messageBox.setWindowTitle( tr( "QGIS Project Read Error" ) );
36
messageBox.setText( tr( "Unable to open one or more project layers.\nChoose "
37
"ignore to continue loading without the missing layers. Choose cancel to "
38
"return to your pre-project load state. Choose OK to try to find the "
39
"missing layers." ) );
40
messageBox.setIcon( QMessageBox::Critical );
43
QgsProjectBadLayerGuiHandler::mIgnore = false;
45
if ( messageBox.clickedButton() == okButton )
30
47
QgsDebugMsg( "want to find missing layers is true" );
35
52
QString filter = QgsProviderRegistry::instance()->fileVectorFilters();
36
53
findLayers( filter, layers );
55
else if ( messageBox.clickedButton() == ignoreButton )
57
QgsProjectBadLayerGuiHandler::mIgnore = true;
39
64
QApplication::restoreOverrideCursor();
43
67
QgsProjectBadLayerGuiHandler::DataType QgsProjectBadLayerGuiHandler::dataType( QDomNode & layerNode )
45
69
QString type = layerNode.toElement().attribute( "type" );