Skip to content

Commit

Permalink
Only one list of typenames for data providers
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6843 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 29, 2007
1 parent 5b4484d commit e34d6a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 25 deletions.
13 changes: 3 additions & 10 deletions src/app/qgsaddattrdialog.cpp
Expand Up @@ -25,17 +25,10 @@ QgsAddAttrDialog::QgsAddAttrDialog(QgsVectorDataProvider* provider, QWidget *par
connect(mOkButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(mCancelButton, SIGNAL(clicked()), this, SLOT(reject()));

//fill data types into the combo box

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

for(QSet<QString>::const_iterator it = numlist.constBegin(); it != numlist.constEnd(); ++it)
{
mTypeBox->insertItem(*it);
}
for(QSet<QString>::const_iterator it = anumlist.constBegin(); it != anumlist.constEnd(); ++it)
for(QSet<QString>::const_iterator it = typelist.constBegin(); it != typelist.constEnd(); ++it)
{
mTypeBox->insertItem(*it);
}
Expand Down
12 changes: 3 additions & 9 deletions src/core/qgsvectordataprovider.h
Expand Up @@ -268,11 +268,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
QgsAttributeList allAttributesList();

/**Returns the names of the numerical types*/
const QSet<QString> numericalTypes() const {return mNumericalTypes;}

/**Returns the names of the non numerical types*/
const QSet<QString> nonNumericalTypes() const {return mNonNumericalTypes;}

const QSet<QString>& supportedNativeTypes() const {return mSupportedNativeTypes;}

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

/**The names of the numerical types*/
QSet<QString> mNumericalTypes;
/**The names of the non-numerical types*/
QSet<QString> mNonNumericalTypes;
/**The names of the providers native types*/
QSet<QString> mSupportedNativeTypes;
};

#endif
12 changes: 6 additions & 6 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -291,12 +291,12 @@ QgsPostgresProvider::QgsPostgresProvider(QString const & uri)
//--std::cout << "Connection to database failed\n";
}

//fill type names into the sets
mNumericalTypes.insert("double precision");
mNumericalTypes.insert("int4");
mNumericalTypes.insert("int8");
mNonNumericalTypes.insert("text");
mNonNumericalTypes.insert("varchar(30)");
//fill type names into sets
mSupportedNativeTypes.insert("double precision");
mSupportedNativeTypes.insert("int4");
mSupportedNativeTypes.insert("int8");
mSupportedNativeTypes.insert("text");
mSupportedNativeTypes.insert("varchar(30)");

if (primaryKey.isEmpty())
{
Expand Down

0 comments on commit e34d6a4

Please sign in to comment.