1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Add more QSL + nullptr

This commit is contained in:
Laurent Montel 2018-07-06 08:20:47 +02:00
parent 07b4dd4f6e
commit db10e175f0
22 changed files with 207 additions and 207 deletions

View File

@ -67,36 +67,36 @@ void AdBlockTest::parseRegExpFilterTest_data()
QTest::addColumn<QString>("parsedFilter"); QTest::addColumn<QString>("parsedFilter");
QTest::addColumn<QStringList>("result"); QTest::addColumn<QStringList>("result");
QTest::newRow("test1") << "||doubleclick.net/pfadx/tmg.telegraph." QTest::newRow("test1") << QSL("||doubleclick.net/pfadx/tmg.telegraph.")
<< (QStringList() << "doubleclick.net/pfadx/tmg.telegraph."); << (QStringList() << QSL("doubleclick.net/pfadx/tmg.telegraph."));
QTest::newRow("test2") << "||doubleclick.net/pfadx/*.mtvi" QTest::newRow("test2") << QSL("||doubleclick.net/pfadx/*.mtvi")
<< (QStringList() << "doubleclick.net/pfadx/" << ".mtvi"); << (QStringList() << QSL("doubleclick.net/pfadx/") << QSL(".mtvi"));
QTest::newRow("test3") << "&prvtof=*&poru=" QTest::newRow("test3") << QSL("&prvtof=*&poru=")
<< (QStringList() << "&prvtof=" << "&poru="); << (QStringList() << QSL("&prvtof=") << QSL("&poru="));
QTest::newRow("test4") << "/addyn|*;adtech;" QTest::newRow("test4") << QSL("/addyn|*;adtech;")
<< (QStringList() << "/addyn" << ";adtech;"); << (QStringList() << QSL("/addyn") << QSL(";adtech;"));
QTest::newRow("test5") << "/eas_fif.html^" QTest::newRow("test5") << QSL("/eas_fif.html^")
<< (QStringList() << "/eas_fif.html"); << (QStringList() << QSL("/eas_fif.html"));
QTest::newRow("test6") << "://findnsave.^.*/api/groupon.json?" QTest::newRow("test6") << QSL("://findnsave.^.*/api/groupon.json?")
<< (QStringList() << "://findnsave." << "/api/groupon.json?"); << (QStringList() << QSL("://findnsave.") << QSL("/api/groupon.json?"));
QTest::newRow("test7") << "^fp=*&prvtof=" QTest::newRow("test7") << QSL("^fp=*&prvtof=")
<< (QStringList() << "fp=" << "&prvtof="); << (QStringList() << QSL("fp=") << QSL("&prvtof="));
QTest::newRow("test8") << "|http://ax-d.*/jstag^" QTest::newRow("test8") << QSL("|http://ax-d.*/jstag^")
<< (QStringList() << "http://ax-d." << "/jstag"); << (QStringList() << QSL("http://ax-d.") << QSL("/jstag"));
QTest::newRow("test9") << "||reuters.com^*/rcom-wt-mlt.js" QTest::newRow("test9") << QSL("||reuters.com^*/rcom-wt-mlt.js")
<< (QStringList() << "reuters.com" <<"/rcom-wt-mlt.js"); << (QStringList() << QSL("reuters.com") <<QSL("/rcom-wt-mlt.js"));
QTest::newRow("test10") << "||chip.de^*/tracking.js" QTest::newRow("test10") << QSL("||chip.de^*/tracking.js")
<< (QStringList() << "chip.de" << "/tracking.js"); << (QStringList() << QSL("chip.de") << QSL("/tracking.js"));
QTest::newRow("ignore1char") << "/search.php?uid=*.*&src=" QTest::newRow("ignore1char") << QSL("/search.php?uid=*.*&src=")
<< (QStringList() << "/search.php?uid=" << "&src="); << (QStringList() << QSL("/search.php?uid=") << QSL("&src="));
QTest::newRow("ignoreDuplicates") << "/search.*.dup.*.dup.*&src=" QTest::newRow("ignoreDuplicates") << QSL("/search.*.dup.*.dup.*&src=")
<< (QStringList() << "/search." << ".dup." << "&src="); << (QStringList() << QSL("/search.") << QSL(".dup.") << QSL("&src="));
QTest::newRow("empty") << QString() QTest::newRow("empty") << QString()
<< (QStringList()); << (QStringList());
QTest::newRow("justspaces") << QString(" ") QTest::newRow("justspaces") << QSL(" ")
<< (QStringList() << " "); << (QStringList() << QSL(" "));
QTest::newRow("spacesWithMetachars") << QString(" * ?") QTest::newRow("spacesWithMetachars") << QSL(" * ?")
<< (QStringList() << " " << " ?"); << (QStringList() << QSL(" ") << QSL(" ?"));
} }
void AdBlockTest::parseRegExpFilterTest() void AdBlockTest::parseRegExpFilterTest()
@ -111,13 +111,13 @@ void AdBlockTest::parseRegExpFilterTest()
void AdBlockTest::ignoreEmptyLinesInSubscriptionTest() void AdBlockTest::ignoreEmptyLinesInSubscriptionTest()
{ {
AdBlockSubscription subscription("test-subscription"); AdBlockSubscription subscription(QSL("test-subscription"));
subscription.setFilePath(":autotests/data/adblock_empty_lines.txt"); subscription.setFilePath(QSL(":autotests/data/adblock_empty_lines.txt"));
subscription.loadSubscription({}); subscription.loadSubscription({});
QCOMPARE(subscription.allRules().count(), 3); QCOMPARE(subscription.allRules().count(), 3);
QCOMPARE(subscription.allRules().at(0)->filter(), QString("filter.com")); QCOMPARE(subscription.allRules().at(0)->filter(), QSL("filter.com"));
QCOMPARE(subscription.allRules().at(1)->filter(), QString("test")); QCOMPARE(subscription.allRules().at(1)->filter(), QSL("test"));
QCOMPARE(subscription.allRules().at(2)->isComment(), true); QCOMPARE(subscription.allRules().at(2)->isComment(), true);
} }

View File

@ -43,8 +43,8 @@ void DatabaseEncryptedPasswordBackendTest::init()
{ {
QSqlDatabase db = QSqlDatabase::database(); QSqlDatabase db = QSqlDatabase::database();
if (!db.isValid()) { if (!db.isValid()) {
db = QSqlDatabase::addDatabase("QSQLITE"); db = QSqlDatabase::addDatabase(QSL("QSQLITE"));
db.setDatabaseName(":memory:"); db.setDatabaseName(QSL(":memory:"));
} }
db.open(); db.open();
} }

View File

@ -29,12 +29,12 @@ void DatabasePasswordBackendTest::reloadBackend()
void DatabasePasswordBackendTest::init() void DatabasePasswordBackendTest::init()
{ {
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); QSqlDatabase db = QSqlDatabase::addDatabase(QSL("QSQLITE"));
db.setDatabaseName(":memory:"); db.setDatabaseName(QSL(":memory:"));
db.open(); db.open();
db.exec("CREATE TABLE autofill (data TEXT, id INTEGER PRIMARY KEY, password TEXT," db.exec(QSL("CREATE TABLE autofill (data TEXT, id INTEGER PRIMARY KEY, password TEXT,"
"server TEXT, username TEXT, last_used NUMERIC)"); "server TEXT, username TEXT, last_used NUMERIC)"));
} }
void DatabasePasswordBackendTest::cleanup() void DatabasePasswordBackendTest::cleanup()

