125 changes: 0 additions & 125 deletions src/plugins/delimited_text/delimitedText.svg

This file was deleted.

Binary file removed src/plugins/delimited_text/delimited_text.png
Binary file not shown.
5 changes: 0 additions & 5 deletions src/plugins/delimited_text/delimited_text.qrc

This file was deleted.

229 changes: 0 additions & 229 deletions src/plugins/delimited_text/qgsdelimitedtextplugin.cpp

This file was deleted.

97 changes: 0 additions & 97 deletions src/plugins/delimited_text/qgsdelimitedtextplugin.h

This file was deleted.

8 changes: 4 additions & 4 deletions src/providers/delimitedtext/qgsdelimitedtextfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ QgsDelimitedTextFile::QgsDelimitedTextFile( QString url ) :
mEncoding( "UTF-8" ),
mFile( 0 ),
mStream( 0 ),
mUseWatcher( true ),
mUseWatcher( false ),
mWatcher( 0 ),
mDefinitionValid( false ),
mUseHeader( true ),
Expand Down Expand Up @@ -153,9 +153,9 @@ bool QgsDelimitedTextFile::setFromUrl( QUrl &url )
}

//
if ( url.hasQueryItem( "useWatcher" ) )
if ( url.hasQueryItem( "watchFile" ) )
{
mUseWatcher = ! url.queryItemValue( "useWatcher" ).toUpper().startsWith( 'N' );;
mUseWatcher = ! url.queryItemValue( "watchFile" ).toUpper().startsWith( 'N' );;
}

// The default type is csv, to be consistent with the
Expand Down Expand Up @@ -264,7 +264,7 @@ QUrl QgsDelimitedTextFile::url()
url.addQueryItem( "encoding", mEncoding );
}

if( ! mUseWatcher ) url.addQueryItem( "useWatcher", "no");
if( mUseWatcher ) url.addQueryItem( "watchFile", "yes");

url.addQueryItem( "type", type() );
if ( mType == DelimTypeRegexp )
Expand Down
32 changes: 28 additions & 4 deletions src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "qgsdelimitedtextprovider.h"
#include "qgsdelimitedtextfile.h"

#include <QButtonGroup>
#include <QFile>
#include <QFileDialog>
#include <QFileInfo>
Expand Down Expand Up @@ -52,11 +53,24 @@ QgsDelimitedTextSourceSelect::QgsDelimitedTextSourceSelect( QWidget * parent, Qt
buttonBox->button( QDialogButtonBox::Ok )->hide();
}

bgFileFormat=new QButtonGroup(this);
bgFileFormat->addButton(delimiterCSV,swFileFormat->indexOf( swpCSVOptions));
bgFileFormat->addButton(delimiterChars,swFileFormat->indexOf( swpDelimOptions));
bgFileFormat->addButton(delimiterRegexp,swFileFormat->indexOf( swpRegexpOptions));

bgGeomType=new QButtonGroup(this);
bgGeomType->addButton(geomTypeXY,swGeomType->indexOf( swpGeomXY));
bgGeomType->addButton(geomTypeWKT,swGeomType->indexOf( swpGeomWKT));
bgGeomType->addButton(geomTypeNone,swGeomType->indexOf( swpGeomNone));

connect( bgFileFormat, SIGNAL(buttonClicked(int)), swFileFormat, SLOT(setCurrentIndex(int)));
connect( bgGeomType, SIGNAL(buttonClicked(int)),swGeomType,SLOT(setCurrentIndex(int)));

cmbEncoding->clear();
cmbEncoding->addItems( QgsVectorDataProvider::availableEncodings() );
cmbEncoding->setCurrentIndex( cmbEncoding->findText( "UTF-8" ) );
loadSettings();

loadSettings();
updateFieldsAndEnable();

