Skip to content
Permalink
Browse files
#9191: fix enable/disable issues of buttons
At the http connection dialog, the 'Name' and 'Url' text boxes must be
filled to enable 'ok' button.
Also disable connect-edit-delete buttons when there is not any
connection defined.
  • Loading branch information
ahuarte47 committed Dec 16, 2013
1 parent b192f64 commit 57e9411f263b682489fc61c5755423bfdcfeed2a
@@ -141,7 +141,12 @@ QgsNewHttpConnection::~QgsNewHttpConnection()

void QgsNewHttpConnection::on_txtName_textChanged( const QString &text )
{
buttonBox->button( QDialogButtonBox::Ok )->setDisabled( text.isEmpty() );
buttonBox->button( QDialogButtonBox::Ok )->setDisabled( txtName->text().isEmpty() || txtUrl->text().isEmpty() );
}

void QgsNewHttpConnection::on_txtUrl_textChanged( const QString &text )
{
buttonBox->button( QDialogButtonBox::Ok )->setDisabled( txtName->text().isEmpty() || txtUrl->text().isEmpty() );
}

void QgsNewHttpConnection::accept()
@@ -38,6 +38,8 @@ class GUI_EXPORT QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpCo

void on_txtName_textChanged( const QString & );

void on_txtUrl_textChanged( const QString & );

void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }

private:
@@ -239,21 +239,6 @@ void QgsOWSSourceSelect::populateConnectionList()
mConnectionsComboBox->addItems( QgsOWSConnection::connectionList( mService ) );

setConnectionListPosition();

if ( mConnectionsComboBox->count() == 0 )
{
// No connections - disable various buttons
mConnectButton->setEnabled( false );
mEditButton->setEnabled( false );
mDeleteButton->setEnabled( false );
}
else
{
// Connections - enable various buttons
mConnectButton->setEnabled( true );
mEditButton->setEnabled( true );
mDeleteButton->setEnabled( true );
}
}
void QgsOWSSourceSelect::on_mNewButton_clicked()
{
@@ -546,6 +531,22 @@ void QgsOWSSourceSelect::setConnectionListPosition()
else
mConnectionsComboBox->setCurrentIndex( mConnectionsComboBox->count() - 1 );
}

if ( mConnectionsComboBox->count() == 0 )
{
// No connections - disable various buttons
mConnectButton->setEnabled( false );
mEditButton->setEnabled( false );
mDeleteButton->setEnabled( false );
}
else
{
// Connections - enable various buttons
mConnectButton->setEnabled( true );
mEditButton->setEnabled( true );
mDeleteButton->setEnabled( true );
}

QgsOWSConnection::setSelectedConnection( mService, mConnectionsComboBox->currentText() );
}

@@ -303,6 +303,21 @@ void QgsWFSSourceSelect::deleteEntryOfServerList()
QgsOWSConnection::deleteConnection( "WFS", cmbConnections->currentText() );
cmbConnections->removeItem( cmbConnections->currentIndex() );
emit connectionsChanged();

if ( cmbConnections->count() > 0 )
{
// Connections available - enable various buttons
btnConnect->setEnabled( true );
btnEdit->setEnabled( true );
btnDelete->setEnabled( true );
}
else
{
// No connections available - disable various buttons
btnConnect->setEnabled( false );
btnEdit->setEnabled( false );
btnDelete->setEnabled( false );
}
}
}

@@ -164,21 +164,6 @@ void QgsWMSSourceSelect::populateConnectionList()
cmbConnections->addItems( QgsWMSConnection::connectionList() );

setConnectionListPosition();

if ( cmbConnections->count() == 0 )
{
// No connections - disable various buttons
btnConnect->setEnabled( false );
btnEdit->setEnabled( false );
btnDelete->setEnabled( false );
}
else
{
// Connections - enable various buttons
btnConnect->setEnabled( true );
btnEdit->setEnabled( true );
btnDelete->setEnabled( true );
}
}
void QgsWMSSourceSelect::on_btnNew_clicked()
{
@@ -214,7 +199,7 @@ void QgsWMSSourceSelect::on_btnDelete_clicked()
if ( result == QMessageBox::Ok )
{
QgsWMSConnection::deleteConnection( cmbConnections->currentText() );
cmbConnections->removeItem( cmbConnections->currentIndex() ); // populateConnectionList();
cmbConnections->removeItem( cmbConnections->currentIndex() );
setConnectionListPosition();
emit connectionsChanged();
}
@@ -1024,6 +1009,21 @@ void QgsWMSSourceSelect::setConnectionListPosition()
else
cmbConnections->setCurrentIndex( cmbConnections->count() - 1 );
}

if ( cmbConnections->count() == 0 )
{
// No connections - disable various buttons
btnConnect->setEnabled( false );
btnEdit->setEnabled( false );
btnDelete->setEnabled( false );
}
else
{
// Connections - enable various buttons
btnConnect->setEnabled( true );
btnEdit->setEnabled( true );
btnDelete->setEnabled( true );
}
}

void QgsWMSSourceSelect::showStatusMessage( QString const &theMessage )

0 comments on commit 57e9411

Please sign in to comment.