Skip to content
Permalink
Browse files

[Fix #7806] Be more verbose in "invalid layer" dialog

  • Loading branch information
m-kuhn committed May 17, 2013
1 parent df19fe5 commit 5009aad255537d2bd708f72682264ea88eba701e
Showing with 24 additions and 18 deletions.
  1. +22 −18 src/app/qgisapp.cpp
  2. +2 −0 src/providers/postgres/qgspostgresprovider.cpp
@@ -624,8 +624,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
QString myPaths = settings.value( "plugins/searchPathsForPlugins", "" ).toString();
if ( !myPaths.isEmpty() )
{
QStringList myPathList = myPaths.split( "|" );
QgsPluginRegistry::instance()->restoreSessionPlugins( myPathList );
QStringList myPathList = myPaths.split( "|" );
QgsPluginRegistry::instance()->restoreSessionPlugins( myPathList );
}
}

@@ -981,7 +981,7 @@ void QgisApp::createActions()
connect( mActionAddWmsLayer, SIGNAL( triggered() ), this, SLOT( addWmsLayer() ) );
connect( mActionAddWcsLayer, SIGNAL( triggered() ), this, SLOT( addWcsLayer() ) );
connect( mActionAddWfsLayer, SIGNAL( triggered() ), this, SLOT( addWfsLayer() ) );
connect( mActionAddDelimitedText, SIGNAL( triggered()), this, SLOT(addDelimitedTextLayer()));
connect( mActionAddDelimitedText, SIGNAL( triggered() ), this, SLOT( addDelimitedTextLayer() ) );
connect( mActionOpenTable, SIGNAL( triggered() ), this, SLOT( attributeTable() ) );
connect( mActionOpenFieldCalc, SIGNAL( triggered() ), this, SLOT( fieldCalculator() ) );
connect( mActionToggleEditing, SIGNAL( triggered() ), this, SLOT( toggleEditing() ) );
@@ -2934,7 +2934,11 @@ void QgisApp::addDatabaseLayers( QStringList const & layerPathList, QString cons
else
{
QgsMessageLog::logMessage( tr( "%1 is an invalid layer - not loaded" ).arg( layerPath ) );
QMessageBox::critical( this, tr( "Invalid Layer" ), tr( "%1 is an invalid layer and cannot be loaded." ).arg( layerPath ) );
QLabel* msgLabel = new QLabel( tr( "%1 is an invalid layer and cannot be loaded. Please check the <a href=\"#messageLog\">message log</a> for further info." ).arg( layerPath ), messageBar() );
msgLabel->setWordWrap( true );
connect( msgLabel, SIGNAL( linkActivated( QString ) ), mLogDock, SLOT( show() ) );
messageBar()->pushWidget( msgLabel,
QgsMessageBar::WARNING );
delete layer;
}
//qWarning("incrementing iterator");
@@ -4275,22 +4279,22 @@ void QgisApp::labeling()

void QgisApp::fieldCalculator()
{
if ( mMapCanvas && mMapCanvas->isDrawing() )
{
return;
}
if ( mMapCanvas && mMapCanvas->isDrawing() )
{
return;
}

QgsVectorLayer *myLayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
if ( !myLayer )
{
return;
}
QgsVectorLayer *myLayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
if ( !myLayer )
{
return;
}

QgsFieldCalculator calc( myLayer );
if ( calc.exec() )
{
mMapCanvas->refresh();
}
QgsFieldCalculator calc( myLayer );
if ( calc.exec() )
{
mMapCanvas->refresh();
}
}

void QgisApp::attributeTable()
@@ -142,6 +142,7 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
// set the primary key
if ( !determinePrimaryKey() )
{
QgsMessageLog::logMessage( tr( "PostgreSQL layer has no primary key." ), tr( "PostGIS" ) );
mValid = false;
disconnectDb();
return;
@@ -200,6 +201,7 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
}
break;
case pktUnknown:
QgsMessageLog::logMessage( tr( "PostgreSQL layer has unknown primary key type." ), tr( "PostGIS" ) );
mValid = false;
break;
}

0 comments on commit 5009aad

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