Attach to Core: Correctly enable OK button

Task-number: QTCREATORBUG-7683

Change-Id: I9dae6836a010e18d781a0b26eeb447470ac16a28
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Orgad Shaneh
2012-10-10 00:08:56 +02:00
committed by hjk
parent 3a097c295c
commit 67be4201dd

View File

@@ -297,9 +297,11 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
connect(d->selectRemoteCoreButton, SIGNAL(clicked()), SLOT(selectRemoteCoreFile()));
connect(d->remoteCoreFileName, SIGNAL(textChanged(QString)), SLOT(changed()));
connect(d->localCoreFileName, SIGNAL(changed(QString)), SLOT(changed()));
connect(d->kitChooser, SIGNAL(activated(int)), SLOT(changed()));
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject()));
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
changed();
}
AttachCoreDialog::~AttachCoreDialog()
@@ -321,19 +323,20 @@ bool AttachCoreDialog::isLocal() const
void AttachCoreDialog::changed()
{
bool isValid = d->kitChooser->currentIndex() >= 0
&& !localCoreFile().isEmpty();
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(isValid);
bool isValid = d->kitChooser->currentIndex() >= 0;
if (isLocal()) {
d->localCoreFileName->setVisible(true);
d->remoteCoreFileName->setVisible(false);
d->selectRemoteCoreButton->setVisible(false);
isValid &= d->localCoreFileName->isValid();
} else {
d->remoteCoreFileName->setVisible(true);
d->selectRemoteCoreButton->setVisible(true);
d->localCoreFileName->setVisible(false);
isValid &= !remoteCoreFile().isEmpty();
}
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(isValid);
}
void AttachCoreDialog::selectRemoteCoreFile()