mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 10:16:34 +01:00
Add more QSL + nullptr
This commit is contained in:
parent
07b4dd4f6e
commit
db10e175f0
@ -67,36 +67,36 @@ void AdBlockTest::parseRegExpFilterTest_data()
|
||||
QTest::addColumn<QString>("parsedFilter");
|
||||
QTest::addColumn<QStringList>("result");
|
||||
|
||||
QTest::newRow("test1") << "||doubleclick.net/pfadx/tmg.telegraph."
|
||||
<< (QStringList() << "doubleclick.net/pfadx/tmg.telegraph.");
|
||||
QTest::newRow("test2") << "||doubleclick.net/pfadx/*.mtvi"
|
||||
<< (QStringList() << "doubleclick.net/pfadx/" << ".mtvi");
|
||||
QTest::newRow("test3") << "&prvtof=*&poru="
|
||||
<< (QStringList() << "&prvtof=" << "&poru=");
|
||||
QTest::newRow("test4") << "/addyn|*;adtech;"
|
||||
<< (QStringList() << "/addyn" << ";adtech;");
|
||||
QTest::newRow("test5") << "/eas_fif.html^"
|
||||
<< (QStringList() << "/eas_fif.html");
|
||||
QTest::newRow("test6") << "://findnsave.^.*/api/groupon.json?"
|
||||
<< (QStringList() << "://findnsave." << "/api/groupon.json?");
|
||||
QTest::newRow("test7") << "^fp=*&prvtof="
|
||||
<< (QStringList() << "fp=" << "&prvtof=");
|
||||
QTest::newRow("test8") << "|http://ax-d.*/jstag^"
|
||||
<< (QStringList() << "http://ax-d." << "/jstag");
|
||||
QTest::newRow("test9") << "||reuters.com^*/rcom-wt-mlt.js"
|
||||
<< (QStringList() << "reuters.com" <<"/rcom-wt-mlt.js");
|
||||
QTest::newRow("test10") << "||chip.de^*/tracking.js"
|
||||
<< (QStringList() << "chip.de" << "/tracking.js");
|
||||
QTest::newRow("ignore1char") << "/search.php?uid=*.*&src="
|
||||
<< (QStringList() << "/search.php?uid=" << "&src=");
|
||||
QTest::newRow("ignoreDuplicates") << "/search.*.dup.*.dup.*&src="
|
||||
<< (QStringList() << "/search." << ".dup." << "&src=");
|
||||
QTest::newRow("test1") << QSL("||doubleclick.net/pfadx/tmg.telegraph.")
|
||||
<< (QStringList() << QSL("doubleclick.net/pfadx/tmg.telegraph."));
|
||||
QTest::newRow("test2") << QSL("||doubleclick.net/pfadx/*.mtvi")
|
||||
<< (QStringList() << QSL("doubleclick.net/pfadx/") << QSL(".mtvi"));
|
||||
QTest::newRow("test3") << QSL("&prvtof=*&poru=")
|
||||
<< (QStringList() << QSL("&prvtof=") << QSL("&poru="));
|
||||
QTest::newRow("test4") << QSL("/addyn|*;adtech;")
|
||||
<< (QStringList() << QSL("/addyn") << QSL(";adtech;"));
|
||||
QTest::newRow("test5") << QSL("/eas_fif.html^")
|
||||
<< (QStringList() << QSL("/eas_fif.html"));
|
||||
QTest::newRow("test6") << QSL("://findnsave.^.*/api/groupon.json?")
|
||||
<< (QStringList() << QSL("://findnsave.") << QSL("/api/groupon.json?"));
|
||||
QTest::newRow("test7") << QSL("^fp=*&prvtof=")
|
||||
<< (QStringList() << QSL("fp=") << QSL("&prvtof="));
|
||||
QTest::newRow("test8") << QSL("|http://ax-d.*/jstag^")
|
||||
<< (QStringList() << QSL("http://ax-d.") << QSL("/jstag"));
|
||||
QTest::newRow("test9") << QSL("||reuters.com^*/rcom-wt-mlt.js")
|
||||
<< (QStringList() << QSL("reuters.com") <<QSL("/rcom-wt-mlt.js"));
|
||||
QTest::newRow("test10") << QSL("||chip.de^*/tracking.js")
|
||||
<< (QStringList() << QSL("chip.de") << QSL("/tracking.js"));
|
||||
QTest::newRow("ignore1char") << QSL("/search.php?uid=*.*&src=")
|
||||
<< (QStringList() << QSL("/search.php?uid=") << QSL("&src="));
|
||||
QTest::newRow("ignoreDuplicates") << QSL("/search.*.dup.*.dup.*&src=")
|
||||
<< (QStringList() << QSL("/search.") << QSL(".dup.") << QSL("&src="));
|
||||
QTest::newRow("empty") << QString()
|
||||
<< (QStringList());
|
||||
QTest::newRow("justspaces") << QString(" ")
|
||||
<< (QStringList() << " ");
|
||||
QTest::newRow("spacesWithMetachars") << QString(" * ?")
|
||||
<< (QStringList() << " " << " ?");
|
||||
QTest::newRow("justspaces") << QSL(" ")
|
||||
<< (QStringList() << QSL(" "));
|
||||
QTest::newRow("spacesWithMetachars") << QSL(" * ?")
|
||||
<< (QStringList() << QSL(" ") << QSL(" ?"));
|
||||
}
|
||||
|
||||
void AdBlockTest::parseRegExpFilterTest()
|
||||
@ -111,13 +111,13 @@ void AdBlockTest::parseRegExpFilterTest()
|
||||
|
||||
void AdBlockTest::ignoreEmptyLinesInSubscriptionTest()
|
||||
{
|
||||
AdBlockSubscription subscription("test-subscription");
|
||||
subscription.setFilePath(":autotests/data/adblock_empty_lines.txt");
|
||||
AdBlockSubscription subscription(QSL("test-subscription"));
|
||||
subscription.setFilePath(QSL(":autotests/data/adblock_empty_lines.txt"));
|
||||
subscription.loadSubscription({});
|
||||
|
||||
QCOMPARE(subscription.allRules().count(), 3);
|
||||
QCOMPARE(subscription.allRules().at(0)->filter(), QString("filter.com"));
|
||||
QCOMPARE(subscription.allRules().at(1)->filter(), QString("test"));
|
||||
QCOMPARE(subscription.allRules().at(0)->filter(), QSL("filter.com"));
|
||||
QCOMPARE(subscription.allRules().at(1)->filter(), QSL("test"));
|
||||
QCOMPARE(subscription.allRules().at(2)->isComment(), true);
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,8 @@ void DatabaseEncryptedPasswordBackendTest::init()
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::database();
|
||||
if (!db.isValid()) {
|
||||
db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
db.setDatabaseName(":memory:");
|
||||
db = QSqlDatabase::addDatabase(QSL("QSQLITE"));
|
||||
db.setDatabaseName(QSL(":memory:"));
|
||||
}
|
||||
db.open();
|
||||
}
|
||||
|
@ -29,12 +29,12 @@ void DatabasePasswordBackendTest::reloadBackend()
|
||||
|
||||
void DatabasePasswordBackendTest::init()
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
db.setDatabaseName(":memory:");
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase(QSL("QSQLITE"));
|
||||
db.setDatabaseName(QSL(":memory:"));
|
||||
db.open();
|
||||
|
||||
db.exec("CREATE TABLE autofill (data TEXT, id INTEGER PRIMARY KEY, password TEXT,"
|
||||
"server TEXT, username TEXT, last_used NUMERIC)");
|
||||
db.exec(QSL("CREATE TABLE autofill (data TEXT, id INTEGER PRIMARY KEY, password TEXT,"
|
||||
"server TEXT, username TEXT, last_used NUMERIC)"));
|
||||
}
|
||||
|
||||
void DatabasePasswordBackendTest::cleanup()
|
||||
|
@ -166,9 +166,9 @@ void PasswordBackendTest::removeAllTest()
|
||||
entry.username.append(QSL("s"));
|
||||
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();
|
||||
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();
|
||||
|
||||
|
@ -42,7 +42,7 @@ void SqlDatabaseTest::sqlQueryJobTest()
|
||||
QTemporaryFile file;
|
||||
file.open();
|
||||
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase(QSL("QSQLITE"));
|
||||
db.setDatabaseName(file.fileName());
|
||||
db.open();
|
||||
|
||||
@ -51,37 +51,37 @@ void SqlDatabaseTest::sqlQueryJobTest()
|
||||
QCOMPARE(db.tables().count(), 0);
|
||||
|
||||
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();
|
||||
QVERIFY(waitForFinished(job));
|
||||
QVERIFY(!job->error().isValid());
|
||||
|
||||
QCOMPARE(db.tables(), QStringList{"test1"});
|
||||
QCOMPARE(db.tables(), QStringList{QSL("test1")});
|
||||
|
||||
job = new SqlQueryJob();
|
||||
job->setQuery("INSERT INTO test1 (data) VALUES (?)");
|
||||
job->addBindValue("test-value");
|
||||
job->setQuery(QSL("INSERT INTO test1 (data) VALUES (?)"));
|
||||
job->addBindValue(QSL("test-value"));
|
||||
job->start();
|
||||
QVERIFY(waitForFinished(job));
|
||||
QVERIFY(!job->error().isValid());
|
||||
|
||||
QCOMPARE(job->lastInsertId().toInt(), 1);
|
||||
QSqlQuery query("SELECT data FROM test1", db);
|
||||
QSqlQuery query(QSL("SELECT data FROM test1"), db);
|
||||
query.next();
|
||||
QCOMPARE(query.value(0).toString(), QString("test-value"));
|
||||
QCOMPARE(query.value(0).toString(), QSL("test-value"));
|
||||
QVERIFY(!query.next());
|
||||
|
||||
job = new SqlQueryJob();
|
||||
job->setQuery("SELECT data FROM test1");
|
||||
job->setQuery(QSL("SELECT data FROM test1"));
|
||||
job->start();
|
||||
QVERIFY(waitForFinished(job));
|
||||
QVERIFY(!job->error().isValid());
|
||||
|
||||
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->setQuery("SELECT invalid sql syntax; 1321sdsa from");
|
||||
job->setQuery(QSL("SELECT invalid sql syntax; 1321sdsa from"));
|
||||
job->start();
|
||||
QVERIFY(waitForFinished(job));
|
||||
QVERIFY(job->error().isValid());
|
||||
|
@ -57,7 +57,7 @@
|
||||
|
||||
AdBlockSubscription::AdBlockSubscription(const QString &title, QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_reply(0)
|
||||
, m_reply(nullptr)
|
||||
, m_title(title)
|
||||
, m_updated(false)
|
||||
{
|
||||
@ -191,7 +191,7 @@ bool AdBlockSubscription::saveDownloadedData(const QByteArray &data)
|
||||
}
|
||||
|
||||
// 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.commit();
|
||||
return true;
|
||||
@ -200,7 +200,7 @@ bool AdBlockSubscription::saveDownloadedData(const QByteArray &data)
|
||||
const AdBlockRule* AdBlockSubscription::rule(int offset) const
|
||||
{
|
||||
if (!QzTools::containsIndex(m_rules, offset)) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_rules[offset];
|
||||
@ -214,7 +214,7 @@ QVector<AdBlockRule*> AdBlockSubscription::allRules() const
|
||||
const AdBlockRule* AdBlockSubscription::enableRule(int offset)
|
||||
{
|
||||
if (!QzTools::containsIndex(m_rules, offset)) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AdBlockRule* rule = m_rules[offset];
|
||||
@ -232,7 +232,7 @@ const AdBlockRule* AdBlockSubscription::enableRule(int offset)
|
||||
const AdBlockRule* AdBlockSubscription::disableRule(int offset)
|
||||
{
|
||||
if (!QzTools::containsIndex(m_rules, offset)) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AdBlockRule* rule = m_rules[offset];
|
||||
@ -273,7 +273,7 @@ const AdBlockRule* AdBlockSubscription::replaceRule(AdBlockRule* rule, int offse
|
||||
{
|
||||
Q_UNUSED(rule)
|
||||
Q_UNUSED(offset)
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AdBlockSubscription::~AdBlockSubscription()
|
||||
|
@ -60,7 +60,7 @@ class FALKON_EXPORT AdBlockSubscription : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AdBlockSubscription(const QString &title, QObject* parent = 0);
|
||||
explicit AdBlockSubscription(const QString &title, QObject* parent = nullptr);
|
||||
~AdBlockSubscription();
|
||||
|
||||
QString title() const;
|
||||
@ -116,7 +116,7 @@ class AdBlockCustomList : public AdBlockSubscription
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AdBlockCustomList(QObject* parent = 0);
|
||||
explicit AdBlockCustomList(QObject* parent = nullptr);
|
||||
|
||||
void loadSubscription(const QStringList &disabledRules);
|
||||
void saveSubscription();
|
||||
|
@ -86,23 +86,23 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
, m_isPortable(false)
|
||||
, m_isClosing(false)
|
||||
, m_isStartingAfterCrash(false)
|
||||
, m_history(0)
|
||||
, m_bookmarks(0)
|
||||
, m_autoFill(0)
|
||||
, m_cookieJar(0)
|
||||
, m_plugins(0)
|
||||
, m_browsingLibrary(0)
|
||||
, m_networkManager(0)
|
||||
, m_restoreManager(0)
|
||||
, m_sessionManager(0)
|
||||
, m_downloadManager(0)
|
||||
, m_userAgentManager(0)
|
||||
, m_searchEnginesManager(0)
|
||||
, m_closedWindowsManager(0)
|
||||
, m_html5PermissionsManager(0)
|
||||
, m_desktopNotifications(0)
|
||||
, m_webProfile(0)
|
||||
, m_autoSaver(0)
|
||||
, m_history(nullptr)
|
||||
, m_bookmarks(nullptr)
|
||||
, m_autoFill(nullptr)
|
||||
, m_cookieJar(nullptr)
|
||||
, m_plugins(nullptr)
|
||||
, m_browsingLibrary(nullptr)
|
||||
, m_networkManager(nullptr)
|
||||
, m_restoreManager(nullptr)
|
||||
, m_sessionManager(nullptr)
|
||||
, m_downloadManager(nullptr)
|
||||
, m_userAgentManager(nullptr)
|
||||
, m_searchEnginesManager(nullptr)
|
||||
, m_closedWindowsManager(nullptr)
|
||||
, m_html5PermissionsManager(nullptr)
|
||||
, m_desktopNotifications(nullptr)
|
||||
, m_webProfile(nullptr)
|
||||
, m_autoSaver(nullptr)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
|
||||
, m_registerQAppAssociation(0)
|
||||
#endif
|
||||
@ -118,7 +118,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
#ifdef GIT_REVISION
|
||||
setApplicationVersion(QSL("%1 (%2)").arg(Qz::VERSION, GIT_REVISION));
|
||||
#else
|
||||
setApplicationVersion(Qz::VERSION);
|
||||
setApplicationVersion(QString::fromLatin1(Qz::VERSION));
|
||||
#endif
|
||||
|
||||
// Set fallback icon theme (eg. on Windows/Mac)
|
||||
@ -128,7 +128,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
|
||||
// QSQLITE database plugin is required
|
||||
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;
|
||||
return;
|
||||
}
|
||||
@ -663,7 +663,7 @@ void MainApplication::startPrivateBrowsing(const QUrl &startUrl)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -764,19 +764,19 @@ void MainApplication::saveSettings()
|
||||
m_isClosing = true;
|
||||
|
||||
Settings settings;
|
||||
settings.beginGroup("SessionRestore");
|
||||
settings.setValue("isRunning", false);
|
||||
settings.setValue("isRestoring", false);
|
||||
settings.beginGroup(QSL("SessionRestore"));
|
||||
settings.setValue(QSL("isRunning"), false);
|
||||
settings.setValue(QSL("isRestoring"), false);
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("Web-Browser-Settings");
|
||||
bool deleteCache = settings.value("deleteCacheOnClose", false).toBool();
|
||||
bool deleteHistory = settings.value("deleteHistoryOnClose", false).toBool();
|
||||
bool deleteHtml5Storage = settings.value("deleteHTML5StorageOnClose", false).toBool();
|
||||
settings.beginGroup(QSL("Web-Browser-Settings"));
|
||||
bool deleteCache = settings.value(QSL("deleteCacheOnClose"), false).toBool();
|
||||
bool deleteHistory = settings.value(QSL("deleteHistoryOnClose"), false).toBool();
|
||||
bool deleteHtml5Storage = settings.value(QSL("deleteHTML5StorageOnClose"), false).toBool();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("Cookie-Settings");
|
||||
bool deleteCookies = settings.value("deleteCookiesOnClose", false).toBool();
|
||||
settings.beginGroup(QSL("Cookie-Settings"));
|
||||
bool deleteCookies = settings.value(QSL("deleteCookiesOnClose"), false).toBool();
|
||||
settings.endGroup();
|
||||
|
||||
if (deleteHistory) {
|
||||
@ -941,7 +941,7 @@ void MainApplication::loadSettings()
|
||||
|
||||
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::CursiveFont, settings.value(QSL("CursiveFont"), webSettings->fontFamily(QWebEngineSettings::CursiveFont)).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")));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1031,7 +1031,7 @@ void MainApplication::checkDefaultWebBrowser()
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
|
||||
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) {
|
||||
return;
|
||||
@ -1056,7 +1056,7 @@ void MainApplication::checkDefaultWebBrowser()
|
||||
checkAgain = dialog.isChecked();
|
||||
}
|
||||
|
||||
settings.setValue("Web-Browser-Settings/CheckDefaultBrowser", checkAgain);
|
||||
settings.setValue(QSL("Web-Browser-Settings/CheckDefaultBrowser"), checkAgain);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,9 @@
|
||||
|
||||
AutoFillIcon::AutoFillIcon(QWidget* parent)
|
||||
: ClickableLabel(parent)
|
||||
, m_view(0)
|
||||
, m_view(nullptr)
|
||||
{
|
||||
setObjectName("locationbar-autofillicon");
|
||||
setObjectName(QSL("locationbar-autofillicon"));
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
setToolTip(AutoFillWidget::tr("Choose username to login"));
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
|
@ -28,7 +28,7 @@ class FALKON_EXPORT AutoFillIcon : public ClickableLabel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AutoFillIcon(QWidget* parent = 0);
|
||||
explicit AutoFillIcon(QWidget* parent = nullptr);
|
||||
|
||||
void setWebView(WebView* view);
|
||||
void setUsernames(const QStringList &usernames);
|
||||
|
@ -43,8 +43,8 @@ void AutoFillWidget::setUsernames(const QStringList &usernames)
|
||||
}
|
||||
|
||||
QPushButton* button = new QPushButton(this);
|
||||
button->setIcon(QIcon(":icons/other/login.png"));
|
||||
button->setStyleSheet("text-align:left;font-weight:bold;");
|
||||
button->setIcon(QIcon(QSL(":icons/other/login.png")));
|
||||
button->setStyleSheet(QSL("text-align:left;font-weight:bold;"));
|
||||
button->setText(username);
|
||||
button->setFlat(true);
|
||||
|
||||
|
@ -36,7 +36,7 @@ class FALKON_EXPORT AutoFillWidget : public LocationBarPopup
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AutoFillWidget(WebView* view, QWidget* parent = 0);
|
||||
explicit AutoFillWidget(WebView* view, QWidget* parent = nullptr);
|
||||
~AutoFillWidget();
|
||||
|
||||
void setUsernames(const QStringList &usernames);
|
||||
|
@ -37,8 +37,8 @@ QVector<PasswordEntry> DatabasePasswordBackend::getEntries(const QUrl &url)
|
||||
const QString host = PasswordManager::createHost(url);
|
||||
|
||||
QSqlQuery query(SqlDatabase::instance()->database());
|
||||
query.prepare("SELECT id, username, password, data FROM autofill "
|
||||
"WHERE server=? ORDER BY last_used DESC");
|
||||
query.prepare(QSL("SELECT id, username, password, data FROM autofill "
|
||||
"WHERE server=? ORDER BY last_used DESC"));
|
||||
query.addBindValue(host);
|
||||
query.exec();
|
||||
|
||||
@ -63,7 +63,7 @@ QVector<PasswordEntry> DatabasePasswordBackend::getAllEntries()
|
||||
QVector<PasswordEntry> list;
|
||||
|
||||
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();
|
||||
|
||||
while (query.next()) {
|
||||
@ -86,7 +86,7 @@ void DatabasePasswordBackend::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 FROM autofill WHERE server=?");
|
||||
query.prepare(QSL("SELECT username FROM autofill WHERE server=?"));
|
||||
query.addBindValue(entry.host);
|
||||
query.exec();
|
||||
|
||||
@ -96,8 +96,8 @@ void DatabasePasswordBackend::addEntry(const PasswordEntry &entry)
|
||||
}
|
||||
|
||||
QSqlQuery query(SqlDatabase::instance()->database());
|
||||
query.prepare("INSERT INTO autofill (server, data, username, password, last_used) "
|
||||
"VALUES (?,?,?,?,strftime('%s', 'now'))");
|
||||
query.prepare(QSL("INSERT INTO autofill (server, data, username, password, last_used) "
|
||||
"VALUES (?,?,?,?,strftime('%s', 'now'))"));
|
||||
query.bindValue(0, entry.host);
|
||||
query.bindValue(1, entry.data);
|
||||
query.bindValue(2, entry.username);
|
||||
@ -111,13 +111,13 @@ bool DatabasePasswordBackend::updateEntry(const PasswordEntry &entry)
|
||||
|
||||
// Data is empty only for HTTP/FTP authorization
|
||||
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(1, entry.password);
|
||||
query.bindValue(2, entry.host);
|
||||
}
|
||||
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.username);
|
||||
query.addBindValue(entry.password);
|
||||
@ -130,7 +130,7 @@ bool DatabasePasswordBackend::updateEntry(const PasswordEntry &entry)
|
||||
void DatabasePasswordBackend::updateLastUsed(PasswordEntry &entry)
|
||||
{
|
||||
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.exec();
|
||||
}
|
||||
@ -138,7 +138,7 @@ void DatabasePasswordBackend::updateLastUsed(PasswordEntry &entry)
|
||||
void DatabasePasswordBackend::removeEntry(const PasswordEntry &entry)
|
||||
{
|
||||
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.exec();
|
||||
}
|
||||
@ -146,5 +146,5 @@ void DatabasePasswordBackend::removeEntry(const PasswordEntry &entry)
|
||||
void DatabasePasswordBackend::removeAll()
|
||||
{
|
||||
QSqlQuery query(SqlDatabase::instance()->database());
|
||||
query.exec("DELETE FROM autofill");
|
||||
query.exec(QSL("DELETE FROM autofill"));
|
||||
}
|
||||
|
@ -61,25 +61,25 @@ QDataStream &operator >>(QDataStream &stream, PasswordEntry &entry)
|
||||
PasswordManager::PasswordManager(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_loaded(false)
|
||||
, m_backend(0)
|
||||
, m_backend(nullptr)
|
||||
, m_databaseBackend(new DatabasePasswordBackend)
|
||||
, m_databaseEncryptedBackend(new DatabaseEncryptedPasswordBackend)
|
||||
{
|
||||
m_backends["database"] = m_databaseBackend;
|
||||
m_backends["database-encrypted"] = m_databaseEncryptedBackend;
|
||||
m_backends[QSL("database")] = m_databaseBackend;
|
||||
m_backends[QSL("database-encrypted")] = m_databaseEncryptedBackend;
|
||||
}
|
||||
|
||||
void PasswordManager::loadSettings()
|
||||
{
|
||||
Settings settings;
|
||||
settings.beginGroup("PasswordManager");
|
||||
QString backendId = settings.value("Backend", "database").toString();
|
||||
settings.beginGroup(QSL("PasswordManager"));
|
||||
QString backendId = settings.value(QSL("Backend"), QSL("database")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
if (m_backend) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -159,8 +159,8 @@ void PasswordManager::switchBackend(const QString &backendID)
|
||||
m_backend->setActive(true);
|
||||
|
||||
Settings settings;
|
||||
settings.beginGroup("PasswordManager");
|
||||
settings.setValue("Backend", backendID);
|
||||
settings.beginGroup(QSL("PasswordManager"));
|
||||
settings.setValue(QSL("Backend"), backendID);
|
||||
settings.endGroup();
|
||||
|
||||
emit passwordBackendChanged();
|
||||
|
@ -58,7 +58,7 @@ class FALKON_EXPORT PasswordManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PasswordManager(QObject* parent = 0);
|
||||
explicit PasswordManager(QObject* parent = nullptr);
|
||||
~PasswordManager();
|
||||
|
||||
void loadSettings();
|
||||
|
@ -31,7 +31,7 @@ static const int bookmarksVersion = 1;
|
||||
|
||||
Bookmarks::Bookmarks(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_autoSaver(0)
|
||||
, m_autoSaver(nullptr)
|
||||
{
|
||||
m_autoSaver = new AutoSaver(this);
|
||||
connect(m_autoSaver, SIGNAL(save()), this, SLOT(saveSettings()));
|
||||
@ -49,9 +49,9 @@ Bookmarks::~Bookmarks()
|
||||
void Bookmarks::loadSettings()
|
||||
{
|
||||
Settings settings;
|
||||
settings.beginGroup("Bookmarks");
|
||||
m_showOnlyIconsInToolbar = settings.value("showOnlyIconsInToolbar", false).toBool();
|
||||
m_showOnlyTextInToolbar = settings.value("showOnlyTextInToolbar", false).toBool();
|
||||
settings.beginGroup(QSL("Bookmarks"));
|
||||
m_showOnlyIconsInToolbar = settings.value(QSL("showOnlyIconsInToolbar"), false).toBool();
|
||||
m_showOnlyTextInToolbar = settings.value(QSL("showOnlyTextInToolbar"), false).toBool();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
@ -191,9 +191,9 @@ void Bookmarks::setShowOnlyTextInToolbar(bool state)
|
||||
void Bookmarks::saveSettings()
|
||||
{
|
||||
Settings settings;
|
||||
settings.beginGroup("Bookmarks");
|
||||
settings.setValue("showOnlyIconsInToolbar", m_showOnlyIconsInToolbar);
|
||||
settings.setValue("showOnlyTextInToolbar", m_showOnlyTextInToolbar);
|
||||
settings.beginGroup(QSL("Bookmarks"));
|
||||
settings.setValue(QSL("showOnlyIconsInToolbar"), m_showOnlyIconsInToolbar);
|
||||
settings.setValue(QSL("showOnlyTextInToolbar"), m_showOnlyTextInToolbar);
|
||||
settings.endGroup();
|
||||
|
||||
saveBookmarks();
|
||||
@ -254,13 +254,13 @@ void Bookmarks::loadBookmarks()
|
||||
Q_ASSERT(err.error == QJsonParseError::NoError);
|
||||
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
|
||||
m_autoSaver->changeOccurred();
|
||||
}
|
||||
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) \
|
||||
QVariantMap mapName; \
|
||||
mapName.insert("children", writeBookmarks(folder)); \
|
||||
mapName.insert("expanded", folder->isExpanded()); \
|
||||
mapName.insert("expanded_sidebar", folder->isSidebarExpanded()); \
|
||||
mapName.insert("name", folder->title()); \
|
||||
mapName.insert("description", folder->description()); \
|
||||
mapName.insert("type", "folder"); \
|
||||
mapName.insert(QSL("children"), writeBookmarks(folder)); \
|
||||
mapName.insert(QSL("expanded"), folder->isExpanded()); \
|
||||
mapName.insert(QSL("expanded_sidebar"), folder->isSidebarExpanded()); \
|
||||
mapName.insert(QSL("name"), folder->title()); \
|
||||
mapName.insert(QSL("description"), folder->description()); \
|
||||
mapName.insert(QSL("type"), QSL("folder")); \
|
||||
bookmarksMap.insert(name, mapName);
|
||||
|
||||
WRITE_FOLDER("bookmark_bar", toolbarMap, m_folderToolbar)
|
||||
WRITE_FOLDER("bookmark_menu", menuMap, m_folderMenu)
|
||||
WRITE_FOLDER("other", unsortedMap, m_folderUnsorted)
|
||||
WRITE_FOLDER(QSL("bookmark_bar"), toolbarMap, m_folderToolbar)
|
||||
WRITE_FOLDER(QSL("bookmark_menu"), menuMap, m_folderMenu)
|
||||
WRITE_FOLDER(QSL("other"), unsortedMap, m_folderUnsorted)
|
||||
#undef WRITE_FOLDER
|
||||
|
||||
QVariantMap map;
|
||||
map.insert("version", bookmarksVersion);
|
||||
map.insert("roots", bookmarksMap);
|
||||
map.insert(QSL("version"), bookmarksVersion);
|
||||
map.insert(QSL("roots"), bookmarksMap);
|
||||
|
||||
const QJsonDocument json = QJsonDocument::fromVariant(map);
|
||||
const QByteArray data = json.toJson();
|
||||
@ -308,13 +308,13 @@ void Bookmarks::saveBookmarks()
|
||||
void Bookmarks::loadBookmarksFromMap(const QVariantMap &map)
|
||||
{
|
||||
#define READ_FOLDER(name, folder) \
|
||||
readBookmarks(map.value(name).toMap().value("children").toList(), folder); \
|
||||
folder->setExpanded(map.value(name).toMap().value("expanded").toBool()); \
|
||||
folder->setSidebarExpanded(map.value(name).toMap().value("expanded_sidebar").toBool());
|
||||
readBookmarks(map.value(name).toMap().value(QSL("children")).toList(), folder); \
|
||||
folder->setExpanded(map.value(name).toMap().value(QSL("expanded")).toBool()); \
|
||||
folder->setSidebarExpanded(map.value(name).toMap().value(QSL("expanded_sidebar")).toBool());
|
||||
|
||||
READ_FOLDER("bookmark_bar", m_folderToolbar)
|
||||
READ_FOLDER("bookmark_menu", m_folderMenu)
|
||||
READ_FOLDER("other", m_folderUnsorted)
|
||||
READ_FOLDER(QSL("bookmark_bar"), m_folderToolbar)
|
||||
READ_FOLDER(QSL("bookmark_menu"), m_folderMenu)
|
||||
READ_FOLDER(QSL("other"), m_folderUnsorted)
|
||||
#undef READ_FOLDER
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ void Bookmarks::readBookmarks(const QVariantList &list, BookmarkItem* parent)
|
||||
|
||||
foreach (const QVariant &entry, list) {
|
||||
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) {
|
||||
continue;
|
||||
@ -334,26 +334,26 @@ void Bookmarks::readBookmarks(const QVariantList &list, BookmarkItem* parent)
|
||||
|
||||
switch (type) {
|
||||
case BookmarkItem::Url:
|
||||
item->setUrl(QUrl::fromEncoded(map.value("url").toByteArray()));
|
||||
item->setTitle(map.value("name").toString());
|
||||
item->setDescription(map.value("description").toString());
|
||||
item->setKeyword(map.value("keyword").toString());
|
||||
item->setVisitCount(map.value("visit_count").toInt());
|
||||
item->setUrl(QUrl::fromEncoded(map.value(QSL("url")).toByteArray()));
|
||||
item->setTitle(map.value(QSL("name")).toString());
|
||||
item->setDescription(map.value(QSL("description")).toString());
|
||||
item->setKeyword(map.value(QSL("keyword")).toString());
|
||||
item->setVisitCount(map.value(QSL("visit_count")).toInt());
|
||||
break;
|
||||
|
||||
case BookmarkItem::Folder:
|
||||
item->setTitle(map.value("name").toString());
|
||||
item->setDescription(map.value("description").toString());
|
||||
item->setExpanded(map.value("expanded").toBool());
|
||||
item->setSidebarExpanded(map.value("expanded_sidebar").toBool());
|
||||
item->setTitle(map.value(QSL("name")).toString());
|
||||
item->setDescription(map.value(QSL("description")).toString());
|
||||
item->setExpanded(map.value(QSL("expanded")).toBool());
|
||||
item->setSidebarExpanded(map.value(QSL("expanded_sidebar")).toBool());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (map.contains("children")) {
|
||||
readBookmarks(map.value("children").toList(), item);
|
||||
if (map.contains(QSL("children"))) {
|
||||
readBookmarks(map.value(QSL("children")).toList(), item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -366,22 +366,22 @@ QVariantList Bookmarks::writeBookmarks(BookmarkItem* parent)
|
||||
|
||||
foreach (BookmarkItem* child, parent->children()) {
|
||||
QVariantMap map;
|
||||
map.insert("type", BookmarkItem::typeToString(child->type()));
|
||||
map.insert(QSL("type"), BookmarkItem::typeToString(child->type()));
|
||||
|
||||
switch (child->type()) {
|
||||
case BookmarkItem::Url:
|
||||
map.insert("url", child->urlString());
|
||||
map.insert("name", child->title());
|
||||
map.insert("description", child->description());
|
||||
map.insert("keyword", child->keyword());
|
||||
map.insert("visit_count", child->visitCount());
|
||||
map.insert(QSL("url"), child->urlString());
|
||||
map.insert(QSL("name"), child->title());
|
||||
map.insert(QSL("description"), child->description());
|
||||
map.insert(QSL("keyword"), child->keyword());
|
||||
map.insert(QSL("visit_count"), child->visitCount());
|
||||
break;
|
||||
|
||||
case BookmarkItem::Folder:
|
||||
map.insert("name", child->title());
|
||||
map.insert("description", child->description());
|
||||
map.insert("expanded", child->isExpanded());
|
||||
map.insert("expanded_sidebar", child->isSidebarExpanded());
|
||||
map.insert(QSL("name"), child->title());
|
||||
map.insert(QSL("description"), child->description());
|
||||
map.insert(QSL("expanded"), child->isExpanded());
|
||||
map.insert(QSL("expanded_sidebar"), child->isSidebarExpanded());
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -389,7 +389,7 @@ QVariantList Bookmarks::writeBookmarks(BookmarkItem* parent)
|
||||
}
|
||||
|
||||
if (!child->children().isEmpty()) {
|
||||
map.insert("children", writeBookmarks(child));
|
||||
map.insert(QSL("children"), writeBookmarks(child));
|
||||
}
|
||||
|
||||
list.append(map);
|
||||
|
@ -33,7 +33,7 @@ class FALKON_EXPORT Bookmarks : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Bookmarks(QObject* parent = 0);
|
||||
explicit Bookmarks(QObject* parent = nullptr);
|
||||
~Bookmarks();
|
||||
|
||||
void loadSettings();
|
||||
|
@ -34,9 +34,9 @@ BookmarksImportDialog::BookmarksImportDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::BookmarksImportDialog)
|
||||
, m_currentPage(0)
|
||||
, m_importer(0)
|
||||
, m_importedFolder(0)
|
||||
, m_model(0)
|
||||
, m_importer(nullptr)
|
||||
, m_importedFolder(nullptr)
|
||||
, m_model(nullptr)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
ui->setupUi(this);
|
||||
@ -56,7 +56,7 @@ BookmarksImportDialog::BookmarksImportDialog(QWidget* parent)
|
||||
|
||||
BookmarksImportDialog::~BookmarksImportDialog()
|
||||
{
|
||||
ui->treeView->setModel(0);
|
||||
ui->treeView->setModel(nullptr);
|
||||
delete m_model;
|
||||
delete m_importedFolder;
|
||||
delete m_importer;
|
||||
@ -148,7 +148,7 @@ void BookmarksImportDialog::previousPage()
|
||||
ui->stackedWidget->setCurrentIndex(--m_currentPage);
|
||||
|
||||
delete m_importer;
|
||||
m_importer = 0;
|
||||
m_importer = nullptr;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
@ -159,12 +159,12 @@ void BookmarksImportDialog::previousPage()
|
||||
ui->backButton->setEnabled(true);
|
||||
ui->stackedWidget->setCurrentIndex(--m_currentPage);
|
||||
|
||||
ui->treeView->setModel(0);
|
||||
ui->treeView->setModel(nullptr);
|
||||
delete m_model;
|
||||
m_model = 0;
|
||||
m_model = nullptr;
|
||||
|
||||
delete m_importedFolder;
|
||||
m_importedFolder = 0;
|
||||
m_importedFolder = nullptr;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -185,12 +185,12 @@ void BookmarksImportDialog::showImporterPage()
|
||||
ui->iconLabel->setPixmap(ui->browserList->currentItem()->icon().pixmap(48));
|
||||
ui->importingFromLabel->setText(tr("<b>Importing from %1</b>").arg(ui->browserList->currentItem()->text()));
|
||||
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()
|
||||
{
|
||||
m_model = new BookmarksModel(m_importedFolder, 0, this);
|
||||
m_model = new BookmarksModel(m_importedFolder, nullptr, this);
|
||||
ui->treeView->setModel(m_model);
|
||||
ui->treeView->header()->resizeSection(0, ui->treeView->header()->width() / 2);
|
||||
ui->treeView->expandAll();
|
||||
@ -199,5 +199,5 @@ void BookmarksImportDialog::showExportedBookmarks()
|
||||
void BookmarksImportDialog::addExportedBookmarks()
|
||||
{
|
||||
mApp->bookmarks()->addBookmark(mApp->bookmarks()->unsortedFolder(), m_importedFolder);
|
||||
m_importedFolder = 0;
|
||||
m_importedFolder = nullptr;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ QString ChromeImporter::standardPath() const
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -74,25 +74,25 @@ BookmarkItem* ChromeImporter::importBookmarks()
|
||||
|
||||
if (err.error != QJsonParseError::NoError || res.type() != QVariant::Map) {
|
||||
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);
|
||||
root->setTitle("Chrome Import");
|
||||
root->setTitle(QSL("Chrome Import"));
|
||||
|
||||
BookmarkItem* toolbar = new BookmarkItem(BookmarkItem::Folder, root);
|
||||
toolbar->setTitle(rootMap.value("bookmark_bar").toMap().value("name").toString());
|
||||
readBookmarks(rootMap.value("bookmark_bar").toMap().value("children").toList(), toolbar);
|
||||
toolbar->setTitle(rootMap.value(QSL("bookmark_bar")).toMap().value(QSL("name")).toString());
|
||||
readBookmarks(rootMap.value(QSL("bookmark_bar")).toMap().value(QSL("children")).toList(), toolbar);
|
||||
|
||||
BookmarkItem* other = new BookmarkItem(BookmarkItem::Folder, root);
|
||||
other->setTitle(rootMap.value("other").toMap().value("name").toString());
|
||||
readBookmarks(rootMap.value("other").toMap().value("children").toList(), other);
|
||||
other->setTitle(rootMap.value(QSL("other")).toMap().value(QSL("name")).toString());
|
||||
readBookmarks(rootMap.value(QSL("other")).toMap().value(QSL("children")).toList(), other);
|
||||
|
||||
BookmarkItem* synced = new BookmarkItem(BookmarkItem::Folder, root);
|
||||
synced->setTitle(rootMap.value("synced").toMap().value("name").toString());
|
||||
readBookmarks(rootMap.value("synced").toMap().value("synced").toList(), other);
|
||||
synced->setTitle(rootMap.value(QSL("synced")).toMap().value(QSL("name")).toString());
|
||||
readBookmarks(rootMap.value(QSL("synced")).toMap().value(QSL("synced")).toList(), other);
|
||||
|
||||
return root;
|
||||
}
|
||||
@ -103,7 +103,7 @@ void ChromeImporter::readBookmarks(const QVariantList &list, BookmarkItem* paren
|
||||
|
||||
foreach (const QVariant &entry, list) {
|
||||
const QVariantMap map = entry.toMap();
|
||||
const QString typeString = map.value("type").toString();
|
||||
const QString typeString = map.value(QSL("type")).toString();
|
||||
BookmarkItem::Type type;
|
||||
|
||||
if (typeString == QLatin1String("url")) {
|
||||
@ -117,14 +117,14 @@ void ChromeImporter::readBookmarks(const QVariantList &list, BookmarkItem* paren
|
||||
}
|
||||
|
||||
BookmarkItem* item = new BookmarkItem(type, parent);
|
||||
item->setTitle(map.value("name").toString());
|
||||
item->setTitle(map.value(QSL("name")).toString());
|
||||
|
||||
if (item->isUrl()) {
|
||||
item->setUrl(QUrl::fromEncoded(map.value("url").toByteArray()));
|
||||
item->setUrl(QUrl::fromEncoded(map.value(QSL("url")).toByteArray()));
|
||||
}
|
||||
|
||||
if (map.contains("children")) {
|
||||
readBookmarks(map.value("children").toList(), item);
|
||||
if (map.contains(QSL("children"))) {
|
||||
readBookmarks(map.value(QSL("children")).toList(), item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ BookmarksManager::BookmarksManager(BrowserWindow* window, QWidget* parent)
|
||||
, ui(new Ui::BookmarksManager)
|
||||
, m_window(window)
|
||||
, m_bookmarks(mApp->bookmarks())
|
||||
, m_selectedBookmark(0)
|
||||
, m_selectedBookmark(nullptr)
|
||||
, m_blockDescriptionChangedSignal(false)
|
||||
, m_adjustHeaderSizesOnShow(true)
|
||||
{
|
||||
@ -48,7 +48,7 @@ BookmarksManager::BookmarksManager(BrowserWindow* window, QWidget* parent)
|
||||
connect(ui->tree, SIGNAL(contextMenuRequested(QPoint)), this, SLOT(createContextMenu(QPoint)));
|
||||
|
||||
// Box for editing bookmarks
|
||||
updateEditBox(0);
|
||||
updateEditBox(nullptr);
|
||||
connect(ui->title, SIGNAL(textEdited(QString)), this, SLOT(bookmarkEdited()));
|
||||
connect(ui->address, 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)
|
||||
{
|
||||
if (items.size() != 1) {
|
||||
m_selectedBookmark = 0;
|
||||
updateEditBox(0);
|
||||
m_selectedBookmark = nullptr;
|
||||
updateEditBox(nullptr);
|
||||
}
|
||||
else {
|
||||
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 Separator"), this, SLOT(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(actNewWindow, SIGNAL(triggered()), this, SLOT(openBookmarkInNewWindow()));
|
||||
@ -169,7 +169,7 @@ void BookmarksManager::addBookmark()
|
||||
{
|
||||
BookmarkItem* item = new BookmarkItem(BookmarkItem::Url);
|
||||
item->setTitle(tr("New Bookmark"));
|
||||
item->setUrl(QUrl("http://"));
|
||||
item->setUrl(QUrl(QSL("http://")));
|
||||
addBookmark(item);
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,8 @@ SBI_NetworkIconDialog::SBI_NetworkIconDialog(QWidget* parent)
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->addButton->setIcon(QIcon::fromTheme("document-new", QIcon(":sbi/data/add.png")));
|
||||
ui->removeButton->setIcon(QIcon::fromTheme("edit-delete", QIcon(":sbi/data/remove.png")));
|
||||
ui->addButton->setIcon(QIcon::fromTheme(QLatin1String("document-new"), QIcon(QLatin1String(":sbi/data/add.png"))));
|
||||
ui->removeButton->setIcon(QIcon::fromTheme(QLatin1String("edit-delete"), QIcon(QLatin1String(":sbi/data/remove.png"))));
|
||||
|
||||
const QHash<QString, SBI_NetworkProxy*> &proxies = SBINetManager->proxies();
|
||||
|
||||
|
@ -23,12 +23,12 @@
|
||||
|
||||
#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)
|
||||
: QObject(parent)
|
||||
, m_settingsFile(settingsPath + QL1S("/networkicon.ini"))
|
||||
, m_currentProxy(0)
|
||||
, m_currentProxy(nullptr)
|
||||
{
|
||||
s_instance = this;
|
||||
|
||||
@ -58,8 +58,8 @@ void SBI_NetworkManager::loadSettings()
|
||||
m_proxies[group] = proxy;
|
||||
}
|
||||
|
||||
const QString currentName = settings.value("CurrentProxy", QString()).toString();
|
||||
m_currentProxy = m_proxies.contains(currentName) ? m_proxies.value(currentName) : 0;
|
||||
const QString currentName = settings.value(QSL("CurrentProxy"), QString()).toString();
|
||||
m_currentProxy = m_proxies.contains(currentName) ? m_proxies.value(currentName) : nullptr;
|
||||
|
||||
applyCurrentProxy();
|
||||
}
|
||||
@ -77,9 +77,9 @@ SBI_NetworkProxy* SBI_NetworkManager::currentProxy() const
|
||||
void SBI_NetworkManager::setCurrentProxy(const QString &name)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user