Re-enable the settings dialog buttons after authentication even if you've switched to another tab before pressing Ok. Fixes issue #725

This commit is contained in:
David Sansome 2010-09-13 21:40:50 +00:00
parent b9699c690f
commit d08389bb9d
2 changed files with 7 additions and 2 deletions

View File

@ -28,7 +28,8 @@
LastFMConfig::LastFMConfig(QWidget *parent) LastFMConfig::LastFMConfig(QWidget *parent)
: QWidget(parent), : QWidget(parent),
service_(static_cast<LastFMService*>(RadioModel::ServiceByName("Last.fm"))), service_(static_cast<LastFMService*>(RadioModel::ServiceByName("Last.fm"))),
ui_(new Ui_LastFMConfig) ui_(new Ui_LastFMConfig),
waiting_for_auth_(false)
{ {
ui_->setupUi(this); ui_->setupUi(this);
ui_->busy->hide(); ui_->busy->hide();
@ -53,15 +54,17 @@ bool LastFMConfig::NeedsValidation() const {
void LastFMConfig::Validate() { void LastFMConfig::Validate() {
ui_->busy->show(); ui_->busy->show();
waiting_for_auth_ = true;
service_->Authenticate(ui_->username->text(), ui_->password->text()); service_->Authenticate(ui_->username->text(), ui_->password->text());
} }
void LastFMConfig::AuthenticationComplete(bool success) { void LastFMConfig::AuthenticationComplete(bool success) {
if (!ui_->busy->isVisible()) if (!waiting_for_auth_)
return; // Wasn't us that was waiting for auth return; // Wasn't us that was waiting for auth
ui_->busy->hide(); ui_->busy->hide();
waiting_for_auth_ = false;
if (success) { if (success) {
ui_->username->setText(lastfm::ws::Username); ui_->username->setText(lastfm::ws::Username);

View File

@ -46,6 +46,8 @@ class LastFMConfig : public QWidget {
private: private:
LastFMService* service_; LastFMService* service_;
Ui_LastFMConfig* ui_; Ui_LastFMConfig* ui_;
bool waiting_for_auth_;
}; };
#endif // LASTFMCONFIG_H #endif // LASTFMCONFIG_H