[QGIS Commit] r13593 - trunk/qgis/src/plugins/oracle_raster
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat May 29 11:21:10 EDT 2010
Author: jef
Date: 2010-05-29 11:21:09 -0400 (Sat, 29 May 2010)
New Revision: 13593
Modified:
trunk/qgis/src/plugins/oracle_raster/qgsselectgeoraster_ui.cpp
trunk/qgis/src/plugins/oracle_raster/qgsselectgeoraster_ui.h
Log:
fix #2759 and some cleanups
Modified: trunk/qgis/src/plugins/oracle_raster/qgsselectgeoraster_ui.cpp
===================================================================
--- trunk/qgis/src/plugins/oracle_raster/qgsselectgeoraster_ui.cpp 2010-05-29 13:37:51 UTC (rev 13592)
+++ trunk/qgis/src/plugins/oracle_raster/qgsselectgeoraster_ui.cpp 2010-05-29 15:21:09 UTC (rev 13593)
@@ -92,7 +92,7 @@
}
}
-void QgsOracleSelectGeoraster::addNewConnection()
+void QgsOracleSelectGeoraster::on_btnNew_clicked()
{
QgsOracleConnect *oc = new QgsOracleConnect( this, "New Connection" );
if ( oc->exec() )
@@ -101,7 +101,7 @@
}
}
-void QgsOracleSelectGeoraster::editConnection()
+void QgsOracleSelectGeoraster::on_btnEdit_clicked()
{
QgsOracleConnect *oc = new QgsOracleConnect( this, cmbConnections->currentText() );
if ( oc->exec() )
@@ -110,7 +110,7 @@
}
}
-void QgsOracleSelectGeoraster::deleteConnection()
+void QgsOracleSelectGeoraster::on_btnDelete_clicked()
{
QSettings settings;
QString key = "/Oracle/connections/" + cmbConnections->currentText();
@@ -137,6 +137,9 @@
void QgsOracleSelectGeoraster::connectToServer()
{
+ if ( cmbConnections->currentText().isEmpty() )
+ return;
+
QSettings settings;
QString key = "/Oracle/connections/" + cmbConnections->currentText();
QString username = settings.value( key + "/username" ).toString();
@@ -281,32 +284,30 @@
GDALClose( hDS );
}
-void QgsOracleSelectGeoraster::showHelp()
+void QgsOracleSelectGeoraster::on_listWidget_clicked( QModelIndex Index )
{
- // implement me
+ if ( lineEdit->text() == listWidget->currentItem()->text() )
+ {
+ showSelection( lineEdit->text() );
+ }
+ else
+ {
+ lineEdit->setText( listWidget->currentItem()->text() );
+ }
}
void QgsOracleSelectGeoraster::setConnectionListPosition()
{
+ // If possible, set the item currently displayed database
QSettings settings;
- // If possible, set the item currently displayed database
QString toSelect = settings.value( "/Oracle/connections/selected" ).toString();
- // Does toSelect exist in cmbConnections?
- bool set = false;
- for ( int i = 0; i < cmbConnections->count(); ++ i )
- {
- if ( cmbConnections->itemText( i ) == toSelect )
- {
- cmbConnections->setCurrentIndex( i );
- set = true;
- break;
- }
- }
+ cmbConnections->setCurrentIndex( cmbConnections->findText( toSelect ) );
+
// If we couldn't find the stored item, but there are some,
// default to the last item (this makes some sense when deleting
// items as it allows the user to repeatidly click on delete to
// remove a whole lot of items).
- if ( ! set && cmbConnections->count() > 0 )
+ if ( cmbConnections->currentIndex() == -1 && cmbConnections->count() > 0 )
{
// If toSelect is null, then the selected connection wasn't found
// by QSettings, which probably means that this is the first time
Modified: trunk/qgis/src/plugins/oracle_raster/qgsselectgeoraster_ui.h
===================================================================
--- trunk/qgis/src/plugins/oracle_raster/qgsselectgeoraster_ui.h 2010-05-29 13:37:51 UTC (rev 13592)
+++ trunk/qgis/src/plugins/oracle_raster/qgsselectgeoraster_ui.h 2010-05-29 15:21:09 UTC (rev 13593)
@@ -28,6 +28,7 @@
// QGIS Includes
#include <qgisinterface.h>
#include <qgsmapcanvas.h>
+#include "qgscontexthelp.h"
class QgsOracleSelectGeoraster : public QDialog, private Ui::SelectGeoRasterBase
{
@@ -42,54 +43,18 @@
QString mUri;
private:
- void addNewConnection();
- void editConnection();
- void deleteConnection();
void populateConnectionList();
void connectToServer();
- void showHelp();
void setConnectionListPosition();
void showSelection( const QString & line );
public slots:
-
- void on_btnNew_clicked()
- {
- addNewConnection();
- };
-
- void on_btnEdit_clicked()
- {
- editConnection();
- };
-
- void on_btnDelete_clicked()
- {
- deleteConnection();
- };
-
- void on_btnConnect_clicked()
- {
- connectToServer();
- };
-
- void on_listWidget_clicked( QModelIndex Index )
- {
- if ( lineEdit->text() == listWidget->currentItem()->text() )
- {
- showSelection( lineEdit->text() );
- }
- else
- {
- lineEdit->setText( listWidget->currentItem()->text() );
- }
- }
-
- void on_btnAdd_clicked()
- {
- showSelection( lineEdit->text() );
- };
-
+ void on_btnConnect_clicked() { connectToServer(); }
+ void on_btnNew_clicked();
+ void on_btnEdit_clicked();
+ void on_btnDelete_clicked();
+ void on_listWidget_clicked( QModelIndex Index );
+ void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
};
#endif
More information about the QGIS-commit
mailing list