1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-19 10:16:34 +01:00

Add sime QLS + nullptr

This commit is contained in:
Laurent Montel 2018-07-05 13:57:41 +02:00
parent 06020d9615
commit 07b4dd4f6e
24 changed files with 224 additions and 224 deletions

View File

@ -72,9 +72,9 @@ void CookiesTest::listMatchesDomainTest_data()
QTest::addColumn<bool>("result");
QStringList list;
list << "www.example.com" << "accounts.google.com";
list << QSL("www.example.com") << QSL("accounts.google.com");
QStringList list2;
list2 << "anotherexample.com" << "a.b.x.google.com";
list2 << QSL("anotherexample.com") << QSL("a.b.x.google.com");
QTest::newRow("test1") << list << ".www.example.com" << true;
QTest::newRow("test2") << list << ".google.com" << false;

View File

@ -53,7 +53,7 @@ static bool compareEntries(const PasswordEntry &value, const PasswordEntry &ref)
PasswordBackendTest::PasswordBackendTest()
: QObject()
, m_backend(0)
, m_backend(nullptr)
{
}
@ -83,28 +83,28 @@ void PasswordBackendTest::storeTest()
/* Basic password entry */
PasswordEntry entry;
entry.host = "org.falkon.google.com";
entry.username = "user1";
entry.password = "pass1";
entry.host = QSL("org.falkon.google.com");
entry.username = QSL("user1");
entry.password = QSL("pass1");
entry.data = "entry1-data=23&username=user1&password=pass1";
m_backend->addEntry(entry);
// Check entry that may be stored in cache
PasswordEntry stored = m_backend->getEntries(QUrl("org.falkon.google.com")).constFirst();
PasswordEntry stored = m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).constFirst();
QVERIFY(compareEntries(stored, entry) == true);
reloadBackend();
// Check entry retrieved from backend engine
QVERIFY(!m_backend->getEntries(QUrl("org.falkon.google.com")).isEmpty());
stored = m_backend->getEntries(QUrl("org.falkon.google.com")).constFirst();
QVERIFY(!m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).isEmpty());
stored = m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).constFirst();
QVERIFY(compareEntries(stored, entry) == true);
/* UTF-8 password entry */
PasswordEntry entry2;
entry2.host = "org.falkon.falkon.com";
entry2.host = QSL("org.falkon.falkon.com");
entry2.username = QString::fromUtf8("+ě ++ éí§`]|~đ11 +!:");
entry2.password = QString::fromUtf8("+ěš asn~đ°#&# |€");
entry2.data = "use%C2%B6+_nam%C4%8D=%2B%C4%9B+%2B%2B+%C3%A9%C3%AD%C2%A7%60%5D%7C%7E%C4%9111+%2B%21%3A"
@ -113,28 +113,28 @@ void PasswordBackendTest::storeTest()
m_backend->addEntry(entry2);
// Check entry that may be stored in cache
PasswordEntry stored2 = m_backend->getEntries(QUrl("org.falkon.falkon.com")).constFirst();
PasswordEntry stored2 = m_backend->getEntries(QUrl(QSL("org.falkon.falkon.com"))).constFirst();
QVERIFY(compareEntries(stored2, entry2) == true);
reloadBackend();
// Check entry retrieved from backend engine
stored2 = m_backend->getEntries(QUrl("org.falkon.falkon.com")).constFirst();
stored2 = m_backend->getEntries(QUrl(QSL("org.falkon.falkon.com"))).constFirst();
QVERIFY(compareEntries(stored2, entry2) == true);
/* Cleanup */
// Local cleanup
m_backend->removeEntry(stored);
QCOMPARE(m_backend->getEntries(QUrl("org.falkon.google.com")).count(), 0);
QCOMPARE(m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).count(), 0);
m_backend->removeEntry(stored2);
QCOMPARE(m_backend->getEntries(QUrl("org.falkon.falkon.com")).count(), 0);
QCOMPARE(m_backend->getEntries(QUrl(QSL("org.falkon.falkon.com"))).count(), 0);
reloadBackend();
// Backend engine cleanup
QCOMPARE(m_backend->getEntries(QUrl("org.falkon.google.com")).count(), 0);
QCOMPARE(m_backend->getEntries(QUrl("org.falkon.falkon.com")).count(), 0);
QCOMPARE(m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).count(), 0);
QCOMPARE(m_backend->getEntries(QUrl(QSL("org.falkon.falkon.com"))).count(), 0);
}
void PasswordBackendTest::removeAllTest()
@ -142,28 +142,28 @@ void PasswordBackendTest::removeAllTest()
reloadBackend();
PasswordEntry entry;
entry.host = "org.falkon.google.com";
entry.username = "user1";
entry.password = "pass1";
entry.host = QSL("org.falkon.google.com");
entry.username = QSL("user1");
entry.password = QSL("pass1");
entry.data = "entry1-data=23&username=user1&password=pass1";
m_backend->addEntry(entry);
entry.username.append("s");
entry.username.append(QSL("s"));
m_backend->addEntry(entry);
entry.username.append("s");
entry.username.append(QSL("s"));
m_backend->addEntry(entry);
entry.username.append("s");
entry.username.append(QSL("s"));
m_backend->addEntry(entry);
entry.username.append("s");
entry.username.append(QSL("s"));
m_backend->addEntry(entry);
entry.username.append("s");
entry.username.append(QSL("s"));
m_backend->addEntry(entry);
entry.username.append("s");
entry.username.append(QSL("s"));
m_backend->addEntry(entry);
QCOMPARE(m_backend->getEntries(QUrl("org.falkon.google.com")).count(), 7);
@ -182,9 +182,9 @@ void PasswordBackendTest::updateLastUsedTest()
reloadBackend();
PasswordEntry entry;
entry.host = "org.falkon.google.com";
entry.username = "user1";
entry.password = "pass1";
entry.host = QSL("org.falkon.google.com");
entry.username = QSL("user1");
entry.password = QSL("pass1");
entry.data = "entry1-data=23&username=user1&password=pass1";
m_backend->addEntry(entry);
@ -194,17 +194,17 @@ void PasswordBackendTest::updateLastUsedTest()
sleep(1);
#endif
entry.username.append("s");
entry.username.append(QSL("s"));
m_backend->addEntry(entry);
QVERIFY(!m_backend->getEntries(QUrl("org.falkon.google.com")).isEmpty());
QVERIFY(compareEntries(entry, m_backend->getEntries(QUrl("org.falkon.google.com")).constFirst()));
QVERIFY(!m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).isEmpty());
QVERIFY(compareEntries(entry, m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).constFirst()));
reloadBackend();
QVERIFY(!m_backend->getEntries(QUrl("org.falkon.google.com")).isEmpty());
QVERIFY(compareEntries(entry, m_backend->getEntries(QUrl("org.falkon.google.com")).constFirst()));
QVERIFY(!m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).isEmpty());
QVERIFY(compareEntries(entry, m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).constFirst()));
m_backend->removeEntry(m_backend->getEntries(QUrl("org.falkon.google.com")).constFirst());
m_backend->removeEntry(m_backend->getEntries(QUrl("org.falkon.google.com")).constFirst());
m_backend->removeEntry(m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).constFirst());
m_backend->removeEntry(m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).constFirst());
QCOMPARE(m_backend->getAllEntries().count(), 0);
reloadBackend();

View File

