diff --git a/src/accounts/lastfm/LastFmConfig.cpp b/src/accounts/lastfm/LastFmConfig.cpp index d364d7ba4..b344e34c2 100644 --- a/src/accounts/lastfm/LastFmConfig.cpp +++ b/src/accounts/lastfm/LastFmConfig.cpp @@ -33,10 +33,6 @@ LastFmConfig::LastFmConfig( LastFmAccount* account ) m_ui = new Ui_LastFmConfig; m_ui->setupUi( this ); - m_ui->username->setText( m_account->username() ); - m_ui->password->setText( m_account->password() ); - m_ui->enable->setChecked( m_account->scrobble() ); - connect( m_ui->testLogin, SIGNAL( clicked( bool ) ), this, SLOT( testLogin( bool ) ) ); connect( m_ui->username, SIGNAL( textChanged( QString ) ), this, SLOT( enableButton() ) ); @@ -62,6 +58,15 @@ LastFmConfig::scrobble() const } +void +LastFmConfig::loadFromConfig() +{ + m_ui->username->setText( m_account->username() ); + m_ui->password->setText( m_account->password() ); + m_ui->enable->setChecked( m_account->scrobble() ); +} + + QString LastFmConfig::username() const { @@ -143,3 +148,10 @@ LastFmConfig::onLastFmFinished() } } } + + +void +LastFmConfig::showEvent(QShowEvent* event) +{ + loadFromConfig(); +} diff --git a/src/accounts/lastfm/LastFmConfig.h b/src/accounts/lastfm/LastFmConfig.h index f6e0d72be..7ae0ec9af 100644 --- a/src/accounts/lastfm/LastFmConfig.h +++ b/src/accounts/lastfm/LastFmConfig.h @@ -37,10 +37,15 @@ public: QString username() const; QString password() const; bool scrobble() const; + + void loadFromConfig(); public slots: void testLogin( bool ); void onLastFmFinished(); + +protected: + void showEvent( QShowEvent* event ); private slots: void enableButton(); diff --git a/src/accounts/twitter/TwitterConfigWidget.cpp b/src/accounts/twitter/TwitterConfigWidget.cpp index 4187b7834..720037b46 100644 --- a/src/accounts/twitter/TwitterConfigWidget.cpp +++ b/src/accounts/twitter/TwitterConfigWidget.cpp @@ -57,6 +57,17 @@ TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *pare m_ui->twitterTweetComboBox->setCurrentIndex( 0 ); m_ui->twitterTweetGotTomahawkButton->setText( tr( "Tweet!" ) ); +} + +TwitterConfigWidget::~TwitterConfigWidget() +{ + delete m_ui; +} + + +void +TwitterConfigWidget::loadConfig() +{ QVariantHash credentials = m_account->credentials(); if ( credentials[ "oauthtoken" ].toString().isEmpty() || @@ -78,13 +89,8 @@ TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *pare emit twitterAuthed( true ); } - } -TwitterConfigWidget::~TwitterConfigWidget() -{ - delete m_ui; -} void TwitterConfigWidget::authDeauthTwitter() @@ -290,6 +296,14 @@ TwitterConfigWidget::postGotTomahawkStatusUpdateError( QTweetNetBase::ErrorCode QMessageBox::critical( this, tr("Tweetin' Error"), tr("There was an error posting your status -- sorry!") ); } + +void +TwitterConfigWidget::showEvent(QShowEvent* event) +{ + loadConfig(); +} + + } } \ No newline at end of file diff --git a/src/accounts/twitter/TwitterConfigWidget.h b/src/accounts/twitter/TwitterConfigWidget.h index 52f4279e8..9e54c8c08 100644 --- a/src/accounts/twitter/TwitterConfigWidget.h +++ b/src/accounts/twitter/TwitterConfigWidget.h @@ -50,11 +50,17 @@ class ACCOUNTDLLEXPORT TwitterConfigWidget : public QWidget public: explicit TwitterConfigWidget( TwitterAccount* account = 0, QWidget *parent = 0 ); virtual ~TwitterConfigWidget(); + + void loadConfig(); signals: void twitterAuthed( bool authed ); void sizeHintChanged(); + +protected: + void showEvent( QShowEvent* event ); + private slots: void authDeauthTwitter();