Skip to content

Commit

Permalink
Fix column translations in HANA provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mrylov committed Dec 9, 2020
1 parent f83ba17 commit 79f6176
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
14 changes: 6 additions & 8 deletions src/providers/hana/qgshanasourceselect.cpp
Expand Up @@ -36,8 +36,6 @@
#include <QStringList>
#include <QStyledItemDelegate>

using namespace std;

//! Used to create an editor for when the user tries to change the contents of a cell
QWidget *QgsHanaSourceSelectDelegate::createEditor(
QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const
Expand Down Expand Up @@ -245,9 +243,9 @@ QgsHanaSourceSelect::QgsHanaSourceSelect(
mSearchColumnComboBox->addItem( tr( "Schema" ) );
mSearchColumnComboBox->addItem( tr( "Table" ) );
mSearchColumnComboBox->addItem( tr( "Comment" ) );
mSearchColumnComboBox->addItem( tr( "Column" ) );
mSearchColumnComboBox->addItem( tr( "Spatial Type" ) );
mSearchColumnComboBox->addItem( tr( "Feature ID" ) );
mSearchColumnComboBox->addItem( tr( "Geometry column" ) );
mSearchColumnComboBox->addItem( tr( "Type" ) );
mSearchColumnComboBox->addItem( tr( "Feature id" ) );
mSearchColumnComboBox->addItem( tr( "SRID" ) );
mSearchColumnComboBox->addItem( tr( "Sql" ) );

Expand Down Expand Up @@ -433,11 +431,11 @@ void QgsHanaSourceSelect::mSearchColumnComboBox_currentIndexChanged( const QStri
{
mProxyModel.setFilterKeyColumn( QgsHanaTableModel::DbtmGeomCol );
}
else if ( text == tr( "Geometry type" ) )
else if ( text == tr( "Type" ) )
{
mProxyModel.setFilterKeyColumn( QgsHanaTableModel::DbtmGeomType );
}
else if ( text == tr( "Feature ID" ) )
else if ( text == tr( "Feature id" ) )
{
mProxyModel.setFilterKeyColumn( QgsHanaTableModel::DbtmPkCol );
}
Expand Down Expand Up @@ -547,7 +545,7 @@ void QgsHanaSourceSelect::btnConnect_clicked()
const QgsDataSourceUri uri = settings.toDataSourceUri();
bool canceled = false;

unique_ptr<QgsHanaConnection> conn( QgsHanaConnection::createConnection( uri, &canceled, nullptr ) );
std::unique_ptr<QgsHanaConnection> conn( QgsHanaConnection::createConnection( uri, &canceled, nullptr ) );
if ( !conn )
{
if ( !canceled )
Expand Down
10 changes: 5 additions & 5 deletions src/providers/hana/qgshanatablemodel.cpp
Expand Up @@ -27,10 +27,10 @@ QgsHanaTableModel::QgsHanaTableModel()
headerLabels << tr( "Table" );
headerLabels << tr( "Comment" );
headerLabels << tr( "Column" );
headerLabels << tr( "Spatial Type" );
headerLabels << tr( "Type" );
headerLabels << tr( "SRID" );
headerLabels << tr( "Feature ID" );
headerLabels << tr( "Select at ID" );
headerLabels << tr( "Feature id" );
headerLabels << tr( "Select at id" );
headerLabels << tr( "Sql" );
setHorizontalHeaderLabels( headerLabels );
}
Expand All @@ -49,7 +49,7 @@ void QgsHanaTableModel::addTableEntry( const QgsHanaLayerProperty &layerProperty
else if ( wkbType != QgsWkbTypes::NoGeometry && srid == std::numeric_limits<int>::min() )
tip = tr( "Enter a SRID into the '%1' column" ).arg( tr( "SRID" ) );
else if ( layerProperty.pkCols.size() > 1 )
tip = tr( "Select columns in the '%1' column that uniquely identify features of this layer" ).arg( tr( "Feature ID" ) );
tip = tr( "Select columns in the '%1' column that uniquely identify features of this layer" ).arg( tr( "Feature id" ) );

QStandardItem *schemaNameItem = new QStandardItem( layerProperty.schemaName );
QStandardItem *typeItem = new QStandardItem( iconForWkbType( wkbType ),
Expand Down Expand Up @@ -248,7 +248,7 @@ bool QgsHanaTableModel::setData( const QModelIndex &idx, const QVariant &value,
QSet<QString> s0( qgis::listToSet( idx.sibling( idx.row(), DbtmPkCol ).data( Qt::UserRole + 2 ).toStringList() ) );
QSet<QString> s1( qgis::listToSet( pkCols ) );
if ( s0.intersect( s1 ).isEmpty() )
tip = tr( "Select columns in the '%1' column that uniquely identify features of this layer" ).arg( tr( "Feature ID" ) );
tip = tr( "Select columns in the '%1' column that uniquely identify features of this layer" ).arg( tr( "Feature id" ) );
}

for ( int i = 0; i < DbtmColumns; i++ )
Expand Down

0 comments on commit 79f6176

Please sign in to comment.