1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Using QLatin1String and QLatin1Char now everywhere

- it saves few unnecessary allocations
This commit is contained in:
nowrep 2012-09-04 12:42:45 +02:00
parent 1afc663e91
commit 528f398cbe
62 changed files with 702 additions and 685 deletions

View File

@ -182,7 +182,7 @@ void FancyTabProxyStyle::drawControl(
void FancyTabProxyStyle::polish(QWidget* widget) void FancyTabProxyStyle::polish(QWidget* widget)
{ {
if (QString(widget->metaObject()->className()) == "QTabBar") { if (QString(widget->metaObject()->className()) == QLatin1String("QTabBar")) {
widget->setMouseTracking(true); widget->setMouseTracking(true);
widget->installEventFilter(this); widget->installEventFilter(this);
} }

View File

@ -63,7 +63,7 @@ void AdBlockAddSubscriptionDialog::indexChanged(int index)
{ {
const Subscription &subscription = m_knownSubscriptions.at(index); const Subscription &subscription = m_knownSubscriptions.at(index);
int pos = subscription.title.indexOf('('); int pos = subscription.title.indexOf(QLatin1Char('('));
QString title = subscription.title; QString title = subscription.title;
if (pos > 0) { if (pos > 0) {

View File

@ -46,7 +46,7 @@ AdBlockIcon::AdBlockIcon(QupZilla* mainClass, QWidget* parent)
void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url) 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 &subscriptionName = ruleString.left(index);
const QString &filter = ruleString.mid(index + 2, ruleString.size() - index - 3); const QString &filter = ruleString.mid(index + 2, ruleString.size() - index - 3);
@ -112,7 +112,7 @@ void AdBlockIcon::createMenu(QMenu* menu)
menu->addSeparator(); menu->addSeparator();
if (!pageUrl.isEmpty()) { 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 &hostFilter = QString("@@||%1^$document").arg(host);
const QString &pageFilter = QString("@@|%1|$document").arg(pageUrl.toString()); 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); const QPair<AdBlockRule, QUrl> &pair = m_blockedPopups.at(i);
QString address = pair.second.toString().right(55); 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())); QAction* action = menu->addAction(actionText, manager, SLOT(showRule()));
action->setData(qVariantFromValue((void*)&pair.first)); 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); menu->addAction(tr("Blocked URL (AdBlock Rule) - click to edit rule"))->setEnabled(false);
foreach(const WebPage::AdBlockedEntry & entry, entries) { foreach(const WebPage::AdBlockedEntry & entry, entries) {
QString address = entry.url.toString().right(55); 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())); QAction* action = menu->addAction(actionText, manager, SLOT(showRule()));
action->setData(qVariantFromValue((void*)entry.rule)); action->setData(qVariantFromValue((void*)entry.rule));

View File

@ -202,7 +202,7 @@ void AdBlockManager::load()
} }
foreach(const QString & fileName, adblockDir.entryList(QStringList("*.txt"), QDir::Files)) { 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; continue;
} }
@ -213,8 +213,8 @@ void AdBlockManager::load()
} }
QTextStream textStream(&file); QTextStream textStream(&file);
QString title = textStream.readLine(1024).remove("Title: "); QString title = textStream.readLine(1024).remove(QLatin1String("Title: "));
QUrl url = QUrl(textStream.readLine(1024).remove("Url: ")); QUrl url = QUrl(textStream.readLine(1024).remove(QLatin1String("Url: ")));
if (title.isEmpty() || !url.isValid()) { if (title.isEmpty() || !url.isValid()) {
qWarning() << "AdBlockManager: Invalid subscription file" << absolutePath; qWarning() << "AdBlockManager: Invalid subscription file" << absolutePath;

View File

@ -172,7 +172,7 @@ bool AdBlockRule::isException() const
bool AdBlockRule::isComment() const bool AdBlockRule::isComment() const
{ {
return m_filter.startsWith('!'); return m_filter.startsWith(QLatin1Char('!'));
} }
bool AdBlockRule::isEnabled() const bool AdBlockRule::isEnabled() const
@ -407,7 +407,7 @@ void AdBlockRule::parseFilter()
} }
else if (option.endsWith(QLatin1String("subdocument"))) { else if (option.endsWith(QLatin1String("subdocument"))) {
m_subdocument = true; m_subdocument = true;
m_subdocumentException = option.startsWith('~'); m_subdocumentException = option.startsWith(QLatin1Char('~'));
++handledOptions; ++handledOptions;
} }
else if (option.endsWith(QLatin1String("xmlhttprequest"))) { else if (option.endsWith(QLatin1String("xmlhttprequest"))) {
@ -513,7 +513,7 @@ void AdBlockRule::parseDomains(const QString &domains, const QChar &separator)
if (domain.isEmpty()) { if (domain.isEmpty()) {
continue; continue;
} }
if (domain.startsWith('~')) { if (domain.startsWith(QLatin1Char('~'))) {
m_blockedDomains.append(domain.mid(1)); m_blockedDomains.append(domain.mid(1));
} }
else { else {

View File

@ -108,7 +108,7 @@ void AdBlockSubscription::loadSubscription(const QStringList &disabledRules)
textStream.readLine(1024); textStream.readLine(1024);
QString header = 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; qWarning() << "AdBlockSubscription::" << __FUNCTION__ << "invalid format of adblock file" << m_filePath;
QTimer::singleShot(0, this, SLOT(updateSubscription())); QTimer::singleShot(0, this, SLOT(updateSubscription()));
return; return;
@ -398,7 +398,7 @@ void AdBlockEasyList::saveDownloadedData(QByteArray &data)
// Third-party advertisers rules are with start domain (||) placeholder which needs regexps // Third-party advertisers rules are with start domain (||) placeholder which needs regexps
// So we are ignoring it for keeping good performance // 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.write(data);
file.close(); file.close();

View File

@ -76,7 +76,7 @@ void CommandLineOptions::parseActions()
for (int i = 1; i < arguments.count(); ++i) { for (int i = 1; i < arguments.count(); ++i) {
QString arg = arguments.at(i); QString arg = arguments.at(i);
if (arg == "-h" || arg == "--help") { if (arg == QLatin1String("-h") || arg == QLatin1String("--help")) {
showHelp(); showHelp();
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_ExitAction; pair.action = Qz::CL_ExitAction;
@ -84,7 +84,7 @@ void CommandLineOptions::parseActions()
break; break;
} }
if (arg == "-a" || arg == "--authors") { if (arg == QLatin1String("-a") || arg == QLatin1String("--authors")) {
cout << "QupZilla authors: " << endl; cout << "QupZilla authors: " << endl;
cout << " nowrep <nowrep@gmail.com>" << endl; cout << " nowrep <nowrep@gmail.com>" << endl;
ActionPair pair; ActionPair pair;
@ -93,7 +93,7 @@ void CommandLineOptions::parseActions()
break; break;
} }
if (arg == "-v" || arg == "--version") { if (arg == QLatin1String("-v") || arg == QLatin1String("--version")) {
cout << "QupZilla v" << QupZilla::VERSION.toUtf8().data() cout << "QupZilla v" << QupZilla::VERSION.toUtf8().data()
#ifdef GIT_REVISION #ifdef GIT_REVISION
<< " rev " << GIT_REVISION << " " << " rev " << GIT_REVISION << " "
@ -106,8 +106,8 @@ void CommandLineOptions::parseActions()
break; break;
} }
if (arg.startsWith("-p=") || arg.startsWith("--profile=")) { if (arg.startsWith(QLatin1String("-p=")) || arg.startsWith(QLatin1String("--profile="))) {
int index = arg.indexOf('='); int index = arg.indexOf(QLatin1Char('='));
if (index != -1) { if (index != -1) {
const QString profileName = arg.mid(index + 1); const QString profileName = arg.mid(index + 1);
cout << "QupZilla: Starting with profile '" << profileName.toUtf8().data() << "'" << endl; 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; ActionPair pair;
pair.action = Qz::CL_StartWithoutAddons; pair.action = Qz::CL_StartWithoutAddons;
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-nt") || arg.startsWith("--new-tab")) { if (arg.startsWith(QLatin1String("-nt")) || arg.startsWith(QLatin1String("--new-tab"))) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_NewTab; pair.action = Qz::CL_NewTab;
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-nw") || arg.startsWith("--new-window")) { if (arg.startsWith(QLatin1String("-nw")) || arg.startsWith(QLatin1String("--new-window"))) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_NewWindow; pair.action = Qz::CL_NewWindow;
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-dm") || arg.startsWith("--download-manager")) { if (arg.startsWith(QLatin1String("-dm")) || arg.startsWith(QLatin1String("--download-manager"))) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_ShowDownloadManager; pair.action = Qz::CL_ShowDownloadManager;
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-pb") || arg.startsWith("--private-browsing")) { if (arg.startsWith(QLatin1String("-pb")) || arg.startsWith(QLatin1String("--private-browsing"))) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_StartPrivateBrowsing; pair.action = Qz::CL_StartPrivateBrowsing;
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-nr") || arg.startsWith("--no-remote")) { if (arg.startsWith(QLatin1String("-nr")) || arg.startsWith(QLatin1String("--no-remote"))) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_StartNewInstance; pair.action = Qz::CL_StartNewInstance;
m_actions.append(pair); m_actions.append(pair);
} }
if (arg.startsWith("-ct") || arg.startsWith("--current-tab")) { if (arg.startsWith(QLatin1String("-ct")) || arg.startsWith(QLatin1String("--current-tab"))) {
int index = arg.indexOf('='); int index = arg.indexOf(QLatin1Char('='));
if (index != -1) { if (index != -1) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_OpenUrlInCurrentTab; pair.action = Qz::CL_OpenUrlInCurrentTab;
@ -165,8 +165,8 @@ void CommandLineOptions::parseActions()
} }
} }
if (arg.startsWith("-ow") || arg.startsWith("--open-window")) { if (arg.startsWith(QLatin1String("-ow")) || arg.startsWith(QLatin1String("--open-window"))) {
int index = arg.indexOf('='); int index = arg.indexOf(QLatin1Char('='));
if (index != -1) { if (index != -1) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_OpenUrlInNewWindow; pair.action = Qz::CL_OpenUrlInNewWindow;
@ -178,8 +178,9 @@ void CommandLineOptions::parseActions()
const QString &url = arguments.last(); const QString &url = arguments.last();
if (m_argc > 1 && !url.isEmpty() && !url.startsWith('-') && if (m_argc > 1 && !url.isEmpty() && !url.startsWith(QLatin1Char('-')) &&
(url.contains('.') || url.contains('/') || url.contains('\\'))) { (url.contains(QLatin1Char('.')) || url.contains(QLatin1Char('/'))
|| url.contains(QLatin1Char('\\')))) {
ActionPair pair; ActionPair pair;
pair.action = Qz::CL_OpenUrl; pair.action = Qz::CL_OpenUrl;
pair.text = url; pair.text = url;

View File

@ -101,7 +101,7 @@ MainApplication::MainApplication(int &argc, char** argv)
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
DATADIR.append("../Resources/"); DATADIR.append(QLatin1String("../Resources/"));
#endif #endif
#ifdef PORTABLE_BUILD #ifdef PORTABLE_BUILD
@ -132,14 +132,14 @@ MainApplication::MainApplication(int &argc, char** argv)
startProfile = pair.text; startProfile = pair.text;
break; break;
case Qz::CL_NewTab: case Qz::CL_NewTab:
messages.append("ACTION:NewTab"); messages.append(QLatin1String("ACTION:NewTab"));
m_postLaunchActions.append(OpenNewTab); m_postLaunchActions.append(OpenNewTab);
break; break;
case Qz::CL_NewWindow: case Qz::CL_NewWindow:
messages.append("ACTION:NewWindow"); messages.append(QLatin1String("ACTION:NewWindow"));
break; break;
case Qz::CL_ShowDownloadManager: case Qz::CL_ShowDownloadManager:
messages.append("ACTION:ShowDownloadManager"); messages.append(QLatin1String("ACTION:ShowDownloadManager"));
m_postLaunchActions.append(OpenDownloadManager); m_postLaunchActions.append(OpenDownloadManager);
break; break;
case Qz::CL_StartPrivateBrowsing: case Qz::CL_StartPrivateBrowsing:
@ -174,7 +174,7 @@ MainApplication::MainApplication(int &argc, char** argv)
QString appId = "QupZillaWebBrowser"; QString appId = "QupZillaWebBrowser";
if (newInstance) { 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; std::cout << "New instance cannot be started with default profile!" << std::endl;
} }
else { else {
@ -186,7 +186,7 @@ MainApplication::MainApplication(int &argc, char** argv)
} }
if (messages.isEmpty()) { if (messages.isEmpty()) {
messages.append(" "); messages.append(QLatin1String(" "));
} }
if (isRunning()) { if (isRunning()) {
@ -213,7 +213,7 @@ MainApplication::MainApplication(int &argc, char** argv)
QSettings::setDefaultFormat(QSettings::IniFormat); QSettings::setDefaultFormat(QSettings::IniFormat);
if (startProfile.isEmpty()) { if (startProfile.isEmpty()) {
QSettings settings(PROFILEDIR + "profiles/profiles.ini", QSettings::IniFormat); 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/"; m_activeProfil = PROFILEDIR + "profiles/default/";
} }
else { else {
@ -483,27 +483,27 @@ void MainApplication::receiveAppMessage(QString message)
QWidget* actWin = getWindow(); QWidget* actWin = getWindow();
QUrl actUrl; QUrl actUrl;
if (message.startsWith("URL:")) { if (message.startsWith(QLatin1String("URL:"))) {
QUrl url = QUrl::fromUserInput(message.mid(4)); QUrl url = QUrl::fromUserInput(message.mid(4));
addNewTab(url); addNewTab(url);
actWin = getWindow(); actWin = getWindow();
} }
else if (message.startsWith("ACTION:")) { else if (message.startsWith(QLatin1String("ACTION:"))) {
QString text = message.mid(7); QString text = message.mid(7);
if (text == "NewTab") { if (text == QLatin1String("NewTab")) {
addNewTab(); addNewTab();
} }
else if (text == "NewWindow") { else if (text == QLatin1String("NewWindow")) {
actWin = makeNewWindow(Qz::BW_NewWindow); actWin = makeNewWindow(Qz::BW_NewWindow);
} }
else if (text == "ShowDownloadManager") { else if (text == QLatin1String("ShowDownloadManager")) {
downManager()->show(); downManager()->show();
actWin = downManager(); actWin = downManager();
} }
else if (text.startsWith("OpenUrlInCurrentTab")) { else if (text.startsWith(QLatin1String("OpenUrlInCurrentTab"))) {
actUrl = QUrl::fromUserInput(text.mid(19)); 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))); makeNewWindow(Qz::BW_NewWindow, QUrl::fromUserInput(text.mid(18)));
return; return;
} }
@ -789,12 +789,12 @@ void MainApplication::startPrivateBrowsing()
{ {
QStringList args; QStringList args;
foreach(const QString & arg, arguments()) { foreach(const QString & arg, arguments()) {
if (arg.startsWith('-')) { if (arg.startsWith(QLatin1Char('-'))) {
args.append(arg); args.append(arg);
} }
} }
args.append("--private-browsing"); args.append(QLatin1String("--private-browsing"));
if (!QProcess::startDetached(applicationFilePath(), args)) { if (!QProcess::startDetached(applicationFilePath(), args)) {
qWarning() << "MainApplication: Cannot start new browser process for private browsing!" << 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); QFile file(filePath);
if (!filePath.isEmpty() && file.open(QFile::ReadOnly)) { if (!filePath.isEmpty() && file.open(QFile::ReadOnly)) {
QString fileData = QString::fromUtf8(file.readAll()); QString fileData = QString::fromUtf8(file.readAll());
fileData.remove('\n'); fileData.remove(QLatin1Char('\n'));
userStyle.append(fileData); userStyle.append(fileData);
file.close(); file.close();
} }

View File

@ -39,7 +39,7 @@ int ProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption* option, cons
if (m_TabBarTabHSpace == -1) { if (m_TabBarTabHSpace == -1) {
m_TabBarTabHSpace = qMin(QProxyStyle::pixelMetric(PM_TabBarTabHSpace, option, widget), 14); m_TabBarTabHSpace = qMin(QProxyStyle::pixelMetric(PM_TabBarTabHSpace, option, widget), 14);
if (baseStyle()->objectName() == "oxygen") { if (baseStyle()->objectName() == QLatin1String("oxygen")) {
m_TabBarTabHSpace = 14; m_TabBarTabHSpace = 14;
} }
} }

View File

@ -192,7 +192,7 @@ void QupZilla::postLaunch()
m_tabWidget->addView(request, Qz::NT_CleanSelectedTabAtTheEnd); m_tabWidget->addView(request, Qz::NT_CleanSelectedTabAtTheEnd);
if (startUrl.isEmpty() || startUrl.toString() == "qupzilla:speeddial") { if (startUrl.isEmpty() || startUrl.toString() == QLatin1String("qupzilla:speeddial")) {
locationBar()->setFocus(); locationBar()->setFocus();
} }
} }
@ -968,27 +968,30 @@ void QupZilla::aboutToShowEncodingMenu()
if (QTextCodec::codecForName(name)->aliases().contains(name)) { if (QTextCodec::codecForName(name)->aliases().contains(name)) {
continue; 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); action->setCheckable(true);
connect(action, SIGNAL(triggered()), this, SLOT(changeEncoding())); connect(action, SIGNAL(triggered()), this, SLOT(changeEncoding()));
if (activeCodec.compare(name, Qt::CaseInsensitive) == 0) { if (activeCodec.compare(nameString, Qt::CaseInsensitive) == 0) {
action->setChecked(true); action->setChecked(true);
} }
if (name.startsWith("ISO")) { if (nameString.startsWith(QLatin1String("ISO"))) {
menuISO->addAction(action); menuISO->addAction(action);
} }
else if (name.startsWith("UTF")) { else if (nameString.startsWith(QLatin1String("UTF"))) {
menuUTF->addAction(action); menuUTF->addAction(action);
} }
else if (name.startsWith("windows")) { else if (nameString.startsWith(QLatin1String("windows"))) {
menuWindows->addAction(action); menuWindows->addAction(action);
} }
else if (name.startsWith("Iscii")) { else if (nameString.startsWith(QLatin1String("Iscii"))) {
menuIscii->addAction(action); menuIscii->addAction(action);
} }
else if (name == "System") { else if (nameString == QLatin1String("System")) {
m_menuEncoding->addAction(action); m_menuEncoding->addAction(action);
} }
else { else {

View File

@ -229,8 +229,8 @@ void AutoFillModel::completePage(WebPage* page)
for (int i = 0; i < arguments.count(); i++) { for (int i = 0; i < arguments.count(); i++) {
QString key = arguments.at(i).first; QString key = arguments.at(i).first;
QString value = arguments.at(i).second; QString value = arguments.at(i).second;
key.replace('+', ' '); key.replace(QLatin1Char('+'), QLatin1Char(' '));
value.replace('+', ' '); value.replace(QLatin1Char('+'), QLatin1Char(' '));
key = QUrl::fromEncoded(key.toUtf8()).toString(); key = QUrl::fromEncoded(key.toUtf8()).toString();
value = QUrl::fromEncoded(value.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++) { for (int i = 0; i < inputs.count(); i++) {
QWebElement element = inputs.at(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; continue;
} }
@ -382,13 +384,13 @@ QByteArray AutoFillModel::convertWebKitFormBoundaryIfNecessary(const QByteArray
QString string = rx.cap(1); QString string = rx.cap(1);
pos += rx.matchedLength(); pos += rx.matchedLength();
int endOfAttributeName = string.indexOf('"'); int endOfAttributeName = string.indexOf(QLatin1Char('"'));
if (endOfAttributeName == -1) { if (endOfAttributeName == -1) {
continue; continue;
} }
QString attrName = string.left(endOfAttributeName); 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()) { if (attrName.isEmpty() || attrValue.isEmpty()) {
continue; continue;
@ -462,27 +464,27 @@ bool AutoFillModel::importPasswords(const QByteArray &data)
xml.readNext(); xml.readNext();
if (xml.isStartElement()) { if (xml.isStartElement()) {
if (xml.name() == "entry") { if (xml.name() == QLatin1String("entry")) {
QString server; QString server;
QString username; QString username;
QString password; QString password;
QByteArray data; QByteArray data;
while (xml.readNext()) { while (xml.readNext()) {
if (xml.name() == "server") { if (xml.name() == QLatin1String("server")) {
server = xml.readElementText(); server = xml.readElementText();
} }
else if (xml.name() == "username") { else if (xml.name() == QLatin1String("username")) {
username = xml.readElementText(); username = xml.readElementText();
} }
else if (xml.name() == "password") { else if (xml.name() == QLatin1String("password")) {
password = xml.readElementText(); password = xml.readElementText();
} }
else if (xml.name() == "data") { else if (xml.name() == QLatin1String("data")) {
data = xml.readElementText().toUtf8(); data = xml.readElementText().toUtf8();
} }
if (xml.isEndElement() && xml.name() == "entry") { if (xml.isEndElement() && xml.name() == QLatin1String("entry")) {
break; break;
} }
} }
@ -505,15 +507,15 @@ bool AutoFillModel::importPasswords(const QByteArray &data)
} }
} }
} }
else if (xml.name() == "exception") { else if (xml.name() == QLatin1String("exception")) {
QString server; QString server;
while (xml.readNext()) { while (xml.readNext()) {
if (xml.name() == "server") { if (xml.name() == QLatin1String("server")) {
server = xml.readElementText(); server = xml.readElementText();
} }
if (xml.isEndElement() && xml.name() == "exception") { if (xml.isEndElement() && xml.name() == QLatin1String("exception")) {
break; break;
} }
} }

View File

@ -345,10 +345,10 @@ void BookmarksManager::refreshTable()
QString folder = query.value(3).toString(); QString folder = query.value(3).toString();
QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(4).toByteArray())); QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(4).toByteArray()));
QTreeWidgetItem* item = new QTreeWidgetItem(); QTreeWidgetItem* item = new QTreeWidgetItem();
if (folder == "bookmarksMenu") { if (folder == QLatin1String("bookmarksMenu")) {
folder = _bookmarksMenu; folder = _bookmarksMenu;
} }
if (folder == "bookmarksToolbar") { if (folder == QLatin1String("bookmarksToolbar")) {
folder = _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); QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(bookmark.title, Qt::MatchExactly);
if (list.count() == 0) { if (list.count() == 0) {
return; return;

View File

@ -65,7 +65,8 @@ void BookmarksModel::setShowingOnlyIconsInToolbar(bool state)
bool BookmarksModel::isFolder(const QString &name) 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; return true;
} }
@ -501,7 +502,7 @@ bool BookmarksModel::isSubfolder(const QString &name)
return false; return false;
} }
return query.value(0).toString() == "yes"; return query.value(0).toString() == QLatin1String("yes");
} }
bool BookmarksModel::bookmarksEqual(const Bookmark &one, const Bookmark &two) 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 BookmarksModel::toTranslatedFolder(const QString &name)
{ {
QString trFolder; QString trFolder;
if (name == "bookmarksMenu") { if (name == QLatin1String("bookmarksMenu")) {
trFolder = tr("Bookmarks In Menu"); trFolder = tr("Bookmarks In Menu");
} }
else if (name == "bookmarksToolbar") { else if (name == QLatin1String("bookmarksToolbar")) {
trFolder = tr("Bookmarks In ToolBar"); trFolder = tr("Bookmarks In ToolBar");
} }
else if (name == "unsorted") { else if (name == QLatin1String("unsorted")) {
trFolder = tr("Unsorted Bookmarks"); trFolder = tr("Unsorted Bookmarks");
} }
else { else {

View File

@ -444,13 +444,16 @@ void BookmarksToolbar::removeBookmark(const BookmarksModel::Bookmark &bookmark)
void BookmarksToolbar::bookmarkEdited(const BookmarksModel::Bookmark &before, const BookmarksModel::Bookmark &after) 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); 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); addBookmark(after);
} }
else { //Editing bookmark already in toolbar else {
// Editing bookmark already in toolbar
for (int i = 0; i < m_layout->count(); i++) { for (int i = 0; i < m_layout->count(); i++) {
ToolButton* button = qobject_cast<ToolButton*>(m_layout->itemAt(i)->widget()); ToolButton* button = qobject_cast<ToolButton*>(m_layout->itemAt(i)->widget());
if (!button) { if (!button) {

View File

@ -73,7 +73,8 @@ QList<BookmarksModel::Bookmark> FirefoxImporter::exportBookmarks()
QUrl url = query2.value(0).toUrl(); 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; continue;
} }

View File

@ -69,29 +69,29 @@ QList<BookmarksModel::Bookmark> HtmlImporter::exportBookmarks()
// Converting tags to lower case -,- // Converting tags to lower case -,-
// For some reason Qt::CaseInsensitive is not everytime insensitive :-D // For some reason Qt::CaseInsensitive is not everytime insensitive :-D
bookmarks.replace("<DL", "<dl"); bookmarks.replace(QLatin1String("<DL"), QLatin1String("<dl"));
bookmarks.replace("</DL", "</dl"); bookmarks.replace(QLatin1String("</DL"), QLatin1String("</dl"));
bookmarks.replace("<DT", "<dt"); bookmarks.replace(QLatin1String("<DT"), QLatin1String("<dt"));
bookmarks.replace("</DT", "</dt"); bookmarks.replace(QLatin1String("</DT"), QLatin1String("</dt"));
bookmarks.replace("<P", "<p"); bookmarks.replace(QLatin1String("<P"), QLatin1String("<p"));
bookmarks.replace("</P", "</p"); bookmarks.replace(QLatin1String("</P"), QLatin1String("</p"));
bookmarks.replace("<A", "<a"); bookmarks.replace(QLatin1String("<A"), QLatin1String("<a"));
bookmarks.replace("</A", "</a"); bookmarks.replace(QLatin1String("</A"), QLatin1String("</a"));
bookmarks.replace("HREF=", "href="); bookmarks.replace(QLatin1String("HREF="), QLatin1String("href="));
bookmarks.replace("<H3", "<h3"); bookmarks.replace(QLatin1String("<H3"), QLatin1String("<h3"));
bookmarks.replace("</H3", "</h3"); bookmarks.replace(QLatin1String("</H3"), QLatin1String("</h3"));
bookmarks = bookmarks.left(bookmarks.lastIndexOf("</dl><p>")); bookmarks = bookmarks.left(bookmarks.lastIndexOf(QLatin1String("</dl><p>")));
int start = bookmarks.indexOf("<dl><p>"); int start = bookmarks.indexOf(QLatin1String("<dl><p>"));
QStringList folders("Html Import"); QStringList folders("Html Import");
while (start > 0) { while (start > 0) {
QString string = bookmarks.mid(start); QString string = bookmarks.mid(start);
int posOfFolder = string.indexOf("<dt><h3"); int posOfFolder = string.indexOf(QLatin1String("<dt><h3"));
int posOfEndFolder = string.indexOf("</dl><p>"); int posOfEndFolder = string.indexOf(QLatin1String("</dl><p>"));
int posOfLink = string.indexOf("<dt><a"); int posOfLink = string.indexOf(QLatin1String("<dt><a"));
int nearest = qzMin(posOfLink, qzMin(posOfFolder, posOfEndFolder)); int nearest = qzMin(posOfLink, qzMin(posOfFolder, posOfEndFolder));
if (nearest == -1) { if (nearest == -1) {
@ -136,7 +136,8 @@ QList<BookmarksModel::Bookmark> HtmlImporter::exportBookmarks()
start += posOfLink + rx.cap(0).size(); 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; continue;
} }

View File

@ -33,11 +33,11 @@ bool _matchDomain(const QString &domain, const QString &filter)
int index = domain.indexOf(filter); int index = domain.indexOf(filter);
if (index == 0 || filter[0] == '.') { if (index == 0 || filter[0] == QLatin1Char('.')) {
return true; return true;
} }
return domain[index - 1] == '.'; return domain[index - 1] == QLatin1Char('.');
} }
bool containsDomain(QString string, const QString &domain) bool containsDomain(QString string, const QString &domain)
@ -47,7 +47,7 @@ bool containsDomain(QString string, const QString &domain)
return true; return true;
} }
if (string.startsWith('.')) { if (string.startsWith(QLatin1Char('.'))) {
string = string.mid(1); string = string.mid(1);
} }

View File

@ -160,7 +160,7 @@ void CookieManager::slotRefreshTable()
QTreeWidgetItem* item; QTreeWidgetItem* item;
QString cookieDomain = cookie.domain(); QString cookieDomain = cookie.domain();
if (cookieDomain.startsWith('.')) { if (cookieDomain.startsWith(QLatin1Char('.'))) {
cookieDomain = cookieDomain.mid(1); cookieDomain = cookieDomain.mid(1);
} }

View File

@ -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()); QDBusInterface dbus("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus());
QVariantList args; QVariantList args;
args.append("qupzilla"); args.append(QLatin1String("qupzilla"));
args.append(m_uint); args.append(m_uint);
args.append(tmp.fileName()); args.append(tmp.fileName());
args.append(heading); args.append(heading);
@ -111,7 +111,7 @@ void DesktopNotificationsFactory::nativeNotificationPreview()
QDBusInterface dbus("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus()); QDBusInterface dbus("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus());
QVariantList args; QVariantList args;
args.append("qupzilla"); args.append(QLatin1String("qupzilla"));
args.append(m_uint); args.append(m_uint);
args.append(tmp.fileName()); args.append(tmp.fileName());
args.append(QObject::tr("Native System Notification")); args.append(QObject::tr("Native System Notification"));

View File

@ -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) { if (pos != -1) {
int size = m_userFileName.size(); int size = m_userFileName.size();
m_path = m_userFileName.left(pos + 1); m_path = m_userFileName.left(pos + 1);
@ -254,7 +254,7 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply)
reg.indexIn(value); reg.indexIn(value);
path = reg.cap(1).trimmed(); path = reg.cap(1).trimmed();
if (path.startsWith('"') && path.endsWith('"')) { if (path.startsWith(QLatin1Char('"')) && path.endsWith(QLatin1Char('"'))) {
path = path.mid(1, path.length() - 2); path = path.mid(1, path.length() - 2);
} }
} }
@ -273,13 +273,13 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply)
} }
if (!endName.isEmpty()) { if (!endName.isEmpty()) {
endName.prepend("."); endName.prepend(QLatin1Char('.'));
} }
QString name = baseName + endName; QString name = baseName + endName;
if (name.contains('"')) { if (name.contains(QLatin1Char('"'))) {
name.remove("\";"); name.remove(QLatin1String("\";"));
} }
return qz_filterCharsFromFilename(name); return qz_filterCharsFromFilename(name);

View File

@ -368,7 +368,7 @@ void DownloadItem::openFolder()
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QString winFileName = m_path + m_fileName; QString winFileName = m_path + m_fileName;
winFileName.replace("/", "\\"); winFileName.replace(QLatin1Char('/'), "\\");
QProcess::startDetached("explorer.exe /e,/select,\"" + winFileName + "\""); QProcess::startDetached("explorer.exe /e,/select,\"" + winFileName + "\"");
#else #else
QDesktopServices::openUrl(QUrl::fromLocalFile(m_path)); QDesktopServices::openUrl(QUrl::fromLocalFile(m_path));

View File

@ -68,7 +68,7 @@ void DownloadManager::loadSettings()
Settings settings; Settings settings;
settings.beginGroup("DownloadManager"); settings.beginGroup("DownloadManager");
m_downloadPath = settings.value("defaultDownloadPath", QString()).toString(); 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_closeOnFinish = settings.value("CloseManagerOnFinish", false).toBool();
m_useNativeDialog = settings.value("useNativeDialog", DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG).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) void DownloadManager::startExternalManager(const QUrl &url)
{ {
QStringList arguments = m_externalArguments.split(' ', QString::SkipEmptyParts); QStringList arguments = m_externalArguments.split(QLatin1Char(' '), QString::SkipEmptyParts);
arguments << url.toString(); arguments << url.toString();
bool success = QProcess::startDetached(m_externalExecutable, arguments); 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) void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const DownloadInfo &info)
{ {
if (!info.page || reply->url().scheme() == "qupzilla") { if (!info.page || reply->url().scheme() == QLatin1String("qupzilla")) {
return; return;
} }

View File

@ -68,7 +68,7 @@ void History::addHistoryEntry(const QUrl &url, QString title)
if (!m_isSaving) { if (!m_isSaving) {
return; return;
} }
if (url.scheme() == "qupzilla" || url.scheme() == "about" || url.isEmpty()) { if (url.scheme() == QLatin1String("qupzilla") || url.scheme() == QLatin1String("about") || url.isEmpty()) {
return; return;
} }
if (title.isEmpty()) { if (title.isEmpty()) {

View File

@ -129,7 +129,7 @@ void LocationCompleterDelegate::drawHighlightedTextLine(const QRect &rect, QStri
const QPalette::ColorRole &role) const const QPalette::ColorRole &role) const
{ {
QList<int> delimiters; QList<int> delimiters;
QStringList searchStrings = searchText.split(' ', QString::SkipEmptyParts); QStringList searchStrings = searchText.split(QLatin1Char(' '), QString::SkipEmptyParts);
// Look for longer parts first // Look for longer parts first
qSort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan); qSort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan);

View File

@ -133,23 +133,23 @@ QSqlQuery LocationCompleterModel::createQuery(const QString &searchString, const
QStringList searchList; QStringList searchList;
if (bookmarks) { 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 { else {
query.append(" FROM history "); query.append(QLatin1String(" FROM history "));
} }
query.append("WHERE "); query.append(QLatin1String("WHERE "));
if (exactMatch) { if (exactMatch) {
query.append(QString("%1.title LIKE ? OR %1.url LIKE ? ").arg(table)); query.append(QString("%1.title LIKE ? OR %1.url LIKE ? ").arg(table));
} }
else { else {
searchList = searchString.split(' ', QString::SkipEmptyParts); searchList = searchString.split(QLatin1Char(' '), QString::SkipEmptyParts);
const int slSize = searchList.size(); const int slSize = searchList.size();
for (int i = 0; i < slSize; ++i) { for (int i = 0; i < slSize; ++i) {
query.append(QString("(%1.title LIKE ? OR %1.url LIKE ?) ").arg(table)); query.append(QString("(%1.title LIKE ? OR %1.url LIKE ?) ").arg(table));
if (i < slSize - 1) { 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("ORDER BY " + orderBy);
} }
query.append(" LIMIT ?"); query.append(QLatin1String(" LIMIT ?"));
QSqlQuery sqlQuery; QSqlQuery sqlQuery;
sqlQuery.prepare(query); sqlQuery.prepare(query);

View File

@ -125,14 +125,14 @@ QUrl LocationBar::createUrl()
QUrl urlToLoad; QUrl urlToLoad;
//Check for Search Engine shortcut //Check for Search Engine shortcut
int firstSpacePos = text().indexOf(' '); int firstSpacePos = text().indexOf(QLatin1Char(' '));
if (firstSpacePos != -1) { if (firstSpacePos != -1) {
QString shortcut = text().left(firstSpacePos); QString shortcut = text().left(firstSpacePos);
QString searchedString = QUrl::toPercentEncoding(text().mid(firstSpacePos).trimmed()); QString searchedString = QUrl::toPercentEncoding(text().mid(firstSpacePos).trimmed());
SearchEngine en = mApp->searchEnginesManager()->engineForShortcut(shortcut); SearchEngine en = mApp->searchEnginesManager()->engineForShortcut(shortcut);
if (!en.name.isEmpty()) { 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(); QUrl url = p_QupZilla->weView()->url();
if (url.isEmpty() || url.scheme() == "qupzilla") { if (url.isEmpty() || url.scheme() == QLatin1String("qupzilla")) {
return; return;
} }
@ -243,7 +243,7 @@ void LocationBar::showUrl(const QUrl &url)
QString stringUrl = qz_urlEncodeQueryString(url); QString stringUrl = qz_urlEncodeQueryString(url);
if (stringUrl == "qupzilla:speeddial" || stringUrl == "about:blank") { if (stringUrl == QLatin1String("qupzilla:speeddial") || stringUrl == QLatin1String("about:blank")) {
stringUrl = ""; stringUrl = "";
} }
@ -452,7 +452,7 @@ void LocationBar::keyPressEvent(QKeyEvent* event)
case Qt::Key_Enter: case Qt::Key_Enter:
switch (event->modifiers()) { switch (event->modifiers()) {
case Qt::ControlModifier: case Qt::ControlModifier:
setText(text().append(".com")); setText(text().append(QLatin1String(".com")));
urlEnter(); urlEnter();
m_holdingAlt = false; m_holdingAlt = false;
break; 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"); 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 && 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)); LineEdit::setText(text().append(localDomain));
} }

View File

@ -53,7 +53,7 @@ QString titleForUrl(QString title, const QUrl &url)
QIcon iconForPage(const QUrl &url, const QIcon &sIcon) QIcon iconForPage(const QUrl &url, const QIcon &sIcon)
{ {
QIcon icon; 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); icon.addPixmap(sIcon.pixmap(16, 16), QIcon::Active);
return icon; return icon;
} }

View File

@ -52,8 +52,8 @@
QString fileNameForCert(const QSslCertificate &cert) QString fileNameForCert(const QSslCertificate &cert)
{ {
QString certFileName = CertificateInfoWidget::certificateItemText(cert); QString certFileName = CertificateInfoWidget::certificateItemText(cert);
certFileName.remove(' '); certFileName.remove(QLatin1Char(' '));
certFileName.append(".crt"); certFileName.append(QLatin1String(".crt"));
certFileName = qz_filterCharsFromFilename(certFileName); certFileName = qz_filterCharsFromFilename(certFileName);
return certFileName; return certFileName;
} }
@ -499,7 +499,7 @@ void NetworkManager::loadCertificates()
QDirIterator it(path, QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories); QDirIterator it(path, QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories);
while (it.hasNext()) { while (it.hasNext()) {
QString filePath = it.next(); QString filePath = it.next();
if (!filePath.endsWith(".crt")) { if (!filePath.endsWith(QLatin1String(".crt"))) {
continue; continue;
} }
@ -517,7 +517,7 @@ void NetworkManager::loadCertificates()
QDirIterator it_(mApp->currentProfilePath() + "certificates", QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories); QDirIterator it_(mApp->currentProfilePath() + "certificates", QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories);
while (it_.hasNext()) { while (it_.hasNext()) {
QString filePath = it_.next(); QString filePath = it_.next();
if (!filePath.endsWith(".crt")) { if (!filePath.endsWith(QLatin1String(".crt"))) {
continue; continue;
} }

View File

@ -66,7 +66,7 @@ QList<QNetworkProxy> NetworkProxyFactory::queryProxy(const QNetworkProxyQuery &q
case DefinedProxy: case DefinedProxy:
proxy = m_proxyType; proxy = m_proxyType;
if (m_useDifferentProxyForHttps && query.protocolTag() == "https") { if (m_useDifferentProxyForHttps && query.protocolTag() == QLatin1String("https")) {
proxy.setHostName(m_httpsHostName); proxy.setHostName(m_httpsHostName);
proxy.setPort(m_httpsPort); proxy.setPort(m_httpsPort);
proxy.setUser(m_httpsUsername); proxy.setUser(m_httpsUsername);

View File

@ -43,10 +43,10 @@ QNetworkReply* AdBlockSchemeHandler::createRequest(QNetworkAccessManager::Operat
for (int i = 0; i < queryItems.count(); ++i) { for (int i = 0; i < queryItems.count(); ++i) {
QPair<QString, QString> pair = queryItems.at(i); QPair<QString, QString> pair = queryItems.at(i);
if (pair.first == "location") { if (pair.first == QLatin1String("location")) {
subscriptionUrl = pair.second; subscriptionUrl = pair.second;
} }
else if (pair.first == "title") { else if (pair.first == QLatin1String("title")) {
subscriptionTitle = pair.second; subscriptionTitle = pair.second;
} }
} }

View File

@ -143,57 +143,57 @@ QString FileSchemeReply::loadDirectory()
if (sPage.isEmpty()) { if (sPage.isEmpty()) {
sPage = qz_readAllFileContents(":/html/dirlist.html"); sPage = qz_readAllFileContents(":/html/dirlist.html");
sPage.replace("%BOX-BORDER%", "qrc:html/box-border.png"); sPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
sPage.replace("%UP-IMG%", qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_FileDialogToParent).pixmap(22))); sPage.replace(QLatin1String("%UP-IMG%"), qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_FileDialogToParent).pixmap(22)));
sPage.replace("%UP-DIR-TEXT%", tr("Up to higher level directory")); sPage.replace(QLatin1String("%UP-DIR-TEXT%"), tr("Up to higher level directory"));
sPage.replace("%SHOW-HIDDEN-TEXT%", tr("Show hidden files")); sPage.replace(QLatin1String("%SHOW-HIDDEN-TEXT%"), tr("Show hidden files"));
sPage.replace("%NAME%", tr("Name")); sPage.replace(QLatin1String("%NAME%"), tr("Name"));
sPage.replace("%SIZE%", tr("Size")); sPage.replace(QLatin1String("%SIZE%"), tr("Size"));
sPage.replace("%MODIFIED%", tr("Last modified")); sPage.replace(QLatin1String("%MODIFIED%"), tr("Last modified"));
sPage = qz_applyDirectionToPage(sPage); sPage = qz_applyDirectionToPage(sPage);
} }
QString page = 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 upDirDisplay = QLatin1String("none");
QString showHiddenDisplay = "none"; QString showHiddenDisplay = QLatin1String("none");
QString tBody; QString tBody;
if (!dir.isRoot()) { if (!dir.isRoot()) {
QDir upDir = dir; QDir upDir = dir;
upDir.cdUp(); upDir.cdUp();
upDirDisplay = "inline"; upDirDisplay = QLatin1String("inline");
page.replace("%UP-DIR-LINK%", QUrl::fromLocalFile(upDir.absolutePath()).toEncoded()); page.replace(QLatin1String("%UP-DIR-LINK%"), QUrl::fromLocalFile(upDir.absolutePath()).toEncoded());
} }
foreach(const QFileInfo & info, list) { foreach(const QFileInfo & info, list) {
if (info.fileName() == "." || info.fileName() == "..") { if (info.fileName() == QLatin1String(".") || info.fileName() == QLatin1String("..")) {
continue; continue;
} }
QString line = "<tr"; QString line = QLatin1String("<tr");
if (info.isHidden()) { if (info.isHidden()) {
showHiddenDisplay = "inline"; showHiddenDisplay = "inline";
line += " class=\"tr-hidden\""; 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 += qz_pixmapToByteArray(QFileIconProvider().icon(info).pixmap(16));
line += ");\">"; line += QLatin1String(");\">");
line += "<a href=\""; line += QLatin1String("<a href=\"");
line += QUrl::fromLocalFile(info.absoluteFilePath()).toEncoded(); line += QUrl::fromLocalFile(info.absoluteFilePath()).toEncoded();
line += "\">"; line += QLatin1String("\">");
line += info.fileName(); 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 += info.isDir() ? QString() : qz_fileSizeToString(info.size());
line += "</td><td>"; line += QLatin1String("</td><td>");
line += info.lastModified().toString("dd.MM.yyyy"); line += info.lastModified().toString("dd.MM.yyyy");
line += "</td><td>"; line += QLatin1String("</td><td>");
line += info.lastModified().toString("hh:mm:ss"); line += info.lastModified().toString("hh:mm:ss");
line += "</td></tr>\n"; line += QLatin1String("</td></tr>\n");
tBody.append(line); tBody.append(line);
} }
@ -202,9 +202,9 @@ QString FileSchemeReply::loadDirectory()
tBody = QString("<tr><td colspan='4'>%1</td></tr>").arg(tr("Folder is empty.")); tBody = QString("<tr><td colspan='4'>%1</td></tr>").arg(tr("Folder is empty."));
} }
page.replace("%T-BODY%", tBody); page.replace(QLatin1String("%T-BODY%"), tBody);
page.replace("%UP-DIR-DISPLAY%", upDirDisplay); page.replace(QLatin1String("%UP-DIR-DISPLAY%"), upDirDisplay);
page.replace("%SHOW-HIDDEN-DISPLAY%", showHiddenDisplay); page.replace(QLatin1String("%SHOW-HIDDEN-DISPLAY%"), showHiddenDisplay);
return page; return page;
} }

View File

@ -82,22 +82,22 @@ void QupZillaSchemeReply::loadPage()
QTextStream stream(&m_buffer); QTextStream stream(&m_buffer);
stream.setCodec("UTF-8"); stream.setCodec("UTF-8");
if (m_pageName == "about") { if (m_pageName == QLatin1String("about")) {
stream << aboutPage(); stream << aboutPage();
} }
else if (m_pageName == "reportbug") { else if (m_pageName == QLatin1String("reportbug")) {
stream << reportbugPage(); stream << reportbugPage();
} }
else if (m_pageName == "start") { else if (m_pageName == QLatin1String("start")) {
stream << startPage(); stream << startPage();
} }
else if (m_pageName == "speeddial") { else if (m_pageName == QLatin1String("speeddial")) {
stream << speeddialPage(); stream << speeddialPage();
} }
else if (m_pageName == "config") { else if (m_pageName == QLatin1String("config")) {
stream << configPage(); stream << configPage();
} }
else if (m_pageName == "restore") { else if (m_pageName == QLatin1String("restore")) {
stream << restorePage(); stream << restorePage();
} }
@ -140,19 +140,19 @@ QString QupZillaSchemeReply::reportbugPage()
} }
bPage.append(qz_readAllFileContents(":html/reportbug.html")); bPage.append(qz_readAllFileContents(":html/reportbug.html"));
bPage.replace("%FAVICON%", "qrc:icons/qupzilla.png"); bPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
bPage.replace("%BOX-BORDER%", "qrc:html/box-border.png"); bPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
bPage.replace("%TITLE%", tr("Report Issue")); bPage.replace(QLatin1String("%TITLE%"), tr("Report Issue"));
bPage.replace("%REPORT-ISSUE%", tr("Report Issue")); bPage.replace(QLatin1String("%REPORT-ISSUE%"), tr("Report Issue"));
bPage.replace("%PLUGINS-TEXT%", tr("If you are experiencing problems with QupZilla, please try to disable" 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: ")); " 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(QLatin1String("%EMAIL%"), tr("Your E-mail"));
bPage.replace("%TYPE%", tr("Issue type")); bPage.replace(QLatin1String("%TYPE%"), tr("Issue type"));
bPage.replace("%DESCRIPTION%", tr("Issue description")); bPage.replace(QLatin1String("%DESCRIPTION%"), tr("Issue description"));
bPage.replace("%SEND%", tr("Send")); bPage.replace(QLatin1String("%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(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("%FIELDS-ARE-REQUIRED%", tr("Please fill out all required fields!")); bPage.replace(QLatin1String("%FIELDS-ARE-REQUIRED%"), tr("Please fill out all required fields!"));
bPage = qz_applyDirectionToPage(bPage); bPage = qz_applyDirectionToPage(bPage);
return bPage; return bPage;
@ -167,16 +167,16 @@ QString QupZillaSchemeReply::startPage()
} }
sPage.append(qz_readAllFileContents(":html/start.html")); sPage.append(qz_readAllFileContents(":html/start.html"));
sPage.replace("%FAVICON%", "qrc:icons/qupzilla.png"); sPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
sPage.replace("%BOX-BORDER%", "qrc:html/box-border.png"); sPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
sPage.replace("%ABOUT-IMG%", "qrc:icons/other/about.png"); sPage.replace(QLatin1String("%ABOUT-IMG%"), QLatin1String("qrc:icons/other/about.png"));
sPage.replace("%TITLE%", tr("Start Page")); sPage.replace(QLatin1String("%TITLE%"), tr("Start Page"));
sPage.replace("%BUTTON-LABEL%", tr("Search on Web")); sPage.replace(QLatin1String("%BUTTON-LABEL%"), tr("Search on Web"));
sPage.replace("%SEARCH-BY%", tr("Search results provided by DuckDuckGo")); sPage.replace(QLatin1String("%SEARCH-BY%"), tr("Search results provided by DuckDuckGo"));
sPage.replace("%WWW%", QupZilla::WIKIADDRESS); sPage.replace(QLatin1String("%WWW%"), QupZilla::WIKIADDRESS);
sPage.replace("%ABOUT-QUPZILLA%", tr("About QupZilla")); sPage.replace(QLatin1String("%ABOUT-QUPZILLA%"), tr("About QupZilla"));
sPage.replace("%PRIVATE-BROWSING%", mApp->isPrivateSession() ? tr("<h1>Private Browsing</h1>") : QString()); sPage.replace(QLatin1String("%PRIVATE-BROWSING%"), mApp->isPrivateSession() ? tr("<h1>Private Browsing</h1>") : QString());
sPage = qz_applyDirectionToPage(sPage); sPage = qz_applyDirectionToPage(sPage);
return sPage; return sPage;
@ -188,27 +188,27 @@ QString QupZillaSchemeReply::aboutPage()
if (aPage.isEmpty()) { if (aPage.isEmpty()) {
aPage.append(qz_readAllFileContents(":html/about.html")); aPage.append(qz_readAllFileContents(":html/about.html"));
aPage.replace("%FAVICON%", "qrc:icons/qupzilla.png"); aPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
aPage.replace("%BOX-BORDER%", "qrc:html/box-border.png"); aPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
aPage.replace("%ABOUT-IMG%", "qrc:icons/other/about.png"); aPage.replace(QLatin1String("%ABOUT-IMG%"), QLatin1String("qrc:icons/other/about.png"));
aPage.replace("%COPYRIGHT-INCLUDE%", Qt::escape(qz_readAllFileContents(":html/copyright"))); aPage.replace(QLatin1String("%COPYRIGHT-INCLUDE%"), Qt::escape(qz_readAllFileContents(":html/copyright")));
aPage.replace("%TITLE%", tr("About QupZilla")); aPage.replace(QLatin1String("%TITLE%"), tr("About QupZilla"));
aPage.replace("%ABOUT-QUPZILLA%", tr("About QupZilla")); aPage.replace(QLatin1String("%ABOUT-QUPZILLA%"), tr("About QupZilla"));
aPage.replace("%INFORMATIONS-ABOUT-VERSION%", tr("Information about version")); aPage.replace(QLatin1String("%INFORMATIONS-ABOUT-VERSION%"), tr("Information about version"));
aPage.replace("%COPYRIGHT%", tr("Copyright")); 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 QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"), QupZilla::VERSION
#ifdef GIT_REVISION #ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")" + " (" + GIT_REVISION + ")"
#endif #endif
) + ) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), QupZilla::WEBKITVERSION)); QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), QupZilla::WEBKITVERSION));
aPage.replace("%MAIN-DEVELOPER%", tr("Main developer")); aPage.replace(QLatin1String("%MAIN-DEVELOPER%"), tr("Main developer"));
aPage.replace("%MAIN-DEVELOPER-TEXT%", authorString(QupZilla::AUTHOR.toUtf8(), "nowrep@gmail.com")); aPage.replace(QLatin1String("%MAIN-DEVELOPER-TEXT%"), authorString(QupZilla::AUTHOR.toUtf8(), "nowrep@gmail.com"));
aPage.replace("%CONTRIBUTORS%", tr("Contributors")); aPage.replace(QLatin1String("%CONTRIBUTORS%"), tr("Contributors"));
aPage.replace("%CONTRIBUTORS-TEXT%", aPage.replace(QLatin1String("%CONTRIBUTORS-TEXT%"),
authorString("Mladen Pejaković", "pejakm@gmail.com") + "<br/>" + authorString("Mladen Pejaković", "pejakm@gmail.com") + "<br/>" +
authorString("Alexander Samilov", "alexsamilovskih@gmail.com") + "<br/>" + authorString("Alexander Samilov", "alexsamilovskih@gmail.com") + "<br/>" +
authorString("Seyyed Razi Alavizadeh", "s.r.alavizadeh@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("Jan Rajnoha", "honza.rajny@hotmail.com") + "<br/>" +
authorString("Daniele Cocca", "jmc@chakra-project.org") authorString("Daniele Cocca", "jmc@chakra-project.org")
); );
aPage.replace("%TRANSLATORS%", tr("Translators")); aPage.replace(QLatin1String("%TRANSLATORS%"), tr("Translators"));
aPage.replace("%TRANSLATORS-TEXT%", aPage.replace(QLatin1String("%TRANSLATORS-TEXT%"),
authorString("Heimen Stoffels", "vistausss@gmail.com") + " (Dutch)<br/>" + authorString("Heimen Stoffels", "vistausss@gmail.com") + " (Dutch)<br/>" +
authorString("Peter Vacula", "pvacula1989@gmail.com") + " (Slovak)<br/>" + authorString("Peter Vacula", "pvacula1989@gmail.com") + " (Slovak)<br/>" +
authorString("Ján Ďanovský", "dagsoftware@yahoo.com") + " (Slovak)<br/>" + authorString("Ján Ďanovský", "dagsoftware@yahoo.com") + " (Slovak)<br/>" +
@ -260,53 +260,53 @@ QString QupZillaSchemeReply::speeddialPage()
if (dPage.isEmpty()) { if (dPage.isEmpty()) {
dPage.append(qz_readAllFileContents(":html/speeddial.html")); dPage.append(qz_readAllFileContents(":html/speeddial.html"));
dPage.replace("%FAVICON%", "qrc:icons/qupzilla.png"); dPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
dPage.replace("%IMG_PLUS%", "qrc:html/plus.png"); dPage.replace(QLatin1String("%IMG_PLUS%"), QLatin1String("qrc:html/plus.png"));
dPage.replace("%BOX-BORDER%", "qrc:html/box-border-small.png"); dPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border-small.png"));
dPage.replace("%IMG_CLOSE%", "qrc:html/close.png"); dPage.replace(QLatin1String("%IMG_CLOSE%"), QLatin1String("qrc:html/close.png"));
dPage.replace("%IMG_EDIT%", "qrc:html/edit.png"); dPage.replace(QLatin1String("%IMG_EDIT%"), QLatin1String("qrc:html/edit.png"));
dPage.replace("%IMG_RELOAD%", "qrc:html/reload.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(QLatin1String("%SITE-TITLE%"), tr("Speed Dial"));
dPage.replace("%ADD-TITLE%", tr("Add New Page")); dPage.replace(QLatin1String("%ADD-TITLE%"), tr("Add New Page"));
dPage.replace("%TITLE-EDIT%", tr("Edit")); dPage.replace(QLatin1String("%TITLE-EDIT%"), tr("Edit"));
dPage.replace("%TITLE-REMOVE%", tr("Remove")); dPage.replace(QLatin1String("%TITLE-REMOVE%"), tr("Remove"));
dPage.replace("%TITLE-RELOAD%", tr("Reload")); dPage.replace(QLatin1String("%TITLE-RELOAD%"), tr("Reload"));
dPage.replace("%TITLE-WARN%", tr("Are you sure to remove this speed dial?")); dPage.replace(QLatin1String("%TITLE-WARN%"), tr("Are you sure to remove this speed dial?"));
dPage.replace("%TITLE-FETCHTITLE%", tr("Load title from page")); dPage.replace(QLatin1String("%TITLE-FETCHTITLE%"), tr("Load title from page"));
dPage.replace("%JQUERY%", "qrc:html/jquery.js"); dPage.replace(QLatin1String("%URL%"), tr("Url"));
dPage.replace("%JQUERY-UI%", "qrc:html/jquery-ui.js"); dPage.replace(QLatin1String("%TITLE%"), tr("Title"));
dPage.replace("%LOADING-IMG%", "qrc:html/loading.gif"); dPage.replace(QLatin1String("%APPLY%"), tr("Apply"));
dPage.replace("%URL%", tr("Url")); dPage.replace(QLatin1String("%CLOSE%"), tr("Close"));
dPage.replace("%TITLE%", tr("Title")); dPage.replace(QLatin1String("%NEW-PAGE%"), tr("New Page"));
dPage.replace("%APPLY%", tr("Apply")); dPage.replace(QLatin1String("%SETTINGS-TITLE%"), tr("Speed Dial settings"));
dPage.replace("%CLOSE%", tr("Close")); dPage.replace(QLatin1String("%TXT_PLACEMENT%"), tr("Placement: "));
dPage.replace("%NEW-PAGE%", tr("New Page")); dPage.replace(QLatin1String("%TXT_AUTO%"), tr("Auto"));
dPage.replace("%IMG_SETTINGS%", "qrc:html/setting.png"); dPage.replace(QLatin1String("%TXT_COVER%"), tr("Cover"));
dPage.replace("%SETTINGS-TITLE%", tr("Speed Dial settings")); dPage.replace(QLatin1String("%TXT_FIT%"), tr("Fit"));
dPage.replace("%TXT_PLACEMENT%", tr("Placement: ")); dPage.replace(QLatin1String("%TXT_FWIDTH%"), tr("Fit Width"));
dPage.replace("%TXT_AUTO%", tr("Auto")); dPage.replace(QLatin1String("%TXT_FHEIGHT%"), tr("Fit Height"));
dPage.replace("%TXT_COVER%", tr("Cover")); dPage.replace(QLatin1String("%TXT_NOTE%"), tr("Use background image"));
dPage.replace("%TXT_FIT%", tr("Fit")); dPage.replace(QLatin1String("%TXT_SELECTIMAGE%"), tr("Select image"));
dPage.replace("%TXT_FWIDTH%", tr("Fit Width")); dPage.replace(QLatin1String("%TXT_NRROWS%"), tr("Maximum pages in a row:"));
dPage.replace("%TXT_FHEIGHT%", tr("Fit Height")); dPage.replace(QLatin1String("%TXT_SDSIZE%"), tr("Change size of pages:"));
dPage.replace("%TXT_NOTE%", tr("Use background image")); dPage.replace(QLatin1String("%TXT_CNTRDLS%"), tr("Center speed dials"));
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 = qz_applyDirectionToPage(dPage); dPage = qz_applyDirectionToPage(dPage);
} }
QString page = dPage; QString page = dPage;
SpeedDial* dial = mApp->plugins()->speedDial(); SpeedDial* dial = mApp->plugins()->speedDial();
page.replace("%INITIAL-SCRIPT%", dial->initialScript()); page.replace(QLatin1String("%INITIAL-SCRIPT%"), dial->initialScript());
page.replace("%IMG_BACKGROUND%", dial->backgroundImage()); page.replace(QLatin1String("%IMG_BACKGROUND%"), dial->backgroundImage());
page.replace("%B_SIZE%", dial->backgroundImageSize()); page.replace(QLatin1String("%B_SIZE%"), dial->backgroundImageSize());
page.replace("%ROW-PAGES%", QString::number(dial->pagesInRow())); page.replace(QLatin1String("%ROW-PAGES%"), QString::number(dial->pagesInRow()));
page.replace("%SD-SIZE%", QString::number(dial->sdSize())); page.replace(QLatin1String("%SD-SIZE%"), QString::number(dial->sdSize()));
page.replace("%SD-CNTR%", QString::number(dial->sdCntr())); page.replace(QLatin1String("%SD-CNTR%"), QString::number(dial->sdCntr()));
return page; return page;
} }
@ -317,16 +317,16 @@ QString QupZillaSchemeReply::restorePage()
if (rPage.isEmpty()) { if (rPage.isEmpty()) {
rPage.append(qz_readAllFileContents(":html/restore.html")); rPage.append(qz_readAllFileContents(":html/restore.html"));
rPage.replace("%FAVICON%", "qrc:icons/qupzilla.png"); rPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
rPage.replace("%BOX-BORDER%", "qrc:html/box-border.png"); rPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
rPage.replace("%IMAGE%", qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(45, 45))); rPage.replace(QLatin1String("%IMAGE%"), qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(45, 45)));
rPage.replace("%TITLE%", tr("Restore Session")); rPage.replace(QLatin1String("%TITLE%"), tr("Restore Session"));
rPage.replace("%OOPS%", tr("Oops, QupZilla crashed.")); rPage.replace(QLatin1String("%OOPS%"), tr("Oops, QupZilla crashed."));
rPage.replace("%APOLOGIZE%", tr("We apologize for this. Would you like to restore the last saved state?")); rPage.replace(QLatin1String("%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(QLatin1String("%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("%START-NEW%"), tr("Or you can start completely new session"));
rPage = qz_applyDirectionToPage(rPage); rPage = qz_applyDirectionToPage(rPage);
} }
@ -339,27 +339,27 @@ QString QupZillaSchemeReply::configPage()
if (cPage.isEmpty()) { if (cPage.isEmpty()) {
cPage.append(qz_readAllFileContents(":html/config.html")); cPage.append(qz_readAllFileContents(":html/config.html"));
cPage.replace("%FAVICON%", "qrc:icons/qupzilla.png"); cPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
cPage.replace("%BOX-BORDER%", "qrc:html/box-border.png"); cPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
cPage.replace("%ABOUT-IMG%", "qrc:icons/other/about.png"); cPage.replace(QLatin1String("%ABOUT-IMG%"), QLatin1String("qrc:icons/other/about.png"));
cPage.replace("%TITLE%", tr("Configuration Information")); cPage.replace(QLatin1String("%TITLE%"), tr("Configuration Information"));
cPage.replace("%CONFIG%", tr("Configuration Information")); cPage.replace(QLatin1String("%CONFIG%"), tr("Configuration Information"));
cPage.replace("%INFORMATIONS-ABOUT-VERSION%", tr("Information about version")); cPage.replace(QLatin1String("%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(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("%BROWSER-IDENTIFICATION%", tr("Browser Identification")); cPage.replace(QLatin1String("%BROWSER-IDENTIFICATION%"), tr("Browser Identification"));
cPage.replace("%PATHS%", tr("Paths")); cPage.replace(QLatin1String("%PATHS%"), tr("Paths"));
cPage.replace("%BUILD-CONFIG%", tr("Build Configuration")); cPage.replace(QLatin1String("%BUILD-CONFIG%"), tr("Build Configuration"));
cPage.replace("%PREFS%", tr("Preferences")); cPage.replace(QLatin1String("%PREFS%"), tr("Preferences"));
cPage.replace("%OPTION%", tr("Option")); cPage.replace(QLatin1String("%OPTION%"), tr("Option"));
cPage.replace("%VALUE%", tr("Value")); cPage.replace(QLatin1String("%VALUE%"), tr("Value"));
cPage.replace("%PLUGINS%", tr("Extensions")); cPage.replace(QLatin1String("%PLUGINS%"), tr("Extensions"));
cPage.replace("%PL-NAME%", tr("Name")); cPage.replace(QLatin1String("%PL-NAME%"), tr("Name"));
cPage.replace("%PL-VER%", tr("Version")); cPage.replace(QLatin1String("%PL-VER%"), tr("Version"));
cPage.replace("%PL-AUTH%", tr("Author")); cPage.replace(QLatin1String("%PL-AUTH%"), tr("Author"));
cPage.replace("%PL-DESC%", tr("Description")); 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 QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"), QupZilla::VERSION
#ifdef GIT_REVISION #ifdef GIT_REVISION
+ " (" + 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("Build time"), QupZilla::BUILDTIME) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), qz_buildSystem())); 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("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("Settings"), mApp->currentProfilePath() + "settings.ini") +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Saved session"), mApp->currentProfilePath() + "session.dat") + 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>"); portableBuild = tr("<b>Enabled</b>");
#endif #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("Debug build"), debugBuild) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebGL support"), webGLEnabled) + 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) + QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Windows 7 API"), w7APIEnabled) +
@ -412,7 +412,7 @@ QString QupZillaSchemeReply::configPage()
} }
QString page = cPage; 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; QString pluginsString;
const QList<Plugins::Plugin> &availablePlugins = mApp->plugins()->getAvailablePlugins(); 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.")); 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; QString allGroupsString;
QSettings* settings = Settings::globalSettings(); QSettings* settings = Settings::globalSettings();
@ -441,7 +441,7 @@ QString QupZillaSchemeReply::configPage()
switch (keyValue.type()) { switch (keyValue.type()) {
case QVariant::ByteArray: case QVariant::ByteArray:
keyString = "QByteArray"; keyString = QLatin1String("QByteArray");
break; break;
case QVariant::Point: { case QVariant::Point: {
@ -459,7 +459,7 @@ QString QupZillaSchemeReply::configPage()
} }
if (keyString.isEmpty()) { if (keyString.isEmpty()) {
keyString = "\"empty\""; keyString = QLatin1String("\"empty\"");
} }
groupString.append(QString("<tr><td>%1</td><td>%2</td></tr>").arg(key, Qt::escape(keyString))); 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); allGroupsString.append(groupString);
} }
page.replace("%PREFS-INFO%", allGroupsString); page.replace(QLatin1String("%PREFS-INFO%"), allGroupsString);
return page; return page;
} }

View File

@ -276,7 +276,7 @@ QUrl OpenSearchEngine::suggestionsUrl(const QString &searchTerm) const
{ {
if (!m_preparedSuggestionsUrl.isEmpty()) { if (!m_preparedSuggestionsUrl.isEmpty()) {
QString s = m_preparedSuggestionsUrl; QString s = m_preparedSuggestionsUrl;
s.replace("%s", searchTerm); s.replace(QLatin1String("%s"), searchTerm);
return QUrl(s); return QUrl(s);
} }
@ -502,7 +502,7 @@ void OpenSearchEngine::setSuggestionsUrl(const QString &string)
QString OpenSearchEngine::getSuggestionsUrl() QString OpenSearchEngine::getSuggestionsUrl()
{ {
return suggestionsUrl("searchstring").toString().replace("searchstring", "%s"); return suggestionsUrl("searchstring").toString().replace(QLatin1String("searchstring"), QLatin1String("%s"));
} }
QByteArray OpenSearchEngine::getSuggestionsParameters() QByteArray OpenSearchEngine::getSuggestionsParameters()

View File

@ -100,7 +100,7 @@ QUrl SearchEnginesManager::searchUrl(const Engine &engine, const QString &string
ENSURE_LOADED; ENSURE_LOADED;
QByteArray url = engine.url.toUtf8(); QByteArray url = engine.url.toUtf8();
url.replace("%s", QUrl::toPercentEncoding(string)); url.replace(QLatin1String("%s"), QUrl::toPercentEncoding(string));
return QUrl::fromEncoded(url); return QUrl::fromEncoded(url);
} }
@ -195,7 +195,7 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView
QWebElement formElement = element.parent(); QWebElement formElement = element.parent();
while (!formElement.isNull()) { while (!formElement.isNull()) {
if (formElement.tagName().toLower() == "form") { if (formElement.tagName().toLower() == QLatin1String("form")) {
break; break;
} }
@ -262,7 +262,7 @@ void SearchEnginesManager::addEngine(OpenSearchEngine* engine)
Engine en; Engine en;
en.name = engine->name(); 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()) { if (engine->image().isNull()) {
en.icon = iconForSearchEngine(engine->searchUrl(QString())); en.icon = iconForSearchEngine(engine->searchUrl(QString()));
} }

View File

@ -58,8 +58,8 @@ void PageScreen::dialogAccepted()
suggestedPath); suggestedPath);
if (!path.isEmpty()) { if (!path.isEmpty()) {
if (!path.endsWith(".png", Qt::CaseInsensitive)) { if (!path.endsWith(QLatin1String(".png"), Qt::CaseInsensitive)) {
path.append(".png"); path.append(QLatin1String(".png"));
} }
m_pageImage.save(path, "PNG"); m_pageImage.save(path, "PNG");

View File

@ -38,12 +38,12 @@ Updater::Version Updater::parseVersionFromString(const QString &string)
Version ver; Version ver;
ver.isValid = false; ver.isValid = false;
QStringList v = string.split('.'); QStringList v = string.split(QLatin1Char('.'));
if (v.count() != 3) { if (v.count() != 3) {
return ver; return ver;
} }
QStringList r = v.at(2).split('.'); QStringList r = v.at(2).split(QLatin1Char('.'));
ver.majorVersion = v.at(0).toInt(); ver.majorVersion = v.at(0).toInt();
ver.minorVersion = v.at(1).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) 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; return true;
} }
if (one.contains("b") && two.contains("rc")) { if (one.contains(QLatin1Char('b')) && two.contains(QLatin1String("rc"))) {
return false; return false;
} }
@ -74,16 +74,16 @@ bool Updater::isBiggerThan_SpecialSymbol(QString one, QString two)
return false; return false;
} }
if (one.contains('b')) { if (one.contains(QLatin1Char('b'))) {
int o = one.remove('b').toInt(); int o = one.remove(QLatin1Char('b')).toInt();
int t = two.remove('b').toInt(); int t = two.remove(QLatin1Char('b')).toInt();
return o > t; return o > t;
} }
if (one.contains("rc")) { if (one.contains(QLatin1String("rc"))) {
int o = one.remove("rc").toInt(); int o = one.remove(QLatin1String("rc")).toInt();
int t = two.remove("rc").toInt(); int t = two.remove(QLatin1String("rc")).toInt();
return o > t; return o > t;
} }
@ -108,8 +108,8 @@ void Updater::downCompleted(QNetworkReply* reply)
{ {
QString html = reply->readAll(); QString html = reply->readAll();
if (html.startsWith("Version:")) { if (html.startsWith(QLatin1String("Version:"))) {
html.remove("Version:"); html.remove(QLatin1String("Version:"));
Version current = parseVersionFromString(QupZilla::VERSION); Version current = parseVersionFromString(QupZilla::VERSION);
Version updated = parseVersionFromString(html); Version updated = parseVersionFromString(html);

View File

@ -61,7 +61,7 @@ QString UserAgentManager::userAgentForUrl(const QUrl &url) const
} }
} }
if (host.contains("google")) { if (host.contains(QLatin1String("google"))) {
return m_fakeUserAgent; return m_fakeUserAgent;
} }

View File

@ -236,7 +236,7 @@ void SpeedDial::changed(const QString &allPages)
return; return;
} }
const QStringList &entries = allPages.split("\";"); const QStringList &entries = allPages.split(QLatin1String("\";"));
m_webPages.clear(); m_webPages.clear();
foreach(const QString & entry, entries) { foreach(const QString & entry, entries) {
@ -244,7 +244,7 @@ void SpeedDial::changed(const QString &allPages)
continue; continue;
} }
const QStringList &tmp = entry.split("\"|"); const QStringList &tmp = entry.split(QLatin1String("\"|"));
if (tmp.count() != 2) { if (tmp.count() != 2) {
continue; continue;
} }
@ -365,15 +365,15 @@ void SpeedDial::thumbnailCreated(const QPixmap &pixmap)
QString SpeedDial::escapeTitle(QString title) const QString SpeedDial::escapeTitle(QString title) const
{ {
title.replace('"', "&quot;"); title.replace(QLatin1Char('"'), QLatin1String("&quot;"));
title.replace('\'', "&apos;"); title.replace(QLatin1Char('\''), QLatin1String("&apos;"));
return title; return title;
} }
QString SpeedDial::escapeUrl(QString url) const QString SpeedDial::escapeUrl(QString url) const
{ {
url.remove('"'); url.remove(QLatin1Char('"'));
url.remove('\''); url.remove(QLatin1Char('\''));
return url; return url;
} }

View File

@ -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 QString mime = mimeType.trimmed(); //Fixing bad behaviour when mimeType contains spaces
if (mime.isEmpty()) { if (mime.isEmpty()) {
if (url.toString().endsWith(".swf")) { if (url.toString().endsWith(QLatin1String(".swf"))) {
mime = "application/x-shockwave-flash"; mime = "application/x-shockwave-flash";
} }
else { else {
@ -68,7 +68,7 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons
// Click2Flash whitelist // Click2Flash whitelist
QStringList whitelist = mApp->plugins()->c2f_getWhiteList(); 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; return 0;
} }

View File

@ -41,7 +41,7 @@
QStringList AcceptLanguage::defaultLanguage() QStringList AcceptLanguage::defaultLanguage()
{ {
return QStringList(QLocale::system().name().replace("_", "-")); return QStringList(QLocale::system().name().replace(QLatin1Char('_'), QLatin1Char('-')));
} }
QByteArray AcceptLanguage::generateHeader(const QStringList &langs) QByteArray AcceptLanguage::generateHeader(const QStringList &langs)
@ -63,7 +63,7 @@ QByteArray AcceptLanguage::generateHeader(const QStringList &langs)
header.append(s); header.append(s);
} }
header.append(", *"); header.append(QLatin1String(", *"));
return header; return header;
} }
@ -80,7 +80,7 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
foreach(const QString & code, langs) { foreach(const QString & code, langs) {
QString code_ = code; QString code_ = code;
QLocale loc = QLocale(code_.replace('-', '_')); QLocale loc = QLocale(code_.replace(QLatin1Char('-'), QLatin1Char('_')));
QString label; QString label;
if (loc.language() == QLocale::C) { if (loc.language() == QLocale::C) {
@ -202,8 +202,8 @@ void AcceptLanguage::accept()
QStringList langs; QStringList langs;
for (int i = 0; i < ui->listWidget->count(); i++) { for (int i = 0; i < ui->listWidget->count(); i++) {
QString t = ui->listWidget->item(i)->text(); QString t = ui->listWidget->item(i)->text();
QString code = t.mid(t.indexOf('[') + 1); QString code = t.mid(t.indexOf(QLatin1Char('[')) + 1);
code.remove(']'); code.remove(QLatin1Char(']'));
langs.append(code); langs.append(code);
} }

View File

@ -59,7 +59,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this); 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(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(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"))); 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) { else if (m_newTabUrl == m_homepage) {
ui->newTab->setCurrentIndex(1); ui->newTab->setCurrentIndex(1);
} }
else if (m_newTabUrl == "qupzilla:speeddial") { else if (m_newTabUrl == QLatin1String("qupzilla:speeddial")) {
ui->newTab->setCurrentIndex(2); ui->newTab->setCurrentIndex(2);
} }
else { else {
@ -123,8 +123,8 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
//PROFILES //PROFILES
m_actProfileName = mApp->currentProfilePath(); m_actProfileName = mApp->currentProfilePath();
m_actProfileName = m_actProfileName.left(m_actProfileName.length() - 1); m_actProfileName = m_actProfileName.left(m_actProfileName.length() - 1);
m_actProfileName = m_actProfileName.mid(m_actProfileName.lastIndexOf("/")); m_actProfileName = m_actProfileName.mid(m_actProfileName.lastIndexOf(QLatin1Char('/')));
m_actProfileName.remove('/'); m_actProfileName.remove(QLatin1Char('/'));
ui->activeProfile->setText("<b>" + m_actProfileName + "</b>"); ui->activeProfile->setText("<b>" + m_actProfileName + "</b>");
@ -343,12 +343,12 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
QDir lanDir(mApp->TRANSLATIONSDIR); QDir lanDir(mApp->TRANSLATIONSDIR);
QStringList list = lanDir.entryList(QStringList("*.qm")); QStringList list = lanDir.entryList(QStringList("*.qm"));
foreach(const QString & name, list) { foreach(const QString & name, list) {
if (name.startsWith("qt_")) { if (name.startsWith(QLatin1String("qt_"))) {
continue; continue;
} }
QString loc = name; QString loc = name;
loc.remove(".qm"); loc.remove(QLatin1String(".qm"));
if (loc == activeLanguage) { if (loc == activeLanguage) {
continue; continue;
@ -477,9 +477,9 @@ void Preferences::chooseDownPath()
return; return;
} }
#ifdef Q_OS_WIN //QFileDialog::getExistingDirectory returns path with \ instead of / (??) #ifdef Q_OS_WIN //QFileDialog::getExistingDirectory returns path with \ instead of / (??)
userFileName.replace('\\', '/'); userFileName.replace(QLatin1Char('\\'), QLatin1Char('/'));
#endif #endif
userFileName += "/"; userFileName += QLatin1Char('/');
ui->downLoc->setText(userFileName); ui->downLoc->setText(userFileName);
} }
@ -913,7 +913,7 @@ void Preferences::saveSettings()
settings.setValue("HttpsUsername", ui->httpsProxyUsername->text()); settings.setValue("HttpsUsername", ui->httpsProxyUsername->text());
settings.setValue("HttpsPassword", ui->httpsProxyPassword->text()); settings.setValue("HttpsPassword", ui->httpsProxyPassword->text());
settings.setValue("ProxyExceptions", ui->proxyExceptions->text().split(',')); settings.setValue("ProxyExceptions", ui->proxyExceptions->text().split(QLatin1Char(',')));
settings.endGroup(); settings.endGroup();
//Profiles //Profiles

View File

@ -339,13 +339,13 @@ void RSSManager::finished()
while (!xml.atEnd()) { while (!xml.atEnd()) {
xml.readNext(); xml.readNext();
if (xml.isStartElement()) { if (xml.isStartElement()) {
if (xml.name() == "item") { if (xml.name() == QLatin1String("item")) {
linkString = xml.attributes().value("rss:about").toString(); linkString = xml.attributes().value("rss:about").toString();
} }
currentTag = xml.qualifiedName().toString(); currentTag = xml.qualifiedName().toString();
} }
else if (xml.isEndElement()) { else if (xml.isEndElement()) {
if (xml.qualifiedName() == "item") { if (xml.qualifiedName() == QLatin1String("item")) {
QTreeWidgetItem* item = new QTreeWidgetItem; QTreeWidgetItem* item = new QTreeWidgetItem;
item->setText(0, titleString); item->setText(0, titleString);
item->setIcon(0, QIcon(":/icons/other/feed.png")); item->setIcon(0, QIcon(":/icons/other/feed.png"));
@ -357,10 +357,10 @@ void RSSManager::finished()
} }
} }
else if (xml.isCharacters() && !xml.isWhitespace()) { else if (xml.isCharacters() && !xml.isWhitespace()) {
if (currentTag == "title") { if (currentTag == QLatin1String("title")) {
titleString = xml.text().toString(); titleString = xml.text().toString();
} }
else if (currentTag == "link") { else if (currentTag == QLatin1String("link")) {
linkString += xml.text().toString(); linkString += xml.text().toString();
} }
} }

View File

@ -112,10 +112,10 @@ void RSSNotification::addRss()
case DesktopApplication: { case DesktopApplication: {
const RssApp &app = m_rssApps.at(index); 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()); 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()) { if (!ProcessInfo("liferea").isRunning()) {
QMessageBox::warning(this, tr("Liferea not running"), tr("Liferea must be running in order to add new feed.")); QMessageBox::warning(this, tr("Liferea not running"), tr("Liferea must be running in order to add new feed."));
success = false; success = false;

View File

@ -163,7 +163,7 @@ void BookmarksSideBar::addBookmark(const BookmarksModel::Bookmark &bookmark)
void BookmarksSideBar::removeBookmark(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); QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(bookmark.title, Qt::MatchExactly);
if (list.count() == 0) { if (list.count() == 0) {
return; return;
@ -280,10 +280,10 @@ void BookmarksSideBar::refreshTable()
QString folder = query.value(3).toString(); QString folder = query.value(3).toString();
QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(4).toByteArray())); QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(4).toByteArray()));
QTreeWidgetItem* item; QTreeWidgetItem* item;
if (folder == "bookmarksMenu") { if (folder == QLatin1String("bookmarksMenu")) {
folder = _bookmarksMenu; folder = _bookmarksMenu;
} }
if (folder == "bookmarksToolbar") { if (folder == QLatin1String("bookmarksToolbar")) {
continue; continue;
} }

View File

@ -169,7 +169,7 @@ void SideBarManager::updateActions()
void SideBarManager::showSideBar(const QString &id, bool toggle) void SideBarManager::showSideBar(const QString &id, bool toggle)
{ {
if (id == "None") { if (id == QLatin1String("None")) {
return; return;
} }
@ -189,10 +189,10 @@ void SideBarManager::showSideBar(const QString &id, bool toggle)
return; return;
} }
if (id == "Bookmarks") { if (id == QLatin1String("Bookmarks")) {
m_sideBar.data()->showBookmarks(); m_sideBar.data()->showBookmarks();
} }
else if (id == "History") { else if (id == QLatin1String("History")) {
m_sideBar.data()->showHistory(); m_sideBar.data()->showHistory();
} }
else { else {

View File

@ -39,248 +39,248 @@ QString CertificateInfoWidget::clearCertSpecialSymbols(const QString &string)
{ {
QString n = Qt::escape(string); QString n = Qt::escape(string);
if (!n.contains('\\')) { if (!n.contains(QLatin1String("\\"))) {
return n; return n;
} }
// Credits to http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/176679?help-en // Credits to http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/176679?help-en
n.replace("\\xC3\\x80", "A"); n.replace(QLatin1String("\\xC3\\x80"), QLatin1String("A"));
n.replace("\\xC3\\x81", "A"); n.replace(QLatin1String("\\xC3\\x81"), QLatin1String("A"));
n.replace("\\xC3\\x82", "A"); n.replace(QLatin1String("\\xC3\\x82"), QLatin1String("A"));
n.replace("\\xC3\\x83", "A"); n.replace(QLatin1String("\\xC3\\x83"), QLatin1String("A"));
n.replace("\\xC3\\x84", "A"); n.replace(QLatin1String("\\xC3\\x84"), QLatin1String("A"));
n.replace("\\xC3\\x85", "A"); n.replace(QLatin1String("\\xC3\\x85"), QLatin1String("A"));
n.replace("\\xC3\\x86", "AE"); n.replace(QLatin1String("\\xC3\\x86"), QLatin1String("AE"));
n.replace("\\xC3\\x87", "C"); n.replace(QLatin1String("\\xC3\\x87"), QLatin1String("C"));
n.replace("\\xC3\\x88", "E"); n.replace(QLatin1String("\\xC3\\x88"), QLatin1String("E"));
n.replace("\\xC3\\x89", "E"); n.replace(QLatin1String("\\xC3\\x89"), QLatin1String("E"));
n.replace("\\xC3\\x8A", "E"); n.replace(QLatin1String("\\xC3\\x8A"), QLatin1String("E"));
n.replace("\\xC3\\x8B", "E"); n.replace(QLatin1String("\\xC3\\x8B"), QLatin1String("E"));
n.replace("\\xC3\\x8C", "I"); n.replace(QLatin1String("\\xC3\\x8C"), QLatin1String("I"));
n.replace("\\xC3\\x8D", "I"); n.replace(QLatin1String("\\xC3\\x8D"), QLatin1String("I"));
n.replace("\\xC3\\x8E", "I"); n.replace(QLatin1String("\\xC3\\x8E"), QLatin1String("I"));
n.replace("\\xC3\\x8F", "I"); n.replace(QLatin1String("\\xC3\\x8F"), QLatin1String("I"));
n.replace("\\xC3\\x90", "D"); n.replace(QLatin1String("\\xC3\\x90"), QLatin1String("D"));
n.replace("\\xC3\\x91", "N"); n.replace(QLatin1String("\\xC3\\x91"), QLatin1String("N"));
n.replace("\\xC3\\x92", "O"); n.replace(QLatin1String("\\xC3\\x92"), QLatin1String("O"));
n.replace("\\xC3\\x93", "O"); n.replace(QLatin1String("\\xC3\\x93"), QLatin1String("O"));
n.replace("\\xC3\\x94", "O"); n.replace(QLatin1String("\\xC3\\x94"), QLatin1String("O"));
n.replace("\\xC3\\x95", "O"); n.replace(QLatin1String("\\xC3\\x95"), QLatin1String("O"));
n.replace("\\xC3\\x96", "O"); n.replace(QLatin1String("\\xC3\\x96"), QLatin1String("O"));
n.replace("\\xC3\\x98", "O"); n.replace(QLatin1String("\\xC3\\x98"), QLatin1String("O"));
n.replace("\\xC3\\x99", "U"); n.replace(QLatin1String("\\xC3\\x99"), QLatin1String("U"));
n.replace("\\xC3\\x9A", "U"); n.replace(QLatin1String("\\xC3\\x9A"), QLatin1String("U"));
n.replace("\\xC3\\x9B", "U"); n.replace(QLatin1String("\\xC3\\x9B"), QLatin1String("U"));
n.replace("\\xC3\\x9C", "U"); n.replace(QLatin1String("\\xC3\\x9C"), QLatin1String("U"));
n.replace("\\xC3\\x9D", "Y"); n.replace(QLatin1String("\\xC3\\x9D"), QLatin1String("Y"));
n.replace("\\xC3\\x9E", "P"); n.replace(QLatin1String("\\xC3\\x9E"), QLatin1String("P"));
n.replace("\\xC3\\x9F", "ss"); n.replace(QLatin1String("\\xC3\\x9F"), QLatin1String("ss"));
n.replace("\\xC9\\x99", "e"); n.replace(QLatin1String("\\xC9\\x99"), QLatin1String("e"));
n.replace("\\xC3\\xA0", "a"); n.replace(QLatin1String("\\xC3\\xA0"), QLatin1String("a"));
n.replace("\\xC3\\xA1", "a"); n.replace(QLatin1String("\\xC3\\xA1"), QLatin1String("a"));
n.replace("\\xC3\\xA2", "a"); n.replace(QLatin1String("\\xC3\\xA2"), QLatin1String("a"));
n.replace("\\xC3\\xA3", "a"); n.replace(QLatin1String("\\xC3\\xA3"), QLatin1String("a"));
n.replace("\\xC3\\xA4", "a"); n.replace(QLatin1String("\\xC3\\xA4"), QLatin1String("a"));
n.replace("\\xC3\\xA5", "a"); n.replace(QLatin1String("\\xC3\\xA5"), QLatin1String("a"));
n.replace("\\xC3\\xA6", "ae"); n.replace(QLatin1String("\\xC3\\xA6"), QLatin1String("ae"));
n.replace("\\xC3\\xA7", "c"); n.replace(QLatin1String("\\xC3\\xA7"), QLatin1String("c"));
n.replace("\\xC3\\xA8", "e"); n.replace(QLatin1String("\\xC3\\xA8"), QLatin1String("e"));
n.replace("\\xC3\\xA9", "e"); n.replace(QLatin1String("\\xC3\\xA9"), QLatin1String("e"));
n.replace("\\xC3\\xAA", "e"); n.replace(QLatin1String("\\xC3\\xAA"), QLatin1String("e"));
n.replace("\\xC3\\xAB", "e"); n.replace(QLatin1String("\\xC3\\xAB"), QLatin1String("e"));
n.replace("\\xC3\\xAC", "i"); n.replace(QLatin1String("\\xC3\\xAC"), QLatin1String("i"));
n.replace("\\xC3\\xAD", "i"); n.replace(QLatin1String("\\xC3\\xAD"), QLatin1String("i"));
n.replace("\\xC3\\xAE", "i"); n.replace(QLatin1String("\\xC3\\xAE"), QLatin1String("i"));
n.replace("\\xC3\\xAF", "i"); n.replace(QLatin1String("\\xC3\\xAF"), QLatin1String("i"));
n.replace("\\xC3\\xB0", "o"); n.replace(QLatin1String("\\xC3\\xB0"), QLatin1String("o"));
n.replace("\\xC3\\xB1", "n"); n.replace(QLatin1String("\\xC3\\xB1"), QLatin1String("n"));
n.replace("\\xC3\\xB2", "o"); n.replace(QLatin1String("\\xC3\\xB2"), QLatin1String("o"));
n.replace("\\xC3\\xB3", "o"); n.replace(QLatin1String("\\xC3\\xB3"), QLatin1String("o"));
n.replace("\\xC3\\xB4", "o"); n.replace(QLatin1String("\\xC3\\xB4"), QLatin1String("o"));
n.replace("\\xC3\\xB5", "o"); n.replace(QLatin1String("\\xC3\\xB5"), QLatin1String("o"));
n.replace("\\xC3\\xB6", "o"); n.replace(QLatin1String("\\xC3\\xB6"), QLatin1String("o"));
n.replace("\\xC3\\xB8", "o"); n.replace(QLatin1String("\\xC3\\xB8"), QLatin1String("o"));
n.replace("\\xC3\\xB9", "u"); n.replace(QLatin1String("\\xC3\\xB9"), QLatin1String("u"));
n.replace("\\xC3\\xBA", "u"); n.replace(QLatin1String("\\xC3\\xBA"), QLatin1String("u"));
n.replace("\\xC3\\xBB", "u"); n.replace(QLatin1String("\\xC3\\xBB"), QLatin1String("u"));
n.replace("\\xC3\\xBC", "u"); n.replace(QLatin1String("\\xC3\\xBC"), QLatin1String("u"));
n.replace("\\xC3\\xBD", "y"); n.replace(QLatin1String("\\xC3\\xBD"), QLatin1String("y"));
n.replace("\\xC3\\xBE", "p"); n.replace(QLatin1String("\\xC3\\xBE"), QLatin1String("p"));
n.replace("\\xC3\\xBF", "y"); n.replace(QLatin1String("\\xC3\\xBF"), QLatin1String("y"));
n.replace("\\xC7\\xBF", "o"); n.replace(QLatin1String("\\xC7\\xBF"), QLatin1String("o"));
n.replace("\\xC4\\x80", "A"); n.replace(QLatin1String("\\xC4\\x80"), QLatin1String("A"));
n.replace("\\xC4\\x81", "a"); n.replace(QLatin1String("\\xC4\\x81"), QLatin1String("a"));
n.replace("\\xC4\\x82", "A"); n.replace(QLatin1String("\\xC4\\x82"), QLatin1String("A"));
n.replace("\\xC4\\x83", "a"); n.replace(QLatin1String("\\xC4\\x83"), QLatin1String("a"));
n.replace("\\xC4\\x84", "A"); n.replace(QLatin1String("\\xC4\\x84"), QLatin1String("A"));
n.replace("\\xC4\\x85", "a"); n.replace(QLatin1String("\\xC4\\x85"), QLatin1String("a"));
n.replace("\\xC4\\x86", "C"); n.replace(QLatin1String("\\xC4\\x86"), QLatin1String("C"));
n.replace("\\xC4\\x87", "c"); n.replace(QLatin1String("\\xC4\\x87"), QLatin1String("c"));
n.replace("\\xC4\\x88", "C"); n.replace(QLatin1String("\\xC4\\x88"), QLatin1String("C"));
n.replace("\\xC4\\x89", "c"); n.replace(QLatin1String("\\xC4\\x89"), QLatin1String("c"));
n.replace("\\xC4\\x8A", "C"); n.replace(QLatin1String("\\xC4\\x8A"), QLatin1String("C"));
n.replace("\\xC4\\x8B", "c"); n.replace(QLatin1String("\\xC4\\x8B"), QLatin1String("c"));
n.replace("\\xC4\\x8C", "C"); n.replace(QLatin1String("\\xC4\\x8C"), QLatin1String("C"));
n.replace("\\xC4\\x8D", "c"); n.replace(QLatin1String("\\xC4\\x8D"), QLatin1String("c"));
n.replace("\\xC4\\x8E", "D"); n.replace(QLatin1String("\\xC4\\x8E"), QLatin1String("D"));
n.replace("\\xC4\\x8F", "d"); n.replace(QLatin1String("\\xC4\\x8F"), QLatin1String("d"));
n.replace("\\xC4\\x90", "D"); n.replace(QLatin1String("\\xC4\\x90"), QLatin1String("D"));
n.replace("\\xC4\\x91", "d"); n.replace(QLatin1String("\\xC4\\x91"), QLatin1String("d"));
n.replace("\\xC4\\x92", "E"); n.replace(QLatin1String("\\xC4\\x92"), QLatin1String("E"));
n.replace("\\xC4\\x93", "e"); n.replace(QLatin1String("\\xC4\\x93"), QLatin1String("e"));
n.replace("\\xC4\\x94", "E"); n.replace(QLatin1String("\\xC4\\x94"), QLatin1String("E"));
n.replace("\\xC4\\x95", "e"); n.replace(QLatin1String("\\xC4\\x95"), QLatin1String("e"));
n.replace("\\xC4\\x96", "E"); n.replace(QLatin1String("\\xC4\\x96"), QLatin1String("E"));
n.replace("\\xC4\\x97", "e"); n.replace(QLatin1String("\\xC4\\x97"), QLatin1String("e"));
n.replace("\\xC4\\x98", "E"); n.replace(QLatin1String("\\xC4\\x98"), QLatin1String("E"));
n.replace("\\xC4\\x99", "e"); n.replace(QLatin1String("\\xC4\\x99"), QLatin1String("e"));
n.replace("\\xC4\\x9A", "E"); n.replace(QLatin1String("\\xC4\\x9A"), QLatin1String("E"));
n.replace("\\xC4\\x9B", "e"); n.replace(QLatin1String("\\xC4\\x9B"), QLatin1String("e"));
n.replace("\\xC4\\x9C", "G"); n.replace(QLatin1String("\\xC4\\x9C"), QLatin1String("G"));
n.replace("\\xC4\\x9D", "g"); n.replace(QLatin1String("\\xC4\\x9D"), QLatin1String("g"));
n.replace("\\xC4\\x9E", "G"); n.replace(QLatin1String("\\xC4\\x9E"), QLatin1String("G"));
n.replace("\\xC4\\x9F", "g"); n.replace(QLatin1String("\\xC4\\x9F"), QLatin1String("g"));
n.replace("\\xC4\\xA0", "G"); n.replace(QLatin1String("\\xC4\\xA0"), QLatin1String("G"));
n.replace("\\xC4\\xA1", "g"); n.replace(QLatin1String("\\xC4\\xA1"), QLatin1String("g"));
n.replace("\\xC4\\xA2", "G"); n.replace(QLatin1String("\\xC4\\xA2"), QLatin1String("G"));
n.replace("\\xC4\\xA3", "g"); n.replace(QLatin1String("\\xC4\\xA3"), QLatin1String("g"));
n.replace("\\xC4\\xA4", "H"); n.replace(QLatin1String("\\xC4\\xA4"), QLatin1String("H"));
n.replace("\\xC4\\xA5", "h"); n.replace(QLatin1String("\\xC4\\xA5"), QLatin1String("h"));
n.replace("\\xC4\\xA6", "H"); n.replace(QLatin1String("\\xC4\\xA6"), QLatin1String("H"));
n.replace("\\xC4\\xA7", "h"); n.replace(QLatin1String("\\xC4\\xA7"), QLatin1String("h"));
n.replace("\\xC4\\xA8", "I"); n.replace(QLatin1String("\\xC4\\xA8"), QLatin1String("I"));
n.replace("\\xC4\\xA9", "i"); n.replace(QLatin1String("\\xC4\\xA9"), QLatin1String("i"));
n.replace("\\xC4\\xAA", "I"); n.replace(QLatin1String("\\xC4\\xAA"), QLatin1String("I"));
n.replace("\\xC4\\xAB", "i"); n.replace(QLatin1String("\\xC4\\xAB"), QLatin1String("i"));
n.replace("\\xC4\\xAC", "I"); n.replace(QLatin1String("\\xC4\\xAC"), QLatin1String("I"));
n.replace("\\xC4\\xAD", "i"); n.replace(QLatin1String("\\xC4\\xAD"), QLatin1String("i"));
n.replace("\\xC4\\xAE", "I"); n.replace(QLatin1String("\\xC4\\xAE"), QLatin1String("I"));
n.replace("\\xC4\\xAF", "i"); n.replace(QLatin1String("\\xC4\\xAF"), QLatin1String("i"));
n.replace("\\xC4\\xB0", "I"); n.replace(QLatin1String("\\xC4\\xB0"), QLatin1String("I"));
n.replace("\\xC4\\xB1", "i"); n.replace(QLatin1String("\\xC4\\xB1"), QLatin1String("i"));
n.replace("\\xC4\\xB2", "IJ"); n.replace(QLatin1String("\\xC4\\xB2"), QLatin1String("IJ"));
n.replace("\\xC4\\xB3", "ij"); n.replace(QLatin1String("\\xC4\\xB3"), QLatin1String("ij"));
n.replace("\\xC4\\xB4", "J"); n.replace(QLatin1String("\\xC4\\xB4"), QLatin1String("J"));
n.replace("\\xC4\\xB5", "j"); n.replace(QLatin1String("\\xC4\\xB5"), QLatin1String("j"));
n.replace("\\xC4\\xB6", "K"); n.replace(QLatin1String("\\xC4\\xB6"), QLatin1String("K"));
n.replace("\\xC4\\xB7", "k"); n.replace(QLatin1String("\\xC4\\xB7"), QLatin1String("k"));
n.replace("\\xC4\\xB8", "k"); n.replace(QLatin1String("\\xC4\\xB8"), QLatin1String("k"));
n.replace("\\xC4\\xB9", "L"); n.replace(QLatin1String("\\xC4\\xB9"), QLatin1String("L"));
n.replace("\\xC4\\xBA", "l"); n.replace(QLatin1String("\\xC4\\xBA"), QLatin1String("l"));
n.replace("\\xC4\\xBB", "L"); n.replace(QLatin1String("\\xC4\\xBB"), QLatin1String("L"));
n.replace("\\xC4\\xBC", "l"); n.replace(QLatin1String("\\xC4\\xBC"), QLatin1String("l"));
n.replace("\\xC4\\xBD", "L"); n.replace(QLatin1String("\\xC4\\xBD"), QLatin1String("L"));
n.replace("\\xC4\\xBE", "l"); n.replace(QLatin1String("\\xC4\\xBE"), QLatin1String("l"));
n.replace("\\xC4\\xBF", "L"); n.replace(QLatin1String("\\xC4\\xBF"), QLatin1String("L"));
n.replace("\\xC5\\x80", "l"); n.replace(QLatin1String("\\xC5\\x80"), QLatin1String("l"));
n.replace("\\xC5\\x81", "L"); n.replace(QLatin1String("\\xC5\\x81"), QLatin1String("L"));
n.replace("\\xC5\\x82", "l"); n.replace(QLatin1String("\\xC5\\x82"), QLatin1String("l"));
n.replace("\\xC5\\x83", "N"); n.replace(QLatin1String("\\xC5\\x83"), QLatin1String("N"));
n.replace("\\xC5\\x84", "n"); n.replace(QLatin1String("\\xC5\\x84"), QLatin1String("n"));
n.replace("\\xC5\\x85", "N"); n.replace(QLatin1String("\\xC5\\x85"), QLatin1String("N"));
n.replace("\\xC5\\x86", "n"); n.replace(QLatin1String("\\xC5\\x86"), QLatin1String("n"));
n.replace("\\xC5\\x87", "N"); n.replace(QLatin1String("\\xC5\\x87"), QLatin1String("N"));
n.replace("\\xC5\\x88", "n"); n.replace(QLatin1String("\\xC5\\x88"), QLatin1String("n"));
n.replace("\\xC5\\x89", "n"); n.replace(QLatin1String("\\xC5\\x89"), QLatin1String("n"));
n.replace("\\xC5\\x8A", "N"); n.replace(QLatin1String("\\xC5\\x8A"), QLatin1String("N"));
n.replace("\\xC5\\x8B", "n"); n.replace(QLatin1String("\\xC5\\x8B"), QLatin1String("n"));
n.replace("\\xC5\\x8C", "O"); n.replace(QLatin1String("\\xC5\\x8C"), QLatin1String("O"));
n.replace("\\xC5\\x8D", "o"); n.replace(QLatin1String("\\xC5\\x8D"), QLatin1String("o"));
n.replace("\\xC5\\x8E", "O"); n.replace(QLatin1String("\\xC5\\x8E"), QLatin1String("O"));
n.replace("\\xC5\\x8F", "o"); n.replace(QLatin1String("\\xC5\\x8F"), QLatin1String("o"));
n.replace("\\xC5\\x90", "O"); n.replace(QLatin1String("\\xC5\\x90"), QLatin1String("O"));
n.replace("\\xC5\\x91", "o"); n.replace(QLatin1String("\\xC5\\x91"), QLatin1String("o"));
n.replace("\\xC5\\x92", "CE"); n.replace(QLatin1String("\\xC5\\x92"), QLatin1String("CE"));
n.replace("\\xC5\\x93", "ce"); n.replace(QLatin1String("\\xC5\\x93"), QLatin1String("ce"));
n.replace("\\xC5\\x94", "R"); n.replace(QLatin1String("\\xC5\\x94"), QLatin1String("R"));
n.replace("\\xC5\\x95", "r"); n.replace(QLatin1String("\\xC5\\x95"), QLatin1String("r"));
n.replace("\\xC5\\x96", "R"); n.replace(QLatin1String("\\xC5\\x96"), QLatin1String("R"));
n.replace("\\xC5\\x97", "r"); n.replace(QLatin1String("\\xC5\\x97"), QLatin1String("r"));
n.replace("\\xC5\\x98", "R"); n.replace(QLatin1String("\\xC5\\x98"), QLatin1String("R"));
n.replace("\\xC5\\x99", "r"); n.replace(QLatin1String("\\xC5\\x99"), QLatin1String("r"));
n.replace("\\xC5\\x9A", "S"); n.replace(QLatin1String("\\xC5\\x9A"), QLatin1String("S"));
n.replace("\\xC5\\x9B", "s"); n.replace(QLatin1String("\\xC5\\x9B"), QLatin1String("s"));
n.replace("\\xC5\\x9C", "S"); n.replace(QLatin1String("\\xC5\\x9C"), QLatin1String("S"));
n.replace("\\xC5\\x9D", "s"); n.replace(QLatin1String("\\xC5\\x9D"), QLatin1String("s"));
n.replace("\\xC5\\x9E", "S"); n.replace(QLatin1String("\\xC5\\x9E"), QLatin1String("S"));
n.replace("\\xC5\\x9F", "s"); n.replace(QLatin1String("\\xC5\\x9F"), QLatin1String("s"));
n.replace("\\xC5\\xA0", "S"); n.replace(QLatin1String("\\xC5\\xA0"), QLatin1String("S"));
n.replace("\\xC5\\xA1", "s"); n.replace(QLatin1String("\\xC5\\xA1"), QLatin1String("s"));
n.replace("\\xC5\\xA2", "T"); n.replace(QLatin1String("\\xC5\\xA2"), QLatin1String("T"));
n.replace("\\xC5\\xA3", "t"); n.replace(QLatin1String("\\xC5\\xA3"), QLatin1String("t"));
n.replace("\\xC5\\xA4", "T"); n.replace(QLatin1String("\\xC5\\xA4"), QLatin1String("T"));
n.replace("\\xC5\\xA5", "t"); n.replace(QLatin1String("\\xC5\\xA5"), QLatin1String("t"));
n.replace("\\xC5\\xA6", "T"); n.replace(QLatin1String("\\xC5\\xA6"), QLatin1String("T"));
n.replace("\\xC5\\xA7", "t"); n.replace(QLatin1String("\\xC5\\xA7"), QLatin1String("t"));
n.replace("\\xC5\\xA8", "U"); n.replace(QLatin1String("\\xC5\\xA8"), QLatin1String("U"));
n.replace("\\xC5\\xA9", "u"); n.replace(QLatin1String("\\xC5\\xA9"), QLatin1String("u"));
n.replace("\\xC5\\xAA", "U"); n.replace(QLatin1String("\\xC5\\xAA"), QLatin1String("U"));
n.replace("\\xC5\\xAB", "u"); n.replace(QLatin1String("\\xC5\\xAB"), QLatin1String("u"));
n.replace("\\xC5\\xAC", "U"); n.replace(QLatin1String("\\xC5\\xAC"), QLatin1String("U"));
n.replace("\\xC5\\xAD", "u"); n.replace(QLatin1String("\\xC5\\xAD"), QLatin1String("u"));
n.replace("\\xC5\\xAE", "U"); n.replace(QLatin1String("\\xC5\\xAE"), QLatin1String("U"));
n.replace("\\xC5\\xAF", "u"); n.replace(QLatin1String("\\xC5\\xAF"), QLatin1String("u"));
n.replace("\\xC5\\xB0", "U"); n.replace(QLatin1String("\\xC5\\xB0"), QLatin1String("U"));
n.replace("\\xC5\\xB1", "u"); n.replace(QLatin1String("\\xC5\\xB1"), QLatin1String("u"));
n.replace("\\xC5\\xB2", "U"); n.replace(QLatin1String("\\xC5\\xB2"), QLatin1String("U"));
n.replace("\\xC5\\xB3", "u"); n.replace(QLatin1String("\\xC5\\xB3"), QLatin1String("u"));
n.replace("\\xC5\\xB4", "W"); n.replace(QLatin1String("\\xC5\\xB4"), QLatin1String("W"));
n.replace("\\xC5\\xB5", "w"); n.replace(QLatin1String("\\xC5\\xB5"), QLatin1String("w"));
n.replace("\\xC5\\xB6", "Y"); n.replace(QLatin1String("\\xC5\\xB6"), QLatin1String("Y"));
n.replace("\\xC5\\xB7", "y"); n.replace(QLatin1String("\\xC5\\xB7"), QLatin1String("y"));
n.replace("\\xC5\\xB8", "Y"); n.replace(QLatin1String("\\xC5\\xB8"), QLatin1String("Y"));
n.replace("\\xC5\\xB9", "Z"); n.replace(QLatin1String("\\xC5\\xB9"), QLatin1String("Z"));
n.replace("\\xC5\\xBA", "z"); n.replace(QLatin1String("\\xC5\\xBA"), QLatin1String("z"));
n.replace("\\xC5\\xBB", "Z"); n.replace(QLatin1String("\\xC5\\xBB"), QLatin1String("Z"));
n.replace("\\xC5\\xBC", "z"); n.replace(QLatin1String("\\xC5\\xBC"), QLatin1String("z"));
n.replace("\\xC5\\xBD", "Z"); n.replace(QLatin1String("\\xC5\\xBD"), QLatin1String("Z"));
n.replace("\\xC5\\xBE", "z"); n.replace(QLatin1String("\\xC5\\xBE"), QLatin1String("z"));
n.replace("\\xC6\\x8F", "E"); n.replace(QLatin1String("\\xC6\\x8F"), QLatin1String("E"));
n.replace("\\xC6\\xA0", "O"); n.replace(QLatin1String("\\xC6\\xA0"), QLatin1String("O"));
n.replace("\\xC6\\xA1", "o"); n.replace(QLatin1String("\\xC6\\xA1"), QLatin1String("o"));
n.replace("\\xC6\\xAF", "U"); n.replace(QLatin1String("\\xC6\\xAF"), QLatin1String("U"));
n.replace("\\xC6\\xB0", "u"); n.replace(QLatin1String("\\xC6\\xB0"), QLatin1String("u"));
n.replace("\\xC7\\x8D", "A"); n.replace(QLatin1String("\\xC7\\x8D"), QLatin1String("A"));
n.replace("\\xC7\\x8E", "a"); n.replace(QLatin1String("\\xC7\\x8E"), QLatin1String("a"));
n.replace("\\xC7\\x8F", "I"); n.replace(QLatin1String("\\xC7\\x8F"), QLatin1String("I"));
n.replace("\\xC7\\x93", "U"); n.replace(QLatin1String("\\xC7\\x93"), QLatin1String("U"));
n.replace("\\xC7\\x90", "i"); n.replace(QLatin1String("\\xC7\\x90"), QLatin1String("i"));
n.replace("\\xC7\\x91", "O"); n.replace(QLatin1String("\\xC7\\x91"), QLatin1String("O"));
n.replace("\\xC7\\x92", "o"); n.replace(QLatin1String("\\xC7\\x92"), QLatin1String("o"));
n.replace("\\xC7\\x97", "U"); n.replace(QLatin1String("\\xC7\\x97"), QLatin1String("U"));
n.replace("\\xC7\\x94", "u"); n.replace(QLatin1String("\\xC7\\x94"), QLatin1String("u"));
n.replace("\\xC7\\x95", "U"); n.replace(QLatin1String("\\xC7\\x95"), QLatin1String("U"));
n.replace("\\xC7\\x96", "u"); n.replace(QLatin1String("\\xC7\\x96"), QLatin1String("u"));
n.replace("\\xC7\\x9B", "U"); n.replace(QLatin1String("\\xC7\\x9B"), QLatin1String("U"));
n.replace("\\xC7\\x98", "u"); n.replace(QLatin1String("\\xC7\\x98"), QLatin1String("u"));
n.replace("\\xC7\\x99", "U"); n.replace(QLatin1String("\\xC7\\x99"), QLatin1String("U"));
n.replace("\\xC7\\x9A", "u"); n.replace(QLatin1String("\\xC7\\x9A"), QLatin1String("u"));
n.replace("\\xC7\\xBD", "ae"); n.replace(QLatin1String("\\xC7\\xBD"), QLatin1String("ae"));
n.replace("\\xC7\\x9C", "u"); n.replace(QLatin1String("\\xC7\\x9C"), QLatin1String("u"));
n.replace("\\xC7\\xBB", "a"); n.replace(QLatin1String("\\xC7\\xBB"), QLatin1String("a"));
n.replace("\\xC7\\xBC", "AE"); n.replace(QLatin1String("\\xC7\\xBC"), QLatin1String("AE"));
n.replace("\\xC7\\xBE", "O"); n.replace(QLatin1String("\\xC7\\xBE"), QLatin1String("O"));
n.replace("\\xC7\\xBA", "A"); n.replace(QLatin1String("\\xC7\\xBA"), QLatin1String("A"));
n.replace("\\xC2\\x82", ","); // High code comma n.replace(QLatin1String("\\xC2\\x82"), QLatin1String(",")); // High code comma
n.replace("\\xC2\\x84", ",,"); // High code double comma n.replace(QLatin1String("\\xC2\\x84"), QLatin1String(",,")); // High code double comma
n.replace("\\xC2\\x85", "..."); // Tripple dot n.replace(QLatin1String("\\xC2\\x85"), QLatin1String("...")); // Tripple dot
n.replace("\\xC2\\x88", "^"); // High carat n.replace(QLatin1String("\\xC2\\x88"), QLatin1String("^")); // High carat
n.replace("\\xC2\\x91", "\\x27"); // Forward single quote n.replace(QLatin1String("\\xC2\\x91"), QLatin1String("\\x27")); // Forward single quote
n.replace("\\xC2\\x92", "\\x27"); // Reverse single quote n.replace(QLatin1String("\\xC2\\x92"), QLatin1String("\\x27")); // Reverse single quote
n.replace("\\xC2\\x93", "\\x22"); // Forward double quote n.replace(QLatin1String("\\xC2\\x93"), QLatin1String("\\x22")); // Forward double quote
n.replace("\\xC2\\x94", "\\x22"); // Reverse double quote n.replace(QLatin1String("\\xC2\\x94"), QLatin1String("\\x22")); // Reverse double quote
n.replace("\\xC2\\x96", "-"); // High hyphen n.replace(QLatin1String("\\xC2\\x96"), QLatin1String("-")); // High hyphen
n.replace("\\xC2\\x97", "--"); // Double hyphen n.replace(QLatin1String("\\xC2\\x97"), QLatin1String("--")); // Double hyphen
n.replace("\\xC2\\xA6", "|"); // Split vertical bar n.replace(QLatin1String("\\xC2\\xA6"), QLatin1String("|")); // Split vertical bar
n.replace("\\xC2\\xAB", "<<"); // Double less than n.replace(QLatin1String("\\xC2\\xAB"), QLatin1String("<<")); // Double less than
n.replace("\\xC2\\xBB", ">>"); // Double greater than n.replace(QLatin1String("\\xC2\\xBB"), QLatin1String(">>")); // Double greater than
n.replace("\\xC2\\xBC", "1/4"); // one quarter n.replace(QLatin1String("\\xC2\\xBC"), QLatin1String("1/4")); // one quarter
n.replace("\\xC2\\xBD", "1/2"); // one half n.replace(QLatin1String("\\xC2\\xBD"), QLatin1String("1/2")); // one half
n.replace("\\xC2\\xBE", "3/4"); // three quarters n.replace(QLatin1String("\\xC2\\xBE"), QLatin1String("3/4")); // three quarters
n.replace("\\xCA\\xBF", "\\x27"); // c-single quote n.replace(QLatin1String("\\xCA\\xBF"), QLatin1String("\\x27")); // c-single quote
n.replace("\\xCC\\xA8", QChar()); // modifier - under curve n.replace(QLatin1String("\\xCC\\xA8"), QString()); // modifier - under curve
n.replace("\\xCC\\xB1", QChar()); // modifier - under line n.replace(QLatin1String("\\xCC\\xB1"), QString()); // modifier - under line
return n; return n;
} }

View File

@ -140,16 +140,16 @@ QUrl qz_makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl)
if (samePart.isEmpty()) { if (samePart.isEmpty()) {
returnUrl = rUrl; returnUrl = rUrl;
} }
else if (samePart == "/") { else if (samePart == QLatin1String("/")) {
returnUrl = QUrl(rUrl.path()); returnUrl = QUrl(rUrl.path());
} }
else { else {
samePart = samePart.left(samePart.lastIndexOf("/") + 1); samePart = samePart.left(samePart.lastIndexOf(QLatin1Char('/')) + 1);
int slashCount = samePart.count("/") + 1; int slashCount = samePart.count(QLatin1Char('/')) + 1;
if (samePart.startsWith('/')) { if (samePart.startsWith(QLatin1Char('/'))) {
slashCount--; slashCount--;
} }
if (samePart.endsWith("/")) { if (samePart.endsWith(QLatin1Char('/'))) {
slashCount--; slashCount--;
} }
@ -166,14 +166,14 @@ QString qz_urlEncodeQueryString(const QUrl &url)
QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment); QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment);
if (url.hasQuery()) { if (url.hasQuery()) {
returnString += '?' + url.encodedQuery(); returnString += QLatin1Char('?') + url.encodedQuery();
} }
if (url.hasFragment()) { if (url.hasFragment()) {
returnString += '#' + url.encodedFragment(); returnString += QLatin1Char('#') + url.encodedFragment();
} }
returnString.replace(' ', "%20"); returnString.replace(QLatin1Char(' '), QLatin1String("%20"));
return returnString; return returnString;
} }
@ -188,7 +188,7 @@ QString qz_ensureUniqueFilename(const QString &name, const QString &appendFormat
int i = 1; int i = 1;
while (QFile::exists(tmpFileName)) { while (QFile::exists(tmpFileName)) {
tmpFileName = name; tmpFileName = name;
int index = tmpFileName.lastIndexOf("."); int index = tmpFileName.lastIndexOf(QLatin1Char('.'));
QString appendString = appendFormat.arg(i); QString appendString = appendFormat.arg(i);
if (index == -1) { if (index == -1) {
@ -205,16 +205,16 @@ QString qz_ensureUniqueFilename(const QString &name, const QString &appendFormat
QString qz_getFileNameFromUrl(const QUrl &url) QString qz_getFileNameFromUrl(const QUrl &url)
{ {
QString fileName = url.toString(QUrl::RemoveFragment | QUrl::RemoveQuery | QUrl::RemoveScheme | QUrl::RemovePort); QString fileName = url.toString(QUrl::RemoveFragment | QUrl::RemoveQuery | QUrl::RemoveScheme | QUrl::RemovePort);
if (fileName.indexOf('/') != -1) { if (fileName.indexOf(QLatin1Char('/')) != -1) {
int pos = fileName.lastIndexOf('/'); int pos = fileName.lastIndexOf(QLatin1Char('/'));
fileName = fileName.mid(pos); fileName = fileName.mid(pos);
fileName.remove('/'); fileName.remove(QLatin1Char('/'));
} }
fileName = qz_filterCharsFromFilename(fileName); fileName = qz_filterCharsFromFilename(fileName);
if (fileName.isEmpty()) { if (fileName.isEmpty()) {
fileName = qz_filterCharsFromFilename(url.host().replace('.', '-')); fileName = qz_filterCharsFromFilename(url.host().replace(QLatin1Char('.'), QLatin1Char('-')));
} }
return fileName; return fileName;
@ -224,15 +224,15 @@ QString qz_filterCharsFromFilename(const QString &name)
{ {
QString value = name; QString value = name;
value.replace('/', '-'); value.replace(QLatin1Char('/'), QLatin1Char('-'));
value.remove('\\'); value.remove(QLatin1Char('\\'));
value.remove(':'); value.remove(QLatin1Char(':'));
value.remove('*'); value.remove(QLatin1Char('*'));
value.remove('?'); value.remove(QLatin1Char('?'));
value.remove('"'); value.remove(QLatin1Char('"'));
value.remove('<'); value.remove(QLatin1Char('<'));
value.remove('>'); value.remove(QLatin1Char('>'));
value.remove('|'); value.remove(QLatin1Char('|'));
return value; 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 QT_QUPZILLA_EXPORT qz_applyDirectionToPage(QString &pageContents)
{ {
QString direction = "ltr"; QString direction = QLatin1String("ltr");
QString right_str = "right"; QString right_str = QLatin1String("right");
QString left_str = "left"; QString left_str = QLatin1String("left");
if (QApplication::isRightToLeft()) { if (QApplication::isRightToLeft()) {
direction = "rtl"; direction = QLatin1String("rtl");
right_str = "left"; right_str = QLatin1String("left");
left_str = "right"; left_str = QLatin1String("right");
} }
pageContents.replace("%DIRECTION%", direction); pageContents.replace(QLatin1String("%DIRECTION%"), direction);
pageContents.replace("%RIGHT_STR%", right_str); pageContents.replace(QLatin1String("%RIGHT_STR%"), right_str);
pageContents.replace("%LEFT_STR%", left_str); pageContents.replace(QLatin1String("%LEFT_STR%"), left_str);
return pageContents; return pageContents;
} }

View File

@ -57,7 +57,7 @@ void IconFetcher::pageDownloaded()
QString linkTag = rx.cap(0); QString linkTag = rx.cap(0);
pos += rx.matchedLength(); pos += rx.matchedLength();
if (linkTag.contains("rel=\"shortcut icon\"", Qt::CaseInsensitive)) { if (linkTag.contains(QLatin1String("rel=\"shortcut icon\""), Qt::CaseInsensitive)) {
shortcutIconTag = linkTag; shortcutIconTag = linkTag;
break; break;
} }

View File

@ -197,22 +197,22 @@ QIcon IconProvider::standardIcon(QStyle::StandardPixmap icon)
QIcon IconProvider::fromTheme(const QString &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")); 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")); 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")); 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")); 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")); 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")); return QIcon::fromTheme("go-previous", QIcon(":icons/faenza/go-previous.png"));
} }
else { else {

View File

@ -84,8 +84,8 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
if (!element.attribute("charset").isEmpty()) { if (!element.attribute("charset").isEmpty()) {
encoding = element.attribute("charset"); encoding = element.attribute("charset");
} }
if (content.contains("charset=")) { if (content.contains(QLatin1String("charset="))) {
encoding = content.mid(content.indexOf("charset=") + 8); encoding = content.mid(content.indexOf(QLatin1String("charset=")) + 8);
} }
if (content.isEmpty() || name.isEmpty()) { if (content.isEmpty() || name.isEmpty()) {
@ -109,13 +109,13 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
QString src = element.attribute("src"); QString src = element.attribute("src");
QString alt = element.attribute("alt"); QString alt = element.attribute("alt");
if (alt.isEmpty()) { if (alt.isEmpty()) {
if (src.indexOf('/') == -1) { if (src.indexOf(QLatin1Char('/')) == -1) {
alt = src; alt = src;
} }
else { else {
int pos = src.lastIndexOf("/"); int pos = src.lastIndexOf(QLatin1Char('/'));
alt = src.mid(pos); alt = src.mid(pos);
alt.remove('/'); alt.remove(QLatin1Char('/'));
} }
} }
if (src.isEmpty() || alt.isEmpty()) { if (src.isEmpty() || alt.isEmpty()) {
@ -251,15 +251,15 @@ void SiteInfo::showImagePreview(QTreeWidgetItem* item)
} }
QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview); QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview);
if (imageUrl.scheme() == "data") { if (imageUrl.scheme() == QLatin1String("data")) {
QByteArray encodedUrl = item->text(1).toUtf8(); QByteArray encodedUrl = item->text(1).toUtf8();
QByteArray imageData = encodedUrl.mid(encodedUrl.indexOf(',') + 1); QByteArray imageData = encodedUrl.mid(encodedUrl.indexOf(',') + 1);
m_activePixmap = qz_pixmapFromByteArray(imageData); m_activePixmap = qz_pixmapFromByteArray(imageData);
} }
else if (imageUrl.scheme() == "file") { else if (imageUrl.scheme() == QLatin1String("file")) {
m_activePixmap = QPixmap(imageUrl.toLocalFile()); 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 m_activePixmap = QPixmap(imageUrl.toString().mid(3)); // Remove qrc from url
} }
else { else {

View File

@ -80,7 +80,8 @@ void TabbedWebView::slotIconChanged()
{ {
const QString &urlScheme = url().scheme(); 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; return;
} }
@ -180,7 +181,7 @@ void TabbedWebView::setIp(const QHostInfo &info)
return; 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()) { if (isCurrent()) {
emit ipChanged(m_currentIp); emit ipChanged(m_currentIp);

View File

@ -240,10 +240,10 @@ void TabWidget::aboutToShowTabsMenu()
} }
else { else {
QString title = tab->title(); QString title = tab->title();
title.replace('&', "&&"); title.replace(QLatin1Char('&'), QLatin1String("&&"));
if (title.length() > 40) { if (title.length() > 40) {
title.truncate(40); title.truncate(40);
title += ".."; title += QLatin1String("..");
} }
action->setText(title); action->setText(title);
} }
@ -356,7 +356,7 @@ void TabWidget::closeTab(int index, bool force)
TabbedWebView* webView = webTab->view(); TabbedWebView* webView = webTab->view();
WebPage* webPage = webView->page(); 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! // Don't close restore page!
return; return;
} }
@ -509,7 +509,7 @@ void TabWidget::setTabText(int index, const QString &text)
} }
QString newtext = 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* webTab = weTab(index)) {
if (webTab->isPinned()) { if (webTab->isPinned()) {
@ -845,7 +845,7 @@ bool TabWidget::restoreState(const QList<WebTab::SavedTab> &tabs, int currentTab
void TabWidget::closeRecoveryTab() void TabWidget::closeRecoveryTab()
{ {
foreach(WebTab * tab, allTabs(false)) { foreach(WebTab * tab, allTabs(false)) {
if (tab->url() == QUrl("qupzilla:restore")) { if (tab->url().toString() == QLatin1String("qupzilla:restore")) {
closeTab(tab->tabIndex(), true); closeTab(tab->tabIndex(), true);
} }
} }

View File

@ -214,7 +214,7 @@ void WebPage::finished()
mainFrame()->setZoomFactor(mainFrame()->zoomFactor() - 1); mainFrame()->setZoomFactor(mainFrame()->zoomFactor() - 1);
} }
if (url().scheme() == "file") { if (url().scheme() == QLatin1String("file")) {
QFileInfo info(url().toLocalFile()); QFileInfo info(url().toLocalFile());
if (info.isFile()) { if (info.isFile()) {
if (!m_fileWatcher) { if (!m_fileWatcher) {
@ -255,7 +255,7 @@ void WebPage::printFrame(QWebFrame* frame)
void WebPage::addJavaScriptObject() void WebPage::addJavaScriptObject()
{ {
if (url().toString() != "qupzilla:speeddial") { if (url().toString() != QLatin1String("qupzilla:speeddial")) {
return; return;
} }
@ -275,7 +275,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
case QNetworkReply::NoError: case QNetworkReply::NoError:
if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) { if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) {
QString requestUrl = reply->request().url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery); 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 &docElement = mainFrame()->documentElement();
const QWebElement &object = docElement.findFirst(QString("object[src=\"%1\"]").arg(requestUrl)); const QWebElement &object = docElement.findFirst(QString("object[src=\"%1\"]").arg(requestUrl));
const QWebElement &embed = docElement.findFirst(QString("embed[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: { case QNetworkReply::ProtocolUnknownError: {
if (url.scheme() == "file") { if (url.scheme() == QLatin1String("file")) {
FileSchemeHandler::handleUrl(url); FileSchemeHandler::handleUrl(url);
return; return;
} }
@ -451,7 +451,7 @@ void WebPage::setSSLCertificate(const QSslCertificate &cert)
QSslCertificate WebPage::sslCertificate() QSslCertificate WebPage::sslCertificate()
{ {
if (url().scheme() == "https" && m_sslCert.isValid()) { if (url().scheme() == QLatin1String("https") && m_sslCert.isValid()) {
return m_sslCert; return m_sslCert;
} }
@ -465,7 +465,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &r
const QString &scheme = request.url().scheme(); const QString &scheme = request.url().scheme();
if (scheme == "mailto" || scheme == "ftp") { if (scheme == QLatin1String("mailto") || scheme == QLatin1String("ftp")) {
desktopServicesOpen(request.url()); desktopServicesOpen(request.url());
return false; return false;
} }
@ -510,9 +510,12 @@ QObject* WebPage::createPlugin(const QString &classid, const QUrl &url, const QS
Q_UNUSED(paramNames) Q_UNUSED(paramNames)
Q_UNUSED(paramValues) Q_UNUSED(paramValues)
if (classid == "RecoveryWidget" && mApp->restoreManager()) { if (classid == QLatin1String("RecoveryWidget") && mApp->restoreManager()) {
return new RecoveryWidget(qobject_cast<WebView*>(view()), p_QupZilla); return new RecoveryWidget(qobject_cast<WebView*>(view()), p_QupZilla);
} }
else {
mainFrame()->load(QUrl("qupzilla:start"));
}
return 0; return 0;
} }
@ -539,28 +542,27 @@ void WebPage::cleanBlockedObjects()
foreach(const AdBlockedEntry & entry, m_adBlockedEntries) { foreach(const AdBlockedEntry & entry, m_adBlockedEntries) {
const QString &urlString = entry.url.toString(); const QString &urlString = entry.url.toString();
if (urlString.endsWith(".js") || urlString.endsWith(".css")) { if (urlString.endsWith(QLatin1String(".js")) || urlString.endsWith(QLatin1String(".css"))) {
continue; continue;
} }
QString urlEnd; QString urlEnd;
int pos = urlString.lastIndexOf('/'); int pos = urlString.lastIndexOf(QLatin1Char('/'));
if (pos > 8) { if (pos > 8) {
urlEnd = urlString.mid(pos + 1); urlEnd = urlString.mid(pos + 1);
} }
if (urlString.endsWith('/')) { if (urlString.endsWith(QLatin1Char('/'))) {
urlEnd = urlString.left(urlString.size() - 1); urlEnd = urlString.left(urlString.size() - 1);
} }
QString selector("img[src$=\"" + urlEnd + "\"], iframe[src$=\"" + urlEnd + "\"]," QString selector("img[src$=\"%1\"], iframe[src$=\"%1\"],embed[src$=\"%1\"]");
"embed[src$=\"" + urlEnd + "\"]"); QWebElementCollection elements = docElement.findAll(selector.arg(urlEnd));
QWebElementCollection elements = docElement.findAll(selector);
foreach(QWebElement element, elements) { foreach(QWebElement element, elements) {
QString src = element.attribute("src"); QString src = element.attribute("src");
src.remove("../"); src.remove(QLatin1String("../"));
if (urlString.contains(src)) { if (urlString.contains(src)) {
element.setStyleProperty("display", "none"); element.setStyleProperty("display", "none");
@ -574,7 +576,7 @@ void WebPage::cleanBlockedObjects()
return; return;
} }
elementHiding.append("{display: none !important;}\n</style>"); elementHiding.append(QLatin1String("{display: none !important;}\n</style>"));
QWebElement bodyElement = docElement.findFirst("body"); QWebElement bodyElement = docElement.findFirst("body");
bodyElement.appendInside("<style type=\"text/css\">\n/* AdBlock for QupZilla */\n" + elementHiding); 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); userAgent = QWebPage::userAgentForUrl(url);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#ifdef __i386__ || __x86_64__ #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
#endif #endif
} }
@ -676,12 +678,12 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
break; break;
case QNetworkReply::ProtocolUnknownError: { case QNetworkReply::ProtocolUnknownError: {
// Sometimes exOption->url returns just "?" instead of actual url // 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); handleUnknownProtocol(unknownProtocolUrl);
return false; return false;
} }
case QNetworkReply::ContentAccessDenied: case QNetworkReply::ContentAccessDenied:
if (exOption->errorString.startsWith("AdBlock")) { if (exOption->errorString.startsWith(QLatin1String("AdBlock"))) {
if (exOption->frame != erPage->mainFrame()) { //Content in <iframe> if (exOption->frame != erPage->mainFrame()) { //Content in <iframe>
QWebElement docElement = erPage->mainFrame()->documentElement(); QWebElement docElement = erPage->mainFrame()->documentElement();
@ -699,14 +701,14 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
} }
else { //The whole page is blocked else { //The whole page is blocked
QString rule = exOption->errorString; QString rule = exOption->errorString;
rule.remove("AdBlock: "); rule.remove(QLatin1String("AdBlock: "));
QString errString = qz_readAllFileContents(":/html/adblockPage.html"); QString errString = qz_readAllFileContents(":/html/adblockPage.html");
errString.replace("%TITLE%", tr("AdBlocked Content")); errString.replace(QLatin1String("%TITLE%"), tr("AdBlocked Content"));
errString.replace("%IMAGE%", "qrc:html/adblock_big.png"); errString.replace(QLatin1String("%IMAGE%"), QLatin1String("qrc:html/adblock_big.png"));
errString.replace("%FAVICON%", "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); errString = qz_applyDirectionToPage(errString);
exReturn->baseUrl = exOption->url; exReturn->baseUrl = exOption->url;
@ -750,20 +752,20 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
QFile file(":/html/errorPage.html"); QFile file(":/html/errorPage.html");
file.open(QFile::ReadOnly); file.open(QFile::ReadOnly);
QString errString = file.readAll(); 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(QLatin1String("%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(QLatin1String("%FAVICON%"), qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(16, 16)));
errString.replace("%BOX-BORDER%", "qrc:html/box-border.png"); 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()); 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(QLatin1String("%HEADING%"), errorString);
errString.replace("%HEADING2%", heading2); errString.replace(QLatin1String("%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(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("%LI-2%", tr("If you are unable to load any pages, check your computer's network connection.")); errString.replace(QLatin1String("%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(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("%TRY-AGAIN%", tr("Try Again")); errString.replace(QLatin1String("%TRY-AGAIN%"), tr("Try Again"));
errString = qz_applyDirectionToPage(errString); errString = qz_applyDirectionToPage(errString);
exReturn->content = QString(errString + "<span id=\"qupzilla-error-page\"></span>").toUtf8(); exReturn->content = QString(errString + "<span id=\"qupzilla-error-page\"></span>").toUtf8();

View File

@ -69,11 +69,11 @@ WebView::WebView(QWidget* parent)
QIcon WebView::icon() const QIcon WebView::icon() const
{ {
if (url().scheme() == "qupzilla") { if (url().scheme() == QLatin1String("qupzilla")) {
return QIcon(":icons/qupzilla.png"); return QIcon(":icons/qupzilla.png");
} }
if (url().scheme() == "file") { if (url().scheme() == QLatin1String("file")) {
return qIconProvider->standardIcon(QStyle::SP_DriveHDIcon); return qIconProvider->standardIcon(QStyle::SP_DriveHDIcon);
} }
@ -96,7 +96,7 @@ QString WebView::title() const
title = url().toString(QUrl::RemoveFragment); title = url().toString(QUrl::RemoveFragment);
} }
if (title.isEmpty() || title == "about:blank") { if (title.isEmpty() || title == QLatin1String("about:blank")) {
return tr("No Named Page"); return tr("No Named Page");
} }
@ -111,7 +111,7 @@ QUrl WebView::url() const
returnUrl = m_aboutToLoadUrl; returnUrl = m_aboutToLoadUrl;
} }
if (returnUrl.toString() == "about:blank") { if (returnUrl.toString() == QLatin1String("about:blank")) {
returnUrl = QUrl(); returnUrl = QUrl();
} }
@ -148,7 +148,7 @@ void WebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operat
{ {
const QUrl &reqUrl = request.url(); const QUrl &reqUrl = request.url();
if (reqUrl.scheme() == "javascript") { if (reqUrl.scheme() == QLatin1String("javascript")) {
// Getting scriptSource from PercentEncoding to properly load bookmarklets // Getting scriptSource from PercentEncoding to properly load bookmarklets
QString scriptSource = QUrl::fromPercentEncoding(reqUrl.toString().mid(11).toUtf8()); QString scriptSource = QUrl::fromPercentEncoding(reqUrl.toString().mid(11).toUtf8());
page()->mainFrame()->evaluateJavaScript(scriptSource); page()->mainFrame()->evaluateJavaScript(scriptSource);
@ -193,11 +193,12 @@ void WebView::fakeLoadingProgress(int progress)
bool WebView::isUrlValid(const QUrl &url) bool WebView::isUrlValid(const QUrl &url)
{ {
const QString &urlScheme = url.scheme(); const QString &urlScheme = url.scheme();
if (urlScheme == "data" || urlScheme == "qrc" || urlScheme == "mailto") { if (urlScheme == QLatin1String("data") || urlScheme == QLatin1String("qrc") ||
urlScheme == QLatin1String("mailto")) {
return true; return true;
} }
if (urlScheme == "qupzilla" || urlScheme == "file") { if (urlScheme == QLatin1String("qupzilla") || urlScheme == QLatin1String("file")) {
return !url.path().isEmpty(); return !url.path().isEmpty();
} }
@ -379,7 +380,7 @@ void WebView::slotIconChanged()
void WebView::slotUrlChanged(const QUrl &url) void WebView::slotUrlChanged(const QUrl &url)
{ {
// Disable touch mocking on all google pages as it just makes it buggy // 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; m_disableTouchMocking = true;
} }
else { else {
@ -419,8 +420,8 @@ void WebView::savePageAs()
{ {
QNetworkRequest request(url()); QNetworkRequest request(url());
QString suggestedFileName = qz_getFileNameFromUrl(url()); QString suggestedFileName = qz_getFileNameFromUrl(url());
if (!suggestedFileName.contains('.')) { if (!suggestedFileName.contains(QLatin1Char('.'))) {
suggestedFileName.append(".html"); suggestedFileName.append(QLatin1String(".html"));
} }
DownloadManager::DownloadInfo info; DownloadManager::DownloadInfo info;
@ -640,7 +641,8 @@ QUrl WebView::lastUrl()
bool WebView::isMediaElement(const QWebElement &element) 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) void WebView::checkForForm(QMenu* menu, const QWebElement &element)
@ -648,7 +650,7 @@ void WebView::checkForForm(QMenu* menu, const QWebElement &element)
QWebElement parentElement = element.parent(); QWebElement parentElement = element.parent();
while (!parentElement.isNull()) { while (!parentElement.isNull()) {
if (parentElement.tagName().toLower() == "form") { if (parentElement.tagName().toLower() == QLatin1String("form")) {
break; break;
} }
@ -662,7 +664,7 @@ void WebView::checkForForm(QMenu* menu, const QWebElement &element)
const QString &url = parentElement.attribute("action"); const QString &url = parentElement.attribute("action");
const QString &method = parentElement.hasAttribute("method") ? parentElement.attribute("method").toUpper() : "GET"; 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())); menu->addAction(QIcon(":icons/menu/search-icon.png"), tr("Create Search Engine"), this, SLOT(createSearchEngine()));
m_clickedElement = element; m_clickedElement = element;
@ -694,7 +696,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
m_actionStop->setEnabled(isLoading()); m_actionStop->setEnabled(isLoading());
} }
if (!hitTest.linkUrl().isEmpty() && hitTest.linkUrl().scheme() != "javascript") { if (!hitTest.linkUrl().isEmpty() && hitTest.linkUrl().scheme() != QLatin1String("javascript")) {
createLinkContextMenu(menu, hitTest); createLinkContextMenu(menu, hitTest);
} }
@ -738,7 +740,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
delete pageMenu; delete pageMenu;
} }
if (hitTest.element().tagName().toLower() == "input") { if (hitTest.element().tagName().toLower() == QLatin1String("input")) {
checkForForm(menu, hitTest.element()); checkForForm(menu, hitTest.element());
} }
} }
@ -807,7 +809,7 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos)
menu->addSeparator(); menu->addSeparator();
menu->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &all"), this, SLOT(selectAll())); menu->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &all"), this, SLOT(selectAll()));
menu->addSeparator(); menu->addSeparator();
if (url().scheme() == "http" || url().scheme() == "https") { 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?")); // bool result = validateConfirm(tr("Do you want to upload this page to an online source code validator?"));
// if (result) // if (result)
menu->addAction(tr("Validate page"), this, SLOT(openUrlInSelectedTab()))->setData(QUrl("http://validator.w3.org/check?uri=" + url().toString())); 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); menu->addAction(dictact);
// #379: Remove newlines // #379: Remove newlines
QString selectedString = selectedText.trimmed().remove('\n'); QString selectedString = selectedText.trimmed().remove(QLatin1Char('\n'));
if (!selectedString.contains('.')) { if (!selectedString.contains(QLatin1Char('.'))) {
// Try to add .com // Try to add .com
selectedString.append(".com"); selectedString.append(QLatin1String(".com"));
} }
QUrl guessedUrl = QUrl::fromUserInput(selectedString); QUrl guessedUrl = QUrl::fromUserInput(selectedString);
@ -907,7 +909,7 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult
menu->addSeparator(); menu->addSeparator();
selectedText.truncate(20); selectedText.truncate(20);
// KDE is displaying new lines in menu actions ... weird -,- // 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(); SearchEngine engine = mApp->searchEnginesManager()->activeEngine();
Action* act = new Action(engine.icon, tr("Search \"%1 ..\" with %2").arg(selectedText, engine.name)); Action* act = new Action(engine.icon, tr("Search \"%1 ..\" with %2").arg(selectedText, engine.name));

View File

@ -60,7 +60,7 @@ bool AKN_Plugin::testPlugin()
{ {
// Let's be sure, require latest version of QupZilla // 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) QTranslator* AKN_Plugin::getTranslator(const QString &locale)

View File

@ -84,7 +84,7 @@ QNetworkReply* GM_Plugin::createRequest(QNetworkAccessManager::Operation op, con
if (op == QNetworkAccessManager::GetOperation && request.rawHeader("X-QupZilla-UserLoadAction") == QByteArray("1")) { if (op == QNetworkAccessManager::GetOperation && request.rawHeader("X-QupZilla-UserLoadAction") == QByteArray("1")) {
const QString &urlString = request.url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery); 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); m_manager->downloadScript(request);
return new EmptyNetworkReply; return new EmptyNetworkReply;
} }

View File

@ -160,7 +160,7 @@ void GM_Script::parseScript(const QString &filePath)
QStringList requireList; QStringList requireList;
const QStringList &lines = metadataBlock.split('\n'); const QStringList &lines = metadataBlock.split(QLatin1Char('\n'));
foreach(QString line, lines) { foreach(QString line, lines) {
if (!line.startsWith(QLatin1String("// @"))) { if (!line.startsWith(QLatin1String("// @"))) {
continue; continue;

View File

@ -92,7 +92,7 @@ void GM_UrlMatcher::parsePattern(QString pattern)
.replace(QRegExp("^\\\\\\|"), QLatin1String("^")) .replace(QRegExp("^\\\\\\|"), QLatin1String("^"))
.replace(QRegExp("\\\\\\|$"), QLatin1String("$")) .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_useRegExp = true;
m_regExp = QRegExp(pattern, Qt::CaseInsensitive); m_regExp = QRegExp(pattern, Qt::CaseInsensitive);

View File

@ -63,7 +63,7 @@ bool MouseGesturesPlugin::testPlugin()
{ {
// Let's be sure, require latest version of QupZilla // 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) QTranslator* MouseGesturesPlugin::getTranslator(const QString &locale)

View File

@ -172,7 +172,7 @@ void PIM_Handler::pimInsert()
} }
QString info = action->data().toString(); 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)); m_element.evaluateJavaScript(QString("var newVal = this.value.substring(0, this.selectionStart) + \"%1\" + this.value.substring(this.selectionEnd); this.value = newVal;").arg(info));
} }

View File

@ -64,7 +64,7 @@ bool PIM_Plugin::testPlugin()
{ {
// Let's be sure, require latest version of QupZilla // 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) QTranslator* PIM_Plugin::getTranslator(const QString &locale)

View File

@ -89,7 +89,7 @@ bool TestPlugin::testPlugin()
//There should be some testing if plugin is loaded correctly //There should be some testing if plugin is loaded correctly
//If this function returns false, plugin is automatically unloaded //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) QTranslator* TestPlugin::getTranslator(const QString &locale)