Disable the google drive login button after starting the browser, re-enable it again when the user comes back to the Clementine window.

This commit is contained in:
David Sansome 2012-08-24 21:33:33 +01:00
parent 7ca7ecbe99
commit 78d473512d
2 changed files with 15 additions and 0 deletions

View File

@ -36,6 +36,8 @@ GoogleDriveSettingsPage::GoogleDriveSettingsPage(SettingsDialog* parent)
connect(ui_->login_button, SIGNAL(clicked()), SLOT(LoginClicked()));
connect(ui_->login_state, SIGNAL(LogoutClicked()), SLOT(LogoutClicked()));
connect(service_, SIGNAL(Connected()), SLOT(Connected()));
dialog()->installEventFilter(this);
}
GoogleDriveSettingsPage::~GoogleDriveSettingsPage() {
@ -60,6 +62,16 @@ void GoogleDriveSettingsPage::Save() {
void GoogleDriveSettingsPage::LoginClicked() {
service_->Connect();
ui_->login_button->setEnabled(false);
}
bool GoogleDriveSettingsPage::eventFilter(QObject* object, QEvent* event) {
if (object == dialog() && event->type() == QEvent::Enter) {
ui_->login_button->setEnabled(true);
return false;
}
return SettingsPage::eventFilter(object, event);
}
void GoogleDriveSettingsPage::LogoutClicked() {

View File

@ -38,6 +38,9 @@ public:
void Load();
void Save();
// QObject
bool eventFilter(QObject* object, QEvent* event);
private slots:
void LoginClicked();
void LogoutClicked();