View File

@ -166,9 +166,9 @@ void PasswordBackendTest::removeAllTest()
entry.username.append(QSL("s")); entry.username.append(QSL("s"));
m_backend->addEntry(entry); m_backend->addEntry(entry);
QCOMPARE(m_backend->getEntries(QUrl("org.falkon.google.com")).count(), 7); QCOMPARE(m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).count(), 7);
reloadBackend(); reloadBackend();
QCOMPARE(m_backend->getEntries(QUrl("org.falkon.google.com")).count(), 7); QCOMPARE(m_backend->getEntries(QUrl(QSL("org.falkon.google.com"))).count(), 7);
m_backend->removeAll(); m_backend->removeAll();

View File

@ -42,7 +42,7 @@ void SqlDatabaseTest::sqlQueryJobTest()
QTemporaryFile file; QTemporaryFile file;
file.open(); file.open();
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); QSqlDatabase db = QSqlDatabase::addDatabase(QSL("QSQLITE"));
db.setDatabaseName(file.fileName()); db.setDatabaseName(file.fileName());
db.open(); db.open();
@ -51,37 +51,37 @@ void SqlDatabaseTest::sqlQueryJobTest()
QCOMPARE(db.tables().count(), 0); QCOMPARE(db.tables().count(), 0);
SqlQueryJob *job = new SqlQueryJob(); SqlQueryJob *job = new SqlQueryJob();
job->setQuery("CREATE TABLE test1 (data TEXT, id INTEGER PRIMARY KEY)"); job->setQuery(QSL("CREATE TABLE test1 (data TEXT, id INTEGER PRIMARY KEY)"));
job->start(); job->start();
QVERIFY(waitForFinished(job)); QVERIFY(waitForFinished(job));
QVERIFY(!job->error().isValid()); QVERIFY(!job->error().isValid());
QCOMPARE(db.tables(), QStringList{"test1"}); QCOMPARE(db.tables(), QStringList{QSL("test1")});
job = new SqlQueryJob(); job = new SqlQueryJob();
job->setQuery("INSERT INTO test1 (data) VALUES (?)"); job->setQuery(QSL("INSERT INTO test1 (data) VALUES (?)"));
job->addBindValue("test-value"); job->addBindValue(QSL("test-value"));
job->start(); job->start();
QVERIFY(waitForFinished(job)); QVERIFY(waitForFinished(job));
QVERIFY(!job->error().isValid()); QVERIFY(!job->error().isValid());
QCOMPARE(job->lastInsertId().toInt(), 1); QCOMPARE(job->lastInsertId().toInt(), 1);
QSqlQuery query("SELECT data FROM test1", db); QSqlQuery query(QSL("SELECT data FROM test1"), db);
query.next(); query.next();
QCOMPARE(query.value(0).toString(), QString("test-value")); QCOMPARE(query.value(0).toString(), QSL("test-value"));
QVERIFY(!query.next()); QVERIFY(!query.next());
job = new SqlQueryJob(); job = new SqlQueryJob();
job->setQuery("SELECT data FROM test1"); job->setQuery(QSL("SELECT data FROM test1"));
job->start(); job->start();
QVERIFY(waitForFinished(job)); QVERIFY(waitForFinished(job));
QVERIFY(!job->error().isValid()); QVERIFY(!job->error().isValid());
QCOMPARE(job->records().size(), 1); QCOMPARE(job->records().size(), 1);
QCOMPARE(job->records().at(0).value(0).toString(), QString("test-value")); QCOMPARE(job->records().at(0).value(0).toString(), QSL("test-value"));
job = new SqlQueryJob(); job = new SqlQueryJob();
job->setQuery("SELECT invalid sql syntax; 1321sdsa from"); job->setQuery(QSL("SELECT invalid sql syntax; 1321sdsa from"));
job->start(); job->start();
QVERIFY(waitForFinished(job)); QVERIFY(waitForFinished(job));
QVERIFY(job->error().isValid()); QVERIFY(job->error().isValid());

View File

