mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Using QLatin1String and QLatin1Char now everywhere
- it saves few unnecessary allocations
This commit is contained in:
parent
1afc663e91
commit
528f398cbe
2
src/lib/3rdparty/fancytabwidget.cpp
vendored
2
src/lib/3rdparty/fancytabwidget.cpp
vendored
@ -182,7 +182,7 @@ void FancyTabProxyStyle::drawControl(
|
||||
|
||||
void FancyTabProxyStyle::polish(QWidget* widget)
|
||||
{
|
||||
if (QString(widget->metaObject()->className()) == "QTabBar") {
|
||||
if (QString(widget->metaObject()->className()) == QLatin1String("QTabBar")) {
|
||||
widget->setMouseTracking(true);
|
||||
widget->installEventFilter(this);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void AdBlockAddSubscriptionDialog::indexChanged(int index)
|
||||
{
|
||||
const Subscription &subscription = m_knownSubscriptions.at(index);
|
||||
|
||||
int pos = subscription.title.indexOf('(');
|
||||
int pos = subscription.title.indexOf(QLatin1Char('('));
|
||||
QString title = subscription.title;
|
||||
|
||||
if (pos > 0) {
|
||||
|
@ -46,7 +46,7 @@ AdBlockIcon::AdBlockIcon(QupZilla* mainClass, QWidget* parent)
|
||||
|
||||
void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url)
|
||||
{
|
||||
int index = ruleString.lastIndexOf(" (");
|
||||
int index = ruleString.lastIndexOf(QLatin1String(" ("));
|
||||
|
||||
const QString &subscriptionName = ruleString.left(index);
|
||||
const QString &filter = ruleString.mid(index + 2, ruleString.size() - index - 3);
|
||||
@ -112,7 +112,7 @@ void AdBlockIcon::createMenu(QMenu* menu)
|
||||
menu->addSeparator();
|
||||
|
||||
if (!pageUrl.isEmpty()) {
|
||||
const QString &host = page->url().host().contains("www.") ? pageUrl.host().mid(4) : pageUrl.host();
|
||||
const QString &host = page->url().host().contains(QLatin1String("www.")) ? pageUrl.host().mid(4) : pageUrl.host();
|
||||
const QString &hostFilter = QString("@@||%1^$document").arg(host);
|
||||
const QString &pageFilter = QString("@@|%1|$document").arg(pageUrl.toString());
|
||||
|
||||
@ -137,7 +137,7 @@ void AdBlockIcon::createMenu(QMenu* menu)
|
||||
const QPair<AdBlockRule, QUrl> &pair = m_blockedPopups.at(i);
|
||||
|
||||
QString address = pair.second.toString().right(55);
|
||||
QString actionText = tr("%1 with (%2)").arg(address, pair.first.filter()).replace('&', "&&");
|
||||
QString actionText = tr("%1 with (%2)").arg(address, pair.first.filter()).replace(QLatin1Char('&'), QLatin1String("&&"));
|
||||
|
||||
QAction* action = menu->addAction(actionText, manager, SLOT(showRule()));
|
||||
action->setData(qVariantFromValue((void*)&pair.first));
|
||||
@ -153,7 +153,7 @@ void AdBlockIcon::createMenu(QMenu* menu)
|
||||
menu->addAction(tr("Blocked URL (AdBlock Rule) - click to edit rule"))->setEnabled(false);
|
||||
foreach(const WebPage::AdBlockedEntry & entry, entries) {
|
||||
QString address = entry.url.toString().right(55);
|
||||
QString actionText = tr("%1 with (%2)").arg(address, entry.rule->filter()).replace('&', "&&");
|
||||
QString actionText = tr("%1 with (%2)").arg(address, entry.rule->filter()).replace(QLatin1Char('&'), QLatin1String("&&"));
|
||||
|
||||
QAction* action = menu->addAction(actionText, manager, SLOT(showRule()));
|
||||
action->setData(qVariantFromValue((void*)entry.rule));
|
||||
|
@ -202,7 +202,7 @@ void AdBlockManager::load()
|
||||
}
|
||||
|
||||
foreach(const QString & fileName, adblockDir.entryList(QStringList("*.txt"), QDir::Files)) {
|
||||
if (fileName == "easylist.txt" || fileName == "customlist.txt") {
|
||||
if (fileName == QLatin1String("easylist.txt") || fileName == QLatin1String("customlist.txt")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -213,8 +213,8 @@ void AdBlockManager::load()
|
||||
}
|
||||
|
||||
QTextStream textStream(&file);
|
||||
QString title = textStream.readLine(1024).remove("Title: ");
|
||||
QUrl url = QUrl(textStream.readLine(1024).remove("Url: "));
|
||||
QString title = textStream.readLine(1024).remove(QLatin1String("Title: "));
|
||||
QUrl url = QUrl(textStream.readLine(1024).remove(QLatin1String("Url: ")));
|
||||
|
||||
if (title.isEmpty() || !url.isValid()) {
|
||||
qWarning() << "AdBlockManager: Invalid subscription file" << absolutePath;
|
||||
|
@ -172,7 +172,7 @@ bool AdBlockRule::isException() const
|
||||
|
||||
bool AdBlockRule::isComment() const
|
||||
{
|
||||
return m_filter.startsWith('!');
|
||||
return m_filter.startsWith(QLatin1Char('!'));
|
||||
}
|
||||
|
||||
bool AdBlockRule::isEnabled() const
|
||||
@ -407,7 +407,7 @@ void AdBlockRule::parseFilter()
|
||||
}
|
||||
else if (option.endsWith(QLatin1String("subdocument"))) {
|
||||
m_subdocument = true;
|
||||
m_subdocumentException = option.startsWith('~');
|
||||
m_subdocumentException = option.startsWith(QLatin1Char('~'));
|
||||
++handledOptions;
|
||||
}
|
||||
else if (option.endsWith(QLatin1String("xmlhttprequest"))) {
|
||||
@ -513,7 +513,7 @@ void AdBlockRule::parseDomains(const QString &domains, const QChar &separator)
|
||||
if (domain.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (domain.startsWith('~')) {
|
||||
if (domain.startsWith(QLatin1Char('~'))) {
|
||||
m_blockedDomains.append(domain.mid(1));
|
||||
}
|
||||
else {
|
||||
|
@ -108,7 +108,7 @@ void AdBlockSubscription::loadSubscription(const QStringList &disabledRules)
|
||||
textStream.readLine(1024);
|
||||
QString header = textStream.readLine(1024);
|
||||
|
||||
if (!header.startsWith("[Adblock") || m_title.isEmpty()) {
|
||||
if (!header.startsWith(QLatin1String("[Adblock")) || m_title.isEmpty()) {
|
||||
qWarning() << "AdBlockSubscription::" << __FUNCTION__ << "invalid format of adblock file" << m_filePath;
|
||||
QTimer::singleShot(0, this, SLOT(updateSubscription()));
|
||||
return;
|
||||
@ -398,7 +398,7 @@ void AdBlockEasyList::saveDownloadedData(QByteArray &data)
|
||||
|
||||
// Third-party advertisers rules are with start domain (||) placeholder which needs regexps
|
||||
// So we are ignoring it for keeping good performance
|
||||
data = data.left(data.indexOf("!-----------------------------Third-party adverts-----------------------------!"));
|
||||
data = data.left(data.indexOf(QLatin1String("!-----------------------------Third-party adverts-----------------------------!")));
|
||||
|
||||
file.write(data);
|
||||
file.close();
|
||||
|
@ -76,7 +76,7 @@ void CommandLineOptions::parseActions()
|
||||
for (int i = 1; i < arguments.count(); ++i) {
|
||||
QString arg = arguments.at(i);
|
||||
|
||||
if (arg == "-h" || arg == "--help") {
|
||||
if (arg == QLatin1String("-h") || arg == QLatin1String("--help")) {
|
||||
showHelp();
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_ExitAction;
|
||||
@ -84,7 +84,7 @@ void CommandLineOptions::parseActions()
|
||||
break;
|
||||
}
|
||||
|
||||
if (arg == "-a" || arg == "--authors") {
|
||||
if (arg == QLatin1String("-a") || arg == QLatin1String("--authors")) {
|
||||
cout << "QupZilla authors: " << endl;
|
||||
cout << " nowrep <nowrep@gmail.com>" << endl;
|
||||
ActionPair pair;
|
||||
@ -93,7 +93,7 @@ void CommandLineOptions::parseActions()
|
||||
break;
|
||||
}
|
||||
|
||||
if (arg == "-v" || arg == "--version") {
|
||||
if (arg == QLatin1String("-v") || arg == QLatin1String("--version")) {
|
||||
cout << "QupZilla v" << QupZilla::VERSION.toUtf8().data()
|
||||
#ifdef GIT_REVISION
|
||||
<< " rev " << GIT_REVISION << " "
|
||||
@ -106,8 +106,8 @@ void CommandLineOptions::parseActions()
|
||||
break;
|
||||
}
|
||||
|
||||
if (arg.startsWith("-p=") || arg.startsWith("--profile=")) {
|
||||
int index = arg.indexOf('=');
|
||||
if (arg.startsWith(QLatin1String("-p=")) || arg.startsWith(QLatin1String("--profile="))) {
|
||||
int index = arg.indexOf(QLatin1Char('='));
|
||||
if (index != -1) {
|
||||
const QString profileName = arg.mid(index + 1);
|
||||
cout << "QupZilla: Starting with profile '" << profileName.toUtf8().data() << "'" << endl;
|
||||
@ -119,44 +119,44 @@ void CommandLineOptions::parseActions()
|
||||
}
|
||||
}
|
||||
|
||||
if (arg.startsWith("-ne") || arg.startsWith("--no-extensions")) {
|
||||
if (arg.startsWith(QLatin1String("-ne")) || arg.startsWith(QLatin1String("--no-extensions"))) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_StartWithoutAddons;
|
||||
m_actions.append(pair);
|
||||
}
|
||||
|
||||
if (arg.startsWith("-nt") || arg.startsWith("--new-tab")) {
|
||||
if (arg.startsWith(QLatin1String("-nt")) || arg.startsWith(QLatin1String("--new-tab"))) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_NewTab;
|
||||
m_actions.append(pair);
|
||||
}
|
||||
|
||||
if (arg.startsWith("-nw") || arg.startsWith("--new-window")) {
|
||||
if (arg.startsWith(QLatin1String("-nw")) || arg.startsWith(QLatin1String("--new-window"))) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_NewWindow;
|
||||
m_actions.append(pair);
|
||||
}
|
||||
|
||||
if (arg.startsWith("-dm") || arg.startsWith("--download-manager")) {
|
||||
if (arg.startsWith(QLatin1String("-dm")) || arg.startsWith(QLatin1String("--download-manager"))) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_ShowDownloadManager;
|
||||
m_actions.append(pair);
|
||||
}
|
||||
|
||||
if (arg.startsWith("-pb") || arg.startsWith("--private-browsing")) {
|
||||
if (arg.startsWith(QLatin1String("-pb")) || arg.startsWith(QLatin1String("--private-browsing"))) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_StartPrivateBrowsing;
|
||||
m_actions.append(pair);
|
||||
}
|
||||
|
||||
if (arg.startsWith("-nr") || arg.startsWith("--no-remote")) {
|
||||
if (arg.startsWith(QLatin1String("-nr")) || arg.startsWith(QLatin1String("--no-remote"))) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_StartNewInstance;
|
||||
m_actions.append(pair);
|
||||
}
|
||||
|
||||
if (arg.startsWith("-ct") || arg.startsWith("--current-tab")) {
|
||||
int index = arg.indexOf('=');
|
||||
if (arg.startsWith(QLatin1String("-ct")) || arg.startsWith(QLatin1String("--current-tab"))) {
|
||||
int index = arg.indexOf(QLatin1Char('='));
|
||||
if (index != -1) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_OpenUrlInCurrentTab;
|
||||
@ -165,8 +165,8 @@ void CommandLineOptions::parseActions()
|
||||
}
|
||||
}
|
||||
|
||||
if (arg.startsWith("-ow") || arg.startsWith("--open-window")) {
|
||||
int index = arg.indexOf('=');
|
||||
if (arg.startsWith(QLatin1String("-ow")) || arg.startsWith(QLatin1String("--open-window"))) {
|
||||
int index = arg.indexOf(QLatin1Char('='));
|
||||
if (index != -1) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_OpenUrlInNewWindow;
|
||||
@ -178,8 +178,9 @@ void CommandLineOptions::parseActions()
|
||||
|
||||
const QString &url = arguments.last();
|
||||
|
||||
if (m_argc > 1 && !url.isEmpty() && !url.startsWith('-') &&
|
||||
(url.contains('.') || url.contains('/') || url.contains('\\'))) {
|
||||
if (m_argc > 1 && !url.isEmpty() && !url.startsWith(QLatin1Char('-')) &&
|
||||
(url.contains(QLatin1Char('.')) || url.contains(QLatin1Char('/'))
|
||||
|| url.contains(QLatin1Char('\\')))) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_OpenUrl;
|
||||
pair.text = url;
|
||||
|
@ -101,7 +101,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
DATADIR.append("../Resources/");
|
||||
DATADIR.append(QLatin1String("../Resources/"));
|
||||
#endif
|
||||
|
||||
#ifdef PORTABLE_BUILD
|
||||
@ -132,14 +132,14 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
startProfile = pair.text;
|
||||
break;
|
||||
case Qz::CL_NewTab:
|
||||
messages.append("ACTION:NewTab");
|
||||
messages.append(QLatin1String("ACTION:NewTab"));
|
||||
m_postLaunchActions.append(OpenNewTab);
|
||||
break;
|
||||
case Qz::CL_NewWindow:
|
||||
messages.append("ACTION:NewWindow");
|
||||
messages.append(QLatin1String("ACTION:NewWindow"));
|
||||
break;
|
||||
case Qz::CL_ShowDownloadManager:
|
||||
messages.append("ACTION:ShowDownloadManager");
|
||||
messages.append(QLatin1String("ACTION:ShowDownloadManager"));
|
||||
m_postLaunchActions.append(OpenDownloadManager);
|
||||
break;
|
||||
case Qz::CL_StartPrivateBrowsing:
|
||||
@ -174,7 +174,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
QString appId = "QupZillaWebBrowser";
|
||||
|
||||
if (newInstance) {
|
||||
if (startProfile.isEmpty() || startProfile == "default") {
|
||||
if (startProfile.isEmpty() || startProfile == QLatin1String("default")) {
|
||||
std::cout << "New instance cannot be started with default profile!" << std::endl;
|
||||
}
|
||||
else {
|
||||
@ -186,7 +186,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
}
|
||||
|
||||
if (messages.isEmpty()) {
|
||||
messages.append(" ");
|
||||
messages.append(QLatin1String(" "));
|
||||
}
|
||||
|
||||
if (isRunning()) {
|
||||
@ -213,7 +213,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
if (startProfile.isEmpty()) {
|
||||
QSettings settings(PROFILEDIR + "profiles/profiles.ini", QSettings::IniFormat);
|
||||
if (settings.value("Profiles/startProfile", "default").toString().contains('/')) {
|
||||
if (settings.value("Profiles/startProfile", "default").toString().contains(QLatin1Char('/'))) {
|
||||
m_activeProfil = PROFILEDIR + "profiles/default/";
|
||||
}
|
||||
else {
|
||||
@ -483,27 +483,27 @@ void MainApplication::receiveAppMessage(QString message)
|
||||
QWidget* actWin = getWindow();
|
||||
QUrl actUrl;
|
||||
|
||||
if (message.startsWith("URL:")) {
|
||||
if (message.startsWith(QLatin1String("URL:"))) {
|
||||
QUrl url = QUrl::fromUserInput(message.mid(4));
|
||||
addNewTab(url);
|
||||
actWin = getWindow();
|
||||
}
|
||||
else if (message.startsWith("ACTION:")) {
|
||||
else if (message.startsWith(QLatin1String("ACTION:"))) {
|
||||
QString text = message.mid(7);
|
||||
if (text == "NewTab") {
|
||||
if (text == QLatin1String("NewTab")) {
|
||||
addNewTab();
|
||||
}
|
||||
else if (text == "NewWindow") {
|
||||
else if (text == QLatin1String("NewWindow")) {
|
||||
actWin = makeNewWindow(Qz::BW_NewWindow);
|
||||
}
|
||||
else if (text == "ShowDownloadManager") {
|
||||
else if (text == QLatin1String("ShowDownloadManager")) {
|
||||
downManager()->show();
|
||||
actWin = downManager();
|
||||
}
|
||||
else if (text.startsWith("OpenUrlInCurrentTab")) {
|
||||
else if (text.startsWith(QLatin1String("OpenUrlInCurrentTab"))) {
|
||||
actUrl = QUrl::fromUserInput(text.mid(19));
|
||||
}
|
||||
else if (text.startsWith("OpenUrlInNewWindow")) {
|
||||
else if (text.startsWith(QLatin1String("OpenUrlInNewWindow"))) {
|
||||
makeNewWindow(Qz::BW_NewWindow, QUrl::fromUserInput(text.mid(18)));
|
||||
return;
|
||||
}
|
||||
@ -789,12 +789,12 @@ void MainApplication::startPrivateBrowsing()
|
||||
{
|
||||
QStringList args;
|
||||
foreach(const QString & arg, arguments()) {
|
||||
if (arg.startsWith('-')) {
|
||||
if (arg.startsWith(QLatin1Char('-'))) {
|
||||
args.append(arg);
|
||||
}
|
||||
}
|
||||
|
||||
args.append("--private-browsing");
|
||||
args.append(QLatin1String("--private-browsing"));
|
||||
|
||||
if (!QProcess::startDetached(applicationFilePath(), args)) {
|
||||
qWarning() << "MainApplication: Cannot start new browser process for private browsing!" << applicationFilePath() << args;
|
||||
@ -816,7 +816,7 @@ QUrl MainApplication::userStyleSheet(const QString &filePath) const
|
||||
QFile file(filePath);
|
||||
if (!filePath.isEmpty() && file.open(QFile::ReadOnly)) {
|
||||
QString fileData = QString::fromUtf8(file.readAll());
|
||||
fileData.remove('\n');
|
||||
fileData.remove(QLatin1Char('\n'));
|
||||
userStyle.append(fileData);
|
||||
file.close();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ int ProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption* option, cons
|
||||
if (m_TabBarTabHSpace == -1) {
|
||||
m_TabBarTabHSpace = qMin(QProxyStyle::pixelMetric(PM_TabBarTabHSpace, option, widget), 14);
|
||||
|
||||
if (baseStyle()->objectName() == "oxygen") {
|
||||
if (baseStyle()->objectName() == QLatin1String("oxygen")) {
|
||||
m_TabBarTabHSpace = 14;
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ void QupZilla::postLaunch()
|
||||
|
||||
m_tabWidget->addView(request, Qz::NT_CleanSelectedTabAtTheEnd);
|
||||
|
||||
if (startUrl.isEmpty() || startUrl.toString() == "qupzilla:speeddial") {
|
||||
if (startUrl.isEmpty() || startUrl.toString() == QLatin1String("qupzilla:speeddial")) {
|
||||
locationBar()->setFocus();
|
||||
}
|
||||
}
|
||||
@ -968,27 +968,30 @@ void QupZilla::aboutToShowEncodingMenu()
|
||||
if (QTextCodec::codecForName(name)->aliases().contains(name)) {
|
||||
continue;
|
||||
}
|
||||
QAction* action = new QAction(name, 0);
|
||||
action->setData(name);
|
||||
|
||||
const QString nameString = QString::fromUtf8(name);
|
||||
|
||||
QAction* action = new QAction(nameString, 0);
|
||||
action->setData(nameString);
|
||||
action->setCheckable(true);
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(changeEncoding()));
|
||||
if (activeCodec.compare(name, Qt::CaseInsensitive) == 0) {
|
||||
if (activeCodec.compare(nameString, Qt::CaseInsensitive) == 0) {
|
||||
action->setChecked(true);
|
||||
}
|
||||
|
||||
if (name.startsWith("ISO")) {
|
||||
if (nameString.startsWith(QLatin1String("ISO"))) {
|
||||
menuISO->addAction(action);
|
||||
}
|
||||
else if (name.startsWith("UTF")) {
|
||||
else if (nameString.startsWith(QLatin1String("UTF"))) {
|
||||
menuUTF->addAction(action);
|
||||
}
|
||||
else if (name.startsWith("windows")) {
|
||||
else if (nameString.startsWith(QLatin1String("windows"))) {
|
||||
menuWindows->addAction(action);
|
||||
}
|
||||
else if (name.startsWith("Iscii")) {
|
||||
else if (nameString.startsWith(QLatin1String("Iscii"))) {
|
||||
menuIscii->addAction(action);
|
||||
}
|
||||
else if (name == "System") {
|
||||
else if (nameString == QLatin1String("System")) {
|
||||
m_menuEncoding->addAction(action);
|
||||
}
|
||||
else {
|
||||
|
@ -229,8 +229,8 @@ void AutoFillModel::completePage(WebPage* page)
|
||||
for (int i = 0; i < arguments.count(); i++) {
|
||||
QString key = arguments.at(i).first;
|
||||
QString value = arguments.at(i).second;
|
||||
key.replace('+', ' ');
|
||||
value.replace('+', ' ');
|
||||
key.replace(QLatin1Char('+'), QLatin1Char(' '));
|
||||
value.replace(QLatin1Char('+'), QLatin1Char(' '));
|
||||
|
||||
key = QUrl::fromEncoded(key.toUtf8()).toString();
|
||||
value = QUrl::fromEncoded(value.toUtf8()).toString();
|
||||
@ -238,7 +238,9 @@ void AutoFillModel::completePage(WebPage* page)
|
||||
for (int i = 0; i < inputs.count(); i++) {
|
||||
QWebElement element = inputs.at(i);
|
||||
|
||||
if (element.attribute("type") != "text" && element.attribute("type") != "password" && !element.attribute("type").isEmpty()) {
|
||||
if (element.attribute("type") != QLatin1String("text")
|
||||
&& element.attribute("type") != QLatin1String("password")
|
||||
&& !element.attribute("type").isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -382,13 +384,13 @@ QByteArray AutoFillModel::convertWebKitFormBoundaryIfNecessary(const QByteArray
|
||||
QString string = rx.cap(1);
|
||||
pos += rx.matchedLength();
|
||||
|
||||
int endOfAttributeName = string.indexOf('"');
|
||||
int endOfAttributeName = string.indexOf(QLatin1Char('"'));
|
||||
if (endOfAttributeName == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QString attrName = string.left(endOfAttributeName);
|
||||
QString attrValue = string.mid(endOfAttributeName + 1).trimmed().remove('\n');
|
||||
QString attrValue = string.mid(endOfAttributeName + 1).trimmed().remove(QLatin1Char('\n'));
|
||||
|
||||
if (attrName.isEmpty() || attrValue.isEmpty()) {
|
||||
continue;
|
||||
@ -462,27 +464,27 @@ bool AutoFillModel::importPasswords(const QByteArray &data)
|
||||
xml.readNext();
|
||||
|
||||
if (xml.isStartElement()) {
|
||||
if (xml.name() == "entry") {
|
||||
if (xml.name() == QLatin1String("entry")) {
|
||||
QString server;
|
||||
QString username;
|
||||
QString password;
|
||||
QByteArray data;
|
||||
|
||||
while (xml.readNext()) {
|
||||
if (xml.name() == "server") {
|
||||
if (xml.name() == QLatin1String("server")) {
|
||||
server = xml.readElementText();
|
||||
}
|
||||
else if (xml.name() == "username") {
|
||||
else if (xml.name() == QLatin1String("username")) {
|
||||
username = xml.readElementText();
|
||||
}
|
||||
else if (xml.name() == "password") {
|
||||
else if (xml.name() == QLatin1String("password")) {
|
||||
password = xml.readElementText();
|
||||
}
|
||||
else if (xml.name() == "data") {
|
||||
else if (xml.name() == QLatin1String("data")) {
|
||||
data = xml.readElementText().toUtf8();
|
||||
}
|
||||
|
||||
if (xml.isEndElement() && xml.name() == "entry") {
|
||||
if (xml.isEndElement() && xml.name() == QLatin1String("entry")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -505,15 +507,15 @@ bool AutoFillModel::importPasswords(const QByteArray &data)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (xml.name() == "exception") {
|
||||
else if (xml.name() == QLatin1String("exception")) {
|
||||
QString server;
|
||||
|
||||
while (xml.readNext()) {
|
||||
if (xml.name() == "server") {
|
||||
if (xml.name() == QLatin1String("server")) {
|
||||
server = xml.readElementText();
|
||||
}
|
||||
|
||||
if (xml.isEndElement() && xml.name() == "exception") {
|
||||
if (xml.isEndElement() && xml.name() == QLatin1String("exception")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -345,10 +345,10 @@ void BookmarksManager::refreshTable()
|
||||
QString folder = query.value(3).toString();
|
||||
QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(4).toByteArray()));
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
if (folder == "bookmarksMenu") {
|
||||
if (folder == QLatin1String("bookmarksMenu")) {
|
||||
folder = _bookmarksMenu;
|
||||
}
|
||||
if (folder == "bookmarksToolbar") {
|
||||
if (folder == QLatin1String("bookmarksToolbar")) {
|
||||
folder = _bookmarksToolbar;
|
||||
}
|
||||
|
||||
@ -474,7 +474,7 @@ void BookmarksManager::removeBookmark(const BookmarksModel::Bookmark &bookmark)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bookmark.folder == "unsorted") {
|
||||
else if (bookmark.folder == QLatin1String("unsorted")) {
|
||||
QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(bookmark.title, Qt::MatchExactly);
|
||||
if (list.count() == 0) {
|
||||
return;
|
||||
|
@ -65,7 +65,8 @@ void BookmarksModel::setShowingOnlyIconsInToolbar(bool state)
|
||||
|
||||
bool BookmarksModel::isFolder(const QString &name)
|
||||
{
|
||||
if (name == "bookmarksToolbar" || name == "bookmarksMenu" || name == "unsorted") {
|
||||
if (name == QLatin1String("bookmarksToolbar") || name == QLatin1String("bookmarksMenu")
|
||||
|| name == QLatin1String("unsorted")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -501,7 +502,7 @@ bool BookmarksModel::isSubfolder(const QString &name)
|
||||
return false;
|
||||
}
|
||||
|
||||
return query.value(0).toString() == "yes";
|
||||
return query.value(0).toString() == QLatin1String("yes");
|
||||
}
|
||||
|
||||
bool BookmarksModel::bookmarksEqual(const Bookmark &one, const Bookmark &two)
|
||||
@ -524,13 +525,13 @@ bool BookmarksModel::bookmarksEqual(const Bookmark &one, const Bookmark &two)
|
||||
QString BookmarksModel::toTranslatedFolder(const QString &name)
|
||||
{
|
||||
QString trFolder;
|
||||
if (name == "bookmarksMenu") {
|
||||
if (name == QLatin1String("bookmarksMenu")) {
|
||||
trFolder = tr("Bookmarks In Menu");
|
||||
}
|
||||
else if (name == "bookmarksToolbar") {
|
||||
else if (name == QLatin1String("bookmarksToolbar")) {
|
||||
trFolder = tr("Bookmarks In ToolBar");
|
||||
}
|
||||
else if (name == "unsorted") {
|
||||
else if (name == QLatin1String("unsorted")) {
|
||||
trFolder = tr("Unsorted Bookmarks");
|
||||
}
|
||||
else {
|
||||
|
@ -444,13 +444,16 @@ void BookmarksToolbar::removeBookmark(const BookmarksModel::Bookmark &bookmark)
|
||||
|
||||
void BookmarksToolbar::bookmarkEdited(const BookmarksModel::Bookmark &before, const BookmarksModel::Bookmark &after)
|
||||
{
|
||||
if (before.folder == "bookmarksToolbar" && after.folder != "bookmarksToolbar") { //Editing from toolbar folder to other folder -> Remove bookmark
|
||||
if (before.folder == QLatin1String("bookmarksToolbar") && after.folder != QLatin1String("bookmarksToolbar")) {
|
||||
// Editing from toolbar folder to other folder -> Remove bookmark
|
||||
removeBookmark(before);
|
||||
}
|
||||
else if (before.folder != "bookmarksToolbar" && after.folder == "bookmarksToolbar") { //Editing from other folder to toolbar folder -> Add bookmark
|
||||
else if (before.folder != QLatin1String("bookmarksToolbar") && after.folder == QLatin1String("bookmarksToolbar")) {
|
||||
// Editing from other folder to toolbar folder -> Add bookmark
|
||||
addBookmark(after);
|
||||
}
|
||||
else { //Editing bookmark already in toolbar
|
||||
else {
|
||||
// Editing bookmark already in toolbar
|
||||
for (int i = 0; i < m_layout->count(); i++) {
|
||||
ToolButton* button = qobject_cast<ToolButton*>(m_layout->itemAt(i)->widget());
|
||||
if (!button) {
|
||||
|
@ -73,7 +73,8 @@ QList<BookmarksModel::Bookmark> FirefoxImporter::exportBookmarks()
|
||||
|
||||
QUrl url = query2.value(0).toUrl();
|
||||
|
||||
if (title.isEmpty() || url.isEmpty() || url.scheme() == "place" || url.scheme() == "about") {
|
||||
if (title.isEmpty() || url.isEmpty() || url.scheme() == QLatin1String("place")
|
||||
|| url.scheme() == QLatin1String("about")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -69,29 +69,29 @@ QList<BookmarksModel::Bookmark> HtmlImporter::exportBookmarks()
|
||||
// Converting tags to lower case -,-
|
||||
// For some reason Qt::CaseInsensitive is not everytime insensitive :-D
|
||||
|
||||
bookmarks.replace("<DL", "<dl");
|
||||
bookmarks.replace("</DL", "</dl");
|
||||
bookmarks.replace("<DT", "<dt");
|
||||
bookmarks.replace("</DT", "</dt");
|
||||
bookmarks.replace("<P", "<p");
|
||||
bookmarks.replace("</P", "</p");
|
||||
bookmarks.replace("<A", "<a");
|
||||
bookmarks.replace("</A", "</a");
|
||||
bookmarks.replace("HREF=", "href=");
|
||||
bookmarks.replace("<H3", "<h3");
|
||||
bookmarks.replace("</H3", "</h3");
|
||||
bookmarks.replace(QLatin1String("<DL"), QLatin1String("<dl"));
|
||||
bookmarks.replace(QLatin1String("</DL"), QLatin1String("</dl"));
|
||||
bookmarks.replace(QLatin1String("<DT"), QLatin1String("<dt"));
|
||||
bookmarks.replace(QLatin1String("</DT"), QLatin1String("</dt"));
|
||||
bookmarks.replace(QLatin1String("<P"), QLatin1String("<p"));
|
||||
bookmarks.replace(QLatin1String("</P"), QLatin1String("</p"));
|
||||
bookmarks.replace(QLatin1String("<A"), QLatin1String("<a"));
|
||||
bookmarks.replace(QLatin1String("</A"), QLatin1String("</a"));
|
||||
bookmarks.replace(QLatin1String("HREF="), QLatin1String("href="));
|
||||
bookmarks.replace(QLatin1String("<H3"), QLatin1String("<h3"));
|
||||
bookmarks.replace(QLatin1String("</H3"), QLatin1String("</h3"));
|
||||
|
||||
bookmarks = bookmarks.left(bookmarks.lastIndexOf("</dl><p>"));
|
||||
int start = bookmarks.indexOf("<dl><p>");
|
||||
bookmarks = bookmarks.left(bookmarks.lastIndexOf(QLatin1String("</dl><p>")));
|
||||
int start = bookmarks.indexOf(QLatin1String("<dl><p>"));
|
||||
|
||||
QStringList folders("Html Import");
|
||||
|
||||
while (start > 0) {
|
||||
QString string = bookmarks.mid(start);
|
||||
|
||||
int posOfFolder = string.indexOf("<dt><h3");
|
||||
int posOfEndFolder = string.indexOf("</dl><p>");
|
||||
int posOfLink = string.indexOf("<dt><a");
|
||||
int posOfFolder = string.indexOf(QLatin1String("<dt><h3"));
|
||||
int posOfEndFolder = string.indexOf(QLatin1String("</dl><p>"));
|
||||
int posOfLink = string.indexOf(QLatin1String("<dt><a"));
|
||||
|
||||
int nearest = qzMin(posOfLink, qzMin(posOfFolder, posOfEndFolder));
|
||||
if (nearest == -1) {
|
||||
@ -136,7 +136,8 @@ QList<BookmarksModel::Bookmark> HtmlImporter::exportBookmarks()
|
||||
|
||||
start += posOfLink + rx.cap(0).size();
|
||||
|
||||
if (linkName.isEmpty() || url.isEmpty() || url.scheme() == "place" || url.scheme() == "about") {
|
||||
if (linkName.isEmpty() || url.isEmpty() || url.scheme() == QLatin1String("place")
|
||||
|| url.scheme() == QLatin1String("about")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -33,11 +33,11 @@ bool _matchDomain(const QString &domain, const QString &filter)
|
||||
|
||||
int index = domain.indexOf(filter);
|
||||
|
||||
if (index == 0 || filter[0] == '.') {
|
||||
if (index == 0 || filter[0] == QLatin1Char('.')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return domain[index - 1] == '.';
|
||||
return domain[index - 1] == QLatin1Char('.');
|
||||
}
|
||||
|
||||
bool containsDomain(QString string, const QString &domain)
|
||||
@ -47,7 +47,7 @@ bool containsDomain(QString string, const QString &domain)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (string.startsWith('.')) {
|
||||
if (string.startsWith(QLatin1Char('.'))) {
|
||||
string = string.mid(1);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ void CookieManager::slotRefreshTable()
|
||||
QTreeWidgetItem* item;
|
||||
|
||||
QString cookieDomain = cookie.domain();
|
||||
if (cookieDomain.startsWith('.')) {
|
||||
if (cookieDomain.startsWith(QLatin1Char('.'))) {
|
||||
cookieDomain = cookieDomain.mid(1);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS
|
||||
|
||||
QDBusInterface dbus("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus());
|
||||
QVariantList args;
|
||||
args.append("qupzilla");
|
||||
args.append(QLatin1String("qupzilla"));
|
||||
args.append(m_uint);
|
||||
args.append(tmp.fileName());
|
||||
args.append(heading);
|
||||
@ -111,7 +111,7 @@ void DesktopNotificationsFactory::nativeNotificationPreview()
|
||||
|
||||
QDBusInterface dbus("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus());
|
||||
QVariantList args;
|
||||
args.append("qupzilla");
|
||||
args.append(QLatin1String("qupzilla"));
|
||||
args.append(m_uint);
|
||||
args.append(tmp.fileName());
|
||||
args.append(QObject::tr("Native System Notification"));
|
||||
|
@ -205,7 +205,7 @@ void DownloadFileHelper::fileNameChoosed(const QString &name, bool fileNameAutoG
|
||||
}
|
||||
|
||||
|
||||
int pos = m_userFileName.lastIndexOf("/");
|
||||
int pos = m_userFileName.lastIndexOf(QLatin1Char('/'));
|
||||
if (pos != -1) {
|
||||
int size = m_userFileName.size();
|
||||
m_path = m_userFileName.left(pos + 1);
|
||||
@ -254,7 +254,7 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply)
|
||||
reg.indexIn(value);
|
||||
path = reg.cap(1).trimmed();
|
||||
|
||||
if (path.startsWith('"') && path.endsWith('"')) {
|
||||
if (path.startsWith(QLatin1Char('"')) && path.endsWith(QLatin1Char('"'))) {
|
||||
path = path.mid(1, path.length() - 2);
|
||||
}
|
||||
}
|
||||
@ -273,13 +273,13 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply)
|
||||
}
|
||||
|
||||
if (!endName.isEmpty()) {
|
||||
endName.prepend(".");
|
||||
endName.prepend(QLatin1Char('.'));
|
||||
}
|
||||
|
||||
QString name = baseName + endName;
|
||||
|
||||
if (name.contains('"')) {
|
||||
name.remove("\";");
|
||||
if (name.contains(QLatin1Char('"'))) {
|
||||
name.remove(QLatin1String("\";"));
|
||||
}
|
||||
|
||||
return qz_filterCharsFromFilename(name);
|
||||
|
@ -368,7 +368,7 @@ void DownloadItem::openFolder()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QString winFileName = m_path + m_fileName;
|
||||
winFileName.replace("/", "\\");
|
||||
winFileName.replace(QLatin1Char('/'), "\\");
|
||||
QProcess::startDetached("explorer.exe /e,/select,\"" + winFileName + "\"");
|
||||
#else
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(m_path));
|
||||
|
@ -68,7 +68,7 @@ void DownloadManager::loadSettings()
|
||||
Settings settings;
|
||||
settings.beginGroup("DownloadManager");
|
||||
m_downloadPath = settings.value("defaultDownloadPath", QString()).toString();
|
||||
m_lastDownloadPath = settings.value("lastDownloadPath", QDir::homePath().append("/")).toString();
|
||||
m_lastDownloadPath = settings.value("lastDownloadPath", QDir::homePath().append(QLatin1Char('/'))).toString();
|
||||
m_closeOnFinish = settings.value("CloseManagerOnFinish", false).toBool();
|
||||
m_useNativeDialog = settings.value("useNativeDialog", DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG).toBool();
|
||||
|
||||
@ -102,7 +102,7 @@ void DownloadManager::keyPressEvent(QKeyEvent* e)
|
||||
|
||||
void DownloadManager::startExternalManager(const QUrl &url)
|
||||
{
|
||||
QStringList arguments = m_externalArguments.split(' ', QString::SkipEmptyParts);
|
||||
QStringList arguments = m_externalArguments.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
arguments << url.toString();
|
||||
|
||||
bool success = QProcess::startDetached(m_externalExecutable, arguments);
|
||||
@ -210,7 +210,7 @@ void DownloadManager::download(const QNetworkRequest &request, const DownloadInf
|
||||
|
||||
void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const DownloadInfo &info)
|
||||
{
|
||||
if (!info.page || reply->url().scheme() == "qupzilla") {
|
||||
if (!info.page || reply->url().scheme() == QLatin1String("qupzilla")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ void History::addHistoryEntry(const QUrl &url, QString title)
|
||||
if (!m_isSaving) {
|
||||
return;
|
||||
}
|
||||
if (url.scheme() == "qupzilla" || url.scheme() == "about" || url.isEmpty()) {
|
||||
if (url.scheme() == QLatin1String("qupzilla") || url.scheme() == QLatin1String("about") || url.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (title.isEmpty()) {
|
||||
|
@ -129,7 +129,7 @@ void LocationCompleterDelegate::drawHighlightedTextLine(const QRect &rect, QStri
|
||||
const QPalette::ColorRole &role) const
|
||||
{
|
||||
QList<int> delimiters;
|
||||
QStringList searchStrings = searchText.split(' ', QString::SkipEmptyParts);
|
||||
QStringList searchStrings = searchText.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
|
||||
// Look for longer parts first
|
||||
qSort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan);
|
||||
|
@ -133,23 +133,23 @@ QSqlQuery LocationCompleterModel::createQuery(const QString &searchString, const
|
||||
QStringList searchList;
|
||||
|
||||
if (bookmarks) {
|
||||
query.append(", bookmarks.icon FROM bookmarks LEFT JOIN history ON bookmarks.url=history.url ");
|
||||
query.append(QLatin1String(", bookmarks.icon FROM bookmarks LEFT JOIN history ON bookmarks.url=history.url "));
|
||||
}
|
||||
else {
|
||||
query.append(" FROM history ");
|
||||
query.append(QLatin1String(" FROM history "));
|
||||
}
|
||||
|
||||
query.append("WHERE ");
|
||||
query.append(QLatin1String("WHERE "));
|
||||
if (exactMatch) {
|
||||
query.append(QString("%1.title LIKE ? OR %1.url LIKE ? ").arg(table));
|
||||
}
|
||||
else {
|
||||
searchList = searchString.split(' ', QString::SkipEmptyParts);
|
||||
searchList = searchString.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
const int slSize = searchList.size();
|
||||
for (int i = 0; i < slSize; ++i) {
|
||||
query.append(QString("(%1.title LIKE ? OR %1.url LIKE ?) ").arg(table));
|
||||
if (i < slSize - 1) {
|
||||
query.append("AND ");
|
||||
query.append(QLatin1String("AND "));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -162,7 +162,7 @@ QSqlQuery LocationCompleterModel::createQuery(const QString &searchString, const
|
||||
query.append("ORDER BY " + orderBy);
|
||||
}
|
||||
|
||||
query.append(" LIMIT ?");
|
||||
query.append(QLatin1String(" LIMIT ?"));
|
||||
|
||||
QSqlQuery sqlQuery;
|
||||
sqlQuery.prepare(query);
|
||||
|
@ -125,14 +125,14 @@ QUrl LocationBar::createUrl()
|
||||
QUrl urlToLoad;
|
||||
|
||||
//Check for Search Engine shortcut
|
||||
int firstSpacePos = text().indexOf(' ');
|
||||
int firstSpacePos = text().indexOf(QLatin1Char(' '));
|
||||
if (firstSpacePos != -1) {
|
||||
QString shortcut = text().left(firstSpacePos);
|
||||
QString searchedString = QUrl::toPercentEncoding(text().mid(firstSpacePos).trimmed());
|
||||
|
||||
SearchEngine en = mApp->searchEnginesManager()->engineForShortcut(shortcut);
|
||||
if (!en.name.isEmpty()) {
|
||||
urlToLoad = QUrl::fromEncoded(en.url.replace("%s", searchedString).toUtf8());
|
||||
urlToLoad = QUrl::fromEncoded(en.url.replace(QLatin1String("%s"), searchedString).toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ void LocationBar::showSiteInfo()
|
||||
{
|
||||
QUrl url = p_QupZilla->weView()->url();
|
||||
|
||||
if (url.isEmpty() || url.scheme() == "qupzilla") {
|
||||
if (url.isEmpty() || url.scheme() == QLatin1String("qupzilla")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ void LocationBar::showUrl(const QUrl &url)
|
||||
|
||||
QString stringUrl = qz_urlEncodeQueryString(url);
|
||||
|
||||
if (stringUrl == "qupzilla:speeddial" || stringUrl == "about:blank") {
|
||||
if (stringUrl == QLatin1String("qupzilla:speeddial") || stringUrl == QLatin1String("about:blank")) {
|
||||
stringUrl = "";
|
||||
}
|
||||
|
||||
@ -452,7 +452,7 @@ void LocationBar::keyPressEvent(QKeyEvent* event)
|
||||
case Qt::Key_Enter:
|
||||
switch (event->modifiers()) {
|
||||
case Qt::ControlModifier:
|
||||
setText(text().append(".com"));
|
||||
setText(text().append(QLatin1String(".com")));
|
||||
urlEnter();
|
||||
m_holdingAlt = false;
|
||||
break;
|
||||
@ -498,7 +498,7 @@ void LocationBar::keyReleaseEvent(QKeyEvent* event)
|
||||
QString localDomain = tr(".co.uk", "Append domain name on ALT + Enter = Should be different for every country");
|
||||
|
||||
if (event->key() == Qt::Key_Alt && m_holdingAlt && qzSettings->addCountryWithAlt &&
|
||||
!text().endsWith(localDomain) && !text().endsWith("/")) {
|
||||
!text().endsWith(localDomain) && !text().endsWith(QLatin1Char('/'))) {
|
||||
LineEdit::setText(text().append(localDomain));
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ QString titleForUrl(QString title, const QUrl &url)
|
||||
QIcon iconForPage(const QUrl &url, const QIcon &sIcon)
|
||||
{
|
||||
QIcon icon;
|
||||
icon.addPixmap(url.scheme() == "qupzilla" ? QIcon(":icons/qupzilla.png").pixmap(16, 16) : _iconForUrl(url).pixmap(16, 16));
|
||||
icon.addPixmap(url.scheme() == QLatin1String("qupzilla") ? QIcon(":icons/qupzilla.png").pixmap(16, 16) : _iconForUrl(url).pixmap(16, 16));
|
||||
icon.addPixmap(sIcon.pixmap(16, 16), QIcon::Active);
|
||||
return icon;
|
||||
}
|
||||
|
@ -52,8 +52,8 @@
|
||||
QString fileNameForCert(const QSslCertificate &cert)
|
||||
{
|
||||
QString certFileName = CertificateInfoWidget::certificateItemText(cert);
|
||||
certFileName.remove(' ');
|
||||
certFileName.append(".crt");
|
||||
certFileName.remove(QLatin1Char(' '));
|
||||
certFileName.append(QLatin1String(".crt"));
|
||||
certFileName = qz_filterCharsFromFilename(certFileName);
|
||||
return certFileName;
|
||||
}
|
||||
@ -499,7 +499,7 @@ void NetworkManager::loadCertificates()
|
||||
QDirIterator it(path, QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
QString filePath = it.next();
|
||||
if (!filePath.endsWith(".crt")) {
|
||||
if (!filePath.endsWith(QLatin1String(".crt"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ void NetworkManager::loadCertificates()
|
||||
QDirIterator it_(mApp->currentProfilePath() + "certificates", QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories);
|
||||
while (it_.hasNext()) {
|
||||
QString filePath = it_.next();
|
||||
if (!filePath.endsWith(".crt")) {
|
||||
if (!filePath.endsWith(QLatin1String(".crt"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ QList<QNetworkProxy> NetworkProxyFactory::queryProxy(const QNetworkProxyQuery &q
|
||||
case DefinedProxy:
|
||||
proxy = m_proxyType;
|
||||
|
||||
if (m_useDifferentProxyForHttps && query.protocolTag() == "https") {
|
||||
if (m_useDifferentProxyForHttps && query.protocolTag() == QLatin1String("https")) {
|
||||
proxy.setHostName(m_httpsHostName);
|
||||
proxy.setPort(m_httpsPort);
|
||||
proxy.setUser(m_httpsUsername);
|
||||
|
@ -43,10 +43,10 @@ QNetworkReply* AdBlockSchemeHandler::createRequest(QNetworkAccessManager::Operat
|
||||
|
||||
for (int i = 0; i < queryItems.count(); ++i) {
|
||||
QPair<QString, QString> pair = queryItems.at(i);
|
||||
if (pair.first == "location") {
|
||||
if (pair.first == QLatin1String("location")) {
|
||||
subscriptionUrl = pair.second;
|
||||
}
|
||||
else if (pair.first == "title") {
|
||||
else if (pair.first == QLatin1String("title")) {
|
||||
subscriptionTitle = pair.second;
|
||||
}
|
||||
}
|
||||
|
@ -143,57 +143,57 @@ QString FileSchemeReply::loadDirectory()
|
||||
|
||||
if (sPage.isEmpty()) {
|
||||
sPage = qz_readAllFileContents(":/html/dirlist.html");
|
||||
sPage.replace("%BOX-BORDER%", "qrc:html/box-border.png");
|
||||
sPage.replace("%UP-IMG%", qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_FileDialogToParent).pixmap(22)));
|
||||
sPage.replace("%UP-DIR-TEXT%", tr("Up to higher level directory"));
|
||||
sPage.replace("%SHOW-HIDDEN-TEXT%", tr("Show hidden files"));
|
||||
sPage.replace("%NAME%", tr("Name"));
|
||||
sPage.replace("%SIZE%", tr("Size"));
|
||||
sPage.replace("%MODIFIED%", tr("Last modified"));
|
||||
sPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
||||
sPage.replace(QLatin1String("%UP-IMG%"), qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_FileDialogToParent).pixmap(22)));
|
||||
sPage.replace(QLatin1String("%UP-DIR-TEXT%"), tr("Up to higher level directory"));
|
||||
sPage.replace(QLatin1String("%SHOW-HIDDEN-TEXT%"), tr("Show hidden files"));
|
||||
sPage.replace(QLatin1String("%NAME%"), tr("Name"));
|
||||
sPage.replace(QLatin1String("%SIZE%"), tr("Size"));
|
||||
sPage.replace(QLatin1String("%MODIFIED%"), tr("Last modified"));
|
||||
sPage = qz_applyDirectionToPage(sPage);
|
||||
}
|
||||
|
||||
QString page = sPage;
|
||||
page.replace("%TITLE%", tr("Index for %1").arg(request().url().toLocalFile()));
|
||||
page.replace(QLatin1String("%TITLE%"), tr("Index for %1").arg(request().url().toLocalFile()));
|
||||
|
||||
QString upDirDisplay = "none";
|
||||
QString showHiddenDisplay = "none";
|
||||
QString upDirDisplay = QLatin1String("none");
|
||||
QString showHiddenDisplay = QLatin1String("none");
|
||||
QString tBody;
|
||||
|
||||
if (!dir.isRoot()) {
|
||||
QDir upDir = dir;
|
||||
upDir.cdUp();
|
||||
|
||||
upDirDisplay = "inline";
|
||||
page.replace("%UP-DIR-LINK%", QUrl::fromLocalFile(upDir.absolutePath()).toEncoded());
|
||||
upDirDisplay = QLatin1String("inline");
|
||||
page.replace(QLatin1String("%UP-DIR-LINK%"), QUrl::fromLocalFile(upDir.absolutePath()).toEncoded());
|
||||
}
|
||||
|
||||
foreach(const QFileInfo & info, list) {
|
||||
if (info.fileName() == "." || info.fileName() == "..") {
|
||||
if (info.fileName() == QLatin1String(".") || info.fileName() == QLatin1String("..")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QString line = "<tr";
|
||||
QString line = QLatin1String("<tr");
|
||||
|
||||
if (info.isHidden()) {
|
||||
showHiddenDisplay = "inline";
|
||||
line += " class=\"tr-hidden\"";
|
||||
}
|
||||
|
||||
line += "><td class=\"td-name\" style=\"background-image:url(data:image/png;base64,";
|
||||
line += QLatin1String("><td class=\"td-name\" style=\"background-image:url(data:image/png;base64,");
|
||||
line += qz_pixmapToByteArray(QFileIconProvider().icon(info).pixmap(16));
|
||||
line += ");\">";
|
||||
line += "<a href=\"";
|
||||
line += QLatin1String(");\">");
|
||||
line += QLatin1String("<a href=\"");
|
||||
line += QUrl::fromLocalFile(info.absoluteFilePath()).toEncoded();
|
||||
line += "\">";
|
||||
line += QLatin1String("\">");
|
||||
line += info.fileName();
|
||||
line += "</a></td><td class=\"td-size\">";
|
||||
line += QLatin1String("</a></td><td class=\"td-size\">");
|
||||
line += info.isDir() ? QString() : qz_fileSizeToString(info.size());
|
||||
line += "</td><td>";
|
||||
line += QLatin1String("</td><td>");
|
||||
line += info.lastModified().toString("dd.MM.yyyy");
|
||||
line += "</td><td>";
|
||||
line += QLatin1String("</td><td>");
|
||||
line += info.lastModified().toString("hh:mm:ss");
|
||||
line += "</td></tr>\n";
|
||||
line += QLatin1String("</td></tr>\n");
|
||||
|
||||
tBody.append(line);
|
||||
}
|
||||
@ -202,9 +202,9 @@ QString FileSchemeReply::loadDirectory()
|
||||
tBody = QString("<tr><td colspan='4'>%1</td></tr>").arg(tr("Folder is empty."));
|
||||
}
|
||||
|
||||
page.replace("%T-BODY%", tBody);
|
||||
page.replace("%UP-DIR-DISPLAY%", upDirDisplay);
|
||||
page.replace("%SHOW-HIDDEN-DISPLAY%", showHiddenDisplay);
|
||||
page.replace(QLatin1String("%T-BODY%"), tBody);
|
||||
page.replace(QLatin1String("%UP-DIR-DISPLAY%"), upDirDisplay);
|
||||
page.replace(QLatin1String("%SHOW-HIDDEN-DISPLAY%"), showHiddenDisplay);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
@ -82,22 +82,22 @@ void QupZillaSchemeReply::loadPage()
|
||||
QTextStream stream(&m_buffer);
|
||||
stream.setCodec("UTF-8");
|
||||
|
||||
if (m_pageName == "about") {
|
||||
if (m_pageName == QLatin1String("about")) {
|
||||
stream << aboutPage();
|
||||
}
|
||||
else if (m_pageName == "reportbug") {
|
||||
else if (m_pageName == QLatin1String("reportbug")) {
|
||||
stream << reportbugPage();
|
||||
}
|
||||
else if (m_pageName == "start") {
|
||||
else if (m_pageName == QLatin1String("start")) {
|
||||
stream << startPage();
|
||||
}
|
||||
else if (m_pageName == "speeddial") {
|
||||
else if (m_pageName == QLatin1String("speeddial")) {
|
||||
stream << speeddialPage();
|
||||
}
|
||||
else if (m_pageName == "config") {
|
||||
else if (m_pageName == QLatin1String("config")) {
|
||||
stream << configPage();
|
||||
}
|
||||
else if (m_pageName == "restore") {
|
||||
else if (m_pageName == QLatin1String("restore")) {
|
||||
stream << restorePage();
|
||||
}
|
||||
|
||||
@ -140,19 +140,19 @@ QString QupZillaSchemeReply::reportbugPage()
|
||||
}
|
||||
|
||||
bPage.append(qz_readAllFileContents(":html/reportbug.html"));
|
||||
bPage.replace("%FAVICON%", "qrc:icons/qupzilla.png");
|
||||
bPage.replace("%BOX-BORDER%", "qrc:html/box-border.png");
|
||||
bPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
||||
bPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
||||
|
||||
bPage.replace("%TITLE%", tr("Report Issue"));
|
||||
bPage.replace("%REPORT-ISSUE%", tr("Report Issue"));
|
||||
bPage.replace("%PLUGINS-TEXT%", tr("If you are experiencing problems with QupZilla, please try to disable"
|
||||
bPage.replace(QLatin1String("%TITLE%"), tr("Report Issue"));
|
||||
bPage.replace(QLatin1String("%REPORT-ISSUE%"), tr("Report Issue"));
|
||||
bPage.replace(QLatin1String("%PLUGINS-TEXT%"), tr("If you are experiencing problems with QupZilla, please try to disable"
|
||||
" all extensions first. <br/>If this does not fix it, then please fill out this form: "));
|
||||
bPage.replace("%EMAIL%", tr("Your E-mail"));
|
||||
bPage.replace("%TYPE%", tr("Issue type"));
|
||||
bPage.replace("%DESCRIPTION%", tr("Issue description"));
|
||||
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.replace(QLatin1String("%EMAIL%"), tr("Your E-mail"));
|
||||
bPage.replace(QLatin1String("%TYPE%"), tr("Issue type"));
|
||||
bPage.replace(QLatin1String("%DESCRIPTION%"), tr("Issue description"));
|
||||
bPage.replace(QLatin1String("%SEND%"), tr("Send"));
|
||||
bPage.replace(QLatin1String("%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(QLatin1String("%FIELDS-ARE-REQUIRED%"), tr("Please fill out all required fields!"));
|
||||
bPage = qz_applyDirectionToPage(bPage);
|
||||
|
||||
return bPage;
|
||||
@ -167,16 +167,16 @@ QString QupZillaSchemeReply::startPage()
|
||||
}
|
||||
|
||||
sPage.append(qz_readAllFileContents(":html/start.html"));
|
||||
sPage.replace("%FAVICON%", "qrc:icons/qupzilla.png");
|
||||
sPage.replace("%BOX-BORDER%", "qrc:html/box-border.png");
|
||||
sPage.replace("%ABOUT-IMG%", "qrc:icons/other/about.png");
|
||||
sPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
||||
sPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
||||
sPage.replace(QLatin1String("%ABOUT-IMG%"), QLatin1String("qrc:icons/other/about.png"));
|
||||
|
||||
sPage.replace("%TITLE%", tr("Start Page"));
|
||||
sPage.replace("%BUTTON-LABEL%", tr("Search on Web"));
|
||||
sPage.replace("%SEARCH-BY%", tr("Search results provided by DuckDuckGo"));
|
||||
sPage.replace("%WWW%", QupZilla::WIKIADDRESS);
|
||||
sPage.replace("%ABOUT-QUPZILLA%", tr("About QupZilla"));
|
||||
sPage.replace("%PRIVATE-BROWSING%", mApp->isPrivateSession() ? tr("<h1>Private Browsing</h1>") : QString());
|
||||
sPage.replace(QLatin1String("%TITLE%"), tr("Start Page"));
|
||||
sPage.replace(QLatin1String("%BUTTON-LABEL%"), tr("Search on Web"));
|
||||
sPage.replace(QLatin1String("%SEARCH-BY%"), tr("Search results provided by DuckDuckGo"));
|
||||
sPage.replace(QLatin1String("%WWW%"), QupZilla::WIKIADDRESS);
|
||||
sPage.replace(QLatin1String("%ABOUT-QUPZILLA%"), tr("About QupZilla"));
|
||||
sPage.replace(QLatin1String("%PRIVATE-BROWSING%"), mApp->isPrivateSession() ? tr("<h1>Private Browsing</h1>") : QString());
|
||||
sPage = qz_applyDirectionToPage(sPage);
|
||||
|
||||
return sPage;
|
||||
@ -188,27 +188,27 @@ QString QupZillaSchemeReply::aboutPage()
|
||||
|
||||
if (aPage.isEmpty()) {
|
||||
aPage.append(qz_readAllFileContents(":html/about.html"));
|
||||
aPage.replace("%FAVICON%", "qrc:icons/qupzilla.png");
|
||||
aPage.replace("%BOX-BORDER%", "qrc:html/box-border.png");
|
||||
aPage.replace("%ABOUT-IMG%", "qrc:icons/other/about.png");
|
||||
aPage.replace("%COPYRIGHT-INCLUDE%", Qt::escape(qz_readAllFileContents(":html/copyright")));
|
||||
aPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
||||
aPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
||||
aPage.replace(QLatin1String("%ABOUT-IMG%"), QLatin1String("qrc:icons/other/about.png"));
|
||||
aPage.replace(QLatin1String("%COPYRIGHT-INCLUDE%"), Qt::escape(qz_readAllFileContents(":html/copyright")));
|
||||
|
||||
aPage.replace("%TITLE%", tr("About QupZilla"));
|
||||
aPage.replace("%ABOUT-QUPZILLA%", tr("About QupZilla"));
|
||||
aPage.replace("%INFORMATIONS-ABOUT-VERSION%", tr("Information about version"));
|
||||
aPage.replace("%COPYRIGHT%", tr("Copyright"));
|
||||
aPage.replace(QLatin1String("%TITLE%"), tr("About QupZilla"));
|
||||
aPage.replace(QLatin1String("%ABOUT-QUPZILLA%"), tr("About QupZilla"));
|
||||
aPage.replace(QLatin1String("%INFORMATIONS-ABOUT-VERSION%"), tr("Information about version"));
|
||||
aPage.replace(QLatin1String("%COPYRIGHT%"), tr("Copyright"));
|
||||
|
||||
aPage.replace("%VERSION-INFO%",
|
||||
aPage.replace(QLatin1String("%VERSION-INFO%"),
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"), QupZilla::VERSION
|
||||
#ifdef GIT_REVISION
|
||||
+ " (" + GIT_REVISION + ")"
|
||||
#endif
|
||||
) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), QupZilla::WEBKITVERSION));
|
||||
aPage.replace("%MAIN-DEVELOPER%", tr("Main developer"));
|
||||
aPage.replace("%MAIN-DEVELOPER-TEXT%", authorString(QupZilla::AUTHOR.toUtf8(), "nowrep@gmail.com"));
|
||||
aPage.replace("%CONTRIBUTORS%", tr("Contributors"));
|
||||
aPage.replace("%CONTRIBUTORS-TEXT%",
|
||||
aPage.replace(QLatin1String("%MAIN-DEVELOPER%"), tr("Main developer"));
|
||||
aPage.replace(QLatin1String("%MAIN-DEVELOPER-TEXT%"), authorString(QupZilla::AUTHOR.toUtf8(), "nowrep@gmail.com"));
|
||||
aPage.replace(QLatin1String("%CONTRIBUTORS%"), tr("Contributors"));
|
||||
aPage.replace(QLatin1String("%CONTRIBUTORS-TEXT%"),
|
||||
authorString("Mladen Pejaković", "pejakm@gmail.com") + "<br/>" +
|
||||
authorString("Alexander Samilov", "alexsamilovskih@gmail.com") + "<br/>" +
|
||||
authorString("Seyyed Razi Alavizadeh", "s.r.alavizadeh@gmail.com") + "<br/>" +
|
||||
@ -218,8 +218,8 @@ QString QupZillaSchemeReply::aboutPage()
|
||||
authorString("Jan Rajnoha", "honza.rajny@hotmail.com") + "<br/>" +
|
||||
authorString("Daniele Cocca", "jmc@chakra-project.org")
|
||||
);
|
||||
aPage.replace("%TRANSLATORS%", tr("Translators"));
|
||||
aPage.replace("%TRANSLATORS-TEXT%",
|
||||
aPage.replace(QLatin1String("%TRANSLATORS%"), tr("Translators"));
|
||||
aPage.replace(QLatin1String("%TRANSLATORS-TEXT%"),
|
||||
authorString("Heimen Stoffels", "vistausss@gmail.com") + " (Dutch)<br/>" +
|
||||
authorString("Peter Vacula", "pvacula1989@gmail.com") + " (Slovak)<br/>" +
|
||||
authorString("Ján Ďanovský", "dagsoftware@yahoo.com") + " (Slovak)<br/>" +
|
||||
@ -260,53 +260,53 @@ QString QupZillaSchemeReply::speeddialPage()
|
||||
|
||||
if (dPage.isEmpty()) {
|
||||
dPage.append(qz_readAllFileContents(":html/speeddial.html"));
|
||||
dPage.replace("%FAVICON%", "qrc:icons/qupzilla.png");
|
||||
dPage.replace("%IMG_PLUS%", "qrc:html/plus.png");
|
||||
dPage.replace("%BOX-BORDER%", "qrc:html/box-border-small.png");
|
||||
dPage.replace("%IMG_CLOSE%", "qrc:html/close.png");
|
||||
dPage.replace("%IMG_EDIT%", "qrc:html/edit.png");
|
||||
dPage.replace("%IMG_RELOAD%", "qrc:html/reload.png");
|
||||
dPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
||||
dPage.replace(QLatin1String("%IMG_PLUS%"), QLatin1String("qrc:html/plus.png"));
|
||||
dPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border-small.png"));
|
||||
dPage.replace(QLatin1String("%IMG_CLOSE%"), QLatin1String("qrc:html/close.png"));
|
||||
dPage.replace(QLatin1String("%IMG_EDIT%"), QLatin1String("qrc:html/edit.png"));
|
||||
dPage.replace(QLatin1String("%IMG_RELOAD%"), QLatin1String("qrc:html/reload.png"));
|
||||
dPage.replace(QLatin1String("%JQUERY%"), QLatin1String("qrc:html/jquery.js"));
|
||||
dPage.replace(QLatin1String("%JQUERY-UI%"), QLatin1String("qrc:html/jquery-ui.js"));
|
||||
dPage.replace(QLatin1String("%LOADING-IMG%"), QLatin1String("qrc:html/loading.gif"));
|
||||
dPage.replace(QLatin1String("%IMG_SETTINGS%"), QLatin1String("qrc:html/setting.png"));
|
||||
|
||||
dPage.replace("%SITE-TITLE%", tr("Speed Dial"));
|
||||
dPage.replace("%ADD-TITLE%", tr("Add New Page"));
|
||||
dPage.replace("%TITLE-EDIT%", tr("Edit"));
|
||||
dPage.replace("%TITLE-REMOVE%", tr("Remove"));
|
||||
dPage.replace("%TITLE-RELOAD%", tr("Reload"));
|
||||
dPage.replace("%TITLE-WARN%", tr("Are you sure to remove this speed dial?"));
|
||||
dPage.replace("%TITLE-FETCHTITLE%", tr("Load title from page"));
|
||||
dPage.replace("%JQUERY%", "qrc:html/jquery.js");
|
||||
dPage.replace("%JQUERY-UI%", "qrc:html/jquery-ui.js");
|
||||
dPage.replace("%LOADING-IMG%", "qrc:html/loading.gif");
|
||||
dPage.replace("%URL%", tr("Url"));
|
||||
dPage.replace("%TITLE%", tr("Title"));
|
||||
dPage.replace("%APPLY%", tr("Apply"));
|
||||
dPage.replace("%CLOSE%", tr("Close"));
|
||||
dPage.replace("%NEW-PAGE%", tr("New Page"));
|
||||
dPage.replace("%IMG_SETTINGS%", "qrc:html/setting.png");
|
||||
dPage.replace("%SETTINGS-TITLE%", tr("Speed Dial settings"));
|
||||
dPage.replace("%TXT_PLACEMENT%", tr("Placement: "));
|
||||
dPage.replace("%TXT_AUTO%", tr("Auto"));
|
||||
dPage.replace("%TXT_COVER%", tr("Cover"));
|
||||
dPage.replace("%TXT_FIT%", tr("Fit"));
|
||||
dPage.replace("%TXT_FWIDTH%", tr("Fit Width"));
|
||||
dPage.replace("%TXT_FHEIGHT%", tr("Fit Height"));
|
||||
dPage.replace("%TXT_NOTE%", tr("Use background image"));
|
||||
dPage.replace("%TXT_SELECTIMAGE%", tr("Select image"));
|
||||
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.replace(QLatin1String("%SITE-TITLE%"), tr("Speed Dial"));
|
||||
dPage.replace(QLatin1String("%ADD-TITLE%"), tr("Add New Page"));
|
||||
dPage.replace(QLatin1String("%TITLE-EDIT%"), tr("Edit"));
|
||||
dPage.replace(QLatin1String("%TITLE-REMOVE%"), tr("Remove"));
|
||||
dPage.replace(QLatin1String("%TITLE-RELOAD%"), tr("Reload"));
|
||||
dPage.replace(QLatin1String("%TITLE-WARN%"), tr("Are you sure to remove this speed dial?"));
|
||||
dPage.replace(QLatin1String("%TITLE-FETCHTITLE%"), tr("Load title from page"));
|
||||
dPage.replace(QLatin1String("%URL%"), tr("Url"));
|
||||
dPage.replace(QLatin1String("%TITLE%"), tr("Title"));
|
||||
dPage.replace(QLatin1String("%APPLY%"), tr("Apply"));
|
||||
dPage.replace(QLatin1String("%CLOSE%"), tr("Close"));
|
||||
dPage.replace(QLatin1String("%NEW-PAGE%"), tr("New Page"));
|
||||
dPage.replace(QLatin1String("%SETTINGS-TITLE%"), tr("Speed Dial settings"));
|
||||
dPage.replace(QLatin1String("%TXT_PLACEMENT%"), tr("Placement: "));
|
||||
dPage.replace(QLatin1String("%TXT_AUTO%"), tr("Auto"));
|
||||
dPage.replace(QLatin1String("%TXT_COVER%"), tr("Cover"));
|
||||
dPage.replace(QLatin1String("%TXT_FIT%"), tr("Fit"));
|
||||
dPage.replace(QLatin1String("%TXT_FWIDTH%"), tr("Fit Width"));
|
||||
dPage.replace(QLatin1String("%TXT_FHEIGHT%"), tr("Fit Height"));
|
||||
dPage.replace(QLatin1String("%TXT_NOTE%"), tr("Use background image"));
|
||||
dPage.replace(QLatin1String("%TXT_SELECTIMAGE%"), tr("Select image"));
|
||||
dPage.replace(QLatin1String("%TXT_NRROWS%"), tr("Maximum pages in a row:"));
|
||||
dPage.replace(QLatin1String("%TXT_SDSIZE%"), tr("Change size of pages:"));
|
||||
dPage.replace(QLatin1String("%TXT_CNTRDLS%"), tr("Center speed dials"));
|
||||
dPage = qz_applyDirectionToPage(dPage);
|
||||
}
|
||||
|
||||
QString page = dPage;
|
||||
SpeedDial* dial = mApp->plugins()->speedDial();
|
||||
|
||||
page.replace("%INITIAL-SCRIPT%", dial->initialScript());
|
||||
page.replace("%IMG_BACKGROUND%", dial->backgroundImage());
|
||||
page.replace("%B_SIZE%", dial->backgroundImageSize());
|
||||
page.replace("%ROW-PAGES%", QString::number(dial->pagesInRow()));
|
||||
page.replace("%SD-SIZE%", QString::number(dial->sdSize()));
|
||||
page.replace("%SD-CNTR%", QString::number(dial->sdCntr()));
|
||||
page.replace(QLatin1String("%INITIAL-SCRIPT%"), dial->initialScript());
|
||||
page.replace(QLatin1String("%IMG_BACKGROUND%"), dial->backgroundImage());
|
||||
page.replace(QLatin1String("%B_SIZE%"), dial->backgroundImageSize());
|
||||
page.replace(QLatin1String("%ROW-PAGES%"), QString::number(dial->pagesInRow()));
|
||||
page.replace(QLatin1String("%SD-SIZE%"), QString::number(dial->sdSize()));
|
||||
page.replace(QLatin1String("%SD-CNTR%"), QString::number(dial->sdCntr()));
|
||||
|
||||
return page;
|
||||
}
|
||||
@ -317,16 +317,16 @@ QString QupZillaSchemeReply::restorePage()
|
||||
|
||||
if (rPage.isEmpty()) {
|
||||
rPage.append(qz_readAllFileContents(":html/restore.html"));
|
||||
rPage.replace("%FAVICON%", "qrc:icons/qupzilla.png");
|
||||
rPage.replace("%BOX-BORDER%", "qrc:html/box-border.png");
|
||||
rPage.replace("%IMAGE%", qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(45, 45)));
|
||||
rPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
||||
rPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
||||
rPage.replace(QLatin1String("%IMAGE%"), qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(45, 45)));
|
||||
|
||||
|
||||
rPage.replace("%TITLE%", tr("Restore Session"));
|
||||
rPage.replace("%OOPS%", tr("Oops, QupZilla crashed."));
|
||||
rPage.replace("%APOLOGIZE%", tr("We apologize for this. Would you like to restore the last saved state?"));
|
||||
rPage.replace("%TRY-REMOVING%", tr("Try removing one or more tabs that you think cause troubles"));
|
||||
rPage.replace("%START-NEW%", tr("Or you can start completely new session"));
|
||||
rPage.replace(QLatin1String("%TITLE%"), tr("Restore Session"));
|
||||
rPage.replace(QLatin1String("%OOPS%"), tr("Oops, QupZilla crashed."));
|
||||
rPage.replace(QLatin1String("%APOLOGIZE%"), tr("We apologize for this. Would you like to restore the last saved state?"));
|
||||
rPage.replace(QLatin1String("%TRY-REMOVING%"), tr("Try removing one or more tabs that you think cause troubles"));
|
||||
rPage.replace(QLatin1String("%START-NEW%"), tr("Or you can start completely new session"));
|
||||
rPage = qz_applyDirectionToPage(rPage);
|
||||
}
|
||||
|
||||
@ -339,27 +339,27 @@ QString QupZillaSchemeReply::configPage()
|
||||
|
||||
if (cPage.isEmpty()) {
|
||||
cPage.append(qz_readAllFileContents(":html/config.html"));
|
||||
cPage.replace("%FAVICON%", "qrc:icons/qupzilla.png");
|
||||
cPage.replace("%BOX-BORDER%", "qrc:html/box-border.png");
|
||||
cPage.replace("%ABOUT-IMG%", "qrc:icons/other/about.png");
|
||||
cPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
||||
cPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
||||
cPage.replace(QLatin1String("%ABOUT-IMG%"), QLatin1String("qrc:icons/other/about.png"));
|
||||
|
||||
cPage.replace("%TITLE%", tr("Configuration Information"));
|
||||
cPage.replace("%CONFIG%", tr("Configuration Information"));
|
||||
cPage.replace("%INFORMATIONS-ABOUT-VERSION%", tr("Information about version"));
|
||||
cPage.replace("%CONFIG-ABOUT%", tr("This page contains information about QupZilla's current configuration - relevant for troubleshooting. Please include this information when submitting bug reports."));
|
||||
cPage.replace("%BROWSER-IDENTIFICATION%", tr("Browser Identification"));
|
||||
cPage.replace("%PATHS%", tr("Paths"));
|
||||
cPage.replace("%BUILD-CONFIG%", tr("Build Configuration"));
|
||||
cPage.replace("%PREFS%", tr("Preferences"));
|
||||
cPage.replace("%OPTION%", tr("Option"));
|
||||
cPage.replace("%VALUE%", tr("Value"));
|
||||
cPage.replace("%PLUGINS%", tr("Extensions"));
|
||||
cPage.replace("%PL-NAME%", tr("Name"));
|
||||
cPage.replace("%PL-VER%", tr("Version"));
|
||||
cPage.replace("%PL-AUTH%", tr("Author"));
|
||||
cPage.replace("%PL-DESC%", tr("Description"));
|
||||
cPage.replace(QLatin1String("%TITLE%"), tr("Configuration Information"));
|
||||
cPage.replace(QLatin1String("%CONFIG%"), tr("Configuration Information"));
|
||||
cPage.replace(QLatin1String("%INFORMATIONS-ABOUT-VERSION%"), tr("Information about version"));
|
||||
cPage.replace(QLatin1String("%CONFIG-ABOUT%"), tr("This page contains information about QupZilla's current configuration - relevant for troubleshooting. Please include this information when submitting bug reports."));
|
||||
cPage.replace(QLatin1String("%BROWSER-IDENTIFICATION%"), tr("Browser Identification"));
|
||||
cPage.replace(QLatin1String("%PATHS%"), tr("Paths"));
|
||||
cPage.replace(QLatin1String("%BUILD-CONFIG%"), tr("Build Configuration"));
|
||||
cPage.replace(QLatin1String("%PREFS%"), tr("Preferences"));
|
||||
cPage.replace(QLatin1String("%OPTION%"), tr("Option"));
|
||||
cPage.replace(QLatin1String("%VALUE%"), tr("Value"));
|
||||
cPage.replace(QLatin1String("%PLUGINS%"), tr("Extensions"));
|
||||
cPage.replace(QLatin1String("%PL-NAME%"), tr("Name"));
|
||||
cPage.replace(QLatin1String("%PL-VER%"), tr("Version"));
|
||||
cPage.replace(QLatin1String("%PL-AUTH%"), tr("Author"));
|
||||
cPage.replace(QLatin1String("%PL-DESC%"), tr("Description"));
|
||||
|
||||
cPage.replace("%VERSION-INFO%",
|
||||
cPage.replace(QLatin1String("%VERSION-INFO%"),
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"), QupZilla::VERSION
|
||||
#ifdef GIT_REVISION
|
||||
+ " (" + GIT_REVISION + ")"
|
||||
@ -370,7 +370,7 @@ QString QupZillaSchemeReply::configPage()
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Build time"), QupZilla::BUILDTIME) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), qz_buildSystem()));
|
||||
|
||||
cPage.replace("%PATHS-TEXT%",
|
||||
cPage.replace(QLatin1String("%PATHS-TEXT%"),
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Profile"), mApp->currentProfilePath()) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Settings"), mApp->currentProfilePath() + "settings.ini") +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Saved session"), mApp->currentProfilePath() + "session.dat") +
|
||||
@ -401,7 +401,7 @@ QString QupZillaSchemeReply::configPage()
|
||||
portableBuild = tr("<b>Enabled</b>");
|
||||
#endif
|
||||
|
||||
cPage.replace("%BUILD-CONFIG-TEXT%",
|
||||
cPage.replace(QLatin1String("%BUILD-CONFIG-TEXT%"),
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Debug build"), debugBuild) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebGL support"), webGLEnabled) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Windows 7 API"), w7APIEnabled) +
|
||||
@ -412,7 +412,7 @@ QString QupZillaSchemeReply::configPage()
|
||||
}
|
||||
|
||||
QString page = cPage;
|
||||
page.replace("%USER-AGENT%", mApp->getWindow()->weView()->page()->userAgentForUrl(QUrl()));
|
||||
page.replace(QLatin1String("%USER-AGENT%"), mApp->getWindow()->weView()->page()->userAgentForUrl(QUrl()));
|
||||
|
||||
QString pluginsString;
|
||||
const QList<Plugins::Plugin> &availablePlugins = mApp->plugins()->getAvailablePlugins();
|
||||
@ -427,7 +427,7 @@ QString QupZillaSchemeReply::configPage()
|
||||
pluginsString = QString("<tr><td colspan=4 class=\"no-available-plugins\">%1</td></tr>").arg(tr("No available extensions."));
|
||||
}
|
||||
|
||||
page.replace("%PLUGINS-INFO%", pluginsString);
|
||||
page.replace(QLatin1String("%PLUGINS-INFO%"), pluginsString);
|
||||
|
||||
QString allGroupsString;
|
||||
QSettings* settings = Settings::globalSettings();
|
||||
@ -441,7 +441,7 @@ QString QupZillaSchemeReply::configPage()
|
||||
|
||||
switch (keyValue.type()) {
|
||||
case QVariant::ByteArray:
|
||||
keyString = "QByteArray";
|
||||
keyString = QLatin1String("QByteArray");
|
||||
break;
|
||||
|
||||
case QVariant::Point: {
|
||||
@ -459,7 +459,7 @@ QString QupZillaSchemeReply::configPage()
|
||||
}
|
||||
|
||||
if (keyString.isEmpty()) {
|
||||
keyString = "\"empty\"";
|
||||
keyString = QLatin1String("\"empty\"");
|
||||
}
|
||||
|
||||
groupString.append(QString("<tr><td>%1</td><td>%2</td></tr>").arg(key, Qt::escape(keyString)));
|
||||
@ -469,7 +469,7 @@ QString QupZillaSchemeReply::configPage()
|
||||
allGroupsString.append(groupString);
|
||||
}
|
||||
|
||||
page.replace("%PREFS-INFO%", allGroupsString);
|
||||
page.replace(QLatin1String("%PREFS-INFO%"), allGroupsString);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ QUrl OpenSearchEngine::suggestionsUrl(const QString &searchTerm) const
|
||||
{
|
||||
if (!m_preparedSuggestionsUrl.isEmpty()) {
|
||||
QString s = m_preparedSuggestionsUrl;
|
||||
s.replace("%s", searchTerm);
|
||||
s.replace(QLatin1String("%s"), searchTerm);
|
||||
return QUrl(s);
|
||||
}
|
||||
|
||||
@ -502,7 +502,7 @@ void OpenSearchEngine::setSuggestionsUrl(const QString &string)
|
||||
|
||||
QString OpenSearchEngine::getSuggestionsUrl()
|
||||
{
|
||||
return suggestionsUrl("searchstring").toString().replace("searchstring", "%s");
|
||||
return suggestionsUrl("searchstring").toString().replace(QLatin1String("searchstring"), QLatin1String("%s"));
|
||||
}
|
||||
|
||||
QByteArray OpenSearchEngine::getSuggestionsParameters()
|
||||
|
@ -100,7 +100,7 @@ QUrl SearchEnginesManager::searchUrl(const Engine &engine, const QString &string
|
||||
ENSURE_LOADED;
|
||||
|
||||
QByteArray url = engine.url.toUtf8();
|
||||
url.replace("%s", QUrl::toPercentEncoding(string));
|
||||
url.replace(QLatin1String("%s"), QUrl::toPercentEncoding(string));
|
||||
return QUrl::fromEncoded(url);
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView
|
||||
QWebElement formElement = element.parent();
|
||||
|
||||
while (!formElement.isNull()) {
|
||||
if (formElement.tagName().toLower() == "form") {
|
||||
if (formElement.tagName().toLower() == QLatin1String("form")) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ void SearchEnginesManager::addEngine(OpenSearchEngine* engine)
|
||||
|
||||
Engine en;
|
||||
en.name = engine->name();
|
||||
en.url = engine->searchUrl("searchstring").toString().replace("searchstring", "%s");
|
||||
en.url = engine->searchUrl("searchstring").toString().replace(QLatin1String("searchstring"), QLatin1String("%s"));
|
||||
if (engine->image().isNull()) {
|
||||
en.icon = iconForSearchEngine(engine->searchUrl(QString()));
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ void PageScreen::dialogAccepted()
|
||||
suggestedPath);
|
||||
|
||||
if (!path.isEmpty()) {
|
||||
if (!path.endsWith(".png", Qt::CaseInsensitive)) {
|
||||
path.append(".png");
|
||||
if (!path.endsWith(QLatin1String(".png"), Qt::CaseInsensitive)) {
|
||||
path.append(QLatin1String(".png"));
|
||||
}
|
||||
|
||||
m_pageImage.save(path, "PNG");
|
||||
|
@ -38,12 +38,12 @@ Updater::Version Updater::parseVersionFromString(const QString &string)
|
||||
Version ver;
|
||||
ver.isValid = false;
|
||||
|
||||
QStringList v = string.split('.');
|
||||
QStringList v = string.split(QLatin1Char('.'));
|
||||
if (v.count() != 3) {
|
||||
return ver;
|
||||
}
|
||||
|
||||
QStringList r = v.at(2).split('.');
|
||||
QStringList r = v.at(2).split(QLatin1Char('.'));
|
||||
|
||||
ver.majorVersion = v.at(0).toInt();
|
||||
ver.minorVersion = v.at(1).toInt();
|
||||
@ -58,11 +58,11 @@ Updater::Version Updater::parseVersionFromString(const QString &string)
|
||||
|
||||
bool Updater::isBiggerThan_SpecialSymbol(QString one, QString two)
|
||||
{
|
||||
if (one.contains("rc") && two.contains('b')) {
|
||||
if (one.contains(QLatin1String("rc")) && two.contains(QLatin1Char('b'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (one.contains("b") && two.contains("rc")) {
|
||||
if (one.contains(QLatin1Char('b')) && two.contains(QLatin1String("rc"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -74,16 +74,16 @@ bool Updater::isBiggerThan_SpecialSymbol(QString one, QString two)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (one.contains('b')) {
|
||||
int o = one.remove('b').toInt();
|
||||
int t = two.remove('b').toInt();
|
||||
if (one.contains(QLatin1Char('b'))) {
|
||||
int o = one.remove(QLatin1Char('b')).toInt();
|
||||
int t = two.remove(QLatin1Char('b')).toInt();
|
||||
|
||||
return o > t;
|
||||
}
|
||||
|
||||
if (one.contains("rc")) {
|
||||
int o = one.remove("rc").toInt();
|
||||
int t = two.remove("rc").toInt();
|
||||
if (one.contains(QLatin1String("rc"))) {
|
||||
int o = one.remove(QLatin1String("rc")).toInt();
|
||||
int t = two.remove(QLatin1String("rc")).toInt();
|
||||
|
||||
return o > t;
|
||||
}
|
||||
@ -108,8 +108,8 @@ void Updater::downCompleted(QNetworkReply* reply)
|
||||
{
|
||||
QString html = reply->readAll();
|
||||
|
||||
if (html.startsWith("Version:")) {
|
||||
html.remove("Version:");
|
||||
if (html.startsWith(QLatin1String("Version:"))) {
|
||||
html.remove(QLatin1String("Version:"));
|
||||
Version current = parseVersionFromString(QupZilla::VERSION);
|
||||
Version updated = parseVersionFromString(html);
|
||||
|
||||
|
@ -61,7 +61,7 @@ QString UserAgentManager::userAgentForUrl(const QUrl &url) const
|
||||
}
|
||||
}
|
||||
|
||||
if (host.contains("google")) {
|
||||
if (host.contains(QLatin1String("google"))) {
|
||||
return m_fakeUserAgent;
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ void SpeedDial::changed(const QString &allPages)
|
||||
return;
|
||||
}
|
||||
|
||||
const QStringList &entries = allPages.split("\";");
|
||||
const QStringList &entries = allPages.split(QLatin1String("\";"));
|
||||
m_webPages.clear();
|
||||
|
||||
foreach(const QString & entry, entries) {
|
||||
@ -244,7 +244,7 @@ void SpeedDial::changed(const QString &allPages)
|
||||
continue;
|
||||
}
|
||||
|
||||
const QStringList &tmp = entry.split("\"|");
|
||||
const QStringList &tmp = entry.split(QLatin1String("\"|"));
|
||||
if (tmp.count() != 2) {
|
||||
continue;
|
||||
}
|
||||
@ -365,15 +365,15 @@ void SpeedDial::thumbnailCreated(const QPixmap &pixmap)
|
||||
|
||||
QString SpeedDial::escapeTitle(QString title) const
|
||||
{
|
||||
title.replace('"', """);
|
||||
title.replace('\'', "'");
|
||||
title.replace(QLatin1Char('"'), QLatin1String("""));
|
||||
title.replace(QLatin1Char('\''), QLatin1String("'"));
|
||||
return title;
|
||||
}
|
||||
|
||||
QString SpeedDial::escapeUrl(QString url) const
|
||||
{
|
||||
url.remove('"');
|
||||
url.remove('\'');
|
||||
url.remove(QLatin1Char('"'));
|
||||
url.remove(QLatin1Char('\''));
|
||||
return url;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons
|
||||
|
||||
QString mime = mimeType.trimmed(); //Fixing bad behaviour when mimeType contains spaces
|
||||
if (mime.isEmpty()) {
|
||||
if (url.toString().endsWith(".swf")) {
|
||||
if (url.toString().endsWith(QLatin1String(".swf"))) {
|
||||
mime = "application/x-shockwave-flash";
|
||||
}
|
||||
else {
|
||||
@ -68,7 +68,7 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons
|
||||
|
||||
// Click2Flash whitelist
|
||||
QStringList whitelist = mApp->plugins()->c2f_getWhiteList();
|
||||
if (whitelist.contains(url.host()) || whitelist.contains("www." + url.host()) || whitelist.contains(url.host().remove("www."))) {
|
||||
if (whitelist.contains(url.host()) || whitelist.contains("www." + url.host()) || whitelist.contains(url.host().remove(QLatin1String("www.")))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
QStringList AcceptLanguage::defaultLanguage()
|
||||
{
|
||||
return QStringList(QLocale::system().name().replace("_", "-"));
|
||||
return QStringList(QLocale::system().name().replace(QLatin1Char('_'), QLatin1Char('-')));
|
||||
}
|
||||
|
||||
QByteArray AcceptLanguage::generateHeader(const QStringList &langs)
|
||||
@ -63,7 +63,7 @@ QByteArray AcceptLanguage::generateHeader(const QStringList &langs)
|
||||
|
||||
header.append(s);
|
||||
}
|
||||
header.append(", *");
|
||||
header.append(QLatin1String(", *"));
|
||||
|
||||
return header;
|
||||
}
|
||||
@ -80,7 +80,7 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
|
||||
|
||||
foreach(const QString & code, langs) {
|
||||
QString code_ = code;
|
||||
QLocale loc = QLocale(code_.replace('-', '_'));
|
||||
QLocale loc = QLocale(code_.replace(QLatin1Char('-'), QLatin1Char('_')));
|
||||
QString label;
|
||||
|
||||
if (loc.language() == QLocale::C) {
|
||||
@ -202,8 +202,8 @@ void AcceptLanguage::accept()
|
||||
QStringList langs;
|
||||
for (int i = 0; i < ui->listWidget->count(); i++) {
|
||||
QString t = ui->listWidget->item(i)->text();
|
||||
QString code = t.mid(t.indexOf('[') + 1);
|
||||
code.remove(']');
|
||||
QString code = t.mid(t.indexOf(QLatin1Char('[')) + 1);
|
||||
code.remove(QLatin1Char(']'));
|
||||
langs.append(code);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
ui->setupUi(this);
|
||||
|
||||
if (mApp->currentStyle() == "oxygen") {
|
||||
if (mApp->currentStyle() == QLatin1String("oxygen")) {
|
||||
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
|
||||
ui->listWidget->item(1)->setIcon(QIcon::fromTheme("format-stroke-color", QIcon(":/icons/preferences/application-x-theme.png")));
|
||||
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("tab-new-background", QIcon(":/icons/preferences/applications-internet.png")));
|
||||
@ -106,7 +106,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
else if (m_newTabUrl == m_homepage) {
|
||||
ui->newTab->setCurrentIndex(1);
|
||||
}
|
||||
else if (m_newTabUrl == "qupzilla:speeddial") {
|
||||
else if (m_newTabUrl == QLatin1String("qupzilla:speeddial")) {
|
||||
ui->newTab->setCurrentIndex(2);
|
||||
}
|
||||
else {
|
||||
@ -123,8 +123,8 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
//PROFILES
|
||||
m_actProfileName = mApp->currentProfilePath();
|
||||
m_actProfileName = m_actProfileName.left(m_actProfileName.length() - 1);
|
||||
m_actProfileName = m_actProfileName.mid(m_actProfileName.lastIndexOf("/"));
|
||||
m_actProfileName.remove('/');
|
||||
m_actProfileName = m_actProfileName.mid(m_actProfileName.lastIndexOf(QLatin1Char('/')));
|
||||
m_actProfileName.remove(QLatin1Char('/'));
|
||||
|
||||
ui->activeProfile->setText("<b>" + m_actProfileName + "</b>");
|
||||
|
||||
@ -343,12 +343,12 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
QDir lanDir(mApp->TRANSLATIONSDIR);
|
||||
QStringList list = lanDir.entryList(QStringList("*.qm"));
|
||||
foreach(const QString & name, list) {
|
||||
if (name.startsWith("qt_")) {
|
||||
if (name.startsWith(QLatin1String("qt_"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QString loc = name;
|
||||
loc.remove(".qm");
|
||||
loc.remove(QLatin1String(".qm"));
|
||||
|
||||
if (loc == activeLanguage) {
|
||||
continue;
|
||||
@ -477,9 +477,9 @@ void Preferences::chooseDownPath()
|
||||
return;
|
||||
}
|
||||
#ifdef Q_OS_WIN //QFileDialog::getExistingDirectory returns path with \ instead of / (??)
|
||||
userFileName.replace('\\', '/');
|
||||
userFileName.replace(QLatin1Char('\\'), QLatin1Char('/'));
|
||||
#endif
|
||||
userFileName += "/";
|
||||
userFileName += QLatin1Char('/');
|
||||
|
||||
ui->downLoc->setText(userFileName);
|
||||
}
|
||||
@ -913,7 +913,7 @@ void Preferences::saveSettings()
|
||||
settings.setValue("HttpsUsername", ui->httpsProxyUsername->text());
|
||||
settings.setValue("HttpsPassword", ui->httpsProxyPassword->text());
|
||||
|
||||
settings.setValue("ProxyExceptions", ui->proxyExceptions->text().split(','));
|
||||
settings.setValue("ProxyExceptions", ui->proxyExceptions->text().split(QLatin1Char(',')));
|
||||
settings.endGroup();
|
||||
|
||||
//Profiles
|
||||
|
@ -339,13 +339,13 @@ void RSSManager::finished()
|
||||
while (!xml.atEnd()) {
|
||||
xml.readNext();
|
||||
if (xml.isStartElement()) {
|
||||
if (xml.name() == "item") {
|
||||
if (xml.name() == QLatin1String("item")) {
|
||||
linkString = xml.attributes().value("rss:about").toString();
|
||||
}
|
||||
currentTag = xml.qualifiedName().toString();
|
||||
}
|
||||
else if (xml.isEndElement()) {
|
||||
if (xml.qualifiedName() == "item") {
|
||||
if (xml.qualifiedName() == QLatin1String("item")) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem;
|
||||
item->setText(0, titleString);
|
||||
item->setIcon(0, QIcon(":/icons/other/feed.png"));
|
||||
@ -357,10 +357,10 @@ void RSSManager::finished()
|
||||
}
|
||||
}
|
||||
else if (xml.isCharacters() && !xml.isWhitespace()) {
|
||||
if (currentTag == "title") {
|
||||
if (currentTag == QLatin1String("title")) {
|
||||
titleString = xml.text().toString();
|
||||
}
|
||||
else if (currentTag == "link") {
|
||||
else if (currentTag == QLatin1String("link")) {
|
||||
linkString += xml.text().toString();
|
||||
}
|
||||
}
|
||||
|
@ -112,10 +112,10 @@ void RSSNotification::addRss()
|
||||
|
||||
case DesktopApplication: {
|
||||
const RssApp &app = m_rssApps.at(index);
|
||||
if (app.title == "Akregator") {
|
||||
if (app.title == QLatin1String("Akregator")) {
|
||||
success = startExternalProcess("/usr/bin/akregator", QStringList() << "-a" << m_url.toEncoded());
|
||||
}
|
||||
else if (app.title == "Liferea") {
|
||||
else if (app.title == QLatin1String("Liferea")) {
|
||||
if (!ProcessInfo("liferea").isRunning()) {
|
||||
QMessageBox::warning(this, tr("Liferea not running"), tr("Liferea must be running in order to add new feed."));
|
||||
success = false;
|
||||
|
@ -163,7 +163,7 @@ void BookmarksSideBar::addBookmark(const BookmarksModel::Bookmark &bookmark)
|
||||
|
||||
void BookmarksSideBar::removeBookmark(const BookmarksModel::Bookmark &bookmark)
|
||||
{
|
||||
if (bookmark.folder == "unsorted") {
|
||||
if (bookmark.folder == QLatin1String("unsorted")) {
|
||||
QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(bookmark.title, Qt::MatchExactly);
|
||||
if (list.count() == 0) {
|
||||
return;
|
||||
@ -280,10 +280,10 @@ void BookmarksSideBar::refreshTable()
|
||||
QString folder = query.value(3).toString();
|
||||
QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(4).toByteArray()));
|
||||
QTreeWidgetItem* item;
|
||||
if (folder == "bookmarksMenu") {
|
||||
if (folder == QLatin1String("bookmarksMenu")) {
|
||||
folder = _bookmarksMenu;
|
||||
}
|
||||
if (folder == "bookmarksToolbar") {
|
||||
if (folder == QLatin1String("bookmarksToolbar")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ void SideBarManager::updateActions()
|
||||
|
||||
void SideBarManager::showSideBar(const QString &id, bool toggle)
|
||||
{
|
||||
if (id == "None") {
|
||||
if (id == QLatin1String("None")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -189,10 +189,10 @@ void SideBarManager::showSideBar(const QString &id, bool toggle)
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == "Bookmarks") {
|
||||
if (id == QLatin1String("Bookmarks")) {
|
||||
m_sideBar.data()->showBookmarks();
|
||||
}
|
||||
else if (id == "History") {
|
||||
else if (id == QLatin1String("History")) {
|
||||
m_sideBar.data()->showHistory();
|
||||
}
|
||||
else {
|
||||
|
@ -39,248 +39,248 @@ QString CertificateInfoWidget::clearCertSpecialSymbols(const QString &string)
|
||||
{
|
||||
QString n = Qt::escape(string);
|
||||
|
||||
if (!n.contains('\\')) {
|
||||
if (!n.contains(QLatin1String("\\"))) {
|
||||
return n;
|
||||
}
|
||||
|
||||
// Credits to http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/176679?help-en
|
||||
n.replace("\\xC3\\x80", "A");
|
||||
n.replace("\\xC3\\x81", "A");
|
||||
n.replace("\\xC3\\x82", "A");
|
||||
n.replace("\\xC3\\x83", "A");
|
||||
n.replace("\\xC3\\x84", "A");
|
||||
n.replace("\\xC3\\x85", "A");
|
||||
n.replace("\\xC3\\x86", "AE");
|
||||
n.replace("\\xC3\\x87", "C");
|
||||
n.replace("\\xC3\\x88", "E");
|
||||
n.replace("\\xC3\\x89", "E");
|
||||
n.replace("\\xC3\\x8A", "E");
|
||||
n.replace("\\xC3\\x8B", "E");
|
||||
n.replace("\\xC3\\x8C", "I");
|
||||
n.replace("\\xC3\\x8D", "I");
|
||||
n.replace("\\xC3\\x8E", "I");
|
||||
n.replace("\\xC3\\x8F", "I");
|
||||
n.replace("\\xC3\\x90", "D");
|
||||
n.replace("\\xC3\\x91", "N");
|
||||
n.replace("\\xC3\\x92", "O");
|
||||
n.replace("\\xC3\\x93", "O");
|
||||
n.replace("\\xC3\\x94", "O");
|
||||
n.replace("\\xC3\\x95", "O");
|
||||
n.replace("\\xC3\\x96", "O");
|
||||
n.replace("\\xC3\\x98", "O");
|
||||
n.replace("\\xC3\\x99", "U");
|
||||
n.replace("\\xC3\\x9A", "U");
|
||||
n.replace("\\xC3\\x9B", "U");
|
||||
n.replace("\\xC3\\x9C", "U");
|
||||
n.replace("\\xC3\\x9D", "Y");
|
||||
n.replace("\\xC3\\x9E", "P");
|
||||
n.replace("\\xC3\\x9F", "ss");
|
||||
n.replace("\\xC9\\x99", "e");
|
||||
n.replace("\\xC3\\xA0", "a");
|
||||
n.replace("\\xC3\\xA1", "a");
|
||||
n.replace("\\xC3\\xA2", "a");
|
||||
n.replace("\\xC3\\xA3", "a");
|
||||
n.replace("\\xC3\\xA4", "a");
|
||||
n.replace("\\xC3\\xA5", "a");
|
||||
n.replace("\\xC3\\xA6", "ae");
|
||||
n.replace("\\xC3\\xA7", "c");
|
||||
n.replace("\\xC3\\xA8", "e");
|
||||
n.replace("\\xC3\\xA9", "e");
|
||||
n.replace("\\xC3\\xAA", "e");
|
||||
n.replace("\\xC3\\xAB", "e");
|
||||
n.replace("\\xC3\\xAC", "i");
|
||||
n.replace("\\xC3\\xAD", "i");
|
||||
n.replace("\\xC3\\xAE", "i");
|
||||
n.replace("\\xC3\\xAF", "i");
|
||||
n.replace("\\xC3\\xB0", "o");
|
||||
n.replace("\\xC3\\xB1", "n");
|
||||
n.replace("\\xC3\\xB2", "o");
|
||||
n.replace("\\xC3\\xB3", "o");
|
||||
n.replace("\\xC3\\xB4", "o");
|
||||
n.replace("\\xC3\\xB5", "o");
|
||||
n.replace("\\xC3\\xB6", "o");
|
||||
n.replace("\\xC3\\xB8", "o");
|
||||
n.replace("\\xC3\\xB9", "u");
|
||||
n.replace("\\xC3\\xBA", "u");
|
||||
n.replace("\\xC3\\xBB", "u");
|
||||
n.replace("\\xC3\\xBC", "u");
|
||||
n.replace("\\xC3\\xBD", "y");
|
||||
n.replace("\\xC3\\xBE", "p");
|
||||
n.replace("\\xC3\\xBF", "y");
|
||||
n.replace("\\xC7\\xBF", "o");
|
||||
n.replace("\\xC4\\x80", "A");
|
||||
n.replace("\\xC4\\x81", "a");
|
||||
n.replace("\\xC4\\x82", "A");
|
||||
n.replace("\\xC4\\x83", "a");
|
||||
n.replace("\\xC4\\x84", "A");
|
||||
n.replace("\\xC4\\x85", "a");
|
||||
n.replace("\\xC4\\x86", "C");
|
||||
n.replace("\\xC4\\x87", "c");
|
||||
n.replace("\\xC4\\x88", "C");
|
||||
n.replace("\\xC4\\x89", "c");
|
||||
n.replace("\\xC4\\x8A", "C");
|
||||
n.replace("\\xC4\\x8B", "c");
|
||||
n.replace("\\xC4\\x8C", "C");
|
||||
n.replace("\\xC4\\x8D", "c");
|
||||
n.replace("\\xC4\\x8E", "D");
|
||||
n.replace("\\xC4\\x8F", "d");
|
||||
n.replace("\\xC4\\x90", "D");
|
||||
n.replace("\\xC4\\x91", "d");
|
||||
n.replace("\\xC4\\x92", "E");
|
||||
n.replace("\\xC4\\x93", "e");
|
||||
n.replace("\\xC4\\x94", "E");
|
||||
n.replace("\\xC4\\x95", "e");
|
||||
n.replace("\\xC4\\x96", "E");
|
||||
n.replace("\\xC4\\x97", "e");
|
||||
n.replace("\\xC4\\x98", "E");
|
||||
n.replace("\\xC4\\x99", "e");
|
||||
n.replace("\\xC4\\x9A", "E");
|
||||
n.replace("\\xC4\\x9B", "e");
|
||||
n.replace("\\xC4\\x9C", "G");
|
||||
n.replace("\\xC4\\x9D", "g");
|
||||
n.replace("\\xC4\\x9E", "G");
|
||||
n.replace("\\xC4\\x9F", "g");
|
||||
n.replace("\\xC4\\xA0", "G");
|
||||
n.replace("\\xC4\\xA1", "g");
|
||||
n.replace("\\xC4\\xA2", "G");
|
||||
n.replace("\\xC4\\xA3", "g");
|
||||
n.replace("\\xC4\\xA4", "H");
|
||||
n.replace("\\xC4\\xA5", "h");
|
||||
n.replace("\\xC4\\xA6", "H");
|
||||
n.replace("\\xC4\\xA7", "h");
|
||||
n.replace("\\xC4\\xA8", "I");
|
||||
n.replace("\\xC4\\xA9", "i");
|
||||
n.replace("\\xC4\\xAA", "I");
|
||||
n.replace("\\xC4\\xAB", "i");
|
||||
n.replace("\\xC4\\xAC", "I");
|
||||
n.replace("\\xC4\\xAD", "i");
|
||||
n.replace("\\xC4\\xAE", "I");
|
||||
n.replace("\\xC4\\xAF", "i");
|
||||
n.replace("\\xC4\\xB0", "I");
|
||||
n.replace("\\xC4\\xB1", "i");
|
||||
n.replace("\\xC4\\xB2", "IJ");
|
||||
n.replace("\\xC4\\xB3", "ij");
|
||||
n.replace("\\xC4\\xB4", "J");
|
||||
n.replace("\\xC4\\xB5", "j");
|
||||
n.replace("\\xC4\\xB6", "K");
|
||||
n.replace("\\xC4\\xB7", "k");
|
||||
n.replace("\\xC4\\xB8", "k");
|
||||
n.replace("\\xC4\\xB9", "L");
|
||||
n.replace("\\xC4\\xBA", "l");
|
||||
n.replace("\\xC4\\xBB", "L");
|
||||
n.replace("\\xC4\\xBC", "l");
|
||||
n.replace("\\xC4\\xBD", "L");
|
||||
n.replace("\\xC4\\xBE", "l");
|
||||
n.replace("\\xC4\\xBF", "L");
|
||||
n.replace("\\xC5\\x80", "l");
|
||||
n.replace("\\xC5\\x81", "L");
|
||||
n.replace("\\xC5\\x82", "l");
|
||||
n.replace("\\xC5\\x83", "N");
|
||||
n.replace("\\xC5\\x84", "n");
|
||||
n.replace("\\xC5\\x85", "N");
|
||||
n.replace("\\xC5\\x86", "n");
|
||||
n.replace("\\xC5\\x87", "N");
|
||||
n.replace("\\xC5\\x88", "n");
|
||||
n.replace("\\xC5\\x89", "n");
|
||||
n.replace("\\xC5\\x8A", "N");
|
||||
n.replace("\\xC5\\x8B", "n");
|
||||
n.replace("\\xC5\\x8C", "O");
|
||||
n.replace("\\xC5\\x8D", "o");
|
||||
n.replace("\\xC5\\x8E", "O");
|
||||
n.replace("\\xC5\\x8F", "o");
|
||||
n.replace("\\xC5\\x90", "O");
|
||||
n.replace("\\xC5\\x91", "o");
|
||||
n.replace("\\xC5\\x92", "CE");
|
||||
n.replace("\\xC5\\x93", "ce");
|
||||
n.replace("\\xC5\\x94", "R");
|
||||
n.replace("\\xC5\\x95", "r");
|
||||
n.replace("\\xC5\\x96", "R");
|
||||
n.replace("\\xC5\\x97", "r");
|
||||
n.replace("\\xC5\\x98", "R");
|
||||
n.replace("\\xC5\\x99", "r");
|
||||
n.replace("\\xC5\\x9A", "S");
|
||||
n.replace("\\xC5\\x9B", "s");
|
||||
n.replace("\\xC5\\x9C", "S");
|
||||
n.replace("\\xC5\\x9D", "s");
|
||||
n.replace("\\xC5\\x9E", "S");
|
||||
n.replace("\\xC5\\x9F", "s");
|
||||
n.replace("\\xC5\\xA0", "S");
|
||||
n.replace("\\xC5\\xA1", "s");
|
||||
n.replace("\\xC5\\xA2", "T");
|
||||
n.replace("\\xC5\\xA3", "t");
|
||||
n.replace("\\xC5\\xA4", "T");
|
||||
n.replace("\\xC5\\xA5", "t");
|
||||
n.replace("\\xC5\\xA6", "T");
|
||||
n.replace("\\xC5\\xA7", "t");
|
||||
n.replace("\\xC5\\xA8", "U");
|
||||
n.replace("\\xC5\\xA9", "u");
|
||||
n.replace("\\xC5\\xAA", "U");
|
||||
n.replace("\\xC5\\xAB", "u");
|
||||
n.replace("\\xC5\\xAC", "U");
|
||||
n.replace("\\xC5\\xAD", "u");
|
||||
n.replace("\\xC5\\xAE", "U");
|
||||
n.replace("\\xC5\\xAF", "u");
|
||||
n.replace("\\xC5\\xB0", "U");
|
||||
n.replace("\\xC5\\xB1", "u");
|
||||
n.replace("\\xC5\\xB2", "U");
|
||||
n.replace("\\xC5\\xB3", "u");
|
||||
n.replace("\\xC5\\xB4", "W");
|
||||
n.replace("\\xC5\\xB5", "w");
|
||||
n.replace("\\xC5\\xB6", "Y");
|
||||
n.replace("\\xC5\\xB7", "y");
|
||||
n.replace("\\xC5\\xB8", "Y");
|
||||
n.replace("\\xC5\\xB9", "Z");
|
||||
n.replace("\\xC5\\xBA", "z");
|
||||
n.replace("\\xC5\\xBB", "Z");
|
||||
n.replace("\\xC5\\xBC", "z");
|
||||
n.replace("\\xC5\\xBD", "Z");
|
||||
n.replace("\\xC5\\xBE", "z");
|
||||
n.replace("\\xC6\\x8F", "E");
|
||||
n.replace("\\xC6\\xA0", "O");
|
||||
n.replace("\\xC6\\xA1", "o");
|
||||
n.replace("\\xC6\\xAF", "U");
|
||||
n.replace("\\xC6\\xB0", "u");
|
||||
n.replace("\\xC7\\x8D", "A");
|
||||
n.replace("\\xC7\\x8E", "a");
|
||||
n.replace("\\xC7\\x8F", "I");
|
||||
n.replace("\\xC7\\x93", "U");
|
||||
n.replace("\\xC7\\x90", "i");
|
||||
n.replace("\\xC7\\x91", "O");
|
||||
n.replace("\\xC7\\x92", "o");
|
||||
n.replace("\\xC7\\x97", "U");
|
||||
n.replace("\\xC7\\x94", "u");
|
||||
n.replace("\\xC7\\x95", "U");
|
||||
n.replace("\\xC7\\x96", "u");
|
||||
n.replace("\\xC7\\x9B", "U");
|
||||
n.replace("\\xC7\\x98", "u");
|
||||
n.replace("\\xC7\\x99", "U");
|
||||
n.replace("\\xC7\\x9A", "u");
|
||||
n.replace("\\xC7\\xBD", "ae");
|
||||
n.replace("\\xC7\\x9C", "u");
|
||||
n.replace("\\xC7\\xBB", "a");
|
||||
n.replace("\\xC7\\xBC", "AE");
|
||||
n.replace("\\xC7\\xBE", "O");
|
||||
n.replace("\\xC7\\xBA", "A");
|
||||
n.replace(QLatin1String("\\xC3\\x80"), QLatin1String("A"));
|
||||
n.replace(QLatin1String("\\xC3\\x81"), QLatin1String("A"));
|
||||
n.replace(QLatin1String("\\xC3\\x82"), QLatin1String("A"));
|
||||
n.replace(QLatin1String("\\xC3\\x83"), QLatin1String("A"));
|
||||
n.replace(QLatin1String("\\xC3\\x84"), QLatin1String("A"));
|
||||
n.replace(QLatin1String("\\xC3\\x85"), QLatin1String("A"));
|
||||
n.replace(QLatin1String("\\xC3\\x86"), QLatin1String("AE"));
|
||||
n.replace(QLatin1String("\\xC3\\x87"), QLatin1String("C"));
|
||||
n.replace(QLatin1String("\\xC3\\x88"), QLatin1String("E"));
|
||||
n.replace(QLatin1String("\\xC3\\x89"), QLatin1String("E"));
|
||||
n.replace(QLatin1String("\\xC3\\x8A"), QLatin1String("E"));
|
||||
n.replace(QLatin1String("\\xC3\\x8B"), QLatin1String("E"));
|
||||
n.replace(QLatin1String("\\xC3\\x8C"), QLatin1String("I"));
|
||||
n.replace(QLatin1String("\\xC3\\x8D"), QLatin1String("I"));
|
||||
n.replace(QLatin1String("\\xC3\\x8E"), QLatin1String("I"));
|
||||
n.replace(QLatin1String("\\xC3\\x8F"), QLatin1String("I"));
|
||||
n.replace(QLatin1String("\\xC3\\x90"), QLatin1String("D"));
|
||||
n.replace(QLatin1String("\\xC3\\x91"), QLatin1String("N"));
|
||||
n.replace(QLatin1String("\\xC3\\x92"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC3\\x93"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC3\\x94"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC3\\x95"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC3\\x96"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC3\\x98"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC3\\x99"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC3\\x9A"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC3\\x9B"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC3\\x9C"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC3\\x9D"), QLatin1String("Y"));
|
||||
n.replace(QLatin1String("\\xC3\\x9E"), QLatin1String("P"));
|
||||
n.replace(QLatin1String("\\xC3\\x9F"), QLatin1String("ss"));
|
||||
n.replace(QLatin1String("\\xC9\\x99"), QLatin1String("e"));
|
||||
n.replace(QLatin1String("\\xC3\\xA0"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC3\\xA1"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC3\\xA2"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC3\\xA3"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC3\\xA4"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC3\\xA5"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC3\\xA6"), QLatin1String("ae"));
|
||||
n.replace(QLatin1String("\\xC3\\xA7"), QLatin1String("c"));
|
||||
n.replace(QLatin1String("\\xC3\\xA8"), QLatin1String("e"));
|
||||
n.replace(QLatin1String("\\xC3\\xA9"), QLatin1String("e"));
|
||||
n.replace(QLatin1String("\\xC3\\xAA"), QLatin1String("e"));
|
||||
n.replace(QLatin1String("\\xC3\\xAB"), QLatin1String("e"));
|
||||
n.replace(QLatin1String("\\xC3\\xAC"), QLatin1String("i"));
|
||||
n.replace(QLatin1String("\\xC3\\xAD"), QLatin1String("i"));
|
||||
n.replace(QLatin1String("\\xC3\\xAE"), QLatin1String("i"));
|
||||
n.replace(QLatin1String("\\xC3\\xAF"), QLatin1String("i"));
|
||||
n.replace(QLatin1String("\\xC3\\xB0"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC3\\xB1"), QLatin1String("n"));
|
||||
n.replace(QLatin1String("\\xC3\\xB2"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC3\\xB3"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC3\\xB4"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC3\\xB5"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC3\\xB6"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC3\\xB8"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC3\\xB9"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC3\\xBA"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC3\\xBB"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC3\\xBC"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC3\\xBD"), QLatin1String("y"));
|
||||
n.replace(QLatin1String("\\xC3\\xBE"), QLatin1String("p"));
|
||||
n.replace(QLatin1String("\\xC3\\xBF"), QLatin1String("y"));
|
||||
n.replace(QLatin1String("\\xC7\\xBF"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC4\\x80"), QLatin1String("A"));
|
||||
n.replace(QLatin1String("\\xC4\\x81"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC4\\x82"), QLatin1String("A"));
|
||||
n.replace(QLatin1String("\\xC4\\x83"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC4\\x84"), QLatin1String("A"));
|
||||
n.replace(QLatin1String("\\xC4\\x85"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC4\\x86"), QLatin1String("C"));
|
||||
n.replace(QLatin1String("\\xC4\\x87"), QLatin1String("c"));
|
||||
n.replace(QLatin1String("\\xC4\\x88"), QLatin1String("C"));
|
||||
n.replace(QLatin1String("\\xC4\\x89"), QLatin1String("c"));
|
||||
n.replace(QLatin1String("\\xC4\\x8A"), QLatin1String("C"));
|
||||
n.replace(QLatin1String("\\xC4\\x8B"), QLatin1String("c"));
|
||||
n.replace(QLatin1String("\\xC4\\x8C"), QLatin1String("C"));
|
||||
n.replace(QLatin1String("\\xC4\\x8D"), QLatin1String("c"));
|
||||
n.replace(QLatin1String("\\xC4\\x8E"), QLatin1String("D"));
|
||||
n.replace(QLatin1String("\\xC4\\x8F"), QLatin1String("d"));
|
||||
n.replace(QLatin1String("\\xC4\\x90"), QLatin1String("D"));
|
||||
n.replace(QLatin1String("\\xC4\\x91"), QLatin1String("d"));
|
||||
n.replace(QLatin1String("\\xC4\\x92"), QLatin1String("E"));
|
||||
n.replace(QLatin1String("\\xC4\\x93"), QLatin1String("e"));
|
||||
n.replace(QLatin1String("\\xC4\\x94"), QLatin1String("E"));
|
||||
n.replace(QLatin1String("\\xC4\\x95"), QLatin1String("e"));
|
||||
n.replace(QLatin1String("\\xC4\\x96"), QLatin1String("E"));
|
||||
n.replace(QLatin1String("\\xC4\\x97"), QLatin1String("e"));
|
||||
n.replace(QLatin1String("\\xC4\\x98"), QLatin1String("E"));
|
||||
n.replace(QLatin1String("\\xC4\\x99"), QLatin1String("e"));
|
||||
n.replace(QLatin1String("\\xC4\\x9A"), QLatin1String("E"));
|
||||
n.replace(QLatin1String("\\xC4\\x9B"), QLatin1String("e"));
|
||||
n.replace(QLatin1String("\\xC4\\x9C"), QLatin1String("G"));
|
||||
n.replace(QLatin1String("\\xC4\\x9D"), QLatin1String("g"));
|
||||
n.replace(QLatin1String("\\xC4\\x9E"), QLatin1String("G"));
|
||||
n.replace(QLatin1String("\\xC4\\x9F"), QLatin1String("g"));
|
||||
n.replace(QLatin1String("\\xC4\\xA0"), QLatin1String("G"));
|
||||
n.replace(QLatin1String("\\xC4\\xA1"), QLatin1String("g"));
|
||||
n.replace(QLatin1String("\\xC4\\xA2"), QLatin1String("G"));
|
||||
n.replace(QLatin1String("\\xC4\\xA3"), QLatin1String("g"));
|
||||
n.replace(QLatin1String("\\xC4\\xA4"), QLatin1String("H"));
|
||||
n.replace(QLatin1String("\\xC4\\xA5"), QLatin1String("h"));
|
||||
n.replace(QLatin1String("\\xC4\\xA6"), QLatin1String("H"));
|
||||
n.replace(QLatin1String("\\xC4\\xA7"), QLatin1String("h"));
|
||||
n.replace(QLatin1String("\\xC4\\xA8"), QLatin1String("I"));
|
||||
n.replace(QLatin1String("\\xC4\\xA9"), QLatin1String("i"));
|
||||
n.replace(QLatin1String("\\xC4\\xAA"), QLatin1String("I"));
|
||||
n.replace(QLatin1String("\\xC4\\xAB"), QLatin1String("i"));
|
||||
n.replace(QLatin1String("\\xC4\\xAC"), QLatin1String("I"));
|
||||
n.replace(QLatin1String("\\xC4\\xAD"), QLatin1String("i"));
|
||||
n.replace(QLatin1String("\\xC4\\xAE"), QLatin1String("I"));
|
||||
n.replace(QLatin1String("\\xC4\\xAF"), QLatin1String("i"));
|
||||
n.replace(QLatin1String("\\xC4\\xB0"), QLatin1String("I"));
|
||||
n.replace(QLatin1String("\\xC4\\xB1"), QLatin1String("i"));
|
||||
n.replace(QLatin1String("\\xC4\\xB2"), QLatin1String("IJ"));
|
||||
n.replace(QLatin1String("\\xC4\\xB3"), QLatin1String("ij"));
|
||||
n.replace(QLatin1String("\\xC4\\xB4"), QLatin1String("J"));
|
||||
n.replace(QLatin1String("\\xC4\\xB5"), QLatin1String("j"));
|
||||
n.replace(QLatin1String("\\xC4\\xB6"), QLatin1String("K"));
|
||||
n.replace(QLatin1String("\\xC4\\xB7"), QLatin1String("k"));
|
||||
n.replace(QLatin1String("\\xC4\\xB8"), QLatin1String("k"));
|
||||
n.replace(QLatin1String("\\xC4\\xB9"), QLatin1String("L"));
|
||||
n.replace(QLatin1String("\\xC4\\xBA"), QLatin1String("l"));
|
||||
n.replace(QLatin1String("\\xC4\\xBB"), QLatin1String("L"));
|
||||
n.replace(QLatin1String("\\xC4\\xBC"), QLatin1String("l"));
|
||||
n.replace(QLatin1String("\\xC4\\xBD"), QLatin1String("L"));
|
||||
n.replace(QLatin1String("\\xC4\\xBE"), QLatin1String("l"));
|
||||
n.replace(QLatin1String("\\xC4\\xBF"), QLatin1String("L"));
|
||||
n.replace(QLatin1String("\\xC5\\x80"), QLatin1String("l"));
|
||||
n.replace(QLatin1String("\\xC5\\x81"), QLatin1String("L"));
|
||||
n.replace(QLatin1String("\\xC5\\x82"), QLatin1String("l"));
|
||||
n.replace(QLatin1String("\\xC5\\x83"), QLatin1String("N"));
|
||||
n.replace(QLatin1String("\\xC5\\x84"), QLatin1String("n"));
|
||||
n.replace(QLatin1String("\\xC5\\x85"), QLatin1String("N"));
|
||||
n.replace(QLatin1String("\\xC5\\x86"), QLatin1String("n"));
|
||||
n.replace(QLatin1String("\\xC5\\x87"), QLatin1String("N"));
|
||||
n.replace(QLatin1String("\\xC5\\x88"), QLatin1String("n"));
|
||||
n.replace(QLatin1String("\\xC5\\x89"), QLatin1String("n"));
|
||||
n.replace(QLatin1String("\\xC5\\x8A"), QLatin1String("N"));
|
||||
n.replace(QLatin1String("\\xC5\\x8B"), QLatin1String("n"));
|
||||
n.replace(QLatin1String("\\xC5\\x8C"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC5\\x8D"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC5\\x8E"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC5\\x8F"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC5\\x90"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC5\\x91"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC5\\x92"), QLatin1String("CE"));
|
||||
n.replace(QLatin1String("\\xC5\\x93"), QLatin1String("ce"));
|
||||
n.replace(QLatin1String("\\xC5\\x94"), QLatin1String("R"));
|
||||
n.replace(QLatin1String("\\xC5\\x95"), QLatin1String("r"));
|
||||
n.replace(QLatin1String("\\xC5\\x96"), QLatin1String("R"));
|
||||
n.replace(QLatin1String("\\xC5\\x97"), QLatin1String("r"));
|
||||
n.replace(QLatin1String("\\xC5\\x98"), QLatin1String("R"));
|
||||
n.replace(QLatin1String("\\xC5\\x99"), QLatin1String("r"));
|
||||
n.replace(QLatin1String("\\xC5\\x9A"), QLatin1String("S"));
|
||||
n.replace(QLatin1String("\\xC5\\x9B"), QLatin1String("s"));
|
||||
n.replace(QLatin1String("\\xC5\\x9C"), QLatin1String("S"));
|
||||
n.replace(QLatin1String("\\xC5\\x9D"), QLatin1String("s"));
|
||||
n.replace(QLatin1String("\\xC5\\x9E"), QLatin1String("S"));
|
||||
n.replace(QLatin1String("\\xC5\\x9F"), QLatin1String("s"));
|
||||
n.replace(QLatin1String("\\xC5\\xA0"), QLatin1String("S"));
|
||||
n.replace(QLatin1String("\\xC5\\xA1"), QLatin1String("s"));
|
||||
n.replace(QLatin1String("\\xC5\\xA2"), QLatin1String("T"));
|
||||
n.replace(QLatin1String("\\xC5\\xA3"), QLatin1String("t"));
|
||||
n.replace(QLatin1String("\\xC5\\xA4"), QLatin1String("T"));
|
||||
n.replace(QLatin1String("\\xC5\\xA5"), QLatin1String("t"));
|
||||
n.replace(QLatin1String("\\xC5\\xA6"), QLatin1String("T"));
|
||||
n.replace(QLatin1String("\\xC5\\xA7"), QLatin1String("t"));
|
||||
n.replace(QLatin1String("\\xC5\\xA8"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC5\\xA9"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC5\\xAA"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC5\\xAB"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC5\\xAC"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC5\\xAD"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC5\\xAE"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC5\\xAF"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC5\\xB0"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC5\\xB1"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC5\\xB2"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC5\\xB3"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC5\\xB4"), QLatin1String("W"));
|
||||
n.replace(QLatin1String("\\xC5\\xB5"), QLatin1String("w"));
|
||||
n.replace(QLatin1String("\\xC5\\xB6"), QLatin1String("Y"));
|
||||
n.replace(QLatin1String("\\xC5\\xB7"), QLatin1String("y"));
|
||||
n.replace(QLatin1String("\\xC5\\xB8"), QLatin1String("Y"));
|
||||
n.replace(QLatin1String("\\xC5\\xB9"), QLatin1String("Z"));
|
||||
n.replace(QLatin1String("\\xC5\\xBA"), QLatin1String("z"));
|
||||
n.replace(QLatin1String("\\xC5\\xBB"), QLatin1String("Z"));
|
||||
n.replace(QLatin1String("\\xC5\\xBC"), QLatin1String("z"));
|
||||
n.replace(QLatin1String("\\xC5\\xBD"), QLatin1String("Z"));
|
||||
n.replace(QLatin1String("\\xC5\\xBE"), QLatin1String("z"));
|
||||
n.replace(QLatin1String("\\xC6\\x8F"), QLatin1String("E"));
|
||||
n.replace(QLatin1String("\\xC6\\xA0"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC6\\xA1"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC6\\xAF"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC6\\xB0"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC7\\x8D"), QLatin1String("A"));
|
||||
n.replace(QLatin1String("\\xC7\\x8E"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC7\\x8F"), QLatin1String("I"));
|
||||
n.replace(QLatin1String("\\xC7\\x93"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC7\\x90"), QLatin1String("i"));
|
||||
n.replace(QLatin1String("\\xC7\\x91"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC7\\x92"), QLatin1String("o"));
|
||||
n.replace(QLatin1String("\\xC7\\x97"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC7\\x94"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC7\\x95"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC7\\x96"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC7\\x9B"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC7\\x98"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC7\\x99"), QLatin1String("U"));
|
||||
n.replace(QLatin1String("\\xC7\\x9A"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC7\\xBD"), QLatin1String("ae"));
|
||||
n.replace(QLatin1String("\\xC7\\x9C"), QLatin1String("u"));
|
||||
n.replace(QLatin1String("\\xC7\\xBB"), QLatin1String("a"));
|
||||
n.replace(QLatin1String("\\xC7\\xBC"), QLatin1String("AE"));
|
||||
n.replace(QLatin1String("\\xC7\\xBE"), QLatin1String("O"));
|
||||
n.replace(QLatin1String("\\xC7\\xBA"), QLatin1String("A"));
|
||||
|
||||
n.replace("\\xC2\\x82", ","); // High code comma
|
||||
n.replace("\\xC2\\x84", ",,"); // High code double comma
|
||||
n.replace("\\xC2\\x85", "..."); // Tripple dot
|
||||
n.replace("\\xC2\\x88", "^"); // High carat
|
||||
n.replace("\\xC2\\x91", "\\x27"); // Forward single quote
|
||||
n.replace("\\xC2\\x92", "\\x27"); // Reverse single quote
|
||||
n.replace("\\xC2\\x93", "\\x22"); // Forward double quote
|
||||
n.replace("\\xC2\\x94", "\\x22"); // Reverse double quote
|
||||
n.replace("\\xC2\\x96", "-"); // High hyphen
|
||||
n.replace("\\xC2\\x97", "--"); // Double hyphen
|
||||
n.replace("\\xC2\\xA6", "|"); // Split vertical bar
|
||||
n.replace("\\xC2\\xAB", "<<"); // Double less than
|
||||
n.replace("\\xC2\\xBB", ">>"); // Double greater than
|
||||
n.replace("\\xC2\\xBC", "1/4"); // one quarter
|
||||
n.replace("\\xC2\\xBD", "1/2"); // one half
|
||||
n.replace("\\xC2\\xBE", "3/4"); // three quarters
|
||||
n.replace("\\xCA\\xBF", "\\x27"); // c-single quote
|
||||
n.replace("\\xCC\\xA8", QChar()); // modifier - under curve
|
||||
n.replace("\\xCC\\xB1", QChar()); // modifier - under line
|
||||
n.replace(QLatin1String("\\xC2\\x82"), QLatin1String(",")); // High code comma
|
||||
n.replace(QLatin1String("\\xC2\\x84"), QLatin1String(",,")); // High code double comma
|
||||
n.replace(QLatin1String("\\xC2\\x85"), QLatin1String("...")); // Tripple dot
|
||||
n.replace(QLatin1String("\\xC2\\x88"), QLatin1String("^")); // High carat
|
||||
n.replace(QLatin1String("\\xC2\\x91"), QLatin1String("\\x27")); // Forward single quote
|
||||
n.replace(QLatin1String("\\xC2\\x92"), QLatin1String("\\x27")); // Reverse single quote
|
||||
n.replace(QLatin1String("\\xC2\\x93"), QLatin1String("\\x22")); // Forward double quote
|
||||
n.replace(QLatin1String("\\xC2\\x94"), QLatin1String("\\x22")); // Reverse double quote
|
||||
n.replace(QLatin1String("\\xC2\\x96"), QLatin1String("-")); // High hyphen
|
||||
n.replace(QLatin1String("\\xC2\\x97"), QLatin1String("--")); // Double hyphen
|
||||
n.replace(QLatin1String("\\xC2\\xA6"), QLatin1String("|")); // Split vertical bar
|
||||
n.replace(QLatin1String("\\xC2\\xAB"), QLatin1String("<<")); // Double less than
|
||||
n.replace(QLatin1String("\\xC2\\xBB"), QLatin1String(">>")); // Double greater than
|
||||
n.replace(QLatin1String("\\xC2\\xBC"), QLatin1String("1/4")); // one quarter
|
||||
n.replace(QLatin1String("\\xC2\\xBD"), QLatin1String("1/2")); // one half
|
||||
n.replace(QLatin1String("\\xC2\\xBE"), QLatin1String("3/4")); // three quarters
|
||||
n.replace(QLatin1String("\\xCA\\xBF"), QLatin1String("\\x27")); // c-single quote
|
||||
n.replace(QLatin1String("\\xCC\\xA8"), QString()); // modifier - under curve
|
||||
n.replace(QLatin1String("\\xCC\\xB1"), QString()); // modifier - under line
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -140,16 +140,16 @@ QUrl qz_makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl)
|
||||
if (samePart.isEmpty()) {
|
||||
returnUrl = rUrl;
|
||||
}
|
||||
else if (samePart == "/") {
|
||||
else if (samePart == QLatin1String("/")) {
|
||||
returnUrl = QUrl(rUrl.path());
|
||||
}
|
||||
else {
|
||||
samePart = samePart.left(samePart.lastIndexOf("/") + 1);
|
||||
int slashCount = samePart.count("/") + 1;
|
||||
if (samePart.startsWith('/')) {
|
||||
samePart = samePart.left(samePart.lastIndexOf(QLatin1Char('/')) + 1);
|
||||
int slashCount = samePart.count(QLatin1Char('/')) + 1;
|
||||
if (samePart.startsWith(QLatin1Char('/'))) {
|
||||
slashCount--;
|
||||
}
|
||||
if (samePart.endsWith("/")) {
|
||||
if (samePart.endsWith(QLatin1Char('/'))) {
|
||||
slashCount--;
|
||||
}
|
||||
|
||||
@ -166,14 +166,14 @@ QString qz_urlEncodeQueryString(const QUrl &url)
|
||||
QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment);
|
||||
|
||||
if (url.hasQuery()) {
|
||||
returnString += '?' + url.encodedQuery();
|
||||
returnString += QLatin1Char('?') + url.encodedQuery();
|
||||
}
|
||||
|
||||
if (url.hasFragment()) {
|
||||
returnString += '#' + url.encodedFragment();
|
||||
returnString += QLatin1Char('#') + url.encodedFragment();
|
||||
}
|
||||
|
||||
returnString.replace(' ', "%20");
|
||||
returnString.replace(QLatin1Char(' '), QLatin1String("%20"));
|
||||
|
||||
return returnString;
|
||||
}
|
||||
@ -188,7 +188,7 @@ QString qz_ensureUniqueFilename(const QString &name, const QString &appendFormat
|
||||
int i = 1;
|
||||
while (QFile::exists(tmpFileName)) {
|
||||
tmpFileName = name;
|
||||
int index = tmpFileName.lastIndexOf(".");
|
||||
int index = tmpFileName.lastIndexOf(QLatin1Char('.'));
|
||||
|
||||
QString appendString = appendFormat.arg(i);
|
||||
if (index == -1) {
|
||||
@ -205,16 +205,16 @@ QString qz_ensureUniqueFilename(const QString &name, const QString &appendFormat
|
||||
QString qz_getFileNameFromUrl(const QUrl &url)
|
||||
{
|
||||
QString fileName = url.toString(QUrl::RemoveFragment | QUrl::RemoveQuery | QUrl::RemoveScheme | QUrl::RemovePort);
|
||||
if (fileName.indexOf('/') != -1) {
|
||||
int pos = fileName.lastIndexOf('/');
|
||||
if (fileName.indexOf(QLatin1Char('/')) != -1) {
|
||||
int pos = fileName.lastIndexOf(QLatin1Char('/'));
|
||||
fileName = fileName.mid(pos);
|
||||
fileName.remove('/');
|
||||
fileName.remove(QLatin1Char('/'));
|
||||
}
|
||||
|
||||
fileName = qz_filterCharsFromFilename(fileName);
|
||||
|
||||
if (fileName.isEmpty()) {
|
||||
fileName = qz_filterCharsFromFilename(url.host().replace('.', '-'));
|
||||
fileName = qz_filterCharsFromFilename(url.host().replace(QLatin1Char('.'), QLatin1Char('-')));
|
||||
}
|
||||
|
||||
return fileName;
|
||||
@ -224,15 +224,15 @@ QString qz_filterCharsFromFilename(const QString &name)
|
||||
{
|
||||
QString value = name;
|
||||
|
||||
value.replace('/', '-');
|
||||
value.remove('\\');
|
||||
value.remove(':');
|
||||
value.remove('*');
|
||||
value.remove('?');
|
||||
value.remove('"');
|
||||
value.remove('<');
|
||||
value.remove('>');
|
||||
value.remove('|');
|
||||
value.replace(QLatin1Char('/'), QLatin1Char('-'));
|
||||
value.remove(QLatin1Char('\\'));
|
||||
value.remove(QLatin1Char(':'));
|
||||
value.remove(QLatin1Char('*'));
|
||||
value.remove(QLatin1Char('?'));
|
||||
value.remove(QLatin1Char('"'));
|
||||
value.remove(QLatin1Char('<'));
|
||||
value.remove(QLatin1Char('>'));
|
||||
value.remove(QLatin1Char('|'));
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -325,19 +325,19 @@ QPixmap qz_createPixmapForSite(const QIcon &icon, const QString &title, const QS
|
||||
|
||||
QString QT_QUPZILLA_EXPORT qz_applyDirectionToPage(QString &pageContents)
|
||||
{
|
||||
QString direction = "ltr";
|
||||
QString right_str = "right";
|
||||
QString left_str = "left";
|
||||
QString direction = QLatin1String("ltr");
|
||||
QString right_str = QLatin1String("right");
|
||||
QString left_str = QLatin1String("left");
|
||||
|
||||
if (QApplication::isRightToLeft()) {
|
||||
direction = "rtl";
|
||||
right_str = "left";
|
||||
left_str = "right";
|
||||
direction = QLatin1String("rtl");
|
||||
right_str = QLatin1String("left");
|
||||
left_str = QLatin1String("right");
|
||||
}
|
||||
|
||||
pageContents.replace("%DIRECTION%", direction);
|
||||
pageContents.replace("%RIGHT_STR%", right_str);
|
||||
pageContents.replace("%LEFT_STR%", left_str);
|
||||
pageContents.replace(QLatin1String("%DIRECTION%"), direction);
|
||||
pageContents.replace(QLatin1String("%RIGHT_STR%"), right_str);
|
||||
pageContents.replace(QLatin1String("%LEFT_STR%"), left_str);
|
||||
|
||||
return pageContents;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ void IconFetcher::pageDownloaded()
|
||||
QString linkTag = rx.cap(0);
|
||||
pos += rx.matchedLength();
|
||||
|
||||
if (linkTag.contains("rel=\"shortcut icon\"", Qt::CaseInsensitive)) {
|
||||
if (linkTag.contains(QLatin1String("rel=\"shortcut icon\""), Qt::CaseInsensitive)) {
|
||||
shortcutIconTag = linkTag;
|
||||
break;
|
||||
}
|
||||
|
@ -197,22 +197,22 @@ QIcon IconProvider::standardIcon(QStyle::StandardPixmap icon)
|
||||
|
||||
QIcon IconProvider::fromTheme(const QString &icon)
|
||||
{
|
||||
if (icon == "go-home") {
|
||||
if (icon == QLatin1String("go-home")) {
|
||||
return QIcon::fromTheme("go-home", QIcon(":/icons/faenza/home.png"));
|
||||
}
|
||||
else if (icon == "text-plain") {
|
||||
else if (icon == QLatin1String("text-plain")) {
|
||||
return QIcon::fromTheme("text-plain", QIcon(":icons/locationbar/unknownpage.png"));
|
||||
}
|
||||
else if (icon == "user-bookmarks") {
|
||||
else if (icon == QLatin1String("user-bookmarks")) {
|
||||
return QIcon::fromTheme("user-bookmarks", QIcon(":icons/faenza/user-bookmarks.png"));
|
||||
}
|
||||
else if (icon == "list-remove") {
|
||||
else if (icon == QLatin1String("list-remove")) {
|
||||
return QIcon::fromTheme("list-remove", QIcon(":icons/faenza/list-remove.png"));
|
||||
}
|
||||
else if (icon == "go-next") {
|
||||
else if (icon == QLatin1String("go-next")) {
|
||||
return QIcon::fromTheme("go-next", QIcon(":icons/faenza/go-next.png"));
|
||||
}
|
||||
else if (icon == "go-previous") {
|
||||
else if (icon == QLatin1String("go-previous")) {
|
||||
return QIcon::fromTheme("go-previous", QIcon(":icons/faenza/go-previous.png"));
|
||||
}
|
||||
else {
|
||||
|
@ -84,8 +84,8 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
|
||||
if (!element.attribute("charset").isEmpty()) {
|
||||
encoding = element.attribute("charset");
|
||||
}
|
||||
if (content.contains("charset=")) {
|
||||
encoding = content.mid(content.indexOf("charset=") + 8);
|
||||
if (content.contains(QLatin1String("charset="))) {
|
||||
encoding = content.mid(content.indexOf(QLatin1String("charset=")) + 8);
|
||||
}
|
||||
|
||||
if (content.isEmpty() || name.isEmpty()) {
|
||||
@ -109,13 +109,13 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
|
||||
QString src = element.attribute("src");
|
||||
QString alt = element.attribute("alt");
|
||||
if (alt.isEmpty()) {
|
||||
if (src.indexOf('/') == -1) {
|
||||
if (src.indexOf(QLatin1Char('/')) == -1) {
|
||||
alt = src;
|
||||
}
|
||||
else {
|
||||
int pos = src.lastIndexOf("/");
|
||||
int pos = src.lastIndexOf(QLatin1Char('/'));
|
||||
alt = src.mid(pos);
|
||||
alt.remove('/');
|
||||
alt.remove(QLatin1Char('/'));
|
||||
}
|
||||
}
|
||||
if (src.isEmpty() || alt.isEmpty()) {
|
||||
@ -251,15 +251,15 @@ void SiteInfo::showImagePreview(QTreeWidgetItem* item)
|
||||
}
|
||||
QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview);
|
||||
|
||||
if (imageUrl.scheme() == "data") {
|
||||
if (imageUrl.scheme() == QLatin1String("data")) {
|
||||
QByteArray encodedUrl = item->text(1).toUtf8();
|
||||
QByteArray imageData = encodedUrl.mid(encodedUrl.indexOf(',') + 1);
|
||||
m_activePixmap = qz_pixmapFromByteArray(imageData);
|
||||
}
|
||||
else if (imageUrl.scheme() == "file") {
|
||||
else if (imageUrl.scheme() == QLatin1String("file")) {
|
||||
m_activePixmap = QPixmap(imageUrl.toLocalFile());
|
||||
}
|
||||
else if (imageUrl.scheme() == "qrc") {
|
||||
else if (imageUrl.scheme() == QLatin1String("qrc")) {
|
||||
m_activePixmap = QPixmap(imageUrl.toString().mid(3)); // Remove qrc from url
|
||||
}
|
||||
else {
|
||||
|
@ -80,7 +80,8 @@ void TabbedWebView::slotIconChanged()
|
||||
{
|
||||
const QString &urlScheme = url().scheme();
|
||||
|
||||
if (urlScheme == "file" || urlScheme == "qupzilla" || title().contains(tr("Failed loading page"))) {
|
||||
if (urlScheme == QLatin1String("file") || urlScheme == QLatin1String("qupzilla")
|
||||
|| title().contains(tr("Failed loading page"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -180,7 +181,7 @@ void TabbedWebView::setIp(const QHostInfo &info)
|
||||
return;
|
||||
}
|
||||
|
||||
m_currentIp = info.hostName() + " (" + info.addresses().at(0).toString() + ")";
|
||||
m_currentIp = QString("%1 (%2)").arg(info.hostName(), info.addresses().at(0).toString());
|
||||
|
||||
if (isCurrent()) {
|
||||
emit ipChanged(m_currentIp);
|
||||
|
@ -240,10 +240,10 @@ void TabWidget::aboutToShowTabsMenu()
|
||||
}
|
||||
else {
|
||||
QString title = tab->title();
|
||||
title.replace('&', "&&");
|
||||
title.replace(QLatin1Char('&'), QLatin1String("&&"));
|
||||
if (title.length() > 40) {
|
||||
title.truncate(40);
|
||||
title += "..";
|
||||
title += QLatin1String("..");
|
||||
}
|
||||
action->setText(title);
|
||||
}
|
||||
@ -356,7 +356,7 @@ void TabWidget::closeTab(int index, bool force)
|
||||
TabbedWebView* webView = webTab->view();
|
||||
WebPage* webPage = webView->page();
|
||||
|
||||
if (!force && webView->url() == QUrl("qupzilla:restore") && mApp->restoreManager()) {
|
||||
if (!force && webView->url().toString() == QLatin1String("qupzilla:restore") && mApp->restoreManager()) {
|
||||
// Don't close restore page!
|
||||
return;
|
||||
}
|
||||
@ -509,7 +509,7 @@ void TabWidget::setTabText(int index, const QString &text)
|
||||
}
|
||||
|
||||
QString newtext = text;
|
||||
newtext.replace('&', "&&"); // Avoid Alt+letter shortcuts
|
||||
newtext.replace(QLatin1Char('&'), QLatin1String("&&")); // Avoid Alt+letter shortcuts
|
||||
|
||||
if (WebTab* webTab = weTab(index)) {
|
||||
if (webTab->isPinned()) {
|
||||
@ -845,7 +845,7 @@ bool TabWidget::restoreState(const QList<WebTab::SavedTab> &tabs, int currentTab
|
||||
void TabWidget::closeRecoveryTab()
|
||||
{
|
||||
foreach(WebTab * tab, allTabs(false)) {
|
||||
if (tab->url() == QUrl("qupzilla:restore")) {
|
||||
if (tab->url().toString() == QLatin1String("qupzilla:restore")) {
|
||||
closeTab(tab->tabIndex(), true);
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ void WebPage::finished()
|
||||
mainFrame()->setZoomFactor(mainFrame()->zoomFactor() - 1);
|
||||
}
|
||||
|
||||
if (url().scheme() == "file") {
|
||||
if (url().scheme() == QLatin1String("file")) {
|
||||
QFileInfo info(url().toLocalFile());
|
||||
if (info.isFile()) {
|
||||
if (!m_fileWatcher) {
|
||||
@ -255,7 +255,7 @@ void WebPage::printFrame(QWebFrame* frame)
|
||||
|
||||
void WebPage::addJavaScriptObject()
|
||||
{
|
||||
if (url().toString() != "qupzilla:speeddial") {
|
||||
if (url().toString() != QLatin1String("qupzilla:speeddial")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
|
||||
case QNetworkReply::NoError:
|
||||
if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) {
|
||||
QString requestUrl = reply->request().url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery);
|
||||
if (requestUrl.endsWith(".swf")) {
|
||||
if (requestUrl.endsWith(QLatin1String(".swf"))) {
|
||||
const QWebElement &docElement = mainFrame()->documentElement();
|
||||
const QWebElement &object = docElement.findFirst(QString("object[src=\"%1\"]").arg(requestUrl));
|
||||
const QWebElement &embed = docElement.findFirst(QString("embed[src=\"%1\"]").arg(requestUrl));
|
||||
@ -292,7 +292,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
|
||||
}
|
||||
|
||||
case QNetworkReply::ProtocolUnknownError: {
|
||||
if (url.scheme() == "file") {
|
||||
if (url.scheme() == QLatin1String("file")) {
|
||||
FileSchemeHandler::handleUrl(url);
|
||||
return;
|
||||
}
|
||||
@ -451,7 +451,7 @@ void WebPage::setSSLCertificate(const QSslCertificate &cert)
|
||||
|
||||
QSslCertificate WebPage::sslCertificate()
|
||||
{
|
||||
if (url().scheme() == "https" && m_sslCert.isValid()) {
|
||||
if (url().scheme() == QLatin1String("https") && m_sslCert.isValid()) {
|
||||
return m_sslCert;
|
||||
}
|
||||
|
||||
@ -465,7 +465,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &r
|
||||
|
||||
const QString &scheme = request.url().scheme();
|
||||
|
||||
if (scheme == "mailto" || scheme == "ftp") {
|
||||
if (scheme == QLatin1String("mailto") || scheme == QLatin1String("ftp")) {
|
||||
desktopServicesOpen(request.url());
|
||||
return false;
|
||||
}
|
||||
@ -510,9 +510,12 @@ QObject* WebPage::createPlugin(const QString &classid, const QUrl &url, const QS
|
||||
Q_UNUSED(paramNames)
|
||||
Q_UNUSED(paramValues)
|
||||
|
||||
if (classid == "RecoveryWidget" && mApp->restoreManager()) {
|
||||
if (classid == QLatin1String("RecoveryWidget") && mApp->restoreManager()) {
|
||||
return new RecoveryWidget(qobject_cast<WebView*>(view()), p_QupZilla);
|
||||
}
|
||||
else {
|
||||
mainFrame()->load(QUrl("qupzilla:start"));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -539,28 +542,27 @@ void WebPage::cleanBlockedObjects()
|
||||
|
||||
foreach(const AdBlockedEntry & entry, m_adBlockedEntries) {
|
||||
const QString &urlString = entry.url.toString();
|
||||
if (urlString.endsWith(".js") || urlString.endsWith(".css")) {
|
||||
if (urlString.endsWith(QLatin1String(".js")) || urlString.endsWith(QLatin1String(".css"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QString urlEnd;
|
||||
|
||||
int pos = urlString.lastIndexOf('/');
|
||||
int pos = urlString.lastIndexOf(QLatin1Char('/'));
|
||||
if (pos > 8) {
|
||||
urlEnd = urlString.mid(pos + 1);
|
||||
}
|
||||
|
||||
if (urlString.endsWith('/')) {
|
||||
if (urlString.endsWith(QLatin1Char('/'))) {
|
||||
urlEnd = urlString.left(urlString.size() - 1);
|
||||
}
|
||||
|
||||
QString selector("img[src$=\"" + urlEnd + "\"], iframe[src$=\"" + urlEnd + "\"],"
|
||||
"embed[src$=\"" + urlEnd + "\"]");
|
||||
QWebElementCollection elements = docElement.findAll(selector);
|
||||
QString selector("img[src$=\"%1\"], iframe[src$=\"%1\"],embed[src$=\"%1\"]");
|
||||
QWebElementCollection elements = docElement.findAll(selector.arg(urlEnd));
|
||||
|
||||
foreach(QWebElement element, elements) {
|
||||
QString src = element.attribute("src");
|
||||
src.remove("../");
|
||||
src.remove(QLatin1String("../"));
|
||||
|
||||
if (urlString.contains(src)) {
|
||||
element.setStyleProperty("display", "none");
|
||||
@ -574,7 +576,7 @@ void WebPage::cleanBlockedObjects()
|
||||
return;
|
||||
}
|
||||
|
||||
elementHiding.append("{display: none !important;}\n</style>");
|
||||
elementHiding.append(QLatin1String("{display: none !important;}\n</style>"));
|
||||
|
||||
QWebElement bodyElement = docElement.findFirst("body");
|
||||
bodyElement.appendInside("<style type=\"text/css\">\n/* AdBlock for QupZilla */\n" + elementHiding);
|
||||
@ -588,7 +590,7 @@ QString WebPage::userAgentForUrl(const QUrl &url) const
|
||||
userAgent = QWebPage::userAgentForUrl(url);
|
||||
#ifdef Q_OS_MAC
|
||||
#ifdef __i386__ || __x86_64__
|
||||
userAgent.replace("PPC Mac OS X", "Intel Mac OS X");
|
||||
userAgent.replace(QLatin1String("PPC Mac OS X"), QLatin1String("Intel Mac OS X"));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@ -676,12 +678,12 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
|
||||
break;
|
||||
case QNetworkReply::ProtocolUnknownError: {
|
||||
// Sometimes exOption->url returns just "?" instead of actual url
|
||||
const QUrl unknownProtocolUrl = (exOption->url == QUrl("?")) ? erPage->mainFrame()->requestedUrl() : exOption->url;
|
||||
const QUrl unknownProtocolUrl = (exOption->url.toString() == QLatin1String("?")) ? erPage->mainFrame()->requestedUrl() : exOption->url;
|
||||
handleUnknownProtocol(unknownProtocolUrl);
|
||||
return false;
|
||||
}
|
||||
case QNetworkReply::ContentAccessDenied:
|
||||
if (exOption->errorString.startsWith("AdBlock")) {
|
||||
if (exOption->errorString.startsWith(QLatin1String("AdBlock"))) {
|
||||
if (exOption->frame != erPage->mainFrame()) { //Content in <iframe>
|
||||
QWebElement docElement = erPage->mainFrame()->documentElement();
|
||||
|
||||
@ -699,14 +701,14 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
|
||||
}
|
||||
else { //The whole page is blocked
|
||||
QString rule = exOption->errorString;
|
||||
rule.remove("AdBlock: ");
|
||||
rule.remove(QLatin1String("AdBlock: "));
|
||||
|
||||
QString errString = qz_readAllFileContents(":/html/adblockPage.html");
|
||||
errString.replace("%TITLE%", tr("AdBlocked Content"));
|
||||
errString.replace("%IMAGE%", "qrc:html/adblock_big.png");
|
||||
errString.replace("%FAVICON%", "qrc:html/adblock_big.png");
|
||||
errString.replace(QLatin1String("%TITLE%"), tr("AdBlocked Content"));
|
||||
errString.replace(QLatin1String("%IMAGE%"), QLatin1String("qrc:html/adblock_big.png"));
|
||||
errString.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:html/adblock_big.png"));
|
||||
|
||||
errString.replace("%RULE%", tr("Blocked by <i>%1</i>").arg(rule));
|
||||
errString.replace(QLatin1String("%RULE%"), tr("Blocked by <i>%1</i>").arg(rule));
|
||||
errString = qz_applyDirectionToPage(errString);
|
||||
|
||||
exReturn->baseUrl = exOption->url;
|
||||
@ -750,20 +752,20 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
|
||||
QFile file(":/html/errorPage.html");
|
||||
file.open(QFile::ReadOnly);
|
||||
QString errString = file.readAll();
|
||||
errString.replace("%TITLE%", tr("Failed loading page"));
|
||||
errString.replace(QLatin1String("%TITLE%"), tr("Failed loading page"));
|
||||
|
||||
errString.replace("%IMAGE%", qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(45, 45)));
|
||||
errString.replace("%FAVICON%", qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(16, 16)));
|
||||
errString.replace("%BOX-BORDER%", "qrc:html/box-border.png");
|
||||
errString.replace(QLatin1String("%IMAGE%"), qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(45, 45)));
|
||||
errString.replace(QLatin1String("%FAVICON%"), qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(16, 16)));
|
||||
errString.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
||||
|
||||
QString heading2 = loadedUrl.host().isEmpty() ? tr("QupZilla can't load page.") : tr("QupZilla can't load page from %1.").arg(loadedUrl.host());
|
||||
|
||||
errString.replace("%HEADING%", errorString);
|
||||
errString.replace("%HEADING2%", heading2);
|
||||
errString.replace("%LI-1%", tr("Check the address for typing errors such as <b>ww.</b>example.com instead of <b>www.</b>example.com"));
|
||||
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.replace(QLatin1String("%HEADING%"), errorString);
|
||||
errString.replace(QLatin1String("%HEADING2%"), heading2);
|
||||
errString.replace(QLatin1String("%LI-1%"), tr("Check the address for typing errors such as <b>ww.</b>example.com instead of <b>www.</b>example.com"));
|
||||
errString.replace(QLatin1String("%LI-2%"), tr("If you are unable to load any pages, check your computer's network connection."));
|
||||
errString.replace(QLatin1String("%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(QLatin1String("%TRY-AGAIN%"), tr("Try Again"));
|
||||
errString = qz_applyDirectionToPage(errString);
|
||||
|
||||
exReturn->content = QString(errString + "<span id=\"qupzilla-error-page\"></span>").toUtf8();
|
||||
|
@ -69,11 +69,11 @@ WebView::WebView(QWidget* parent)
|
||||
|
||||
QIcon WebView::icon() const
|
||||
{
|
||||
if (url().scheme() == "qupzilla") {
|
||||
if (url().scheme() == QLatin1String("qupzilla")) {
|
||||
return QIcon(":icons/qupzilla.png");
|
||||
}
|
||||
|
||||
if (url().scheme() == "file") {
|
||||
if (url().scheme() == QLatin1String("file")) {
|
||||
return qIconProvider->standardIcon(QStyle::SP_DriveHDIcon);
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ QString WebView::title() const
|
||||
title = url().toString(QUrl::RemoveFragment);
|
||||
}
|
||||
|
||||
if (title.isEmpty() || title == "about:blank") {
|
||||
if (title.isEmpty() || title == QLatin1String("about:blank")) {
|
||||
return tr("No Named Page");
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ QUrl WebView::url() const
|
||||
returnUrl = m_aboutToLoadUrl;
|
||||
}
|
||||
|
||||
if (returnUrl.toString() == "about:blank") {
|
||||
if (returnUrl.toString() == QLatin1String("about:blank")) {
|
||||
returnUrl = QUrl();
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ void WebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operat
|
||||
{
|
||||
const QUrl &reqUrl = request.url();
|
||||
|
||||
if (reqUrl.scheme() == "javascript") {
|
||||
if (reqUrl.scheme() == QLatin1String("javascript")) {
|
||||
// Getting scriptSource from PercentEncoding to properly load bookmarklets
|
||||
QString scriptSource = QUrl::fromPercentEncoding(reqUrl.toString().mid(11).toUtf8());
|
||||
page()->mainFrame()->evaluateJavaScript(scriptSource);
|
||||
@ -193,11 +193,12 @@ void WebView::fakeLoadingProgress(int progress)
|
||||
bool WebView::isUrlValid(const QUrl &url)
|
||||
{
|
||||
const QString &urlScheme = url.scheme();
|
||||
if (urlScheme == "data" || urlScheme == "qrc" || urlScheme == "mailto") {
|
||||
if (urlScheme == QLatin1String("data") || urlScheme == QLatin1String("qrc") ||
|
||||
urlScheme == QLatin1String("mailto")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (urlScheme == "qupzilla" || urlScheme == "file") {
|
||||
if (urlScheme == QLatin1String("qupzilla") || urlScheme == QLatin1String("file")) {
|
||||
return !url.path().isEmpty();
|
||||
}
|
||||
|
||||
@ -379,7 +380,7 @@ void WebView::slotIconChanged()
|
||||
void WebView::slotUrlChanged(const QUrl &url)
|
||||
{
|
||||
// Disable touch mocking on all google pages as it just makes it buggy
|
||||
if (url.host().contains("google")) {
|
||||
if (url.host().contains(QLatin1String("google"))) {
|
||||
m_disableTouchMocking = true;
|
||||
}
|
||||
else {
|
||||
@ -419,8 +420,8 @@ void WebView::savePageAs()
|
||||
{
|
||||
QNetworkRequest request(url());
|
||||
QString suggestedFileName = qz_getFileNameFromUrl(url());
|
||||
if (!suggestedFileName.contains('.')) {
|
||||
suggestedFileName.append(".html");
|
||||
if (!suggestedFileName.contains(QLatin1Char('.'))) {
|
||||
suggestedFileName.append(QLatin1String(".html"));
|
||||
}
|
||||
|
||||
DownloadManager::DownloadInfo info;
|
||||
@ -640,7 +641,8 @@ QUrl WebView::lastUrl()
|
||||
|
||||
bool WebView::isMediaElement(const QWebElement &element)
|
||||
{
|
||||
return (element.tagName().toLower() == "video" || element.tagName().toLower() == "audio");
|
||||
return (element.tagName().toLower() == QLatin1String("video")
|
||||
|| element.tagName().toLower() == QLatin1String("audio"));
|
||||
}
|
||||
|
||||
void WebView::checkForForm(QMenu* menu, const QWebElement &element)
|
||||
@ -648,7 +650,7 @@ void WebView::checkForForm(QMenu* menu, const QWebElement &element)
|
||||
QWebElement parentElement = element.parent();
|
||||
|
||||
while (!parentElement.isNull()) {
|
||||
if (parentElement.tagName().toLower() == "form") {
|
||||
if (parentElement.tagName().toLower() == QLatin1String("form")) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -662,7 +664,7 @@ void WebView::checkForForm(QMenu* menu, const QWebElement &element)
|
||||
const QString &url = parentElement.attribute("action");
|
||||
const QString &method = parentElement.hasAttribute("method") ? parentElement.attribute("method").toUpper() : "GET";
|
||||
|
||||
if (!url.isEmpty() && method == "GET") {
|
||||
if (!url.isEmpty() && method == QLatin1String("GET")) {
|
||||
menu->addAction(QIcon(":icons/menu/search-icon.png"), tr("Create Search Engine"), this, SLOT(createSearchEngine()));
|
||||
|
||||
m_clickedElement = element;
|
||||
@ -694,7 +696,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
|
||||
m_actionStop->setEnabled(isLoading());
|
||||
}
|
||||
|
||||
if (!hitTest.linkUrl().isEmpty() && hitTest.linkUrl().scheme() != "javascript") {
|
||||
if (!hitTest.linkUrl().isEmpty() && hitTest.linkUrl().scheme() != QLatin1String("javascript")) {
|
||||
createLinkContextMenu(menu, hitTest);
|
||||
}
|
||||
|
||||
@ -738,7 +740,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
|
||||
delete pageMenu;
|
||||
}
|
||||
|
||||
if (hitTest.element().tagName().toLower() == "input") {
|
||||
if (hitTest.element().tagName().toLower() == QLatin1String("input")) {
|
||||
checkForForm(menu, hitTest.element());
|
||||
}
|
||||
}
|
||||
@ -807,9 +809,9 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos)
|
||||
menu->addSeparator();
|
||||
menu->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &all"), this, SLOT(selectAll()));
|
||||
menu->addSeparator();
|
||||
if (url().scheme() == "http" || url().scheme() == "https") {
|
||||
// bool result = validateConfirm(tr("Do you want to upload this page to an online source code validator?"));
|
||||
// if (result)
|
||||
if (url().scheme() == QLatin1String("http") || url().scheme() == QLatin1String("https")) {
|
||||
// bool result = validateConfirm(tr("Do you want to upload this page to an online source code validator?"));
|
||||
// if (result)
|
||||
menu->addAction(tr("Validate page"), this, SLOT(openUrlInSelectedTab()))->setData(QUrl("http://validator.w3.org/check?uri=" + url().toString()));
|
||||
}
|
||||
|
||||
@ -888,10 +890,10 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult
|
||||
menu->addAction(dictact);
|
||||
|
||||
// #379: Remove newlines
|
||||
QString selectedString = selectedText.trimmed().remove('\n');
|
||||
if (!selectedString.contains('.')) {
|
||||
QString selectedString = selectedText.trimmed().remove(QLatin1Char('\n'));
|
||||
if (!selectedString.contains(QLatin1Char('.'))) {
|
||||
// Try to add .com
|
||||
selectedString.append(".com");
|
||||
selectedString.append(QLatin1String(".com"));
|
||||
}
|
||||
QUrl guessedUrl = QUrl::fromUserInput(selectedString);
|
||||
|
||||
@ -907,7 +909,7 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult
|
||||
menu->addSeparator();
|
||||
selectedText.truncate(20);
|
||||
// KDE is displaying new lines in menu actions ... weird -,-
|
||||
selectedText.replace('\n', ' ').remove('\t');
|
||||
selectedText.replace(QLatin1Char('\n'), QLatin1Char(' ')).remove(QLatin1Char('\t'));
|
||||
|
||||
SearchEngine engine = mApp->searchEnginesManager()->activeEngine();
|
||||
Action* act = new Action(engine.icon, tr("Search \"%1 ..\" with %2").arg(selectedText, engine.name));
|
||||
|
@ -60,7 +60,7 @@ bool AKN_Plugin::testPlugin()
|
||||
{
|
||||
// Let's be sure, require latest version of QupZilla
|
||||
|
||||
return (QupZilla::VERSION == "1.3.1");
|
||||
return (QupZilla::VERSION == QLatin1String("1.3.1"));
|
||||
}
|
||||
|
||||
QTranslator* AKN_Plugin::getTranslator(const QString &locale)
|
||||
|
@ -84,7 +84,7 @@ QNetworkReply* GM_Plugin::createRequest(QNetworkAccessManager::Operation op, con
|
||||
if (op == QNetworkAccessManager::GetOperation && request.rawHeader("X-QupZilla-UserLoadAction") == QByteArray("1")) {
|
||||
const QString &urlString = request.url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery);
|
||||
|
||||
if (urlString.endsWith(".user.js")) {
|
||||
if (urlString.endsWith(QLatin1String(".user.js"))) {
|
||||
m_manager->downloadScript(request);
|
||||
return new EmptyNetworkReply;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ void GM_Script::parseScript(const QString &filePath)
|
||||
|
||||
QStringList requireList;
|
||||
|
||||
const QStringList &lines = metadataBlock.split('\n');
|
||||
const QStringList &lines = metadataBlock.split(QLatin1Char('\n'));
|
||||
foreach(QString line, lines) {
|
||||
if (!line.startsWith(QLatin1String("// @"))) {
|
||||
continue;
|
||||
|
@ -92,7 +92,7 @@ void GM_UrlMatcher::parsePattern(QString pattern)
|
||||
.replace(QRegExp("^\\\\\\|"), QLatin1String("^"))
|
||||
.replace(QRegExp("\\\\\\|$"), QLatin1String("$"))
|
||||
.replace(QRegExp("\\\\\\*"), QLatin1String(".*"))
|
||||
.replace("\\.tld", QLatin1String("\\.[a-z.]{2,6}"));
|
||||
.replace(QLatin1String("\\.tld"), QLatin1String("\\.[a-z.]{2,6}"));
|
||||
|
||||
m_useRegExp = true;
|
||||
m_regExp = QRegExp(pattern, Qt::CaseInsensitive);
|
||||
|
@ -63,7 +63,7 @@ bool MouseGesturesPlugin::testPlugin()
|
||||
{
|
||||
// Let's be sure, require latest version of QupZilla
|
||||
|
||||
return (QupZilla::VERSION == "1.3.1");
|
||||
return (QupZilla::VERSION == QLatin1String("1.3.1"));
|
||||
}
|
||||
|
||||
QTranslator* MouseGesturesPlugin::getTranslator(const QString &locale)
|
||||
|
@ -172,7 +172,7 @@ void PIM_Handler::pimInsert()
|
||||
}
|
||||
|
||||
QString info = action->data().toString();
|
||||
info.replace('"', "\\\"");
|
||||
info.replace(QLatin1Char('"'), QLatin1String("\\\""));
|
||||
m_element.evaluateJavaScript(QString("var newVal = this.value.substring(0, this.selectionStart) + \"%1\" + this.value.substring(this.selectionEnd); this.value = newVal;").arg(info));
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ bool PIM_Plugin::testPlugin()
|
||||
{
|
||||
// Let's be sure, require latest version of QupZilla
|
||||
|
||||
return (QupZilla::VERSION == "1.3.1");
|
||||
return (QupZilla::VERSION == QLatin1String("1.3.1"));
|
||||
}
|
||||
|
||||
QTranslator* PIM_Plugin::getTranslator(const QString &locale)
|
||||
|
@ -89,7 +89,7 @@ bool TestPlugin::testPlugin()
|
||||
//There should be some testing if plugin is loaded correctly
|
||||
//If this function returns false, plugin is automatically unloaded
|
||||
|
||||
return (QupZilla::VERSION == "1.3.1");
|
||||
return (QupZilla::VERSION == QLatin1String("1.3.1"));
|
||||
}
|
||||
|
||||
QTranslator* TestPlugin::getTranslator(const QString &locale)
|
||||
|
Loading…
Reference in New Issue
Block a user