@ -122,8 +122,8 @@ void FancyTabProxyStyle::drawControl(
p->drawText(text_rect, textFlags, text);
p->setPen(selected ? QColor(60, 60, 60) : Utils::StyleHelper::panelTextColor());
if (widget) {
const QString fader_key = "tab_" + text + "_fader";
const QString animation_key = "tab_" + text + "_animation";
const QString fader_key = QSL("tab_") + text + QSL("_fader");
const QString animation_key = QSL("tab_") + text + QSL("_animation");
const QString tab_hover = widget->property("tab_hover").toString();
int fader = widget->property(fader_key.toUtf8().constData()).toInt();
@ -174,7 +174,7 @@ void FancyTabProxyStyle::drawControl(
void FancyTabProxyStyle::polish(QWidget* widget)
{
if (QString(widget->metaObject()->className()) == QLatin1String("QTabBar")) {
if (QString::fromLatin1(widget->metaObject()->className()) == QLatin1String("QTabBar")) {
widget->setMouseTracking(true);
widget->installEventFilter(this);
}
@ -492,13 +492,13 @@ private:
FancyTabWidget::FancyTabWidget(QWidget* parent)
: QWidget(parent),
mode_(Mode_None),
tab_bar_(NULL),
tab_bar_(nullptr),
stack_(new QStackedLayout),
side_widget_(new QWidget),
side_layout_(new QVBoxLayout),
top_layout_(new QVBoxLayout),
use_background_(false),
menu_(NULL),
menu_(nullptr),
proxy_style_(new FancyTabProxyStyle)
{
side_layout_->setSpacing(0);
@ -602,7 +602,7 @@ void FancyTabWidget::SetMode(Mode mode)
{
// Remove previous tab bar
delete tab_bar_;
tab_bar_ = NULL;
tab_bar_ = nullptr;
use_background_ = false;

View File

@ -100,16 +100,16 @@ class FALKON_EXPORT FancyTabBar : public QWidget
Q_OBJECT
public:
FancyTabBar(QWidget* parent = 0);
~FancyTabBar();
explicit FancyTabBar(QWidget* parent = nullptr);
~FancyTabBar() override;
void paintEvent(QPaintEvent* event);
void paintEvent(QPaintEvent* event) override;
void paintTab(QPainter* painter, int tabIndex) const;
void mousePressEvent(QMouseEvent*);
void mousePressEvent(QMouseEvent*) override;
bool validIndex(int index) const { return index >= 0 && index < m_tabs.count(); }
QSize sizeHint() const;
QSize minimumSizeHint() const;
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
void addTab(const QIcon &icon, const QString &label);
void addSpacer(int size = 40);
@ -151,7 +151,7 @@ class FALKON_EXPORT FancyTabWidget : public QWidget
Q_PROPERTY(QPixmap bgPixmap READ bgPixmap WRITE SetBackgroundPixmap)
public:
FancyTabWidget(QWidget* parent = 0);
explicit FancyTabWidget(QWidget* parent = nullptr);
// Values are persisted - only add to the end
enum Mode {

View File

@ -85,7 +85,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
#endif
prefix = id.section(QLatin1Char('/'), -1);
}
prefix.remove(QRegExp("[^a-zA-Z]"));
prefix.remove(QRegExp(QLatin1String("[^a-zA-Z]")));
prefix.truncate(6);
QByteArray idc = id.toUtf8();
@ -163,7 +163,7 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout)
Sleep(DWORD(ms));
#else
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
nanosleep(&ts, NULL);
nanosleep(&ts, nullptr);
#endif
}
if (!connOk) {

View File

@ -62,7 +62,7 @@ void SqueezeLabelV2::contextMenuEvent(QContextMenuEvent* event)
QMenu menu;
QAction* act = menu.addAction(tr("Copy"), this, SLOT(copy()));
act->setShortcut(QKeySequence("Ctrl+C"));
act->setShortcut(QKeySequence(QSL("Ctrl+C")));
act->setEnabled(hasSelectedText());
menu.exec(event->globalPos());

View File

@ -27,7 +27,7 @@ class FALKON_EXPORT SqueezeLabelV2 : public QLabel
Q_OBJECT
public:
SqueezeLabelV2(QWidget* parent = 0);
explicit SqueezeLabelV2(QWidget* parent = nullptr);
SqueezeLabelV2(const QString &string);
QString originalText();

View File

@ -181,7 +181,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
QPainter* p, QIcon::Mode iconMode, int radius, const QColor &color, const QPoint &offset)
{
QPixmap cache;
QString pixmapName = QString("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height());
QString pixmapName = QSL("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height());
if (!QPixmapCache::find(pixmapName, cache)) {
QPixmap px = icon.pixmap(rect.size(), iconMode);

View File

@ -25,23 +25,23 @@ AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent)
{
ui->setupUi(this);
m_knownSubscriptions << Subscription("EasyList (English)", ADBLOCK_EASYLIST_URL)
<< Subscription("NoCoin List", ADBLOCK_NOCOINLIST_URL)
<< Subscription("BSI Lista Polska (Polish)", "http://www.bsi.info.pl/filtrABP.txt")
<< Subscription("Czech List (Czech)", "http://adblock.dajbych.net/adblock.txt")
<< Subscription("dutchblock (Dutch)", "http://groenewoudt.net/dutchblock/list.txt")
<< Subscription("Filtros Nauscopicos (Spanish)", "http://abp.mozilla-hispano.org/nauscopio/filtros.txt")
<< Subscription("IsraelList (Hebrew)", "http://secure.fanboy.co.nz/israelilist/IsraelList.txt")
<< Subscription("NLBlock (Dutch)", "http://www.verzijlbergh.com/adblock/nlblock.txt")
<< Subscription("Peter Lowe's list (English)", "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&mimetype=plaintext")
<< Subscription("PLgeneral (Polish)", "http://www.niecko.pl/adblock/adblock.txt")
<< Subscription("Schacks Adblock Plus liste (Danish)", "http://adblock.schack.dk/block.txt")
<< Subscription("Xfiles (Italian)", "http://mozilla.gfsolone.com/filtri.txt")
<< Subscription("EasyPrivacy (English)", "http://easylist-downloads.adblockplus.org/easyprivacy.txt")
<< Subscription("RU Adlist (Russian)", "https://easylist-downloads.adblockplus.org/advblock.txt")
<< Subscription("ABPindo (Indonesian)", "https://raw.githubusercontent.com/heradhis/indonesianadblockrules/master/subscriptions/abpindo.txt")
<< Subscription("Easylist China (Chinese)", "https://easylist-downloads.adblockplus.org/easylistchina.txt")
<< Subscription("Anti-Adblock Killer", "https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt")
m_knownSubscriptions << Subscription(QSL("EasyList (English)"), ADBLOCK_EASYLIST_URL)
<< Subscription(QSL("NoCoin List"), ADBLOCK_NOCOINLIST_URL)
<< Subscription(QSL("BSI Lista Polska (Polish)"), QSL("http://www.bsi.info.pl/filtrABP.txt"))
<< Subscription(QSL("Czech List (Czech)"), QSL("http://adblock.dajbych.net/adblock.txt"))
<< Subscription(QSL("dutchblock (Dutch)"), QSL("http://groenewoudt.net/dutchblock/list.txt"))
<< Subscription(QSL("Filtros Nauscopicos (Spanish)"), QSL("http://abp.mozilla-hispano.org/nauscopio/filtros.txt"))
<< Subscription(QSL("IsraelList (Hebrew)"), QSL("http://secure.fanboy.co.nz/israelilist/IsraelList.txt"))
<< Subscription(QSL("NLBlock (Dutch)"), QSL("http://www.verzijlbergh.com/adblock/nlblock.txt"))
<< Subscription(QSL("Peter Lowe's list (English)"), QSL("http://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&mimetype=plaintext"))
<< Subscription(QSL("PLgeneral (Polish)"), QSL("http://www.niecko.pl/adblock/adblock.txt"))
<< Subscription(QSL("Schacks Adblock Plus liste (Danish)"), QSL("http://adblock.schack.dk/block.txt"))
<< Subscription(QSL("Xfiles (Italian)"), QSL("http://mozilla.gfsolone.com/filtri.txt"))
<< Subscription(QSL("EasyPrivacy (English)"), QSL("http://easylist-downloads.adblockplus.org/easyprivacy.txt"))
<< Subscription(QSL("RU Adlist (Russian)"), QSL("https://easylist-downloads.adblockplus.org/advblock.txt"))
<< Subscription(QSL("ABPindo (Indonesian)"), QSL("https://raw.githubusercontent.com/heradhis/indonesianadblockrules/master/subscriptions/abpindo.txt"))
<< Subscription(QSL("Easylist China (Chinese)"), QSL("https://easylist-downloads.adblockplus.org/easylistchina.txt"))
<< Subscription(QSL("Anti-Adblock Killer"), QSL("https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt"))
<< Subscription(tr("Other..."), QString());
foreach (const Subscription &subscription, m_knownSubscriptions) {

View File

@ -31,8 +31,8 @@
AdBlockDialog::AdBlockDialog(QWidget* parent)
: QDialog(parent)
, m_manager(AdBlockManager::instance())
, m_currentTreeWidget(0)
, m_currentSubscription(0)
, m_currentTreeWidget(nullptr)
, m_currentSubscription(nullptr)
, m_loaded(false)
{
setAttribute(Qt::WA_DeleteOnClose);
@ -157,7 +157,7 @@ void AdBlockDialog::aboutToShowMenu()
void AdBlockDialog::learnAboutRules()
{
mApp->addNewTab(QUrl("http://adblockplus.org/en/filters"));
mApp->addNewTab(QUrl(QSL("http://adblockplus.org/en/filters")));
}
void AdBlockDialog::loadSubscriptions()

View File

@ -33,7 +33,7 @@ class FALKON_EXPORT AdBlockDialog : public QDialog, public Ui_AdBlockDialog
Q_OBJECT
public:
explicit AdBlockDialog(QWidget* parent = 0);
explicit AdBlockDialog(QWidget* parent = nullptr);
void showRule(const AdBlockRule* rule) const;

View File

@ -147,8 +147,8 @@ void AdBlockIcon::clicked(ClickController *controller)
if (!pageUrl.host().isEmpty() && manager->isEnabled() && manager->canRunOnScheme(pageUrl.scheme())) {
const QString host = view->url().host().contains(QLatin1String("www.")) ? pageUrl.host().mid(4) : pageUrl.host();
const QString hostFilter = QString("@@||%1^$document").arg(host);
const QString pageFilter = QString("@@|%1|$document").arg(pageUrl.toString());
const QString hostFilter = QSL("@@||%1^$document").arg(host);
const QString pageFilter = QSL("@@|%1|$document").arg(pageUrl.toString());
QAction* act = menu->addAction(tr("Disable on %1").arg(host));
act->setCheckable(true);

View File

@ -78,8 +78,8 @@ void AdBlockManager::setEnabled(bool enabled)
emit enabledChanged(enabled);
Settings settings;
settings.beginGroup("AdBlock");
settings.setValue("enabled", m_enabled);
settings.beginGroup(QSL("AdBlock"));
settings.setValue(QSL("enabled"), m_enabled);
settings.endGroup();
load();
@ -183,7 +183,7 @@ bool AdBlockManager::addSubscriptionFromUrl(const QUrl &url)
const QString message = AdBlockManager::tr("Do you want to add <b>%1</b> subscription?").arg(subscriptionTitle);
QMessageBox::StandardButton result = QMessageBox::question(0, AdBlockManager::tr("AdBlock Subscription"), message, QMessageBox::Yes | QMessageBox::No);
QMessageBox::StandardButton result = QMessageBox::question(nullptr, AdBlockManager::tr("AdBlock Subscription"), message, QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::Yes) {
AdBlockManager::instance()->addSubscription(subscriptionTitle, subscriptionUrl);
AdBlockManager::instance()->showDialog();
@ -195,18 +195,18 @@ bool AdBlockManager::addSubscriptionFromUrl(const QUrl &url)
AdBlockSubscription* AdBlockManager::addSubscription(const QString &title, const QString &url)
{
if (title.isEmpty() || url.isEmpty()) {
return 0;
return nullptr;
}
QString fileName = QzTools::filterCharsFromFilename(title.toLower()) + ".txt";
QString filePath = QzTools::ensureUniqueFilename(DataPaths::currentProfilePath() + "/adblock/" + fileName);
QString fileName = QzTools::filterCharsFromFilename(title.toLower()) + QSL(".txt");
QString filePath = QzTools::ensureUniqueFilename(DataPaths::currentProfilePath() + QSL("/adblock/") + fileName);
QByteArray data = QString("Title: %1\nUrl: %2\n[Adblock Plus 1.1.1]").arg(title, url).toLatin1();
QByteArray data = QSL("Title: %1\nUrl: %2\n[Adblock Plus 1.1.1]").arg(title, url).toLatin1();
QSaveFile file(filePath);
if (!file.open(QFile::WriteOnly)) {
qWarning() << "AdBlockManager: Cannot write to file" << filePath;
return 0;
return nullptr;
}
file.write(data);
file.commit();
@ -250,7 +250,7 @@ AdBlockCustomList* AdBlockManager::customList() const
}
}
return 0;
return nullptr;
}
void AdBlockManager::load()
@ -267,23 +267,23 @@ void AdBlockManager::load()
#endif
Settings settings;
settings.beginGroup("AdBlock");
m_enabled = settings.value("enabled", m_enabled).toBool();
m_disabledRules = settings.value("disabledRules", QStringList()).toStringList();
QDateTime lastUpdate = settings.value("lastUpdate", QDateTime()).toDateTime();
settings.beginGroup(QSL("AdBlock"));
m_enabled = settings.value(QSL("enabled"), m_enabled).toBool();
m_disabledRules = settings.value(QSL("disabledRules"), QStringList()).toStringList();
QDateTime lastUpdate = settings.value(QSL("lastUpdate"), QDateTime()).toDateTime();
settings.endGroup();
if (!m_enabled) {
return;
}
QDir adblockDir(DataPaths::currentProfilePath() + "/adblock");
QDir adblockDir(DataPaths::currentProfilePath() + QSL("/adblock"));
// Create if neccessary
if (!adblockDir.exists()) {
QDir(DataPaths::currentProfilePath()).mkdir("adblock");
QDir(DataPaths::currentProfilePath()).mkdir(QSL("adblock"));
}
foreach (const QString &fileName, adblockDir.entryList(QStringList("*.txt"), QDir::Files)) {
foreach (const QString &fileName, adblockDir.entryList(QStringList(QSL("*.txt")), QDir::Files)) {
if (fileName == QLatin1String("customlist.txt")) {
continue;
}
@ -371,8 +371,8 @@ void AdBlockManager::updateAllSubscriptions()
}
Settings settings;
settings.beginGroup("AdBlock");
settings.setValue("lastUpdate", QDateTime::currentDateTime());
settings.beginGroup(QSL("AdBlock"));
settings.setValue(QSL("lastUpdate"), QDateTime::currentDateTime());
settings.endGroup();
}
@ -387,9 +387,9 @@ void AdBlockManager::save()
}
Settings settings;
settings.beginGroup("AdBlock");
settings.setValue("enabled", m_enabled);
settings.setValue("disabledRules", m_disabledRules);
settings.beginGroup(QSL("AdBlock"));
settings.setValue(QSL("enabled"), m_enabled);
settings.setValue(QSL("disabledRules"), m_disabledRules);
settings.endGroup();
}
@ -433,7 +433,7 @@ AdBlockSubscription* AdBlockManager::subscriptionByName(const QString &name) con
}
}
return 0;
return nullptr;
}
AdBlockDialog *AdBlockManager::showDialog(QWidget *parent)

View File

@ -27,8 +27,8 @@
#include "qzcommon.h"
#define ADBLOCK_EASYLIST_URL "https://easylist-downloads.adblockplus.org/easylist.txt"
#define ADBLOCK_NOCOINLIST_URL "https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/nocoin.txt"
#define ADBLOCK_EASYLIST_URL QSL("https://easylist-downloads.adblockplus.org/easylist.txt")
#define ADBLOCK_NOCOINLIST_URL QSL("https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/nocoin.txt")
class AdBlockRule;
class AdBlockDialog;

View File

@ -83,7 +83,7 @@ AdBlockRule::AdBlockRule(const QString &filter, AdBlockSubscription* subscriptio
, m_isEnabled(true)
, m_isException(false)
, m_isInternalDisabled(false)
, m_regExp(0)
, m_regExp(nullptr)
{
setFilter(filter);
}
@ -186,7 +186,7 @@ void AdBlockRule::setEnabled(bool enabled)
bool AdBlockRule::isSlow() const
{
return m_regExp != 0;
return m_regExp != nullptr;
}
bool AdBlockRule::isInternalDisabled() const
@ -720,7 +720,7 @@ QString AdBlockRule::createRegExpFromFilter(const QString &filter) const
i++;
}
else {
parsed.append('^');
parsed.append(QL1C('^'));
}
break;
}

View File

@ -63,7 +63,7 @@ class FALKON_EXPORT AdBlockRule
Q_DISABLE_COPY(AdBlockRule)
public:
AdBlockRule(const QString &filter = QString(), AdBlockSubscription* subscription = 0);
AdBlockRule(const QString &filter = QString(), AdBlockSubscription* subscription = nullptr);
~AdBlockRule();
AdBlockRule* copy() const;

View File

@ -190,18 +190,18 @@ QDataStream &operator>>(QDataStream &stream, BrowserWindow::SavedWindow &window)
}
BrowserWindow::BrowserWindow(Qz::BrowserWindowType type, const QUrl &startUrl)
: QMainWindow(0)
: QMainWindow(nullptr)
, m_startUrl(startUrl)
, m_windowType(type)
, m_startTab(0)
, m_startPage(0)
, m_startTab(nullptr)
, m_startPage(nullptr)
, m_sideBarManager(new SideBarManager(this))
, m_hideNavigationTimer(0)
, m_hideNavigationTimer(nullptr)
{
setAttribute(Qt::WA_DeleteOnClose);
setAttribute(Qt::WA_DontCreateNativeAncestors);
setObjectName("mainwindow");
setObjectName(QSL("mainwindow"));
setWindowTitle(tr("Falkon"));
setProperty("private", mApp->isPrivate());
@ -218,10 +218,10 @@ BrowserWindow::BrowserWindow(Qz::BrowserWindowType type, const QUrl &startUrl)
QTimer::singleShot(0, this, SLOT(postLaunch()));
if (mApp->isPrivate()) {
QzTools::setWmClass("Falkon Browser (Private Window)", this);
QzTools::setWmClass(QSL("Falkon Browser (Private Window)"), this);
}
else {
QzTools::setWmClass("Falkon Browser", this);
QzTools::setWmClass(QSL("Falkon Browser"), this);
}
}
@ -259,7 +259,7 @@ void BrowserWindow::postLaunch()
break;
case MainApplication::OpenSpeedDial:
startUrl = QUrl("falkon:speeddial");
startUrl = QUrl(QSL("falkon:speeddial"));
break;
case MainApplication::OpenHomePage:
@ -281,7 +281,7 @@ void BrowserWindow::postLaunch()
if (mApp->isStartingAfterCrash()) {
addTab = false;
startUrl.clear();
m_tabWidget->addView(QUrl("falkon:restore"), Qz::NT_CleanSelectedTabAtTheEnd);
m_tabWidget->addView(QUrl(QSL("falkon:restore")), Qz::NT_CleanSelectedTabAtTheEnd);
}
else if (mApp->afterLaunch() == MainApplication::SelectSession || mApp->afterLaunch() == MainApplication::RestoreSession) {
addTab = m_tabWidget->count() <= 0;
@ -338,7 +338,7 @@ void BrowserWindow::postLaunch()
void BrowserWindow::setupUi()
{
Settings settings;
settings.beginGroup("Browser-View-Settings");
settings.beginGroup(QSL("Browser-View-Settings"));
const QByteArray windowGeometry = settings.value(QSL("WindowGeometry")).toByteArray();
const QStringList keys = {
@ -364,7 +364,7 @@ void BrowserWindow::setupUi()
m_mainLayout->setContentsMargins(0, 0, 0, 0);
m_mainLayout->setSpacing(0);
m_mainSplitter = new QSplitter(this);
m_mainSplitter->setObjectName("sidebar-splitter");
m_mainSplitter->setObjectName(QSL("sidebar-splitter"));
m_tabWidget = new TabWidget(this);
m_superMenu = new QMenu(this);
m_navigationToolbar = new NavigationBar(this);
@ -386,12 +386,12 @@ void BrowserWindow::setupUi()
m_mainLayout->addWidget(m_mainSplitter);
m_statusBar = new StatusBar(this);
m_statusBar->setObjectName("mainwindow-statusbar");
m_statusBar->setObjectName(QSL("mainwindow-statusbar"));
m_statusBar->setCursor(Qt::ArrowCursor);
setStatusBar(m_statusBar);
m_progressBar = new ProgressBar(m_statusBar);
m_ipLabel = new QLabel(this);
m_ipLabel->setObjectName("statusbar-ip-label");
m_ipLabel->setObjectName(QSL("statusbar-ip-label"));
m_ipLabel->setToolTip(tr("IP Address of current page"));
m_statusBar->addPermanentWidget(m_progressBar);
@ -471,10 +471,10 @@ void BrowserWindow::setupMenu()
connect(closeTabAction, SIGNAL(activated()), this, SLOT(closeTab()));
connect(closeTabAction2, SIGNAL(activated()), this, SLOT(closeTab()));
QShortcut* reloadAction = new QShortcut(QKeySequence("Ctrl+R"), this);
QShortcut* reloadAction = new QShortcut(QKeySequence(QSL("Ctrl+R")), this);
connect(reloadAction, SIGNAL(activated()), this, SLOT(reload()));
QShortcut* openLocationAction = new QShortcut(QKeySequence("Alt+D"), this);
QShortcut* openLocationAction = new QShortcut(QKeySequence(QSL("Alt+D")), this);
connect(openLocationAction, SIGNAL(activated()), this, SLOT(openLocation()));
QShortcut* inspectorAction = new QShortcut(QKeySequence(QSL("F12")), this);
@ -574,35 +574,35 @@ void BrowserWindow::loadSettings()
Settings settings;
//Url settings
settings.beginGroup("Web-URL-Settings");
m_homepage = settings.value("homepage", "falkon:start").toUrl();
settings.beginGroup(QSL("Web-URL-Settings"));
m_homepage = settings.value(QSL("homepage"), QSL("falkon:start")).toUrl();
settings.endGroup();
//Browser Window settings
settings.beginGroup("Browser-View-Settings");
bool showStatusBar = settings.value("showStatusBar", false).toBool();
bool showBookmarksToolbar = settings.value("showBookmarksToolbar", false).toBool();
bool showNavigationToolbar = settings.value("showNavigationToolbar", true).toBool();
bool showMenuBar = settings.value("showMenubar", false).toBool();
settings.beginGroup(QSL("Browser-View-Settings"));
bool showStatusBar = settings.value(QSL("showStatusBar"), false).toBool();
bool showBookmarksToolbar = settings.value(QSL("showBookmarksToolbar"), false).toBool();
bool showNavigationToolbar = settings.value(QSL("showNavigationToolbar"), true).toBool();
bool showMenuBar = settings.value(QSL("showMenubar"), false).toBool();
// Make sure both menubar and navigationbar are not hidden
// Fixes #781
if (!showNavigationToolbar) {
showMenuBar = true;
settings.setValue("showMenubar", true);
settings.setValue(QSL("showMenubar"), true);
}
settings.endGroup();
settings.beginGroup("Shortcuts");
m_useTabNumberShortcuts = settings.value("useTabNumberShortcuts", true).toBool();
m_useSpeedDialNumberShortcuts = settings.value("useSpeedDialNumberShortcuts", true).toBool();
m_useSingleKeyShortcuts = settings.value("useSingleKeyShortcuts", false).toBool();
settings.beginGroup(QSL("Shortcuts"));
m_useTabNumberShortcuts = settings.value(QSL("useTabNumberShortcuts"), true).toBool();
m_useSpeedDialNumberShortcuts = settings.value(QSL("useSpeedDialNumberShortcuts"), true).toBool();
m_useSingleKeyShortcuts = settings.value(QSL("useSingleKeyShortcuts"), false).toBool();
settings.endGroup();
settings.beginGroup("Web-Browser-Settings");
settings.beginGroup(QSL("Web-Browser-Settings"));
QAction *quitAction = m_mainMenu->action(QSL("Standard/Quit"));
if (settings.value("closeAppWithCtrlQ", true).toBool()) {
if (settings.value(QSL("closeAppWithCtrlQ"), true).toBool()) {
quitAction->setShortcut(QzTools::actionShortcut(QKeySequence::Quit, QKeySequence(QSL("Ctrl+Q"))));
} else {
quitAction->setShortcut(QKeySequence());
@ -656,7 +656,7 @@ TabbedWebView* BrowserWindow::weView(int index) const
{
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
if (!webTab) {
return 0;
return nullptr;
}
return webTab->webView();
@ -745,7 +745,7 @@ void BrowserWindow::changeEncoding()
mApp->webSettings()->setDefaultTextEncoding(encoding);
Settings settings;
settings.setValue("Web-Browser-Settings/DefaultEncoding", encoding);
settings.setValue(QSL("Web-Browser-Settings/DefaultEncoding"), encoding);
weView()->reload();
}
@ -868,7 +868,7 @@ void BrowserWindow::toggleShowMenubar()
setUpdatesEnabled(true);
Settings().setValue("Browser-View-Settings/showMenubar", menuBar()->isVisible());
Settings().setValue(QSL("Browser-View-Settings/showMenubar"), menuBar()->isVisible());
// Make sure we show Navigation Toolbar when Menu Bar is hidden
if (!m_navigationToolbar->isVisible() && !menuBar()->isVisible()) {
@ -884,7 +884,7 @@ void BrowserWindow::toggleShowStatusBar()
setUpdatesEnabled(true);
Settings().setValue("Browser-View-Settings/showStatusBar", m_statusBar->isVisible());
Settings().setValue(QSL("Browser-View-Settings/showStatusBar"), m_statusBar->isVisible());
}
@ -896,8 +896,8 @@ void BrowserWindow::toggleShowBookmarksToolbar()
setUpdatesEnabled(true);
Settings().setValue("Browser-View-Settings/showBookmarksToolbar", m_bookmarksToolbar->isVisible());
Settings().setValue("Browser-View-Settings/instantBookmarksToolbar", false);
Settings().setValue(QSL("Browser-View-Settings/showBookmarksToolbar"), m_bookmarksToolbar->isVisible());
Settings().setValue(QSL("Browser-View-Settings/instantBookmarksToolbar"), false);
}
void BrowserWindow::toggleShowNavigationToolbar()
@ -908,7 +908,7 @@ void BrowserWindow::toggleShowNavigationToolbar()
setUpdatesEnabled(true);
Settings().setValue("Browser-View-Settings/showNavigationToolbar", m_navigationToolbar->isVisible());
Settings().setValue(QSL("Browser-View-Settings/showNavigationToolbar"), m_navigationToolbar->isVisible());
#ifndef Q_OS_MACOS
// Make sure we show Menu Bar when Navigation Toolbar is hidden
@ -1056,7 +1056,7 @@ void BrowserWindow::createToolbarsMenu(QMenu* menu)
action = menu->addAction(tr("&Bookmarks Toolbar"), this, SLOT(toggleShowBookmarksToolbar()));
action->setCheckable(true);
action->setChecked(Settings().value("Browser-View-Settings/showBookmarksToolbar").toBool());
action->setChecked(Settings().value(QSL("Browser-View-Settings/showBookmarksToolbar")).toBool());
menu->addSeparator();
@ -1109,11 +1109,11 @@ void BrowserWindow::createEncodingMenu(QMenu* menu)
if (!menu->isEmpty())
menu->addSeparator();
createEncodingSubMenu("ISO", isoCodecs, menu);
createEncodingSubMenu("UTF", utfCodecs, menu);
createEncodingSubMenu("Windows", windowsCodecs, menu);
createEncodingSubMenu("Iscii", isciiCodecs, menu);
createEncodingSubMenu("IBM", ibmCodecs, menu);
createEncodingSubMenu(QSL("ISO"), isoCodecs, menu);
createEncodingSubMenu(QSL("UTF"), utfCodecs, menu);
createEncodingSubMenu(QSL("Windows"), windowsCodecs, menu);
createEncodingSubMenu(QSL("Iscii"), isciiCodecs, menu);
createEncodingSubMenu(QSL("IBM"), ibmCodecs, menu);
createEncodingSubMenu(tr("Other"), otherCodecs, menu);
}
@ -1143,7 +1143,7 @@ void BrowserWindow::searchOnPage()
{
if (weView() && weView()->webTab()) {
const QString searchText = weView()->page()->selectedText();
if (!searchText.contains('\n')) {
if (!searchText.contains(QL1C('\n'))) {
weView()->webTab()->showSearchToolBar(searchText);
} else {
weView()->webTab()->showSearchToolBar();
@ -1153,12 +1153,12 @@ void BrowserWindow::searchOnPage()
void BrowserWindow::openFile()
{
const QString fileTypes = QString("%1(*.html *.htm *.shtml *.shtm *.xhtml);;"
const QString fileTypes = QSL("%1(*.html *.htm *.shtml *.shtm *.xhtml);;"
"%2(*.png *.jpg *.jpeg *.bmp *.gif *.svg *.tiff);;"
"%3(*.txt);;"
"%4(*.*)").arg(tr("HTML files"), tr("Image files"), tr("Text files"), tr("All files"));
const QString filePath = QzTools::getOpenFileName("MainWindow-openFile", this, tr("Open file..."), QDir::homePath(), fileTypes);
const QString filePath = QzTools::getOpenFileName(QSL("MainWindow-openFile"), this, tr("Open file..."), QDir::homePath(), fileTypes);
if (!filePath.isEmpty()) {
loadAddress(QUrl::fromLocalFile(filePath));
@ -1489,7 +1489,7 @@ void BrowserWindow::closeEvent(QCloseEvent* event)
}
Settings settings;
bool askOnClose = settings.value("Browser-Tabs-Settings/AskOnClosing", true).toBool();
bool askOnClose = settings.value(QSL("Browser-Tabs-Settings/AskOnClosing"), true).toBool();
if ((mApp->afterLaunch() == MainApplication::SelectSession || mApp->afterLaunch() == MainApplication::RestoreSession) && mApp->windowCount() == 1) {
askOnClose = false;
@ -1511,7 +1511,7 @@ void BrowserWindow::closeEvent(QCloseEvent* event)
}
if (dialog.isChecked()) {
settings.setValue("Browser-Tabs-Settings/AskOnClosing", false);
settings.setValue(QSL("Browser-Tabs-Settings/AskOnClosing"), false);
}
}
@ -1547,8 +1547,8 @@ void BrowserWindow::saveSettings()
}
Settings settings;
settings.beginGroup("Browser-View-Settings");
settings.setValue("WindowGeometry", saveGeometry());
settings.beginGroup(QSL("Browser-View-Settings"));
settings.setValue(QSL("WindowGeometry"), saveGeometry());
const auto state = saveUiState();
for (auto it = state.constBegin(); it != state.constEnd(); ++it) {

View File

@ -895,8 +895,8 @@ void MainApplication::downloadRequested(QWebEngineDownloadItem *download)
void MainApplication::loadSettings()
{
Settings settings;
settings.beginGroup("Themes");
QString activeTheme = settings.value("activeTheme", DEFAULT_THEME_NAME).toString();
settings.beginGroup(QSL("Themes"));
QString activeTheme = settings.value(QSL("activeTheme"), DEFAULT_THEME_NAME).toString();
settings.endGroup();
loadTheme(activeTheme);
@ -904,54 +904,54 @@ void MainApplication::loadSettings()
QWebEngineSettings* webSettings = m_webProfile->settings();
// Web browsing settings
settings.beginGroup("Web-Browser-Settings");
settings.beginGroup(QSL("Web-Browser-Settings"));
webSettings->setAttribute(QWebEngineSettings::LocalStorageEnabled, settings.value("HTML5StorageEnabled", true).toBool());
webSettings->setAttribute(QWebEngineSettings::PluginsEnabled, settings.value("allowPlugins", true).toBool());
webSettings->setAttribute(QWebEngineSettings::JavascriptEnabled, settings.value("allowJavaScript", true).toBool());
webSettings->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, settings.value("allowJavaScriptOpenWindow", false).toBool());
webSettings->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, settings.value("allowJavaScriptAccessClipboard", true).toBool());
webSettings->setAttribute(QWebEngineSettings::LinksIncludedInFocusChain, settings.value("IncludeLinkInFocusChain", false).toBool());
webSettings->setAttribute(QWebEngineSettings::XSSAuditingEnabled, settings.value("XSSAuditing", false).toBool());
webSettings->setAttribute(QWebEngineSettings::PrintElementBackgrounds, settings.value("PrintElementBackground", true).toBool());
webSettings->setAttribute(QWebEngineSettings::SpatialNavigationEnabled, settings.value("SpatialNavigation", false).toBool());
webSettings->setAttribute(QWebEngineSettings::ScrollAnimatorEnabled, settings.value("AnimateScrolling", true).toBool());
webSettings->setAttribute(QWebEngineSettings::LocalStorageEnabled, settings.value(QSL("HTML5StorageEnabled"), true).toBool());
webSettings->setAttribute(QWebEngineSettings::PluginsEnabled, settings.value(QSL("allowPlugins"), true).toBool());
webSettings->setAttribute(QWebEngineSettings::JavascriptEnabled, settings.value(QSL("allowJavaScript"), true).toBool());
webSettings->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, settings.value(QSL("allowJavaScriptOpenWindow"), false).toBool());
webSettings->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, settings.value(QSL("allowJavaScriptAccessClipboard"), true).toBool());
webSettings->setAttribute(QWebEngineSettings::LinksIncludedInFocusChain, settings.value(QSL("IncludeLinkInFocusChain"), false).toBool());
webSettings->setAttribute(QWebEngineSettings::XSSAuditingEnabled, settings.value(QSL("XSSAuditing"), false).toBool());
webSettings->setAttribute(QWebEngineSettings::PrintElementBackgrounds, settings.value(QSL("PrintElementBackground"), true).toBool());
webSettings->setAttribute(QWebEngineSettings::SpatialNavigationEnabled, settings.value(QSL("SpatialNavigation"), false).toBool());
webSettings->setAttribute(QWebEngineSettings::ScrollAnimatorEnabled, settings.value(QSL("AnimateScrolling"), true).toBool());
webSettings->setAttribute(QWebEngineSettings::HyperlinkAuditingEnabled, false);
webSettings->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, true);
webSettings->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true);
webSettings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 10, 0)
webSettings->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, settings.value("allowJavaScriptActivateWindow", false).toBool());
webSettings->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, settings.value(QSL("allowJavaScriptActivateWindow"), false).toBool());
#endif
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 11, 0)
webSettings->setAttribute(QWebEngineSettings::JavascriptCanPaste, settings.value("allowJavaScriptPaste", true).toBool());
webSettings->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture, settings.value("DisableVideoAutoPlay", false).toBool());
webSettings->setAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly, settings.value("WebRTCPublicIpOnly", true).toBool());
webSettings->setAttribute(QWebEngineSettings::JavascriptCanPaste, settings.value(QSL("allowJavaScriptPaste"), true).toBool());
webSettings->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture, settings.value(QSL("DisableVideoAutoPlay"), false).toBool());
webSettings->setAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly, settings.value(QSL("WebRTCPublicIpOnly"), true).toBool());
webSettings->setUnknownUrlSchemePolicy(QWebEngineSettings::AllowAllUnknownUrlSchemes);
#endif
webSettings->setDefaultTextEncoding(settings.value("DefaultEncoding", webSettings->defaultTextEncoding()).toString());
webSettings->setDefaultTextEncoding(settings.value(QSL("DefaultEncoding"), webSettings->defaultTextEncoding()).toString());
setWheelScrollLines(settings.value("wheelScrollLines", wheelScrollLines()).toInt());
setWheelScrollLines(settings.value(QSL("wheelScrollLines"), wheelScrollLines()).toInt());
const QString userCss = settings.value("userStyleSheet", QString()).toString();
const QString userCss = settings.value(QSL("userStyleSheet"), QString()).toString();
settings.endGroup();
setUserStyleSheet(userCss);
settings.beginGroup("Browser-Fonts");
webSettings->setFontFamily(QWebEngineSettings::StandardFont, settings.value("StandardFont", webSettings->fontFamily(QWebEngineSettings::StandardFont)).toString());
webSettings->setFontFamily(QWebEngineSettings::CursiveFont, settings.value("CursiveFont", webSettings->fontFamily(QWebEngineSettings::CursiveFont)).toString());
webSettings->setFontFamily(QWebEngineSettings::FantasyFont, settings.value("FantasyFont", webSettings->fontFamily(QWebEngineSettings::FantasyFont)).toString());
webSettings->setFontFamily(QWebEngineSettings::FixedFont, settings.value("FixedFont", webSettings->fontFamily(QWebEngineSettings::FixedFont)).toString());
webSettings->setFontFamily(QWebEngineSettings::SansSerifFont, settings.value("SansSerifFont", webSettings->fontFamily(QWebEngineSettings::SansSerifFont)).toString());
webSettings->setFontFamily(QWebEngineSettings::SerifFont, settings.value("SerifFont", webSettings->fontFamily(QWebEngineSettings::SerifFont)).toString());
webSettings->setFontSize(QWebEngineSettings::DefaultFontSize, settings.value("DefaultFontSize", 15).toInt());
webSettings->setFontSize(QWebEngineSettings::DefaultFixedFontSize, settings.value("FixedFontSize", 14).toInt());
webSettings->setFontSize(QWebEngineSettings::MinimumFontSize, settings.value("MinimumFontSize", 3).toInt());
webSettings->setFontSize(QWebEngineSettings::MinimumLogicalFontSize, settings.value("MinimumLogicalFontSize", 5).toInt());
webSettings->setFontFamily(QWebEngineSettings::StandardFont, settings.value(QSL("StandardFont"), webSettings->fontFamily(QWebEngineSettings::StandardFont)).toString());
webSettings->setFontFamily(QWebEngineSettings::CursiveFont, settings.value(QSL("CursiveFont"), webSettings->fontFamily(QWebEngineSettings::CursiveFont)).toString());
webSettings->setFontFamily(QWebEngineSettings::FantasyFont, settings.value(QSL("FantasyFont"), webSettings->fontFamily(QWebEngineSettings::FantasyFont)).toString());
webSettings->setFontFamily(QWebEngineSettings::FixedFont, settings.value(QSL("FixedFont"), webSettings->fontFamily(QWebEngineSettings::FixedFont)).toString());
webSettings->setFontFamily(QWebEngineSettings::SansSerifFont, settings.value(QSL("SansSerifFont"), webSettings->fontFamily(QWebEngineSettings::SansSerifFont)).toString());
webSettings->setFontFamily(QWebEngineSettings::SerifFont, settings.value(QSL("SerifFont"), webSettings->fontFamily(QWebEngineSettings::SerifFont)).toString());
webSettings->setFontSize(QWebEngineSettings::DefaultFontSize, settings.value(QSL("DefaultFontSize"), 15).toInt());
webSettings->setFontSize(QWebEngineSettings::DefaultFixedFontSize, settings.value(QSL("FixedFontSize"), 14).toInt());
webSettings->setFontSize(QWebEngineSettings::MinimumFontSize, settings.value(QSL("MinimumFontSize"), 3).toInt());
webSettings->setFontSize(QWebEngineSettings::MinimumLogicalFontSize, settings.value(QSL("MinimumLogicalFontSize"), 5).toInt());
settings.endGroup();
QWebEngineProfile* profile = QWebEngineProfile::defaultProfile();
@ -961,7 +961,7 @@ void MainApplication::loadSettings()
QString defaultPath = DataPaths::path(DataPaths::Cache);
if (!defaultPath.startsWith(DataPaths::currentProfilePath()))
defaultPath.append(QLatin1Char('/') + ProfileManager::currentProfile());
const QString &cachePath = settings.value("Web-Browser-Settings/CachePath", defaultPath).toString();
const QString &cachePath = settings.value(QSL("Web-Browser-Settings/CachePath"), defaultPath).toString();
profile->setCachePath(cachePath);
const bool allowCache = settings.value(QSL("Web-Browser-Settings/AllowLocalCache"), true).toBool();
@ -995,7 +995,7 @@ void MainApplication::loadTheme(const QString &name)
if (activeThemePath.isEmpty()) {
qWarning() << "Cannot load theme " << name;
activeThemePath = QString("%1/%2").arg(DataPaths::path(DataPaths::Themes), DEFAULT_THEME_NAME);
activeThemePath = QSL("%1/%2").arg(DataPaths::path(DataPaths::Themes), DEFAULT_THEME_NAME);
}
QString qss = QzTools::readAllFileContents(activeThemePath + QLatin1String("/main.css"));

