示例#1
0
TwitterInterface::TwitterInterface (QObject *parent)
    : QObject (parent)
{
    HttpClient_ = Core::Instance ().GetCoreProxy ()->GetNetworkAccessManager ();
    OAuthRequest_ = new KQOAuthRequest (this);
    OAuthManager_ = new KQOAuthManager (this);

#ifdef WP_DEBUG
    OAuthRequest_->setEnableDebugOutput (true);
#else
    OAuthRequest_->setEnableDebugOutput (false);
#endif
    ConsumerKey_ = XmlSettingsManager::Instance ()->property ("consumer_key").toString ();
    ConsumerKeySecret_ = XmlSettingsManager::Instance ()->
                         property ("consumer_key_secret").toString ();

    connect (OAuthManager_,
             SIGNAL (requestReady (QByteArray)),
             this,
             SLOT (onRequestReady (QByteArray)));

    connect (OAuthManager_,
             SIGNAL (authorizedRequestDone ()),
             this,
             SLOT (onAuthorizedRequestDone ()));
}
示例#2
0
LoginManager::LoginManager(QObject* parent)
 : QObject(parent)
      {
      _oauthManager = new KQOAuthManager(this);
      connect(_oauthManager, SIGNAL(accessTokenReceived(QString, QString)),
            this, SLOT(onAccessTokenReceived(QString, QString)));
      connect(_oauthManager, SIGNAL(authorizedRequestDone()),
            this, SLOT(onAuthorizedRequestDone()));
      QByteArray ba;
      ba.resize(32);
      ba[0] = 0x68; ba[1] = 0x74; ba[2] = 0x55; ba[3] = 0x38;
      ba[4] = 0x48; ba[5] = 0x45; ba[6] = 0x4c; ba[7] = 0x45;
      ba[8] = 0x4d; ba[9] = 0x47; ba[10] = 0x43; ba[11] = 0x55;
      ba[12] = 0x6e; ba[13] = 0x6f; ba[14] = 0x53; ba[15] = 0x54;
      ba[16] = 0x38; ba[17] = 0x67; ba[18] = 0x6b; ba[19] = 0x78;
      ba[20] = 0x34; ba[21] = 0x77; ba[22] = 0x33; ba[23] = 0x69;
      ba[24] = 0x52; ba[25] = 0x63; ba[26] = 0x64; ba[27] = 0x6e;
      ba[28] = 0x41; ba[29] = 0x6a; ba[30] = 0x37; ba[31] = 0x51;
      _consumerKey = QString(ba);
      ba[0] = 0x52; ba[1] = 0x50; ba[2] = 0x75; ba[3] = 0x32; 
      ba[4] = 0x79; ba[5] = 0x52; ba[6] = 0x69; ba[7] = 0x52;
      ba[8] = 0x6f; ba[9] = 0x58; ba[10] = 0x53; ba[11] = 0x41;
      ba[12] = 0x48; ba[13] = 0x6d; ba[14] = 0x4a; ba[15] = 0x6f;
      ba[16] = 0x6b; ba[17] = 0x61; ba[18] = 0x62; ba[19] = 0x59;
      ba[20] = 0x35; ba[21] = 0x37; ba[22] = 0x59; ba[23] = 0x74;
      ba[24] = 0x66; ba[25] = 0x51; ba[26] = 0x5a; ba[27] = 0x36;
      ba[28] = 0x77; ba[29] = 0x35; ba[30] = 0x69; ba[31] = 0x77;
      _consumerSecret  = QString(ba);
      load();
      }
示例#3
0
TwitterAPI::TwitterAPI(QObject *parent) :
        QObject(parent)
        //QMainWindow(parent),
        //ui_main(new Ui::MainWindow)
{
    oauthManager = new KQOAuthManager(this);
    oauthManager->setHandleUserAuthorization(false);

    connect(oauthManager, SIGNAL(temporaryTokenReceived(QString,QString)),
            this, SLOT(onTemporaryTokenReceived(QString,QString)));

    connect(oauthManager, SIGNAL(accessTokenReceived(QString,QString)),
            this, SLOT(onAccessTokenReceived(QString,QString)));

//    connect(this->oauthManager, SIGNAL(requestReady(QByteArray, QNetworkReply *)),
//            this, SLOT(responseHandler(QByteArray, QNetworkReply *)));

    connect(oauthManager, SIGNAL(requestReady(QNetworkReply *, QByteArray)),
                this, SLOT(responseHandler(QNetworkReply *, QByteArray)));

    connect(oauthManager, SIGNAL(authorizedRequestDone()),
            this, SLOT(onAuthorizedRequestDone()));

}