1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-13 20:39:57 +01:00

Log in to spotify if the user entered credentials and hit OK without pressing log in

This commit is contained in:
Leo Franchi 2012-04-15 22:38:51 -04:00
parent 3cbb6c426b
commit 3ade68cf25
3 changed files with 12 additions and 0 deletions

View File

@ -509,6 +509,12 @@ SpotifyAccount::saveConfig()
}
}
sync();
if ( !m_configWidget.data()->loggedInManually() && !m_configWidget.data()->username().isEmpty() && !m_configWidget.data()->password().isEmpty() )
{
// If the user never pressed log in, he might have just pressed ok or hit enter. So log in anyway
login( m_configWidget.data()->username(), m_configWidget.data()->password() );
}
}

View File

@ -34,6 +34,7 @@ SpotifyAccountConfig::SpotifyAccountConfig( SpotifyAccount *account )
, m_ui( new Ui::SpotifyConfig )
, m_account( account )
, m_playlistsLoading( 0 )
, m_loggedInManually( false )
{
m_ui->setupUi( this );
@ -51,6 +52,7 @@ void
SpotifyAccountConfig::showEvent( QShowEvent *event )
{
loadFromConfig();
m_loggedInManually = false;
}
@ -132,6 +134,7 @@ SpotifyAccountConfig::doLogin()
m_ui->loginButton->setEnabled( false );
m_playlistsLoading->fadeIn();
m_loggedInManually = true;
emit login( username(), password() );
}

View File

@ -56,6 +56,8 @@ public:
void saveSettings();
void loginResponse( bool success, const QString& msg );
bool loggedInManually() const { return m_loggedInManually; }
signals:
void login( const QString& username, const QString& pw );
@ -73,6 +75,7 @@ private:
Ui::SpotifyConfig* m_ui;
SpotifyAccount* m_account;
LoadingSpinner* m_playlistsLoading;
bool m_loggedInManually;
};
}