View File

@ -113,13 +113,13 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qz::NewTabPositionFlags)
}
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
#define DEFAULT_THEME_NAME "windows"
#define DEFAULT_THEME_NAME QSL("windows")
#elif defined(Q_OS_MACOS)
#define DEFAULT_THEME_NAME "mac"
#define DEFAULT_THEME_NAME QSL("mac")
#elif defined(Q_OS_UNIX)
#define DEFAULT_THEME_NAME "linux"
#define DEFAULT_THEME_NAME QSL("linux")
#else
#define DEFAULT_THEME_NAME "default"
#define DEFAULT_THEME_NAME QSL("default")
#endif
#ifdef Q_OS_WIN

View File

@ -37,9 +37,9 @@ DatabaseEncryptedPasswordBackend::DatabaseEncryptedPasswordBackend()
{
QSqlDatabase db = SqlDatabase::instance()->database();
if (!db.tables().contains(QLatin1String("autofill_encrypted"))) {
db.exec("CREATE TABLE autofill_encrypted (data_encrypted TEXT, id INTEGER PRIMARY KEY,"
"password_encrypted TEXT, server TEXT, username_encrypted TEXT, last_used NUMERIC)");
db.exec("CREATE INDEX autofillEncryptedServer ON autofill_encrypted(server ASC)");
db.exec(QSL("CREATE TABLE autofill_encrypted (data_encrypted TEXT, id INTEGER PRIMARY KEY,"
"password_encrypted TEXT, server TEXT, username_encrypted TEXT, last_used NUMERIC)"));
db.exec(QSL("CREATE INDEX autofillEncryptedServer ON autofill_encrypted(server ASC)"));
}
}
@ -54,7 +54,7 @@ QStringList DatabaseEncryptedPasswordBackend::getUsernames(const QUrl &url)
}
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT username_encrypted FROM autofill_encrypted WHERE server=? ORDER BY last_used DESC");
query.prepare(QSL("SELECT username_encrypted FROM autofill_encrypted WHERE server=? ORDER BY last_used DESC"));
query.addBindValue(PasswordManager::createHost(url));
query.exec();
@ -74,8 +74,8 @@ QVector<PasswordEntry> DatabaseEncryptedPasswordBackend::getEntries(const QUrl &
const QString host = PasswordManager::createHost(url);
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT id, username_encrypted, password_encrypted, data_encrypted FROM autofill_encrypted "
"WHERE server=? ORDER BY last_used DESC");
query.prepare(QSL("SELECT id, username_encrypted, password_encrypted, data_encrypted FROM autofill_encrypted "
"WHERE server=? ORDER BY last_used DESC"));
query.addBindValue(host);
query.exec();
@ -105,7 +105,7 @@ QVector<PasswordEntry> DatabaseEncryptedPasswordBackend::getAllEntries()
AesInterface aesDecryptor;
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT id, server, username_encrypted, password_encrypted, data_encrypted FROM autofill_encrypted");
query.prepare(QSL("SELECT id, server, username_encrypted, password_encrypted, data_encrypted FROM autofill_encrypted"));
query.exec();
if (query.next() && hasPermission()) {
@ -160,7 +160,7 @@ void DatabaseEncryptedPasswordBackend::addEntry(const PasswordEntry &entry)
if (entry.data.isEmpty()) {
// Multiple-usernames for HTTP/FTP authorization not supported
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT username_encrypted FROM autofill_encrypted WHERE server=?");
query.prepare(QSL("SELECT username_encrypted FROM autofill_encrypted WHERE server=?"));
query.addBindValue(entry.host);
query.exec();
@ -174,8 +174,8 @@ void DatabaseEncryptedPasswordBackend::addEntry(const PasswordEntry &entry)
if (hasPermission() && encryptPasswordEntry(encryptedEntry, &aesEncryptor)) {
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("INSERT INTO autofill_encrypted (server, data_encrypted, username_encrypted, password_encrypted, last_used) "
"VALUES (?,?,?,?,strftime('%s', 'now'))");
query.prepare(QSL("INSERT INTO autofill_encrypted (server, data_encrypted, username_encrypted, password_encrypted, last_used) "
"VALUES (?,?,?,?,strftime('%s', 'now'))"));
query.bindValue(0, encryptedEntry.host);
query.bindValue(1, encryptedEntry.data);
query.bindValue(2, encryptedEntry.username);
@ -194,13 +194,13 @@ bool DatabaseEncryptedPasswordBackend::updateEntry(const PasswordEntry &entry)
// Data is empty only for HTTP/FTP authorization
if (entry.data.isEmpty()) {
query.prepare("UPDATE autofill_encrypted SET username_encrypted=?, password_encrypted=? WHERE server=?");
query.prepare(QSL("UPDATE autofill_encrypted SET username_encrypted=?, password_encrypted=? WHERE server=?"));
query.bindValue(0, encryptedEntry.username);
query.bindValue(1, encryptedEntry.password);
query.bindValue(2, encryptedEntry.host);
}
else {
query.prepare("UPDATE autofill_encrypted SET data_encrypted=?, username_encrypted=?, password_encrypted=? WHERE id=?");
query.prepare(QSL("UPDATE autofill_encrypted SET data_encrypted=?, username_encrypted=?, password_encrypted=? WHERE id=?"));
query.addBindValue(encryptedEntry.data);
query.addBindValue(encryptedEntry.username);
query.addBindValue(encryptedEntry.password);
@ -216,7 +216,7 @@ bool DatabaseEncryptedPasswordBackend::updateEntry(const PasswordEntry &entry)
void DatabaseEncryptedPasswordBackend::updateLastUsed(PasswordEntry &entry)
{
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("UPDATE autofill_encrypted SET last_used=strftime('%s', 'now') WHERE id=?");
query.prepare(QSL("UPDATE autofill_encrypted SET last_used=strftime('%s', 'now') WHERE id=?"));
query.addBindValue(entry.id);
query.exec();
}
@ -228,7 +228,7 @@ void DatabaseEncryptedPasswordBackend::removeEntry(const PasswordEntry &entry)
}
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("DELETE FROM autofill_encrypted WHERE id=?");
query.prepare(QSL("DELETE FROM autofill_encrypted WHERE id=?"));
query.addBindValue(entry.id);
query.exec();
@ -245,7 +245,7 @@ void DatabaseEncryptedPasswordBackend::removeAll()
}
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("DELETE FROM autofill_encrypted");
query.prepare(QSL("DELETE FROM autofill_encrypted"));
query.exec();
m_stateOfMasterPassword = PasswordIsSetted;
@ -393,7 +393,7 @@ void DatabaseEncryptedPasswordBackend::encryptDataBaseTableOnFly(const QByteArra
}
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT id, data_encrypted, password_encrypted, username_encrypted, server FROM autofill_encrypted");
query.prepare(QSL("SELECT id, data_encrypted, password_encrypted, username_encrypted, server FROM autofill_encrypted"));
query.exec();
AesInterface encryptor;
@ -423,7 +423,7 @@ void DatabaseEncryptedPasswordBackend::encryptDataBaseTableOnFly(const QByteArra
}
QSqlQuery updateQuery(SqlDatabase::instance()->database());
updateQuery.prepare("UPDATE autofill_encrypted SET data_encrypted = ?, password_encrypted = ?, username_encrypted = ? WHERE id = ?");
updateQuery.prepare(QSL("UPDATE autofill_encrypted SET data_encrypted = ?, password_encrypted = ?, username_encrypted = ? WHERE id = ?"));
updateQuery.addBindValue(data);
updateQuery.addBindValue(password);
updateQuery.addBindValue(username);
@ -439,7 +439,7 @@ QByteArray DatabaseEncryptedPasswordBackend::someDataFromDatabase()
}
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT password_encrypted, data_encrypted, username_encrypted FROM autofill_encrypted");
query.prepare(QSL("SELECT password_encrypted, data_encrypted, username_encrypted FROM autofill_encrypted"));
query.exec();
QByteArray someData;
@ -467,7 +467,7 @@ QByteArray DatabaseEncryptedPasswordBackend::someDataFromDatabase()
void DatabaseEncryptedPasswordBackend::updateSampleData(const QByteArray &password)
{
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT id FROM autofill_encrypted WHERE server = ?");
query.prepare(QSL("SELECT id FROM autofill_encrypted WHERE server = ?"));
query.addBindValue(INTERNAL_SERVER_ID);
query.exec();
@ -476,10 +476,10 @@ void DatabaseEncryptedPasswordBackend::updateSampleData(const QByteArray &passwo
m_someDataStoredOnDataBase = aes.encrypt(AesInterface::createRandomData(16), password);
if (query.next()) {
query.prepare("UPDATE autofill_encrypted SET password_encrypted = ? WHERE server=?");
query.prepare(QSL("UPDATE autofill_encrypted SET password_encrypted = ? WHERE server=?"));
}
else {
query.prepare("INSERT INTO autofill_encrypted (password_encrypted, server) VALUES (?,?)");
query.prepare(QSL("INSERT INTO autofill_encrypted (password_encrypted, server) VALUES (?,?)"));
}
query.addBindValue(QString::fromUtf8(m_someDataStoredOnDataBase));
@ -489,7 +489,7 @@ void DatabaseEncryptedPasswordBackend::updateSampleData(const QByteArray &passwo
m_stateOfMasterPassword = PasswordIsSetted;
}
else if (query.next()) {
query.prepare("DELETE FROM autofill_encrypted WHERE server = ?");
query.prepare(QSL("DELETE FROM autofill_encrypted WHERE server = ?"));
query.addBindValue(INTERNAL_SERVER_ID);
query.exec();
@ -580,7 +580,7 @@ void MasterPasswordDialog::reject()
AutoFill::tr("This backend needs a master password to be set! "
"Falkon just switches to its default backend"));
// active default backend
mApp->autoFill()->passwordManager()->switchBackend("database");
mApp->autoFill()->passwordManager()->switchBackend(QSL("database"));
return;
}
}
@ -610,7 +610,7 @@ void MasterPasswordDialog::clearMasterPasswordAndConvert(bool forcedAskPass)
if (m_backend->hasPermission()) {
QVector<PasswordEntry> list = m_backend->getAllEntries();
PasswordBackend* databaseBackend = mApp->autoFill()->passwordManager()->availableBackends().value("database");
PasswordBackend* databaseBackend = mApp->autoFill()->passwordManager()->availableBackends().value(QSL("database"));
if (!databaseBackend) {
return;
}
@ -638,11 +638,11 @@ void MasterPasswordDialog::clearMasterPasswordAndConvert(bool forcedAskPass)
m_backend->removeMasterPassword();
m_backend->setAskMasterPasswordState(false);
mApp->autoFill()->passwordManager()->switchBackend("database");
mApp->autoFill()->passwordManager()->switchBackend(QSL("database"));
}
else {
QMessageBox::information(this, tr("Warning!"), tr("Some data has not been decrypted. The master password was not cleared!"));
mApp->autoFill()->passwordManager()->switchBackend("database");
mApp->autoFill()->passwordManager()->switchBackend(QSL("database"));
}
}
reject();

