3 #include <QApplication>
4 #include <QDomDocument>
21 QgsDebugMsg( QString(
"%1 bad layers found" ).arg( layers.size() ) );
24 QApplication::setOverrideCursor( Qt::ArrowCursor );
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 );
45 if ( messageBox.clickedButton() == okButton )
47 QgsDebugMsg(
"want to find missing layers is true" );
55 else if ( messageBox.clickedButton() == ignoreButton )
64 QApplication::restoreOverrideCursor();
69 QString type = layerNode.toElement().attribute(
"type" );
71 if ( QString::null == type )
78 if (
"raster" == type )
84 else if (
"vector" == type )
99 QDomNode dataSourceNode = layerNode.namedItem(
"datasource" );
101 if ( dataSourceNode.isNull() )
105 return QString::null;
108 return dataSourceNode.toElement().text();
127 if ( ds.contains(
"host=" ) )
131 #ifdef HAVE_POSTGRESQL
132 else if ( ds.contains(
"dbname=" ) )
159 QDomNode dataSourceNode = layerNode.namedItem(
"datasource" );
160 QDomElement dataSourceElement = dataSourceNode.toElement();
161 QDomText dataSourceText = dataSourceElement.firstChild().toText();
163 QgsDebugMsg(
"datasource changed from " + dataSourceText.data() );
165 dataSourceText.setData( dataSource );
179 QFileInfo originalDataSource(
dataSource( layerNode ) );
181 QString memoryQualifier;
188 memoryQualifier =
"lastVectorFileFilter";
194 memoryQualifier =
"lastRasterFileFilter";
208 QString myFileFilters = originalDataSource.fileName() +
";;" + fileFilters;
210 QStringList selectedFiles;
212 QString title = QObject::tr(
"Where is '%1' (original location: %2)?" )
213 .arg( originalDataSource.fileName() )
214 .arg( originalDataSource.absoluteFilePath() );
223 if ( selectedFiles.isEmpty() )
244 QDomNode & layerNode =
const_cast<QDomNode&
>( constLayerNode );
276 for ( QList<QDomNode>::const_iterator i = layerNodes.begin();
277 i != layerNodes.end();