@@ -92,7 +92,7 @@ void QgsOracleSelectGeoraster::populateConnectionList()
9292 }
9393}
9494
95- void QgsOracleSelectGeoraster::addNewConnection ()
95+ void QgsOracleSelectGeoraster::on_btnNew_clicked ()
9696{
9797 QgsOracleConnect *oc = new QgsOracleConnect ( this , " New Connection" );
9898 if ( oc->exec () )
@@ -101,7 +101,7 @@ void QgsOracleSelectGeoraster::addNewConnection()
101101 }
102102}
103103
104- void QgsOracleSelectGeoraster::editConnection ()
104+ void QgsOracleSelectGeoraster::on_btnEdit_clicked ()
105105{
106106 QgsOracleConnect *oc = new QgsOracleConnect ( this , cmbConnections->currentText () );
107107 if ( oc->exec () )
@@ -110,7 +110,7 @@ void QgsOracleSelectGeoraster::editConnection()
110110 }
111111}
112112
113- void QgsOracleSelectGeoraster::deleteConnection ()
113+ void QgsOracleSelectGeoraster::on_btnDelete_clicked ()
114114{
115115 QSettings settings;
116116 QString key = " /Oracle/connections/" + cmbConnections->currentText ();
@@ -137,6 +137,9 @@ void QgsOracleSelectGeoraster::deleteConnection()
137137
138138void QgsOracleSelectGeoraster::connectToServer ()
139139{
140+ if ( cmbConnections->currentText ().isEmpty () )
141+ return ;
142+
140143 QSettings settings;
141144 QString key = " /Oracle/connections/" + cmbConnections->currentText ();
142145 QString username = settings.value ( key + " /username" ).toString ();
@@ -281,32 +284,30 @@ void QgsOracleSelectGeoraster::showSelection( const QString & line )
281284 GDALClose ( hDS );
282285}
283286
284- void QgsOracleSelectGeoraster::showHelp ( )
287+ void QgsOracleSelectGeoraster::on_listWidget_clicked ( QModelIndex Index )
285288{
286- // implement me
289+ if ( lineEdit->text () == listWidget->currentItem ()->text () )
290+ {
291+ showSelection ( lineEdit->text () );
292+ }
293+ else
294+ {
295+ lineEdit->setText ( listWidget->currentItem ()->text () );
296+ }
287297}
288298
289299void QgsOracleSelectGeoraster::setConnectionListPosition ()
290300{
291- QSettings settings;
292301 // If possible, set the item currently displayed database
302+ QSettings settings;
293303 QString toSelect = settings.value ( " /Oracle/connections/selected" ).toString ();
294- // Does toSelect exist in cmbConnections?
295- bool set = false ;
296- for ( int i = 0 ; i < cmbConnections->count (); ++ i )
297- {
298- if ( cmbConnections->itemText ( i ) == toSelect )
299- {
300- cmbConnections->setCurrentIndex ( i );
301- set = true ;
302- break ;
303- }
304- }
304+ cmbConnections->setCurrentIndex ( cmbConnections->findText ( toSelect ) );
305+
305306 // If we couldn't find the stored item, but there are some,
306307 // default to the last item (this makes some sense when deleting
307308 // items as it allows the user to repeatidly click on delete to
308309 // remove a whole lot of items).
309- if ( ! set && cmbConnections->count () > 0 )
310+ if ( cmbConnections-> currentIndex () == - 1 && cmbConnections->count () > 0 )
310311 {
311312 // If toSelect is null, then the selected connection wasn't found
312313 // by QSettings, which probably means that this is the first time
0 commit comments