| 379 | } |
| 380 | |
| 381 | void TwitpicClient::onTransferComplete( const FileTransfer& transfer ) |
| 382 | { |
| 383 | bool launchTwitterPage = true; |
| 384 | bool uploadError = false; |
| 385 | bool cancelTweet = false; |
| 386 | |
| 387 | if (_deferredMessage) |
| 388 | { |
| 389 | QString xml = transfer.getTemporaryString(); |
| 390 | |
| 391 | // extract the url from the xml results |
| 392 | QRegExp urlRe("<mediaurl>([^<]*)</mediaurl>"); |
| 393 | urlRe.setCaseSensitivity(Qt::CaseInsensitive); |
| 394 | if (urlRe.indexIn(xml) > -1) |
| 395 | { |
| 396 | QStringList matches = urlRe.capturedTexts(); |
| 397 | if ((matches.size() > 1) && !matches[1].isEmpty()) |
| 398 | { |
| 399 | QString twitPicUrl = matches[1]; |
| 400 | |
| 401 | // prompt for the tweet |
| 402 | dlgManager->clearState(); |
| 403 | dlgManager->setCaption(QT_TR_NOOP("Update Twitter as %1").arg(GLOBAL(settings).tw_login)); |
| 404 | dlgManager->setPrompt(QT_TR_NOOP("Tell the world more about this image (%1):").arg(filename(transfer.getParams()["media"]))); |
| 405 | dlgManager->setText("\n" + twitPicUrl); |
| 406 | if (dlgManager->promptDialog(DialogTwitterTweet)) |
| 407 | { |
| 408 | QString message = dlgManager->getText(); |
| 409 | |
| 410 | |
| 411 | TwitterClient client(TWITTER_SERVER); |
| 412 | client.initialize(); |
| 413 | if (client.statuses_update(message)) |
| 414 | { |
| 415 | statsManager->getStats().bt.interaction.actors.custom.twitter.droppedOn++; |
| 416 | } |
| 417 | } |
| 418 | else |
| 419 | { |
| 420 | launchTwitterPage = false; |
| 421 | uploadError = false; |
| 422 | cancelTweet = true; |
| 423 | dismiss("TwitpicClient::photos_upload"); |
| 424 | } |
| 425 | } |
| 426 | else |
| 427 | { |
| 428 | launchTwitterPage = false; |
| 429 | uploadError = true; |
| 430 | } |
| 431 | } |
| 432 | else |
| 433 | { |
| 434 | launchTwitterPage = false; |
| 435 | uploadError = true; |
| 436 | } |
| 437 | } |
| 438 |
nothing calls this directly
no test coverage detected