Skip to content
Permalink
Browse files

fix #7865

  • Loading branch information
jef-n committed Jun 29, 2013
1 parent b697371 commit 71759760cff1c7dc01476a59da78f2e8becc1f5a
Showing with 21 additions and 9 deletions.
  1. +9 −8 src/gui/qgsnewvectorlayerdialog.cpp
  2. +11 −1 src/gui/qgsquerybuilder.cpp
  3. +1 −0 src/providers/ogr/qgsogrprovider.cpp
@@ -17,7 +17,6 @@

#include "qgsnewvectorlayerdialog.h"
#include "qgsapplication.h"
//#include "qgisapp.h" // <- for theme icons
#include "qgis.h"
#include "qgslogger.h"
#include "qgscoordinatereferencesystem.h"
@@ -38,22 +37,24 @@ QgsNewVectorLayerDialog::QgsNewVectorLayerDialog( QWidget *parent, Qt::WFlags fl
QSettings settings;
restoreGeometry( settings.value( "/Windows/NewVectorLayer/geometry" ).toByteArray() );

// TODO: do it without QgisApp
//mAddAttributeButton->setIcon( QgisApp::getThemeIcon( "/mActionNewAttribute.png" ) );
//mRemoveAttributeButton->setIcon( QgisApp::getThemeIcon( "/mActionDeleteAttribute.png" ) );
mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) );
mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) );
mTypeBox->addItem( tr( "Text data" ), "String" );
mTypeBox->addItem( tr( "Whole number" ), "Integer" );
mTypeBox->addItem( tr( "Decimal number" ), "Real" );
mTypeBox->addItem( tr( "Date" ), "Date" );

mWidth->setValidator( new QIntValidator( 1, 255, this ) );
mPrecision->setValidator( new QIntValidator( 0, 15, this ) );

mPointRadioButton->setChecked( true );
mFileFormatComboBox->addItem( tr( "ESRI Shapefile" ), "ESRI Shapefile" );
/* Disabled until provider properly supports editing the created file formats */
//mFileFormatComboBox->addItem( tr( "Comma Separated Value" ), "Comma Separated Value" );
//mFileFormatComboBox->addItem(tr( "GML"), "GML" );
//mFileFormatComboBox->addItem(tr( "Mapinfo File" ), "Mapinfo File" );
#if 0
// Disabled until provider properly supports editing the created file formats
mFileFormatComboBox->addItem( tr( "Comma Separated Value" ), "Comma Separated Value" );
mFileFormatComboBox->addItem( tr( "GML" ), "GML" );
mFileFormatComboBox->addItem( tr( "Mapinfo File" ), "Mapinfo File" );
#endif
if ( mFileFormatComboBox->count() == 1 )
{
mFileFormatComboBox->setVisible( false );
@@ -115,7 +115,15 @@ void QgsQueryBuilder::fillValues( int idx, int limit )

for ( int i = 0; i < values.size(); i++ )
{
QStandardItem *myItem = new QStandardItem( values[i].isNull() ? nullValue : values[i].toString() );
QString value;
if ( values[i].isNull() )
value = nullValue;
else if ( values[i].type() == QVariant::Date && mLayer->providerType() == "ogr" && mLayer->storageType() == "ESRI Shapefile" )
value = values[i].toDate().toString( "yyyy/MM/dd" );
else
value = values[i].toString();

QStandardItem *myItem = new QStandardItem( value );
myItem->setEditable( false );
myItem->setData( values[i], Qt::UserRole + 1 );
mModelValues->insertRow( mModelValues->rowCount(), myItem );
@@ -307,6 +315,8 @@ void QgsQueryBuilder::on_lstValues_doubleClicked( const QModelIndex &index )
QVariant value = mModelValues->data( index, Qt::UserRole + 1 );
if ( value.isNull() )
txtSQL->insertPlainText( "NULL" );
else if ( value.type() == QVariant::Date && mLayer->providerType() == "ogr" && mLayer->storageType() == "ESRI Shapefile" )
txtSQL->insertPlainText( "'" + value.toDate().toString( "yyyy/MM/dd" ) + "'" );
else if ( value.type() == QVariant::Int || value.type() == QVariant::Double || value.type() == QVariant::LongLong )
txtSQL->insertPlainText( value.toString() );
else
@@ -2019,6 +2019,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
}
else
{
QgsMessageLog::logMessage( QObject::tr( "field %1 with unsupported type %2 skipped" ).arg( it->first ).arg( fields[0] ), QObject::tr( "OGR" ) );
continue;
}

0 comments on commit 7175976

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