1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Moved WebPage::applyDirectionToPage into globalfunctions.h

This commit is contained in:
nowrep 2012-08-19 19:47:28 +02:00
parent fe0e327089
commit c0b04f660e
6 changed files with 30 additions and 29 deletions

View File

@ -388,8 +388,8 @@ void DownloadItem::openFolder()
{
#ifdef Q_WS_WIN
QString winFileName = m_path + m_fileName;
winFileName.replace("/","\\");
QProcess::startDetached("explorer.exe /e,/select,\""+winFileName+"\"");
winFileName.replace("/", "\\");
QProcess::startDetached("explorer.exe /e,/select,\"" + winFileName + "\"");
#else
QDesktopServices::openUrl(QUrl::fromLocalFile(m_path));
#endif

View File

@ -149,7 +149,7 @@ QString QupZillaSchemeReply::reportbugPage()
bPage.replace("%SEND%", tr("Send"));
bPage.replace("%E-MAIL-OPTIONAL%", tr("E-mail is optional<br/><b>Note: </b>Please read how to make a bug report <a href=%1>here</a> first.").arg("https://github.com/QupZilla/qupzilla/wiki/Bug-Reports target=_blank"));
bPage.replace("%FIELDS-ARE-REQUIRED%", tr("Please fill out all required fields!"));
bPage = WebPage::applyDirectionToPage(bPage);
bPage = qz_applyDirectionToPage(bPage);
return bPage;
}
@ -173,7 +173,7 @@ QString QupZillaSchemeReply::startPage()
sPage.replace("%WWW%", QupZilla::WIKIADDRESS);
sPage.replace("%ABOUT-QUPZILLA%", tr("About QupZilla"));
sPage.replace("%PRIVATE-BROWSING%", mApp->isPrivateSession() ? tr("<h1>Private Browsing</h1>") : "");
sPage = WebPage::applyDirectionToPage(sPage);
sPage = qz_applyDirectionToPage(sPage);
return sPage;
}
@ -241,7 +241,7 @@ QString QupZillaSchemeReply::aboutPage()
authorString("Piccoro McKay Lenz", "mckaygerhard@gmail.com") + " (Venezulean Spanish)<br/>" +
authorString("Stanislav Kuznietsov", "stanislav_kuznetsov@ukr.net") + " (Ukrainian)"
);
aPage = WebPage::applyDirectionToPage(aPage);
aPage = qz_applyDirectionToPage(aPage);
}
return aPage;
@ -288,7 +288,7 @@ QString QupZillaSchemeReply::speeddialPage()
dPage.replace("%TXT_NRROWS%", tr("Maximum pages in a row:"));
dPage.replace("%TXT_SDSIZE%", tr("Change size of pages:"));
dPage.replace("%TXT_CNTRDLS%", tr("Center speed dials"));
dPage = WebPage::applyDirectionToPage(dPage);
dPage = qz_applyDirectionToPage(dPage);
}
QString page = dPage;
@ -380,7 +380,7 @@ QString QupZillaSchemeReply::configPage()
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("KDE integration"), KDEIntegration) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Portable build"), portableBuild));
cPage = WebPage::applyDirectionToPage(cPage);
cPage = qz_applyDirectionToPage(cPage);
}
QString page = cPage;

View File

@ -301,6 +301,25 @@ QPixmap qz_createPixmapForSite(const QIcon &icon, const QString &title, const QS
return pixmap;
}
QString QT_QUPZILLA_EXPORT qz_applyDirectionToPage(QString &pageContents)
{
QString direction = "ltr";
QString right_str = "right";
QString left_str = "left";
if (QApplication::isRightToLeft()) {
direction = "rtl";
right_str = "left";
left_str = "right";
}
pageContents.replace("%DIRECTION%", direction);
pageContents.replace("%RIGHT_STR%", right_str);
pageContents.replace("%LEFT_STR%", left_str);
return pageContents;
}
QString qz_buildSystem()
{
#ifdef Q_OS_LINUX

View File

@ -51,6 +51,8 @@ QString QT_QUPZILLA_EXPORT qz_filterCharsFromFilename(const QString &name);
QString QT_QUPZILLA_EXPORT qz_alignTextToWidth(const QString &string, const QString &text, const QFontMetrics &metrics, int width);
QPixmap QT_QUPZILLA_EXPORT qz_createPixmapForSite(const QIcon &icon, const QString &title, const QString &url);
QString QT_QUPZILLA_EXPORT qz_applyDirectionToPage(QString &pageContents);
QString QT_QUPZILLA_EXPORT qz_buildSystem();

View File

@ -691,7 +691,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
errString.replace("%FAVICON%", "qrc:html/adblock_big.png");
errString.replace("%RULE%", tr("Blocked by <i>%1</i>").arg(rule));
errString = applyDirectionToPage(errString);
errString = qz_applyDirectionToPage(errString);
exReturn->baseUrl = exOption->url;
exReturn->content = QString(errString + "<span id=\"qupzilla-error-page\"></span>").toUtf8();
@ -746,7 +746,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
errString.replace("%LI-2%", tr("If you are unable to load any pages, check your computer's network connection."));
errString.replace("%LI-3%", tr("If your computer or network is protected by a firewall or proxy, make sure that QupZilla is permitted to access the Web."));
errString.replace("%TRY-AGAIN%", tr("Try Again"));
errString = applyDirectionToPage(errString);
errString = qz_applyDirectionToPage(errString);
exReturn->content = QString(errString + "<span id=\"qupzilla-error-page\"></span>").toUtf8();
return true;
@ -943,22 +943,3 @@ WebPage::~WebPage()
s_livingPages.removeOne(this);
}
QString WebPage::applyDirectionToPage(const QString &pageContents)
{
QString direction = "ltr";
QString right_str = "right";
QString left_str = "left";
if (QApplication::isRightToLeft()) {
direction = "rtl";
right_str = "left";
left_str = "right";
}
QString result = pageContents;
result.replace("%DIRECTION%", direction);
result.replace("%RIGHT_STR%", right_str);
result.replace("%LEFT_STR%", left_str);
return result;
}

View File

@ -78,7 +78,6 @@ public:
static bool isPointerSafeToUse(WebPage* page);
void disconnectObjects();
static QString applyDirectionToPage(const QString &pageContents);
signals:
void privacyChanged(bool status);