Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix #7865
  • Loading branch information
jef-n committed Jun 29, 2013
1 parent b697371 commit 7175976
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
17 changes: 9 additions & 8 deletions src/gui/qgsnewvectorlayerdialog.cpp
Expand Up @@ -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"
Expand All @@ -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 );
Expand Down
12 changes: 11 additions & 1 deletion src/gui/qgsquerybuilder.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7175976

Please sign in to comment.