From d08389bb9d6f1146cfb63a7590e474c551f1eeff Mon Sep 17 00:00:00 2001 From: David Sansome Date: Mon, 13 Sep 2010 21:40:50 +0000 Subject: [PATCH] Re-enable the settings dialog buttons after authentication even if you've switched to another tab before pressing Ok. Fixes issue #725 --- src/radio/lastfmconfig.cpp | 7 +++++-- src/radio/lastfmconfig.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/radio/lastfmconfig.cpp b/src/radio/lastfmconfig.cpp index 7582f4382..c63e3fa81 100644 --- a/src/radio/lastfmconfig.cpp +++ b/src/radio/lastfmconfig.cpp @@ -28,7 +28,8 @@ LastFMConfig::LastFMConfig(QWidget *parent) : QWidget(parent), service_(static_cast(RadioModel::ServiceByName("Last.fm"))), - ui_(new Ui_LastFMConfig) + ui_(new Ui_LastFMConfig), + waiting_for_auth_(false) { ui_->setupUi(this); ui_->busy->hide(); @@ -53,15 +54,17 @@ bool LastFMConfig::NeedsValidation() const { void LastFMConfig::Validate() { ui_->busy->show(); + waiting_for_auth_ = true; service_->Authenticate(ui_->username->text(), ui_->password->text()); } void LastFMConfig::AuthenticationComplete(bool success) { - if (!ui_->busy->isVisible()) + if (!waiting_for_auth_) return; // Wasn't us that was waiting for auth ui_->busy->hide(); + waiting_for_auth_ = false; if (success) { ui_->username->setText(lastfm::ws::Username); diff --git a/src/radio/lastfmconfig.h b/src/radio/lastfmconfig.h index eac2997c9..967722f54 100644 --- a/src/radio/lastfmconfig.h +++ b/src/radio/lastfmconfig.h @@ -46,6 +46,8 @@ class LastFMConfig : public QWidget { private: LastFMService* service_; Ui_LastFMConfig* ui_; + + bool waiting_for_auth_; }; #endif // LASTFMCONFIG_H