mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Fixes to PostGIS data selector
git-svn-id: http://svn.osgeo.org/qgis/trunk@217 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
ed6dc21859
commit
6e08a95191
@ -204,9 +204,10 @@ void QgisApp::about()
|
||||
abt->setURLs(urls);
|
||||
QString watsNew = "Version ";
|
||||
watsNew += qgisVersion;
|
||||
watsNew += "\n*Fixes to project save/open support\n"
|
||||
"*Enhancements to plugin tests\n"
|
||||
"*Fixes to build system\n";
|
||||
watsNew += "\n*Preliminary Plugin Manager implementation\n"
|
||||
"*Fix for PostGIS bug when srid != -1\n"
|
||||
"*Database Connections can now be deleted\n"
|
||||
"*Fixes to Database Connection dialog\n";
|
||||
|
||||
|
||||
abt->setWhatsNew(watsNew);
|
||||
|
@ -31,14 +31,7 @@
|
||||
|
||||
QgsDbSourceSelect::QgsDbSourceSelect(QWidget *parent, const char *name):QgsDbSourceSelectBase()
|
||||
{
|
||||
QSettings settings;
|
||||
QStringList keys = settings.subkeyList("/Qgis/connections");
|
||||
QStringList::Iterator it = keys.begin();
|
||||
while (it != keys.end()) {
|
||||
cmbConnections->insertItem(*it);
|
||||
|
||||
++it;
|
||||
}
|
||||
populateConnectionList();
|
||||
// connect the double-click signal to the addSingleLayer slot in the parent
|
||||
|
||||
|
||||
@ -46,6 +39,18 @@ QgsDbSourceSelect::QgsDbSourceSelect(QWidget *parent, const char *name):QgsDbSou
|
||||
|
||||
QgsDbSourceSelect::~QgsDbSourceSelect()
|
||||
{
|
||||
}
|
||||
void QgsDbSourceSelect::populateConnectionList(){
|
||||
QSettings settings;
|
||||
QStringList keys = settings.subkeyList("/Qgis/connections");
|
||||
QStringList::Iterator it = keys.begin();
|
||||
cmbConnections->clear();
|
||||
while (it != keys.end()) {
|
||||
cmbConnections->insertItem(*it);
|
||||
|
||||
++it;
|
||||
}
|
||||
|
||||
}
|
||||
void QgsDbSourceSelect::addNewConnection()
|
||||
{
|
||||
@ -53,6 +58,7 @@ void QgsDbSourceSelect::addNewConnection()
|
||||
QgsNewConnection *nc = new QgsNewConnection();
|
||||
|
||||
if (nc->exec()) {
|
||||
populateConnectionList();
|
||||
}
|
||||
}
|
||||
void QgsDbSourceSelect::editConnection()
|
||||
@ -64,6 +70,24 @@ void QgsDbSourceSelect::editConnection()
|
||||
nc->saveConnection();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsDbSourceSelect::deleteConnection(){
|
||||
QSettings settings;
|
||||
QString key = "/Qgis/connections/" + cmbConnections->currentText();
|
||||
QString msg = "Are you sure you want to remove the " + cmbConnections->currentText() + " connection and all associated settings?";
|
||||
int result = QMessageBox::information(this, "Confirm Delete", msg, "Yes", "No");
|
||||
if(result == 0){
|
||||
settings.removeEntry(key + "/host");
|
||||
settings.removeEntry(key + "/database");
|
||||
settings.removeEntry(key + "/username");
|
||||
settings.removeEntry(key + "/password");
|
||||
//if(!success){
|
||||
// QMessageBox::information(this,"Unable to Remove","Unable to remove the connection " + cmbConnections->currentText());
|
||||
//}
|
||||
cmbConnections->removeItem(cmbConnections->currentItem());// populateConnectionList();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsDbSourceSelect::addTables()
|
||||
{
|
||||
//store the table info
|
||||
|
@ -36,6 +36,10 @@ class QgsDbSourceSelect : public QgsDbSourceSelectBase
|
||||
void addNewConnection();
|
||||
//! Opens a dialog to edit an existing connection
|
||||
void editConnection();
|
||||
//! Deletes the selected connection
|
||||
void deleteConnection();
|
||||
//! Populate the connection list combo box
|
||||
void populateConnectionList();
|
||||
//! Determines the tables the user selected and closes the dialog
|
||||
void addTables();
|
||||
/*! Connects to the database using the stored connection parameters.
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
|
||||
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
|
||||
<class>QgsDbSourceSelectBase</class>
|
||||
<widget class="QDialog">
|
||||
<property name="name">
|
||||
@ -8,7 +8,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>305</width>
|
||||
<width>327</width>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -56,7 +56,7 @@
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<number>0</number>
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
@ -73,7 +73,7 @@
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<number>0</number>
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
@ -87,7 +87,7 @@
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<number>4144</number>
|
||||
<string>F1</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
@ -112,54 +112,6 @@
|
||||
</spacer>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>GroupBox1</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Connection Information</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QComboBox" row="0" column="0" rowspan="1" colspan="3">
|
||||
<property name="name">
|
||||
<cstring>cmbConnections</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>btnConnect</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>btnEdit</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>btnNew</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>TextLabel3_2_2</cstring>
|
||||
@ -181,6 +133,62 @@
|
||||
<enum>Extended</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>GroupBox1</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Connection Information</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QComboBox" row="0" column="0" rowspan="1" colspan="4">
|
||||
<property name="name">
|
||||
<cstring>cmbConnections</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>btnConnect</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>btnNew</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>btnEdit</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="3">
|
||||
<property name="name">
|
||||
<cstring>btnDelete</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<connections>
|
||||
@ -214,6 +222,12 @@
|
||||
<receiver>QgsDbSourceSelectBase</receiver>
|
||||
<slot>editConnection()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>btnDelete</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QgsDbSourceSelectBase</receiver>
|
||||
<slot>deleteConnection()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<tabstops>
|
||||
<tabstop>cmbConnections</tabstop>
|
||||
@ -229,11 +243,12 @@
|
||||
<include location="local" impldecl="in implementation">qgsdbsourceselectbase.ui.h</include>
|
||||
</includes>
|
||||
<slots>
|
||||
<slot>addNewConnection()</slot>
|
||||
<slot>addTables()</slot>
|
||||
<slot>dbConnect()</slot>
|
||||
<slot>init()</slot>
|
||||
<slot>dbConnect()</slot>
|
||||
<slot>addTables()</slot>
|
||||
<slot>addNewConnection()</slot>
|
||||
<slot>editConnection()</slot>
|
||||
<slot>deleteConnection()</slot>
|
||||
</slots>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
||||
|
@ -31,4 +31,9 @@ void QgsDbSourceSelectBase::addNewConnection()
|
||||
void QgsDbSourceSelectBase::editConnection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void QgsDbSourceSelectBase::deleteConnection()
|
||||
{
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user