From fe478a07599194fe66b22e993e59309a0152f664 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Tue, 3 May 2011 14:18:05 -0400 Subject: [PATCH] Switch around when the oauthtwitter gets its nam and add some debug --- src/sip/twitter/twitter.cpp | 12 +++++++----- src/sip/twitter/twitterconfigwidget.cpp | 9 +++------ thirdparty/liblastfm2/src/ws/ws.cpp | 2 +- .../tomahawk-custom/tomahawkoauthtwitter.cpp | 4 ++-- .../qtweetlib/tomahawk-custom/tomahawkoauthtwitter.h | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/sip/twitter/twitter.cpp b/src/sip/twitter/twitter.cpp index d2eaa93a5..0e31ff0fa 100644 --- a/src/sip/twitter/twitter.cpp +++ b/src/sip/twitter/twitter.cpp @@ -131,9 +131,9 @@ TwitterPlugin::connectPlugin( bool /*startup*/ ) if ( refreshTwitterAuth() ) { - QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( m_twitterAuth.data(), this ); - connect( credVerifier, SIGNAL( parsedUser(const QTweetUser &) ), SLOT( connectAuthVerifyReply(const QTweetUser &) ) ); - credVerifier->verify(); + QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( m_twitterAuth.data(), this ); + connect( credVerifier, SIGNAL( parsedUser(const QTweetUser &) ), SLOT( connectAuthVerifyReply(const QTweetUser &) ) ); + credVerifier->verify(); } return true; @@ -142,16 +142,18 @@ TwitterPlugin::connectPlugin( bool /*startup*/ ) bool TwitterPlugin::refreshTwitterAuth() { + qDebug() << Q_FUNC_INFO << " begin"; if( !m_twitterAuth.isNull() ) delete m_twitterAuth.data(); - m_twitterAuth = QWeakPointer( new TomahawkOAuthTwitter( this ) ); + + qDebug() << Q_FUNC_INFO << " with nam " << TomahawkUtils::nam(); + m_twitterAuth = QWeakPointer( new TomahawkOAuthTwitter( TomahawkUtils::nam(), this ) ); if( m_twitterAuth.isNull() ) return false; TomahawkSettings *settings = TomahawkSettings::instance(); - m_twitterAuth.data()->setNetworkAccessManager( TomahawkUtils::nam() ); m_twitterAuth.data()->setOAuthToken( settings->twitterOAuthToken().toLatin1() ); m_twitterAuth.data()->setOAuthTokenSecret( settings->twitterOAuthTokenSecret().toLatin1() ); diff --git a/src/sip/twitter/twitterconfigwidget.cpp b/src/sip/twitter/twitterconfigwidget.cpp index f728b4107..379cfea20 100644 --- a/src/sip/twitter/twitterconfigwidget.cpp +++ b/src/sip/twitter/twitterconfigwidget.cpp @@ -94,8 +94,7 @@ void TwitterConfigWidget::authenticateTwitter() { qDebug() << Q_FUNC_INFO; - TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( this ); - twitAuth->setNetworkAccessManager( TomahawkUtils::nam() ); + TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( TomahawkUtils::nam(), this ); twitAuth->authorizePin(); TomahawkSettings* s = TomahawkSettings::instance(); @@ -207,8 +206,7 @@ TwitterConfigWidget::startPostGotTomahawkStatus() emit twitterAuthed( false ); return; } - TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( this ); - twitAuth->setNetworkAccessManager( TomahawkUtils::nam() ); + TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( TomahawkUtils::nam(), this ); twitAuth->setOAuthToken( s->twitterOAuthToken().toLatin1() ); twitAuth->setOAuthTokenSecret( s->twitterOAuthTokenSecret().toLatin1() ); QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( twitAuth, this ); @@ -227,8 +225,7 @@ TwitterConfigWidget::postGotTomahawkStatusAuthVerifyReply( const QTweetUser &use } TomahawkSettings* s = TomahawkSettings::instance(); s->setTwitterScreenName( user.screenName() ); - TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( this ); - twitAuth->setNetworkAccessManager( TomahawkUtils::nam() ); + TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( TomahawkUtils::nam(), this ); twitAuth->setOAuthToken( s->twitterOAuthToken().toLatin1() ); twitAuth->setOAuthTokenSecret( s->twitterOAuthTokenSecret().toLatin1() ); if ( m_postGTtype != "Direct Message" ) diff --git a/thirdparty/liblastfm2/src/ws/ws.cpp b/thirdparty/liblastfm2/src/ws/ws.cpp index 6e91e749a..3dc1631fa 100644 --- a/thirdparty/liblastfm2/src/ws/ws.cpp +++ b/thirdparty/liblastfm2/src/ws/ws.cpp @@ -206,7 +206,7 @@ lastfm::nam() NetworkAccessManager* newNam = new NetworkAccessManager(); threadNamHash[thread] = newNam; ourNamHash[thread] = true; - qDebug() << Q_FUNC_INFO << " returning " << dynamic_cast(newNam); + qDebug() << Q_FUNC_INFO << " returning " << threadNamHash[thread]; return newNam; } qDebug() << Q_FUNC_INFO << " found a nam, is " << threadNamHash[thread]; diff --git a/thirdparty/qtweetlib/tomahawk-custom/tomahawkoauthtwitter.cpp b/thirdparty/qtweetlib/tomahawk-custom/tomahawkoauthtwitter.cpp index 8f2549643..9ae9749b4 100644 --- a/thirdparty/qtweetlib/tomahawk-custom/tomahawkoauthtwitter.cpp +++ b/thirdparty/qtweetlib/tomahawk-custom/tomahawkoauthtwitter.cpp @@ -2,8 +2,8 @@ #include #include -TomahawkOAuthTwitter::TomahawkOAuthTwitter( QObject* parent ) - : OAuthTwitter( parent ) +TomahawkOAuthTwitter::TomahawkOAuthTwitter( QNetworkAccessManager *nam, QObject* parent ) + : OAuthTwitter( nam, parent ) { } diff --git a/thirdparty/qtweetlib/tomahawk-custom/tomahawkoauthtwitter.h b/thirdparty/qtweetlib/tomahawk-custom/tomahawkoauthtwitter.h index 8336f4158..b845d100a 100644 --- a/thirdparty/qtweetlib/tomahawk-custom/tomahawkoauthtwitter.h +++ b/thirdparty/qtweetlib/tomahawk-custom/tomahawkoauthtwitter.h @@ -10,7 +10,7 @@ class QTWEETLIBSHARED_EXPORT TomahawkOAuthTwitter : public OAuthTwitter Q_OBJECT public: - TomahawkOAuthTwitter( QObject *parent = 0 ); + TomahawkOAuthTwitter( QNetworkAccessManager *nam, QObject *parent = 0 ); ~TomahawkOAuthTwitter() {}