Skip to content

Commit e34d6a4

Browse files
author
mhugent
committed
Only one list of typenames for data providers
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6843 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5b4484d commit e34d6a4

File tree

3 files changed

+12
-25
lines changed

3 files changed

+12
-25
lines changed

src/app/qgsaddattrdialog.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,10 @@ QgsAddAttrDialog::QgsAddAttrDialog(QgsVectorDataProvider* provider, QWidget *par
2525
connect(mOkButton, SIGNAL(clicked()), this, SLOT(accept()));
2626
connect(mCancelButton, SIGNAL(clicked()), this, SLOT(reject()));
2727

28-
//fill data types into the combo box
29-
30-
// TODO: [MD]
31-
const QSet<QString>& numlist=mDataProvider->numericalTypes();
32-
const QSet<QString>& anumlist=mDataProvider->nonNumericalTypes();
28+
//fill data types into the combo box
29+
const QSet<QString>& typelist=mDataProvider->supportedNativeTypes();
3330

34-
for(QSet<QString>::const_iterator it = numlist.constBegin(); it != numlist.constEnd(); ++it)
35-
{
36-
mTypeBox->insertItem(*it);
37-
}
38-
for(QSet<QString>::const_iterator it = anumlist.constBegin(); it != anumlist.constEnd(); ++it)
31+
for(QSet<QString>::const_iterator it = typelist.constBegin(); it != typelist.constEnd(); ++it)
3932
{
4033
mTypeBox->insertItem(*it);
4134
}

src/core/qgsvectordataprovider.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
268268
QgsAttributeList allAttributesList();
269269

270270
/**Returns the names of the numerical types*/
271-
const QSet<QString> numericalTypes() const {return mNumericalTypes;}
272-
273-
/**Returns the names of the non numerical types*/
274-
const QSet<QString> nonNumericalTypes() const {return mNonNumericalTypes;}
275-
271+
const QSet<QString>& supportedNativeTypes() const {return mSupportedNativeTypes;}
276272

277273
/**
278274
* Set whether provider should return also features that don't have
@@ -288,10 +284,8 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
288284
/** should provider fetch also features that don't have geometry? */
289285
bool mFetchFeaturesWithoutGeom;
290286

291-
/**The names of the numerical types*/
292-
QSet<QString> mNumericalTypes;
293-
/**The names of the non-numerical types*/
294-
QSet<QString> mNonNumericalTypes;
287+
/**The names of the providers native types*/
288+
QSet<QString> mSupportedNativeTypes;
295289
};
296290

297291
#endif

src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,12 @@ QgsPostgresProvider::QgsPostgresProvider(QString const & uri)
291291
//--std::cout << "Connection to database failed\n";
292292
}
293293

294-
//fill type names into the sets
295-
mNumericalTypes.insert("double precision");
296-
mNumericalTypes.insert("int4");
297-
mNumericalTypes.insert("int8");
298-
mNonNumericalTypes.insert("text");
299-
mNonNumericalTypes.insert("varchar(30)");
294+
//fill type names into sets
295+
mSupportedNativeTypes.insert("double precision");
296+
mSupportedNativeTypes.insert("int4");
297+
mSupportedNativeTypes.insert("int8");
298+
mSupportedNativeTypes.insert("text");
299+
mSupportedNativeTypes.insert("varchar(30)");
300300

301301
if (primaryKey.isEmpty())
302302
{

0 commit comments

Comments
 (0)