connect( txtFilePath, SIGNAL( textChanged( QString ) ), this, SLOT( updateFileName() ) );
Expand Down Expand Up @@ -173,6 +187,10 @@ void QgsDelimitedTextSourceSelect::on_buttonBox_accepted()
url.addQueryItem( "geomType", "none" );
}

if( ! geomTypeNone->isChecked()) url.addQueryItem( "spatialIndex", cbxSpatialIndex->isChecked() ? "yes" : "no" );
url.addQueryItem( "subsetIndex", cbxSubsetIndex->isChecked() ? "yes" : "no" );
url.addQueryItem( "watchFile", cbxWatchFile->isChecked() ? "yes" : "no" );

// store the settings
saveSettings();
saveSettingsForFile( txtFilePath->text() );
Expand Down Expand Up @@ -242,6 +260,7 @@ void QgsDelimitedTextSourceSelect::loadSettings( QString subkey, bool loadGeomSe
{
delimiterCSV->setChecked( true );
}
swFileFormat->setCurrentIndex( bgFileFormat->checkedId() );

QString encoding = settings.value( key + "/encoding", "" ).toString();
if ( ! encoding.isEmpty() ) cmbEncoding->setCurrentIndex( cmbEncoding->findText( encoding ) );
Expand All @@ -259,6 +278,9 @@ void QgsDelimitedTextSourceSelect::loadSettings( QString subkey, bool loadGeomSe
cbxTrimFields->setChecked( settings.value( key + "/trimFields", "false" ) == "true" );
cbxSkipEmptyFields->setChecked( settings.value( key + "/skipEmptyFields", "false" ) == "true" );
cbxPointIsComma->setChecked( settings.value( key + "/decimalPoint", "." ).toString().contains( "," ) );
cbxSubsetIndex->setChecked( settings.value( key + "/subsetIndex", "false" ) == "true" );
cbxSpatialIndex->setChecked( settings.value( key + "/spatialIndex", "false" ) == "true" );
cbxWatchFile->setChecked( settings.value( key + "/watchFile", "false" ) == "true" );

if ( loadGeomSettings )
{
Expand All @@ -267,6 +289,7 @@ void QgsDelimitedTextSourceSelect::loadSettings( QString subkey, bool loadGeomSe
else if ( geomColumnType == "wkt" ) geomTypeWKT->setChecked( true );
else geomTypeNone->setChecked( true );
cbxXyDms->setChecked( settings.value( key + "/xyDms", "false" ) == "true" );
swGeomType->setCurrentIndex( bgGeomType->checkedId() );
}

}
Expand Down Expand Up @@ -294,6 +317,9 @@ void QgsDelimitedTextSourceSelect::saveSettings( QString subkey, bool saveGeomSe
settings.setValue( key + "/trimFields", cbxTrimFields->isChecked() ? "true" : "false" );
settings.setValue( key + "/skipEmptyFields", cbxSkipEmptyFields->isChecked() ? "true" : "false" );
settings.setValue( key + "/decimalPoint", cbxPointIsComma->isChecked() ? "," : "." );
settings.setValue( key + "/subsetIndex", cbxSubsetIndex->isChecked() ? "true" : "false");
settings.setValue( key + "/spatialIndex", cbxSpatialIndex->isChecked() ? "true" : "false");
settings.setValue( key + "/watchFile", cbxWatchFile->isChecked() ? "true" : "false");
if ( saveGeomSettings )
{
QString geomColumnType = "none";
Expand Down Expand Up @@ -368,8 +394,6 @@ void QgsDelimitedTextSourceSelect::updateFieldLists()
cmbYField->clear();
cmbWktField->clear();

frmGeometry->setEnabled( false );

// clear the sample text box
tblSample->clear();
tblSample->setColumnCount( 0 );
Expand Down Expand Up @@ -529,10 +553,10 @@ void QgsDelimitedTextSourceSelect::updateFieldLists()
( cmbXField->currentIndex() >= 0 && cmbYField->currentIndex() >= 0 ) );
geomTypeXY->setChecked( isXY );
geomTypeWKT->setChecked( ! isXY );
swGeomType->setCurrentIndex( bgGeomType->checkedId() );

if ( haveFields )
{
frmGeometry->setEnabled( true );
connect( cmbXField, SIGNAL( currentIndexChanged( int ) ), this, SLOT( enableAccept() ) );
connect( cmbYField, SIGNAL( currentIndexChanged( int ) ), this, SLOT( enableAccept() ) );
connect( cmbWktField, SIGNAL( currentIndexChanged( int ) ), this, SLOT( enableAccept() ) );
Expand Down
3 changes: 3 additions & 0 deletions src/providers/delimitedtext/qgsdelimitedtextsourceselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgscontexthelp.h"
#include "qgisgui.h"

class QButtonGroup;
class QgisInterface;
class QgsDelimitedTextFile;

Expand Down Expand Up @@ -53,6 +54,8 @@ class QgsDelimitedTextSourceSelect : public QDialog, private Ui::QgsDelimitedTex
int mBadRowCount;
QString mPluginKey;
QString mLastFileType;
QButtonGroup *bgFileFormat;
QButtonGroup *bgGeomType;

private slots:
void on_buttonBox_accepted();
Expand Down
14 changes: 14 additions & 0 deletions src/ui/qgisapp.ui
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
<addaction name="mActionAddLayerSeparator"/>
<addaction name="mActionAddWcsLayer"/>
<addaction name="mActionAddWfsLayer"/>
<addaction name="mActionAddDelimitedText"/>
<addaction name="separator"/>
<addaction name="mActionCopyStyle"/>
<addaction name="mActionPasteStyle"/>
Expand Down Expand Up @@ -287,6 +288,7 @@
<addaction name="mActionAddWmsLayer"/>
<addaction name="mActionAddWcsLayer"/>
<addaction name="mActionAddWfsLayer"/>
<addaction name="mActionAddDelimitedText"/>
<addaction name="mActionNewVectorLayer"/>
<addaction name="mActionRemoveLayer"/>
</widget>
Expand Down Expand Up @@ -2087,6 +2089,18 @@ Acts on currently active editable layer</string>
<string>Open Field Calculator</string>
</property>
</action>
<action name="mActionAddDelimitedText">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionAddDelimitedTextLayer.png</normaloff>:/images/themes/default/mActionAddDelimitedTextLayer.png</iconset>
</property>
<property name="text">
<string>Add Delimited Text Layer...</string>
</property>
<property name="toolTip">
<string>Add Delimited Text Layer</string>
</property>
</action>
</widget>
<resources>
<include location="../../images/images.qrc"/>
Expand Down
1,767 changes: 856 additions & 911 deletions src/ui/qgsdelimitedtextsourceselectbase.ui

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/src/python/test_qgsdelimitedtextprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def test_027_filter_attributes(self):
def test_028_substring_test(self):
# CSV file parsing
filename='test.csv'
params={'geomType': 'none', 'subset': 'id % 2 = 1', 'type': 'csv'}
params={'geomType': 'none', 'subset': 'id % 2 = 1', 'type': 'csv' }
requests=None
runTest(filename,requests,**params)

Expand All @@ -532,7 +532,7 @@ def updatefile2( layer ):
QCoreApplication.instance().processEvents()
def deletefile( layer ):
os.remove(filename)
params={'geomType': 'none', 'type': 'csv' }
params={'geomType': 'none', 'type': 'csv', 'watchFile' : 'yes' }
requests=[
{'fid': 3},
{},
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsdelimitedtextprovider_wanted.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ def test_028_substring_test():

def test_029_file_watcher():
wanted={}
wanted['uri']=u'file://file?geomType=none&type=csv'
wanted['uri']=u'file://file?geomType=none&type=csv&watchFile=yes'
wanted['data']={
3L: {
'id': u'2',
Expand Down