|
|
@ -178,16 +178,16 @@ void PicasawebTalker::getToken(const TQString& username, const TQString& passwor
|
|
|
|
ts.setEncoding(TQTextStream::UnicodeUTF8);
|
|
|
|
ts.setEncoding(TQTextStream::UnicodeUTF8);
|
|
|
|
ts << dataParameters;
|
|
|
|
ts << dataParameters;
|
|
|
|
|
|
|
|
|
|
|
|
KIO::TransferJob* job = KIO::http_post(url, buffer, false);
|
|
|
|
TDEIO::TransferJob* job = TDEIO::http_post(url, buffer, false);
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded" );
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded" );
|
|
|
|
m_state = FE_GETTOKEN;
|
|
|
|
m_state = FE_GETTOKEN;
|
|
|
|
authProgressDlg->setLabelText(i18n("Getting the token"));
|
|
|
|
authProgressDlg->setLabelText(i18n("Getting the token"));
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)),
|
|
|
|
connect(job, TQT_SIGNAL(data(TDEIO::Job*, const TQByteArray&)),
|
|
|
|
this, TQT_SLOT(data(KIO::Job*, const TQByteArray&)));
|
|
|
|
this, TQT_SLOT(data(TDEIO::Job*, const TQByteArray&)));
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(result(KIO::Job *)),
|
|
|
|
connect(job, TQT_SIGNAL(result(TDEIO::Job *)),
|
|
|
|
this, TQT_SLOT(slotResult(KIO::Job *)));
|
|
|
|
this, TQT_SLOT(slotResult(TDEIO::Job *)));
|
|
|
|
|
|
|
|
|
|
|
|
m_job = job;
|
|
|
|
m_job = job;
|
|
|
|
m_buffer.resize(0);
|
|
|
|
m_buffer.resize(0);
|
|
|
@ -220,16 +220,16 @@ void PicasawebTalker::checkToken(const TQString& /*token*/)
|
|
|
|
TQString url = "https://www.google.com/accounts/ClientLogin";
|
|
|
|
TQString url = "https://www.google.com/accounts/ClientLogin";
|
|
|
|
TQString auth_string = "GoogleLogin auth=" + m_token;
|
|
|
|
TQString auth_string = "GoogleLogin auth=" + m_token;
|
|
|
|
TQByteArray tmp;
|
|
|
|
TQByteArray tmp;
|
|
|
|
KIO::TransferJob* job = KIO::http_post(url, tmp, false);
|
|
|
|
TDEIO::TransferJob* job = TDEIO::http_post(url, tmp, false);
|
|
|
|
job->addMetaData("customHTTPHeader", "Authorization: " + auth_string);
|
|
|
|
job->addMetaData("customHTTPHeader", "Authorization: " + auth_string);
|
|
|
|
|
|
|
|
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded");
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded");
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)),
|
|
|
|
connect(job, TQT_SIGNAL(data(TDEIO::Job*, const TQByteArray&)),
|
|
|
|
this, TQT_SLOT(data(KIO::Job*, const TQByteArray&)));
|
|
|
|
this, TQT_SLOT(data(TDEIO::Job*, const TQByteArray&)));
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(result(KIO::Job *)),
|
|
|
|
connect(job, TQT_SIGNAL(result(TDEIO::Job *)),
|
|
|
|
this, TQT_SLOT(slotResult(KIO::Job *)));
|
|
|
|
this, TQT_SLOT(slotResult(TDEIO::Job *)));
|
|
|
|
|
|
|
|
|
|
|
|
m_state = FE_CHECKTOKEN;
|
|
|
|
m_state = FE_CHECKTOKEN;
|
|
|
|
authProgressDlg->setLabelText(i18n("Checking if previous token is still valid"));
|
|
|
|
authProgressDlg->setLabelText(i18n("Checking if previous token is still valid"));
|
|
|
@ -256,15 +256,15 @@ void PicasawebTalker::listAllAlbums() {
|
|
|
|
TQString url = "http://picasaweb.google.com/data/feed/api/user/" + m_username + "?kind=album";
|
|
|
|
TQString url = "http://picasaweb.google.com/data/feed/api/user/" + m_username + "?kind=album";
|
|
|
|
TQByteArray tmp;
|
|
|
|
TQByteArray tmp;
|
|
|
|
TQString auth_string = "GoogleLogin auth=" + m_token;
|
|
|
|
TQString auth_string = "GoogleLogin auth=" + m_token;
|
|
|
|
KIO::TransferJob* job = KIO::get(url, !tmp.isNull(), false);
|
|
|
|
TDEIO::TransferJob* job = TDEIO::get(url, !tmp.isNull(), false);
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded" );
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded" );
|
|
|
|
job->addMetaData("customHTTPHeader", "Authorization: " + auth_string );
|
|
|
|
job->addMetaData("customHTTPHeader", "Authorization: " + auth_string );
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)),
|
|
|
|
connect(job, TQT_SIGNAL(data(TDEIO::Job*, const TQByteArray&)),
|
|
|
|
this, TQT_SLOT(data(KIO::Job*, const TQByteArray&)));
|
|
|
|
this, TQT_SLOT(data(TDEIO::Job*, const TQByteArray&)));
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(result(KIO::Job *)),
|
|
|
|
connect(job, TQT_SIGNAL(result(TDEIO::Job *)),
|
|
|
|
this, TQT_SLOT(slotResult(KIO::Job *)));
|
|
|
|
this, TQT_SLOT(slotResult(TDEIO::Job *)));
|
|
|
|
|
|
|
|
|
|
|
|
m_state = FE_LISTALBUMS;
|
|
|
|
m_state = FE_LISTALBUMS;
|
|
|
|
m_job = job;
|
|
|
|
m_job = job;
|
|
|
@ -292,14 +292,14 @@ void PicasawebTalker::getPhotoProperty(const TQString& method,const TQString& ar
|
|
|
|
TQString queryStr=headers.join("&");
|
|
|
|
TQString queryStr=headers.join("&");
|
|
|
|
TQString postUrl=url+queryStr;
|
|
|
|
TQString postUrl=url+queryStr;
|
|
|
|
TQByteArray tmp;
|
|
|
|
TQByteArray tmp;
|
|
|
|
KIO::TransferJob* job = KIO::http_post(postUrl, tmp, false);
|
|
|
|
TDEIO::TransferJob* job = TDEIO::http_post(postUrl, tmp, false);
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded" );
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded" );
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)),
|
|
|
|
connect(job, TQT_SIGNAL(data(TDEIO::Job*, const TQByteArray&)),
|
|
|
|
this, TQT_SLOT(data(KIO::Job*, const TQByteArray&)));
|
|
|
|
this, TQT_SLOT(data(TDEIO::Job*, const TQByteArray&)));
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(result(KIO::Job *)),
|
|
|
|
connect(job, TQT_SIGNAL(result(TDEIO::Job *)),
|
|
|
|
this, TQT_SLOT(slotResult(KIO::Job *)));
|
|
|
|
this, TQT_SLOT(slotResult(TDEIO::Job *)));
|
|
|
|
|
|
|
|
|
|
|
|
m_state = FE_GETPHOTOPROPERTY;
|
|
|
|
m_state = FE_GETPHOTOPROPERTY;
|
|
|
|
m_job = job;
|
|
|
|
m_job = job;
|
|
|
@ -328,16 +328,16 @@ void PicasawebTalker::addPhotoTag(const TQString& photoURI, const TQString& tag)
|
|
|
|
ts << addTagXML;
|
|
|
|
ts << addTagXML;
|
|
|
|
|
|
|
|
|
|
|
|
TQString auth_string = "GoogleLogin auth=" + m_token;
|
|
|
|
TQString auth_string = "GoogleLogin auth=" + m_token;
|
|
|
|
KIO::TransferJob* job = KIO::http_post(postUrl, buffer, false);
|
|
|
|
TDEIO::TransferJob* job = TDEIO::http_post(postUrl, buffer, false);
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/atom+xml");
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/atom+xml");
|
|
|
|
job->addMetaData("content-length", TQString("Content-Length: %1").arg(addTagXML.length()));
|
|
|
|
job->addMetaData("content-length", TQString("Content-Length: %1").arg(addTagXML.length()));
|
|
|
|
job->addMetaData("customHTTPHeader", "Authorization: " + auth_string );
|
|
|
|
job->addMetaData("customHTTPHeader", "Authorization: " + auth_string );
|
|
|
|
|
|
|
|
|
|
|
|
//connect(job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)),
|
|
|
|
//connect(job, TQT_SIGNAL(data(TDEIO::Job*, const TQByteArray&)),
|
|
|
|
// this, TQT_SLOT(data(KIO::Job*, const TQByteArray&)));
|
|
|
|
// this, TQT_SLOT(data(TDEIO::Job*, const TQByteArray&)));
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(result(KIO::Job *)),
|
|
|
|
connect(job, TQT_SIGNAL(result(TDEIO::Job *)),
|
|
|
|
this, TQT_SLOT(slotResult(KIO::Job *)));
|
|
|
|
this, TQT_SLOT(slotResult(TDEIO::Job *)));
|
|
|
|
|
|
|
|
|
|
|
|
m_state = FE_ADDTAG;
|
|
|
|
m_state = FE_ADDTAG;
|
|
|
|
m_job = job;
|
|
|
|
m_job = job;
|
|
|
@ -390,16 +390,16 @@ void PicasawebTalker::createAlbum(const TQString& albumTitle, const TQString& al
|
|
|
|
MPForm form;
|
|
|
|
MPForm form;
|
|
|
|
TQString postUrl = "http://www.picasaweb.google.com/data/feed/api/user/" + m_username ;
|
|
|
|
TQString postUrl = "http://www.picasaweb.google.com/data/feed/api/user/" + m_username ;
|
|
|
|
TQString auth_string = "GoogleLogin auth=" + m_token;
|
|
|
|
TQString auth_string = "GoogleLogin auth=" + m_token;
|
|
|
|
KIO::TransferJob* job = KIO::http_post(postUrl, buffer, false);
|
|
|
|
TDEIO::TransferJob* job = TDEIO::http_post(postUrl, buffer, false);
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/atom+xml");
|
|
|
|
job->addMetaData("content-type", "Content-Type: application/atom+xml");
|
|
|
|
job->addMetaData("content-length", TQString("Content-Length: %1").arg(newAlbumXML.length()));
|
|
|
|
job->addMetaData("content-length", TQString("Content-Length: %1").arg(newAlbumXML.length()));
|
|
|
|
job->addMetaData("customHTTPHeader", "Authorization: " + auth_string );
|
|
|
|
job->addMetaData("customHTTPHeader", "Authorization: " + auth_string );
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)),
|
|
|
|
connect(job, TQT_SIGNAL(data(TDEIO::Job*, const TQByteArray&)),
|
|
|
|
this, TQT_SLOT(data(KIO::Job*, const TQByteArray&)));
|
|
|
|
this, TQT_SLOT(data(TDEIO::Job*, const TQByteArray&)));
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(result(KIO::Job *)),
|
|
|
|
connect(job, TQT_SIGNAL(result(TDEIO::Job *)),
|
|
|
|
this, TQT_SLOT(slotResult(KIO::Job *)));
|
|
|
|
this, TQT_SLOT(slotResult(TDEIO::Job *)));
|
|
|
|
|
|
|
|
|
|
|
|
m_state = FE_CREATEALBUM;
|
|
|
|
m_state = FE_CREATEALBUM;
|
|
|
|
m_job = job;
|
|
|
|
m_job = job;
|
|
|
@ -493,15 +493,15 @@ bool PicasawebTalker::addPhoto(const TQString& photoPath, FPhotoInfo& info,
|
|
|
|
|
|
|
|
|
|
|
|
form.finish();
|
|
|
|
form.finish();
|
|
|
|
|
|
|
|
|
|
|
|
KIO::TransferJob* job = KIO::http_post(postUrl, form.formData(), false);
|
|
|
|
TDEIO::TransferJob* job = TDEIO::http_post(postUrl, form.formData(), false);
|
|
|
|
job->addMetaData("content-type", form.contentType());
|
|
|
|
job->addMetaData("content-type", form.contentType());
|
|
|
|
job->addMetaData("customHTTPHeader", "Authorization: " + auth_string );
|
|
|
|
job->addMetaData("customHTTPHeader", "Authorization: " + auth_string );
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(data(KIO::Job*, const TQByteArray&)),
|
|
|
|
connect(job, TQT_SIGNAL(data(TDEIO::Job*, const TQByteArray&)),
|
|
|
|
this, TQT_SLOT(data(KIO::Job*, const TQByteArray&)));
|
|
|
|
this, TQT_SLOT(data(TDEIO::Job*, const TQByteArray&)));
|
|
|
|
|
|
|
|
|
|
|
|
connect(job, TQT_SIGNAL(result(KIO::Job *)),
|
|
|
|
connect(job, TQT_SIGNAL(result(TDEIO::Job *)),
|
|
|
|
this, TQT_SLOT(slotResult(KIO::Job *)));
|
|
|
|
this, TQT_SLOT(slotResult(TDEIO::Job *)));
|
|
|
|
|
|
|
|
|
|
|
|
m_state = FE_ADDPHOTO;
|
|
|
|
m_state = FE_ADDPHOTO;
|
|
|
|
m_job = job;
|
|
|
|
m_job = job;
|
|
|
@ -532,11 +532,11 @@ void PicasawebTalker::cancel()
|
|
|
|
authProgressDlg->hide();
|
|
|
|
authProgressDlg->hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PicasawebTalker::info(KIO::Job* /*job*/, const TQString& /*str*/)
|
|
|
|
void PicasawebTalker::info(TDEIO::Job* /*job*/, const TQString& /*str*/)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PicasawebTalker::data(KIO::Job*, const TQByteArray& data)
|
|
|
|
void PicasawebTalker::data(TDEIO::Job*, const TQByteArray& data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (data.isEmpty())
|
|
|
|
if (data.isEmpty())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -597,7 +597,7 @@ void PicasawebTalker::slotError(const TQString & error)
|
|
|
|
//kdDebug()<<"Not handling the error now will see it later"<<endl;
|
|
|
|
//kdDebug()<<"Not handling the error now will see it later"<<endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PicasawebTalker::slotResult(KIO::Job *job)
|
|
|
|
void PicasawebTalker::slotResult(TDEIO::Job *job)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_job = 0;
|
|
|
|
m_job = 0;
|
|
|
|
emit signalBusy(false);
|
|
|
|
emit signalBusy(false);
|
|
|
|