Commit 71f8dd45 authored by Mehrdad Momeny's avatar Mehrdad Momeny
Browse files

FEATURE:270617 a hyperlink (original post) added when a post is translated,...

FEATURE:270617 a hyperlink (original post) added when a post is translated, So, User can restore post to original one!
parent 07a9bd96
......@@ -128,7 +128,14 @@ PostWidget::PostWidget( Account* account, const Choqok::Post& post, QWidget* par
void PostWidget::checkAnchor(const QUrl & url)
{
Choqok::openUrl(url);
if(url.scheme() == "choqok"){
if(url.host() == "showoriginalpost"){
setContent( prepareStatus(currentPost().content).replace("<a href","<a style=\"text-decoration:none\" href",Qt::CaseInsensitive) );
updateUi();
}
} else {
Choqok::openUrl(url);
}
}
PostWidget::~PostWidget()
......
......@@ -89,7 +89,7 @@ void Translator::slotTranslated(KJob* job)
if(!wd || !stj)
return;
QByteArray data = stj->data();
kDebug()<<data;
// kDebug()<<data;
QVariantMap json = QJson::Parser().parse(data).toMap();
QString errorMessage;
if(job->error() == KJob::NoError){
......@@ -102,7 +102,8 @@ void Translator::slotTranslated(KJob* job)
} else {
color = wd->palette().dark().color().name();
}
QString translatedNotice = i18n("<span style=\"color:%2; font-size:small;\">Translated from %1:</span>", srcLang, color);
QString translatedNotice =
i18n("<span style=\"color:%2; font-size:small;\">Translated from %1: (<a href='choqok://showoriginalpost' style=\"text-decoration:none\" >original post</a>)</span>", srcLang, color);
wd->setContent(QString("%1<br/>%2").arg(translatedNotice)
.arg(trMap["translatedText"].toString()));
return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment