Skip to content
Permalink
Browse files

handle bad layer: show unfixable layer count as message bar and skip …

…dialog when list is empty.
  • Loading branch information
jef-n committed May 10, 2013
1 parent 5346c80 commit 0088f2893166ee15e556957ae51b6d14a41a7ba1
Showing with 20 additions and 1 deletion.
  1. +18 −1 src/app/qgshandlebadlayers.cpp
  2. +2 −0 src/app/qgshandlebadlayers.h
@@ -22,6 +22,7 @@
#include "qgslogger.h"
#include "qgsrasterlayer.h"
#include "qgsproviderregistry.h"
#include "qgsmessagebar.h"

#include <QDomDocument>
#include <QDomElement>
@@ -37,7 +38,18 @@ void QgsHandleBadLayersHandler::handleBadLayers( QList<QDomNode> layers, QDomDoc
{
QApplication::setOverrideCursor( Qt::ArrowCursor );
QgsHandleBadLayers *dialog = new QgsHandleBadLayers( layers, projectDom );
dialog->exec();

if ( dialog->layerCount() < layers.size() )
QgisApp::instance()->messageBar()->pushMessage(
tr( "Handle Bad layers" ),
tr( "%1 of %2 bad layers were not not fixable." )
.arg( layers.size() - dialog->layerCount() )
.arg( layers.size() ),
QgsMessageBar::WARNING, QgisApp::instance()->messageTimeout() );

if ( dialog->layerCount() > 0 )
dialog->exec();

delete dialog;
QApplication::restoreOverrideCursor();
}
@@ -357,3 +369,8 @@ void QgsHandleBadLayers::rejected()

QDialog::reject();
}

int QgsHandleBadLayers::layerCount()
{
return mLayerList->rowCount();
}
@@ -46,6 +46,8 @@ class QgsHandleBadLayers
QgsHandleBadLayers( const QList<QDomNode> &layers, const QDomDocument &dom );
~QgsHandleBadLayers();

int layerCount();

private slots:
void selectionChanged();
void browseClicked();

0 comments on commit 0088f28

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