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:
parent
3cbb6c426b
commit
3ade68cf25
@ -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() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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() );
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user