@ -57,7 +57,7 @@
AdBlockSubscription::AdBlockSubscription(const QString &title, QObject* parent) AdBlockSubscription::AdBlockSubscription(const QString &title, QObject* parent)
: QObject(parent) : QObject(parent)
, m_reply(0) , m_reply(nullptr)
, m_title(title) , m_title(title)
, m_updated(false) , m_updated(false)
{ {
@ -191,7 +191,7 @@ bool AdBlockSubscription::saveDownloadedData(const QByteArray &data)
} }
// Write subscription header // Write subscription header
file.write(QString("Title: %1\nUrl: %2\n").arg(title(), url().toString()).toUtf8()); file.write(QSL("Title: %1\nUrl: %2\n").arg(title(), url().toString()).toUtf8());
file.write(data); file.write(data);
file.commit(); file.commit();
return true; return true;
@ -200,7 +200,7 @@ bool AdBlockSubscription::saveDownloadedData(const QByteArray &data)
const AdBlockRule* AdBlockSubscription::rule(int offset) const const AdBlockRule* AdBlockSubscription::rule(int offset) const
{ {
if (!QzTools::containsIndex(m_rules, offset)) { if (!QzTools::containsIndex(m_rules, offset)) {
return 0; return nullptr;
} }
return m_rules[offset]; return m_rules[offset];
@ -214,7 +214,7 @@ QVector<AdBlockRule*> AdBlockSubscription::allRules() const
const AdBlockRule* AdBlockSubscription::enableRule(int offset) const AdBlockRule* AdBlockSubscription::enableRule(int offset)
{ {
if (!QzTools::containsIndex(m_rules, offset)) { if (!QzTools::containsIndex(m_rules, offset)) {
return 0; return nullptr;
} }
AdBlockRule* rule = m_rules[offset]; AdBlockRule* rule = m_rules[offset];
@ -232,7 +232,7 @@ const AdBlockRule* AdBlockSubscription::enableRule(int offset)
const AdBlockRule* AdBlockSubscription::disableRule(int offset) const AdBlockRule* AdBlockSubscription::disableRule(int offset)
{ {
if (!QzTools::containsIndex(m_rules, offset)) { if (!QzTools::containsIndex(m_rules, offset)) {
return 0; return nullptr;
} }
AdBlockRule* rule = m_rules[offset]; AdBlockRule* rule = m_rules[offset];
@ -273,7 +273,7 @@ const AdBlockRule* AdBlockSubscription::replaceRule(AdBlockRule* rule, int offse
{ {
Q_UNUSED(rule) Q_UNUSED(rule)
Q_UNUSED(offset) Q_UNUSED(offset)
return 0; return nullptr;
} }
AdBlockSubscription::~AdBlockSubscription() AdBlockSubscription::~AdBlockSubscription()

View File

@ -60,7 +60,7 @@ class FALKON_EXPORT AdBlockSubscription : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AdBlockSubscription(const QString &title, QObject* parent = 0); explicit AdBlockSubscription(const QString &title, QObject* parent = nullptr);
~AdBlockSubscription(); ~AdBlockSubscription();
QString title() const; QString title() const;
@ -116,7 +116,7 @@ class AdBlockCustomList : public AdBlockSubscription
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AdBlockCustomList(QObject* parent = 0); explicit AdBlockCustomList(QObject* parent = nullptr);
void loadSubscription(const QStringList &disabledRules); void loadSubscription(const QStringList &disabledRules);
void saveSubscription(); void saveSubscription();

View File

@ -86,23 +86,23 @@ MainApplication::MainApplication(int &argc, char** argv)
, m_isPortable(false) , m_isPortable(false)
, m_isClosing(false) , m_isClosing(false)
, m_isStartingAfterCrash(false) , m_isStartingAfterCrash(false)
, m_history(0) , m_history(nullptr)
, m_bookmarks(0) , m_bookmarks(nullptr)
, m_autoFill(0) , m_autoFill(nullptr)
, m_cookieJar(0) , m_cookieJar(nullptr)
, m_plugins(0) , m_plugins(nullptr)
, m_browsingLibrary(0) , m_browsingLibrary(nullptr)
, m_networkManager(0) , m_networkManager(nullptr)
, m_restoreManager(0) , m_restoreManager(nullptr)
, m_sessionManager(0) , m_sessionManager(nullptr)
, m_downloadManager(0) , m_downloadManager(nullptr)
, m_userAgentManager(0) , m_userAgentManager(nullptr)
, m_searchEnginesManager(0) , m_searchEnginesManager(nullptr)
, m_closedWindowsManager(0) , m_closedWindowsManager(nullptr)
, m_html5PermissionsManager(0) , m_html5PermissionsManager(nullptr)
, m_desktopNotifications(0) , m_desktopNotifications(nullptr)
, m_webProfile(0) , m_webProfile(nullptr)
, m_autoSaver(0) , m_autoSaver(nullptr)
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2) #if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
, m_registerQAppAssociation(0) , m_registerQAppAssociation(0)
#endif #endif
@ -118,7 +118,7 @@ MainApplication::MainApplication(int &argc, char** argv)
#ifdef GIT_REVISION #ifdef GIT_REVISION
setApplicationVersion(QSL("%1 (%2)").arg(Qz::VERSION, GIT_REVISION)); setApplicationVersion(QSL("%1 (%2)").arg(Qz::VERSION, GIT_REVISION));
#else #else
setApplicationVersion(Qz::VERSION); setApplicationVersion(QString::fromLatin1(Qz::VERSION));
#endif #endif
// Set fallback icon theme (eg. on Windows/Mac) // Set fallback icon theme (eg. on Windows/Mac)
@ -128,7 +128,7 @@ MainApplication::MainApplication(int &argc, char** argv)
// QSQLITE database plugin is required // QSQLITE database plugin is required
if (!QSqlDatabase::isDriverAvailable(QSL("QSQLITE"))) { if (!QSqlDatabase::isDriverAvailable(QSL("QSQLITE"))) {
QMessageBox::critical(0, QSL("Error"), QSL("Qt SQLite database plugin is not available. Please install it and restart the application.")); QMessageBox::critical(nullptr, QSL("Error"), QSL("Qt SQLite database plugin is not available. Please install it and restart the application."));
m_isClosing = true; m_isClosing = true;
return; return;
} }
@ -663,7 +663,7 @@ void MainApplication::startPrivateBrowsing(const QUrl &startUrl)
void MainApplication::reloadUserStyleSheet() void MainApplication::reloadUserStyleSheet()
{ {
const QString userCssFile = Settings().value("Web-Browser-Settings/userStyleSheet", QString()).toString(); const QString userCssFile = Settings().value(QSL("Web-Browser-Settings/userStyleSheet"), QString()).toString();
setUserStyleSheet(userCssFile); setUserStyleSheet(userCssFile);
} }
@ -764,19 +764,19 @@ void MainApplication::saveSettings()
m_isClosing = true; m_isClosing = true;
Settings settings; Settings settings;
settings.beginGroup("SessionRestore"); settings.beginGroup(QSL("SessionRestore"));
settings.setValue("isRunning", false); settings.setValue(QSL("isRunning"), false);
settings.setValue("isRestoring", false); settings.setValue(QSL("isRestoring"), false);
settings.endGroup(); settings.endGroup();
settings.beginGroup("Web-Browser-Settings"); settings.beginGroup(QSL("Web-Browser-Settings"));
bool deleteCache = settings.value("deleteCacheOnClose", false).toBool(); bool deleteCache = settings.value(QSL("deleteCacheOnClose"), false).toBool();
bool deleteHistory = settings.value("deleteHistoryOnClose", false).toBool(); bool deleteHistory = settings.value(QSL("deleteHistoryOnClose"), false).toBool();
bool deleteHtml5Storage = settings.value("deleteHTML5StorageOnClose", false).toBool(); bool deleteHtml5Storage = settings.value(QSL("deleteHTML5StorageOnClose"), false).toBool();
settings.endGroup(); settings.endGroup();
settings.beginGroup("Cookie-Settings"); settings.beginGroup(QSL("Cookie-Settings"));
bool deleteCookies = settings.value("deleteCookiesOnClose", false).toBool(); bool deleteCookies = settings.value(QSL("deleteCookiesOnClose"), false).toBool();
settings.endGroup(); settings.endGroup();
if (deleteHistory) { if (deleteHistory) {
@ -941,7 +941,7 @@ void MainApplication::loadSettings()
setUserStyleSheet(userCss); setUserStyleSheet(userCss);
settings.beginGroup("Browser-Fonts"); settings.beginGroup(QSL("Browser-Fonts"));
webSettings->setFontFamily(QWebEngineSettings::StandardFont, settings.value(QSL("StandardFont"), webSettings->fontFamily(QWebEngineSettings::StandardFont)).toString()); 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::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::FantasyFont, settings.value(QSL("FantasyFont"), webSettings->fontFamily(QWebEngineSettings::FantasyFont)).toString());
@ -1019,7 +1019,7 @@ void MainApplication::loadTheme(const QString &name)
qss.append(QzTools::readAllFileContents(DataPaths::currentProfilePath() + QL1S("/userChrome.css"))); qss.append(QzTools::readAllFileContents(DataPaths::currentProfilePath() + QL1S("/userChrome.css")));
QString relativePath = QDir::current().relativeFilePath(activeThemePath); QString relativePath = QDir::current().relativeFilePath(activeThemePath);
qss.replace(QRegularExpression(QSL("url\\s*\\(\\s*([^\\*:\\);]+)\\s*\\)")), QString("url(%1/\\1)").arg(relativePath)); qss.replace(QRegularExpression(QSL("url\\s*\\(\\s*([^\\*:\\);]+)\\s*\\)")), QSL("url(%1/\\1)").arg(relativePath));
setStyleSheet(qss); setStyleSheet(qss);
} }
@ -1031,7 +1031,7 @@ void MainApplication::checkDefaultWebBrowser()
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2) #if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
Settings settings; Settings settings;
bool checkNow = settings.value("Web-Browser-Settings/CheckDefaultBrowser", DEFAULT_CHECK_DEFAULTBROWSER).toBool(); bool checkNow = settings.value(QSL("Web-Browser-Settings/CheckDefaultBrowser"), DEFAULT_CHECK_DEFAULTBROWSER).toBool();
if (!checkNow) { if (!checkNow) {
return; return;
@ -1056,7 +1056,7 @@ void MainApplication::checkDefaultWebBrowser()
checkAgain = dialog.isChecked(); checkAgain = dialog.isChecked();
} }
settings.setValue("Web-Browser-Settings/CheckDefaultBrowser", checkAgain); settings.setValue(QSL("Web-Browser-Settings/CheckDefaultBrowser"), checkAgain);
#endif #endif
} }

View File

@ -22,9 +22,9 @@
AutoFillIcon::AutoFillIcon(QWidget* parent) AutoFillIcon::AutoFillIcon(QWidget* parent)
: ClickableLabel(parent) : ClickableLabel(parent)
, m_view(0) , m_view(nullptr)
{ {
setObjectName("locationbar-autofillicon"); setObjectName(QSL("locationbar-autofillicon"));
setCursor(Qt::PointingHandCursor); setCursor(Qt::PointingHandCursor);
setToolTip(AutoFillWidget::tr("Choose username to login")); setToolTip(AutoFillWidget::tr("Choose username to login"));
setFocusPolicy(Qt::ClickFocus); setFocusPolicy(Qt::ClickFocus);

View File

@ -28,7 +28,7 @@ class FALKON_EXPORT AutoFillIcon : public ClickableLabel
Q_OBJECT Q_OBJECT
public: public:
explicit AutoFillIcon(QWidget* parent = 0); explicit AutoFillIcon(QWidget* parent = nullptr);
void setWebView(WebView* view); void setWebView(WebView* view);
void setUsernames(const QStringList &usernames); void setUsernames(const QStringList &usernames);

View File

@ -43,8 +43,8 @@ void AutoFillWidget::setUsernames(const QStringList &usernames)
} }
QPushButton* button = new QPushButton(this); QPushButton* button = new QPushButton(this);
button->setIcon(QIcon(":icons/other/login.png")); button->setIcon(QIcon(QSL(":icons/other/login.png")));
button->setStyleSheet("text-align:left;font-weight:bold;"); button->setStyleSheet(QSL("text-align:left;font-weight:bold;"));
button->setText(username); button->setText(username);
button->setFlat(true); button->setFlat(true);

View File

@ -36,7 +36,7 @@ class FALKON_EXPORT AutoFillWidget : public LocationBarPopup
Q_OBJECT Q_OBJECT
public: public:
explicit AutoFillWidget(WebView* view, QWidget* parent = 0); explicit AutoFillWidget(WebView* view, QWidget* parent = nullptr);
~AutoFillWidget(); ~AutoFillWidget();
void setUsernames(const QStringList &usernames); void setUsernames(const QStringList &usernames);

View File

@ -37,8 +37,8 @@ QVector<PasswordEntry> DatabasePasswordBackend::getEntries(const QUrl &url)
const QString host = PasswordManager::createHost(url); const QString host = PasswordManager::createHost(url);
QSqlQuery query(SqlDatabase::instance()->database()); QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT id, username, password, data FROM autofill " query.prepare(QSL("SELECT id, username, password, data FROM autofill "
"WHERE server=? ORDER BY last_used DESC"); "WHERE server=? ORDER BY last_used DESC"));
query.addBindValue(host); query.addBindValue(host);
query.exec(); query.exec();
@ -63,7 +63,7 @@ QVector<PasswordEntry> DatabasePasswordBackend::getAllEntries()
QVector<PasswordEntry> list; QVector<PasswordEntry> list;
QSqlQuery query(SqlDatabase::instance()->database()); QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT id, server, username, password, data FROM autofill"); query.prepare(QSL("SELECT id, server, username, password, data FROM autofill"));
query.exec(); query.exec();
while (query.next()) { while (query.next()) {
@ -86,7 +86,7 @@ void DatabasePasswordBackend::addEntry(const PasswordEntry &entry)
if (entry.data.isEmpty()) { if (entry.data.isEmpty()) {
// Multiple-usernames for HTTP/FTP authorization not supported // Multiple-usernames for HTTP/FTP authorization not supported
QSqlQuery query(SqlDatabase::instance()->database()); QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT username FROM autofill WHERE server=?"); query.prepare(QSL("SELECT username FROM autofill WHERE server=?"));
query.addBindValue(entry.host); query.addBindValue(entry.host);
query.exec(); query.exec();
@ -96,8 +96,8 @@ void DatabasePasswordBackend::addEntry(const PasswordEntry &entry)
} }
QSqlQuery query(SqlDatabase::instance()->database()); QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("INSERT INTO autofill (server, data, username, password, last_used) " query.prepare(QSL("INSERT INTO autofill (server, data, username, password, last_used) "
"VALUES (?,?,?,?,strftime('%s', 'now'))"); "VALUES (?,?,?,?,strftime('%s', 'now'))"));
query.bindValue(0, entry.host); query.bindValue(0, entry.host);
query.bindValue(1, entry.data); query.bindValue(1, entry.data);
query.bindValue(2, entry.username); query.bindValue(2, entry.username);
@ -111,13 +111,13 @@ bool DatabasePasswordBackend::updateEntry(const PasswordEntry &entry)
// Data is empty only for HTTP/FTP authorization // Data is empty only for HTTP/FTP authorization
if (entry.data.isEmpty()) { if (entry.data.isEmpty()) {
query.prepare("UPDATE autofill SET username=?, password=? WHERE server=?"); query.prepare(QSL("UPDATE autofill SET username=?, password=? WHERE server=?"));
query.bindValue(0, entry.username); query.bindValue(0, entry.username);
query.bindValue(1, entry.password); query.bindValue(1, entry.password);
query.bindValue(2, entry.host); query.bindValue(2, entry.host);
} }
else { else {
query.prepare("UPDATE autofill SET data=?, username=?, password=? WHERE id=?"); query.prepare(QSL("UPDATE autofill SET data=?, username=?, password=? WHERE id=?"));
query.addBindValue(entry.data); query.addBindValue(entry.data);
query.addBindValue(entry.username); query.addBindValue(entry.username);
query.addBindValue(entry.password); query.addBindValue(entry.password);
@ -130,7 +130,7 @@ bool DatabasePasswordBackend::updateEntry(const PasswordEntry &entry)
void DatabasePasswordBackend::updateLastUsed(PasswordEntry &entry) void DatabasePasswordBackend::updateLastUsed(PasswordEntry &entry)
{ {
QSqlQuery query(SqlDatabase::instance()->database()); QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("UPDATE autofill SET last_used=strftime('%s', 'now') WHERE id=?"); query.prepare(QSL("UPDATE autofill SET last_used=strftime('%s', 'now') WHERE id=?"));
query.addBindValue(entry.id); query.addBindValue(entry.id);
query.exec(); query.exec();
} }
@ -138,7 +138,7 @@ void DatabasePasswordBackend::updateLastUsed(PasswordEntry &entry)
void DatabasePasswordBackend::removeEntry(const PasswordEntry &entry) void DatabasePasswordBackend::removeEntry(const PasswordEntry &entry)
{ {
QSqlQuery query(SqlDatabase::instance()->database()); QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("DELETE FROM autofill WHERE id=?"); query.prepare(QSL("DELETE FROM autofill WHERE id=?"));
query.addBindValue(entry.id); query.addBindValue(entry.id);
query.exec(); query.exec();
} }
@ -146,5 +146,5 @@ void DatabasePasswordBackend::removeEntry(const PasswordEntry &entry)
void DatabasePasswordBackend::removeAll() void DatabasePasswordBackend::removeAll()
{ {
QSqlQuery query(SqlDatabase::instance()->database()); QSqlQuery query(SqlDatabase::instance()->database());
query.exec("DELETE FROM autofill"); query.exec(QSL("DELETE FROM autofill"));
} }

View File

@ -61,25 +61,25 @@ QDataStream &operator >>(QDataStream &stream, PasswordEntry &entry)
PasswordManager::PasswordManager(QObject* parent) PasswordManager::PasswordManager(QObject* parent)
: QObject(parent) : QObject(parent)
, m_loaded(false) , m_loaded(false)
, m_backend(0) , m_backend(nullptr)
, m_databaseBackend(new DatabasePasswordBackend) , m_databaseBackend(new DatabasePasswordBackend)
, m_databaseEncryptedBackend(new DatabaseEncryptedPasswordBackend) , m_databaseEncryptedBackend(new DatabaseEncryptedPasswordBackend)
{ {
m_backends["database"] = m_databaseBackend; m_backends[QSL("database")] = m_databaseBackend;
m_backends["database-encrypted"] = m_databaseEncryptedBackend; m_backends[QSL("database-encrypted")] = m_databaseEncryptedBackend;
} }
void PasswordManager::loadSettings() void PasswordManager::loadSettings()
{ {
Settings settings; Settings settings;
settings.beginGroup("PasswordManager"); settings.beginGroup(QSL("PasswordManager"));
QString backendId = settings.value("Backend", "database").toString(); QString backendId = settings.value(QSL("Backend"), QSL("database")).toString();
settings.endGroup(); settings.endGroup();
if (m_backend) { if (m_backend) {
m_backend->setActive(false); m_backend->setActive(false);
} }
m_backend = m_backends[m_backends.contains(backendId) ? backendId : "database"]; m_backend = m_backends[m_backends.contains(backendId) ? backendId : QSL("database")];
m_backend->setActive(true); m_backend->setActive(true);
} }
@ -159,8 +159,8 @@ void PasswordManager::switchBackend(const QString &backendID)
m_backend->setActive(true); m_backend->setActive(true);
Settings settings; Settings settings;
settings.beginGroup("PasswordManager"); settings.beginGroup(QSL("PasswordManager"));
settings.setValue("Backend", backendID); settings.setValue(QSL("Backend"), backendID);
settings.endGroup(); settings.endGroup();
emit passwordBackendChanged(); emit passwordBackendChanged();

View File

@ -58,7 +58,7 @@ class FALKON_EXPORT PasswordManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit PasswordManager(QObject* parent = 0); explicit PasswordManager(QObject* parent = nullptr);
~PasswordManager(); ~PasswordManager();
void loadSettings(); void loadSettings();

View File

@ -31,7 +31,7 @@ static const int bookmarksVersion = 1;
Bookmarks::Bookmarks(QObject* parent) Bookmarks::Bookmarks(QObject* parent)
: QObject(parent) : QObject(parent)
, m_autoSaver(0) , m_autoSaver(nullptr)
{ {
m_autoSaver = new AutoSaver(this); m_autoSaver = new AutoSaver(this);
connect(m_autoSaver, SIGNAL(save()), this, SLOT(saveSettings())); connect(m_autoSaver, SIGNAL(save()), this, SLOT(saveSettings()));
@ -49,9 +49,9 @@ Bookmarks::~Bookmarks()
void Bookmarks::loadSettings() void Bookmarks::loadSettings()
{ {
Settings settings; Settings settings;
settings.beginGroup("Bookmarks"); settings.beginGroup(QSL("Bookmarks"));
m_showOnlyIconsInToolbar = settings.value("showOnlyIconsInToolbar", false).toBool(); m_showOnlyIconsInToolbar = settings.value(QSL("showOnlyIconsInToolbar"), false).toBool();
m_showOnlyTextInToolbar = settings.value("showOnlyTextInToolbar", false).toBool(); m_showOnlyTextInToolbar = settings.value(QSL("showOnlyTextInToolbar"), false).toBool();
settings.endGroup(); settings.endGroup();
} }
@ -191,9 +191,9 @@ void Bookmarks::setShowOnlyTextInToolbar(bool state)
void Bookmarks::saveSettings() void Bookmarks::saveSettings()
{ {
Settings settings; Settings settings;
settings.beginGroup("Bookmarks"); settings.beginGroup(QSL("Bookmarks"));
settings.setValue("showOnlyIconsInToolbar", m_showOnlyIconsInToolbar); settings.setValue(QSL("showOnlyIconsInToolbar"), m_showOnlyIconsInToolbar);
settings.setValue("showOnlyTextInToolbar", m_showOnlyTextInToolbar); settings.setValue(QSL("showOnlyTextInToolbar"), m_showOnlyTextInToolbar);
settings.endGroup(); settings.endGroup();
saveBookmarks(); saveBookmarks();
@ -254,13 +254,13 @@ void Bookmarks::loadBookmarks()
Q_ASSERT(err.error == QJsonParseError::NoError); Q_ASSERT(err.error == QJsonParseError::NoError);
Q_ASSERT(data.type() == QVariant::Map); Q_ASSERT(data.type() == QVariant::Map);
loadBookmarksFromMap(data.toMap().value("roots").toMap()); loadBookmarksFromMap(data.toMap().value(QSL("roots")).toMap());
// Don't forget to save the bookmarks // Don't forget to save the bookmarks
m_autoSaver->changeOccurred(); m_autoSaver->changeOccurred();
} }
else { else {
loadBookmarksFromMap(res.toMap().value("roots").toMap()); loadBookmarksFromMap(res.toMap().value(QSL("roots")).toMap());
} }
} }
@ -270,22 +270,22 @@ void Bookmarks::saveBookmarks()
#define WRITE_FOLDER(name, mapName, folder) \ #define WRITE_FOLDER(name, mapName, folder) \
QVariantMap mapName; \ QVariantMap mapName; \
mapName.insert("children", writeBookmarks(folder)); \ mapName.insert(QSL("children"), writeBookmarks(folder)); \
mapName.insert("expanded", folder->isExpanded()); \ mapName.insert(QSL("expanded"), folder->isExpanded()); \
mapName.insert("expanded_sidebar", folder->isSidebarExpanded()); \ mapName.insert(QSL("expanded_sidebar"), folder->isSidebarExpanded()); \
mapName.insert("name", folder->title()); \ mapName.insert(QSL("name"), folder->title()); \
mapName.insert("description", folder->description()); \ mapName.insert(QSL("description"), folder->description()); \
mapName.insert("type", "folder"); \ mapName.insert(QSL("type"), QSL("folder")); \
bookmarksMap.insert(name, mapName); bookmarksMap.insert(name, mapName);
WRITE_FOLDER("bookmark_bar", toolbarMap, m_folderToolbar) WRITE_FOLDER(QSL("bookmark_bar"), toolbarMap, m_folderToolbar)
WRITE_FOLDER("bookmark_menu", menuMap, m_folderMenu) WRITE_FOLDER(QSL("bookmark_menu"), menuMap, m_folderMenu)
WRITE_FOLDER("other", unsortedMap, m_folderUnsorted) WRITE_FOLDER(QSL("other"), unsortedMap, m_folderUnsorted)
#undef WRITE_FOLDER #undef WRITE_FOLDER
QVariantMap map; QVariantMap map;
map.insert("version", bookmarksVersion); map.insert(QSL("version"), bookmarksVersion);
map.insert("roots", bookmarksMap); map.insert(QSL("roots"), bookmarksMap);
const QJsonDocument json = QJsonDocument::fromVariant(map); const QJsonDocument json = QJsonDocument::fromVariant(map);
const QByteArray data = json.toJson(); const QByteArray data = json.toJson();
@ -308,13 +308,13 @@ void Bookmarks::saveBookmarks()
void Bookmarks::loadBookmarksFromMap(const QVariantMap &map) void Bookmarks::loadBookmarksFromMap(const QVariantMap &map)
{ {
#define READ_FOLDER(name, folder) \ #define READ_FOLDER(name, folder) \
readBookmarks(map.value(name).toMap().value("children").toList(), folder); \ readBookmarks(map.value(name).toMap().value(QSL("children")).toList(), folder); \
folder->setExpanded(map.value(name).toMap().value("expanded").toBool()); \ folder->setExpanded(map.value(name).toMap().value(QSL("expanded")).toBool()); \
folder->setSidebarExpanded(map.value(name).toMap().value("expanded_sidebar").toBool()); folder->setSidebarExpanded(map.value(name).toMap().value(QSL("expanded_sidebar")).toBool());
READ_FOLDER("bookmark_bar", m_folderToolbar) READ_FOLDER(QSL("bookmark_bar"), m_folderToolbar)
READ_FOLDER("bookmark_menu", m_folderMenu) READ_FOLDER(QSL("bookmark_menu"), m_folderMenu)
READ_FOLDER("other", m_folderUnsorted) READ_FOLDER(QSL("other"), m_folderUnsorted)
#undef READ_FOLDER #undef READ_FOLDER
} }
@ -324,7 +324,7 @@ void Bookmarks::readBookmarks(const QVariantList &list, BookmarkItem* parent)
foreach (const QVariant &entry, list) { foreach (const QVariant &entry, list) {
const QVariantMap map = entry.toMap(); const QVariantMap map = entry.toMap();
BookmarkItem::Type type = BookmarkItem::typeFromString(map.value("type").toString()); BookmarkItem::Type type = BookmarkItem::typeFromString(map.value(QSL("type")).toString());
if (type == BookmarkItem::Invalid) { if (type == BookmarkItem::Invalid) {
continue; continue;
@ -334,26 +334,26 @@ void Bookmarks::readBookmarks(const QVariantList &list, BookmarkItem* parent)
switch (type) { switch (type) {
case BookmarkItem::Url: case BookmarkItem::Url:
item->setUrl(QUrl::fromEncoded(map.value("url").toByteArray())); item->setUrl(QUrl::fromEncoded(map.value(QSL("url")).toByteArray()));
item->setTitle(map.value("name").toString()); item->setTitle(map.value(QSL("name")).toString());
item->setDescription(map.value("description").toString()); item->setDescription(map.value(QSL("description")).toString());
item->setKeyword(map.value("keyword").toString()); item->setKeyword(map.value(QSL("keyword")).toString());
item->setVisitCount(map.value("visit_count").toInt()); item->setVisitCount(map.value(QSL("visit_count")).toInt());
break; break;
case BookmarkItem::Folder: case BookmarkItem::Folder:
item->setTitle(map.value("name").toString()); item->setTitle(map.value(QSL("name")).toString());
item->setDescription(map.value("description").toString()); item->setDescription(map.value(QSL("description")).toString());
item->setExpanded(map.value("expanded").toBool()); item->setExpanded(map.value(QSL("expanded")).toBool());
item->setSidebarExpanded(map.value("expanded_sidebar").toBool()); item->setSidebarExpanded(map.value(QSL("expanded_sidebar")).toBool());
break; break;
default: default:
break; break;
} }
if (map.contains("children")) { if (map.contains(QSL("children"))) {
readBookmarks(map.value("children").toList(), item); readBookmarks(map.value(QSL("children")).toList(), item);
} }
} }
} }
@ -366,22 +366,22 @@ QVariantList Bookmarks::writeBookmarks(BookmarkItem* parent)
foreach (BookmarkItem* child, parent->children()) { foreach (BookmarkItem* child, parent->children()) {
QVariantMap map; QVariantMap map;
map.insert("type", BookmarkItem::typeToString(child->type())); map.insert(QSL("type"), BookmarkItem::typeToString(child->type()));
switch (child->type()) { switch (child->type()) {
case BookmarkItem::Url: case BookmarkItem::Url:
map.insert("url", child->urlString()); map.insert(QSL("url"), child->urlString());
map.insert("name", child->title()); map.insert(QSL("name"), child->title());
map.insert("description", child->description()); map.insert(QSL("description"), child->description());
map.insert("keyword", child->keyword()); map.insert(QSL("keyword"), child->keyword());
map.insert("visit_count", child->visitCount()); map.insert(QSL("visit_count"), child->visitCount());
break; break;
case BookmarkItem::Folder: case BookmarkItem::Folder:
map.insert("name", child->title()); map.insert(QSL("name"), child->title());
map.insert("description", child->description()); map.insert(QSL("description"), child->description());
map.insert("expanded", child->isExpanded()); map.insert(QSL("expanded"), child->isExpanded());
map.insert("expanded_sidebar", child->isSidebarExpanded()); map.insert(QSL("expanded_sidebar"), child->isSidebarExpanded());
break; break;
default: default:
@ -389,7 +389,7 @@ QVariantList Bookmarks::writeBookmarks(BookmarkItem* parent)
} }
if (!child->children().isEmpty()) { if (!child->children().isEmpty()) {
map.insert("children", writeBookmarks(child)); map.insert(QSL("children"), writeBookmarks(child));
} }
list.append(map); list.append(map);

View File

@ -33,7 +33,7 @@ class FALKON_EXPORT Bookmarks : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Bookmarks(QObject* parent = 0); explicit Bookmarks(QObject* parent = nullptr);
~Bookmarks(); ~Bookmarks();
void loadSettings(); void loadSettings();

View File

@ -34,9 +34,9 @@ BookmarksImportDialog::BookmarksImportDialog(QWidget* parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::BookmarksImportDialog) , ui(new Ui::BookmarksImportDialog)
, m_currentPage(0) , m_currentPage(0)
, m_importer(0) , m_importer(nullptr)
, m_importedFolder(0) , m_importedFolder(nullptr)
, m_model(0) , m_model(nullptr)
{ {
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this); ui->setupUi(this);
@ -56,7 +56,7 @@ BookmarksImportDialog::BookmarksImportDialog(QWidget* parent)
BookmarksImportDialog::~BookmarksImportDialog() BookmarksImportDialog::~BookmarksImportDialog()
{ {
ui->treeView->setModel(0); ui->treeView->setModel(nullptr);
delete m_model; delete m_model;
delete m_importedFolder; delete m_importedFolder;
delete m_importer; delete m_importer;
@ -148,7 +148,7 @@ void BookmarksImportDialog::previousPage()
ui->stackedWidget->setCurrentIndex(--m_currentPage); ui->stackedWidget->setCurrentIndex(--m_currentPage);
delete m_importer; delete m_importer;
m_importer = 0; m_importer = nullptr;
break; break;
case 2: case 2:
@ -159,12 +159,12 @@ void BookmarksImportDialog::previousPage()
ui->backButton->setEnabled(true); ui->backButton->setEnabled(true);
ui->stackedWidget->setCurrentIndex(--m_currentPage); ui->stackedWidget->setCurrentIndex(--m_currentPage);
ui->treeView->setModel(0); ui->treeView->setModel(nullptr);
delete m_model; delete m_model;
m_model = 0; m_model = nullptr;
delete m_importedFolder; delete m_importedFolder;
m_importedFolder = 0; m_importedFolder = nullptr;
break; break;
default: default:
@ -185,12 +185,12 @@ void BookmarksImportDialog::showImporterPage()
ui->iconLabel->setPixmap(ui->browserList->currentItem()->icon().pixmap(48)); ui->iconLabel->setPixmap(ui->browserList->currentItem()->icon().pixmap(48));
ui->importingFromLabel->setText(tr("<b>Importing from %1</b>").arg(ui->browserList->currentItem()->text())); ui->importingFromLabel->setText(tr("<b>Importing from %1</b>").arg(ui->browserList->currentItem()->text()));
ui->fileText1->setText(m_importer->description()); ui->fileText1->setText(m_importer->description());
ui->standardDirLabel->setText(QString("<i>%1</i>").arg(m_importer->standardPath())); ui->standardDirLabel->setText(QSL("<i>%1</i>").arg(m_importer->standardPath()));
} }
void BookmarksImportDialog::showExportedBookmarks() void BookmarksImportDialog::showExportedBookmarks()
{ {
m_model = new BookmarksModel(m_importedFolder, 0, this); m_model = new BookmarksModel(m_importedFolder, nullptr, this);
ui->treeView->setModel(m_model); ui->treeView->setModel(m_model);
ui->treeView->header()->resizeSection(0, ui->treeView->header()->width() / 2); ui->treeView->header()->resizeSection(0, ui->treeView->header()->width() / 2);
ui->treeView->expandAll(); ui->treeView->expandAll();
@ -199,5 +199,5 @@ void BookmarksImportDialog::showExportedBookmarks()
void BookmarksImportDialog::addExportedBookmarks() void BookmarksImportDialog::addExportedBookmarks()
{ {
mApp->bookmarks()->addBookmark(mApp->bookmarks()->unsortedFolder(), m_importedFolder); mApp->bookmarks()->addBookmark(mApp->bookmarks()->unsortedFolder(), m_importedFolder);
m_importedFolder = 0; m_importedFolder = nullptr;
} }

View File

@ -47,7 +47,7 @@ QString ChromeImporter::standardPath() const
QString ChromeImporter::getPath(QWidget* parent) QString ChromeImporter::getPath(QWidget* parent)
{ {
m_path = QFileDialog::getOpenFileName(parent, BookmarksImporter::tr("Choose file..."), standardPath(), "Bookmarks (Bookmarks)"); m_path = QFileDialog::getOpenFileName(parent, BookmarksImporter::tr("Choose file..."), standardPath(), QSL("Bookmarks (Bookmarks)"));
return m_path; return m_path;
} }
@ -74,25 +74,25 @@ BookmarkItem* ChromeImporter::importBookmarks()
if (err.error != QJsonParseError::NoError || res.type() != QVariant::Map) { if (err.error != QJsonParseError::NoError || res.type() != QVariant::Map) {
setError(BookmarksImporter::tr("Cannot parse JSON file!")); setError(BookmarksImporter::tr("Cannot parse JSON file!"));
return 0; return nullptr;
} }
QVariantMap rootMap = res.toMap().value("roots").toMap(); QVariantMap rootMap = res.toMap().value(QSL("roots")).toMap();
BookmarkItem* root = new BookmarkItem(BookmarkItem::Folder); BookmarkItem* root = new BookmarkItem(BookmarkItem::Folder);
root->setTitle("Chrome Import"); root->setTitle(QSL("Chrome Import"));
BookmarkItem* toolbar = new BookmarkItem(BookmarkItem::Folder, root); BookmarkItem* toolbar = new BookmarkItem(BookmarkItem::Folder, root);
toolbar->setTitle(rootMap.value("bookmark_bar").toMap().value("name").toString()); toolbar->setTitle(rootMap.value(QSL("bookmark_bar")).toMap().value(QSL("name")).toString());
readBookmarks(rootMap.value("bookmark_bar").toMap().value("children").toList(), toolbar); readBookmarks(rootMap.value(QSL("bookmark_bar")).toMap().value(QSL("children")).toList(), toolbar);
BookmarkItem* other = new BookmarkItem(BookmarkItem::Folder, root); BookmarkItem* other = new BookmarkItem(BookmarkItem::Folder, root);
other->setTitle(rootMap.value("other").toMap().value("name").toString()); other->setTitle(rootMap.value(QSL("other")).toMap().value(QSL("name")).toString());
readBookmarks(rootMap.value("other").toMap().value("children").toList(), other); readBookmarks(rootMap.value(QSL("other")).toMap().value(QSL("children")).toList(), other);
BookmarkItem* synced = new BookmarkItem(BookmarkItem::Folder, root); BookmarkItem* synced = new BookmarkItem(BookmarkItem::Folder, root);
synced->setTitle(rootMap.value("synced").toMap().value("name").toString()); synced->setTitle(rootMap.value(QSL("synced")).toMap().value(QSL("name")).toString());
readBookmarks(rootMap.value("synced").toMap().value("synced").toList(), other); readBookmarks(rootMap.value(QSL("synced")).toMap().value(QSL("synced")).toList(), other);
return root; return root;
} }
@ -103,7 +103,7 @@ void ChromeImporter::readBookmarks(const QVariantList &list, BookmarkItem* paren
foreach (const QVariant &entry, list) { foreach (const QVariant &entry, list) {
const QVariantMap map = entry.toMap(); const QVariantMap map = entry.toMap();
const QString typeString = map.value("type").toString(); const QString typeString = map.value(QSL("type")).toString();
BookmarkItem::Type type; BookmarkItem::Type type;
if (typeString == QLatin1String("url")) { if (typeString == QLatin1String("url")) {
@ -117,14 +117,14 @@ void ChromeImporter::readBookmarks(const QVariantList &list, BookmarkItem* paren
} }
BookmarkItem* item = new BookmarkItem(type, parent); BookmarkItem* item = new BookmarkItem(type, parent);
item->setTitle(map.value("name").toString()); item->setTitle(map.value(QSL("name")).toString());
if (item->isUrl()) { if (item->isUrl()) {
item->setUrl(QUrl::fromEncoded(map.value("url").toByteArray())); item->setUrl(QUrl::fromEncoded(map.value(QSL("url")).toByteArray()));
} }
if (map.contains("children")) { if (map.contains(QSL("children"))) {
readBookmarks(map.value("children").toList(), item); readBookmarks(map.value(QSL("children")).toList(), item);
} }
} }
} }

View File

@ -34,7 +34,7 @@ BookmarksManager::BookmarksManager(BrowserWindow* window, QWidget* parent)
, ui(new Ui::BookmarksManager) , ui(new Ui::BookmarksManager)
, m_window(window) , m_window(window)
, m_bookmarks(mApp->bookmarks()) , m_bookmarks(mApp->bookmarks())
, m_selectedBookmark(0) , m_selectedBookmark(nullptr)
, m_blockDescriptionChangedSignal(false) , m_blockDescriptionChangedSignal(false)
, m_adjustHeaderSizesOnShow(true) , m_adjustHeaderSizesOnShow(true)
{ {
@ -48,7 +48,7 @@ BookmarksManager::BookmarksManager(BrowserWindow* window, QWidget* parent)
connect(ui->tree, SIGNAL(contextMenuRequested(QPoint)), this, SLOT(createContextMenu(QPoint))); connect(ui->tree, SIGNAL(contextMenuRequested(QPoint)), this, SLOT(createContextMenu(QPoint)));
// Box for editing bookmarks // Box for editing bookmarks
updateEditBox(0); updateEditBox(nullptr);
connect(ui->title, SIGNAL(textEdited(QString)), this, SLOT(bookmarkEdited())); connect(ui->title, SIGNAL(textEdited(QString)), this, SLOT(bookmarkEdited()));
connect(ui->address, SIGNAL(textEdited(QString)), this, SLOT(bookmarkEdited())); connect(ui->address, SIGNAL(textEdited(QString)), this, SLOT(bookmarkEdited()));
connect(ui->keyword, SIGNAL(textEdited(QString)), this, SLOT(bookmarkEdited())); connect(ui->keyword, SIGNAL(textEdited(QString)), this, SLOT(bookmarkEdited()));
@ -90,8 +90,8 @@ void BookmarksManager::bookmarkShiftActivated(BookmarkItem* item)
void BookmarksManager::bookmarksSelected(const QList<BookmarkItem*> &items) void BookmarksManager::bookmarksSelected(const QList<BookmarkItem*> &items)
{ {
if (items.size() != 1) { if (items.size() != 1) {
m_selectedBookmark = 0; m_selectedBookmark = nullptr;
updateEditBox(0); updateEditBox(nullptr);
} }
else { else {
m_selectedBookmark = items.at(0); m_selectedBookmark = items.at(0);
@ -111,7 +111,7 @@ void BookmarksManager::createContextMenu(const QPoint &pos)
menu.addAction(tr("New Folder"), this, SLOT(addFolder())); menu.addAction(tr("New Folder"), this, SLOT(addFolder()));
menu.addAction(tr("New Separator"), this, SLOT(addSeparator())); menu.addAction(tr("New Separator"), this, SLOT(addSeparator()));
menu.addSeparator(); menu.addSeparator();
QAction* actDelete = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); QAction* actDelete = menu.addAction(QIcon::fromTheme(QSL("edit-delete")), tr("Delete"));
connect(actNewTab, SIGNAL(triggered()), this, SLOT(openBookmarkInNewTab())); connect(actNewTab, SIGNAL(triggered()), this, SLOT(openBookmarkInNewTab()));
connect(actNewWindow, SIGNAL(triggered()), this, SLOT(openBookmarkInNewWindow())); connect(actNewWindow, SIGNAL(triggered()), this, SLOT(openBookmarkInNewWindow()));
@ -169,7 +169,7 @@ void BookmarksManager::addBookmark()
{ {
BookmarkItem* item = new BookmarkItem(BookmarkItem::Url); BookmarkItem* item = new BookmarkItem(BookmarkItem::Url);
item->setTitle(tr("New Bookmark")); item->setTitle(tr("New Bookmark"));
item->setUrl(QUrl("http://")); item->setUrl(QUrl(QSL("http://")));
addBookmark(item); addBookmark(item);
} }

View File

@ -31,8 +31,8 @@ SBI_NetworkIconDialog::SBI_NetworkIconDialog(QWidget* parent)
ui->setupUi(this); ui->setupUi(this);
ui->addButton->setIcon(QIcon::fromTheme("document-new", QIcon(":sbi/data/add.png"))); ui->addButton->setIcon(QIcon::fromTheme(QLatin1String("document-new"), QIcon(QLatin1String(":sbi/data/add.png"))));
ui->removeButton->setIcon(QIcon::fromTheme("edit-delete", QIcon(":sbi/data/remove.png"))); ui->removeButton->setIcon(QIcon::fromTheme(QLatin1String("edit-delete"), QIcon(QLatin1String(":sbi/data/remove.png"))));
const QHash<QString, SBI_NetworkProxy*> &proxies = SBINetManager->proxies(); const QHash<QString, SBI_NetworkProxy*> &proxies = SBINetManager->proxies();

View File

@ -23,12 +23,12 @@
#include <QSettings> #include <QSettings>
SBI_NetworkManager* SBI_NetworkManager::s_instance = 0; SBI_NetworkManager* SBI_NetworkManager::s_instance = nullptr;
SBI_NetworkManager::SBI_NetworkManager(const QString &settingsPath, QObject* parent) SBI_NetworkManager::SBI_NetworkManager(const QString &settingsPath, QObject* parent)
: QObject(parent) : QObject(parent)
, m_settingsFile(settingsPath + QL1S("/networkicon.ini")) , m_settingsFile(settingsPath + QL1S("/networkicon.ini"))
, m_currentProxy(0) , m_currentProxy(nullptr)
{ {
s_instance = this; s_instance = this;
@ -58,8 +58,8 @@ void SBI_NetworkManager::loadSettings()
m_proxies[group] = proxy; m_proxies[group] = proxy;
} }
const QString currentName = settings.value("CurrentProxy", QString()).toString(); const QString currentName = settings.value(QSL("CurrentProxy"), QString()).toString();
m_currentProxy = m_proxies.contains(currentName) ? m_proxies.value(currentName) : 0; m_currentProxy = m_proxies.contains(currentName) ? m_proxies.value(currentName) : nullptr;
applyCurrentProxy(); applyCurrentProxy();
} }
@ -77,9 +77,9 @@ SBI_NetworkProxy* SBI_NetworkManager::currentProxy() const
void SBI_NetworkManager::setCurrentProxy(const QString &name) void SBI_NetworkManager::setCurrentProxy(const QString &name)
{ {
QSettings settings(m_settingsFile, QSettings::IniFormat); QSettings settings(m_settingsFile, QSettings::IniFormat);
settings.setValue("CurrentProxy", name); settings.setValue(QSL("CurrentProxy"), name);
m_currentProxy = m_proxies.contains(name) ? m_proxies.value(name) : 0; m_currentProxy = m_proxies.contains(name) ? m_proxies.value(name) : nullptr;
applyCurrentProxy(); applyCurrentProxy();
} }