Skip to content

Commit

Permalink
[Fix #7806] Be more verbose in "invalid layer" dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 17, 2013
1 parent df19fe5 commit 5009aad
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}

Expand Down Expand Up @@ -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() ) );
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 5009aad

Please sign in to comment.