[QGIS Commit] r8262 - branches/ogr-plugin-branch/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Mar 24 12:22:32 EDT 2008
Author: gcontreras
Date: 2008-03-24 12:22:32 -0400 (Mon, 24 Mar 2008)
New Revision: 8262
Modified:
branches/ogr-plugin-branch/src/app/qgsdbsourceselect.cpp
branches/ogr-plugin-branch/src/app/qgsdbsourceselect.h
Log:
added on_cmbType_activated slot to remember the last type
selected
Modified: branches/ogr-plugin-branch/src/app/qgsdbsourceselect.cpp
===================================================================
--- branches/ogr-plugin-branch/src/app/qgsdbsourceselect.cpp 2008-03-22 10:25:59 UTC (rev 8261)
+++ branches/ogr-plugin-branch/src/app/qgsdbsourceselect.cpp 2008-03-24 16:22:32 UTC (rev 8262)
@@ -48,6 +48,7 @@
setupUi(this);
btnAdd->setEnabled(false);
+
//get last connection type used
QString connType=mConnectionRegistry->selectedType();
populateConnectionList(connType);
@@ -144,6 +145,12 @@
}
/** End Autoconnected SLOTS **/
+//Remember what type was selected
+void QgsDbSourceSelect::on_cmbType_activated(int)
+{
+ dbChanged();
+}
+
// Remember which database is selected
void QgsDbSourceSelect::on_cmbConnections_activated(int)
{
@@ -251,6 +258,7 @@
for (int i = 0; i < connlist.size(); ++i)
cmbConnections->addItem(connlist.at(i));
cmbType->setCurrentIndex(cmbType->findText(type));
+
}
void QgsDbSourceSelect::addNewConnection()
{
@@ -955,9 +963,12 @@
void QgsDbSourceSelect::dbChanged()
{
// Remember which database was selected.
- QSettings settings;
+ qDebug("dbchanged");
+ mConnectionRegistry->setSelectedType(cmbType->currentText());
+ mConnectionRegistry->setSelected(cmbType->currentText(),cmbConnections->currentText());
+ /*QSettings settings;
settings.writeEntry("/PostgreSQL/connections/selected",
- cmbConnections->currentText());
+ cmbConnections->currentText());*/
}
void QgsDbSourceSelect::setConnectionListPosition()
@@ -1022,61 +1033,3 @@
}
-/*
-void QgsGeomColumnTypeThread::setConnInfo(QString s)
-{
- mConnInfo = s;
-}
-
-void QgsGeomColumnTypeThread::addGeometryColumn(QString schema, QString table, QString column)
-{
- schemas.push_back(schema);
- tables.push_back(table);
- columns.push_back(column);
-}
-
-void QgsGeomColumnTypeThread::stop()
-{
- mStopped=true;
-}
-
-void QgsGeomColumnTypeThread::getLayerTypes()
-{
- mStopped=false;
-
- PGconn *pd = PQconnectdb(mConnInfo.toLocal8Bit().data());
- if (PQstatus(pd) == CONNECTION_OK)
- {
- PQsetClientEncoding(pd, "UNICODE");
-
- for (uint i = 0; i<schemas.size(); i++)
- {
- QString query = QgsDbSourceSelect::makeGeomQuery(schemas[i],
- tables[i],
- columns[i]);
- PGresult* gresult = PQexec(pd, query.toLocal8Bit().data());
- QString type;
- if (PQresultStatus(gresult) == PGRES_TUPLES_OK) {
- QStringList types;
-
- for(int j=0; j<PQntuples(gresult); j++) {
- QString type = PQgetvalue(gresult, j, 0);
- if(type!="")
- types += type;
- }
-
- type = types.join(",");
- }
- PQclear(gresult);
-
- if(mStopped)
- break;
-
- // Now tell the layer list dialog box...
- emit setLayerType(schemas[i], tables[i], columns[i], type);
- }
- }
-
- PQfinish(pd);
-}
-*/
Modified: branches/ogr-plugin-branch/src/app/qgsdbsourceselect.h
===================================================================
--- branches/ogr-plugin-branch/src/app/qgsdbsourceselect.h 2008-03-22 10:25:59 UTC (rev 8261)
+++ branches/ogr-plugin-branch/src/app/qgsdbsourceselect.h 2008-03-24 16:22:32 UTC (rev 8262)
@@ -94,6 +94,7 @@
void on_mSearchModeComboBox_currentIndexChanged(const QString & text);
void setSql(const QModelIndex& index);
void on_btnHelp_clicked();
+ void on_cmbType_activated(int);
void on_cmbConnections_activated(int);
void setLayerType(QString schema, QString table, QString column,
QString type);
More information about the QGIS-commit
mailing list