View File

@ -192,7 +192,7 @@ void BookmarkItem::addChild(BookmarkItem* child, int index)
void BookmarkItem::removeChild(BookmarkItem* child)
{
child->m_parent = 0;
child->m_parent = nullptr;
m_children.removeOne(child);
}
@ -217,15 +217,15 @@ QString BookmarkItem::typeToString(BookmarkItem::Type type)
{
switch (type) {
case Url:
return QString("url");
return QSL("url");
case Folder:
return QString("folder");
return QSL("folder");
case Separator:
return QString("separator");
return QSL("separator");
default:
return QString("invalid");
return QSL("invalid");
}
}

View File

@ -37,7 +37,7 @@ public:
Invalid
};
explicit BookmarkItem(Type type, BookmarkItem* parent = 0);
explicit BookmarkItem(Type type, BookmarkItem* parent = nullptr);
~BookmarkItem();
Type type() const;

View File

@ -52,7 +52,7 @@ public:
static QString fromPunycode(const QString &str);
static QString escapeSqlGlobString(QString urlString);
static QString ensureUniqueFilename(const QString &name, const QString &appendFormat = QString("(%1)"));
static QString ensureUniqueFilename(const QString &name, const QString &appendFormat = QSL("(%1)"));
static QString getFileNameFromUrl(const QUrl &url);
static QString filterCharsFromFilename(const QString &name);

View File

@ -33,8 +33,8 @@ private Q_SLOTS:
void AdBlockParseRule::parseEasyList()
{
QBENCHMARK {
AdBlockSubscription* subscription = new AdBlockSubscription("EasyList", this);
subscription->setFilePath(":/files/easylist.txt");
AdBlockSubscription* subscription = new AdBlockSubscription(QSL("EasyList"), this);
subscription->setFilePath(QSL(":/files/easylist.txt"));
subscription->loadSubscription(QStringList());
}
}