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

Update ECM to KF 5.240.0 version

Update code to make it compile.

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2023-11-20 23:35:11 +01:00
parent e02a8ee664
commit eb5b015a5d
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
133 changed files with 1313 additions and 1309 deletions

View File

@ -16,7 +16,7 @@ set(KF_MIN_VERSION "5.240.0")
# Find ECM, with nice error handling in case of failure
include(FeatureSummary)
find_package(ECM 5.78.0 CONFIG)
find_package(ECM ${KF_MIN_VERSION} CONFIG)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://invent.kde.org/frameworks/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

View File

@ -49,82 +49,82 @@ void LocationBarTest::loadActionBasicTest()
{
LocationBar::LoadAction action;
action = LocationBar::loadAction("http://kde.org");
action = LocationBar::loadAction(QSL("http://kde.org"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://kde.org"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://kde.org")));
action = LocationBar::loadAction("kde.org");
action = LocationBar::loadAction(QSL("kde.org"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://kde.org"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://kde.org")));
action = LocationBar::loadAction("localhost");
action = LocationBar::loadAction(QSL("localhost"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://localhost"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://localhost")));
action = LocationBar::loadAction("localhost/test/path?x=2");
action = LocationBar::loadAction(QSL("localhost/test/path?x=2"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://localhost/test/path?x=2"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://localhost/test/path?x=2")));
action = LocationBar::loadAction("host.com/test/path?x=2");
action = LocationBar::loadAction(QSL("host.com/test/path?x=2"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://host.com/test/path?x=2"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://host.com/test/path?x=2")));
action = LocationBar::loadAction("not-url");
action = LocationBar::loadAction(QSL("not-url"));
QCOMPARE(action.type, LocationBar::LoadAction::Search);
action = LocationBar::loadAction("not url with spaces");
action = LocationBar::loadAction(QSL("not url with spaces"));
QCOMPARE(action.type, LocationBar::LoadAction::Search);
action = LocationBar::loadAction("falkon:about");
action = LocationBar::loadAction(QSL("falkon:about"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("falkon:about"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("falkon:about")));
}
void LocationBarTest::loadActionBookmarksTest()
{
auto* bookmark = new BookmarkItem(BookmarkItem::Url);
bookmark->setTitle("KDE Bookmark title");
bookmark->setUrl(QUrl("http://kde.org"));
bookmark->setKeyword("kde-bookmark");
bookmark->setTitle(QSL("KDE Bookmark title"));
bookmark->setUrl(QUrl(QSL("http://kde.org")));
bookmark->setKeyword(QSL("kde-bookmark"));
mApp->bookmarks()->addBookmark(mApp->bookmarks()->unsortedFolder(), bookmark);
LocationBar::LoadAction action;
action = LocationBar::loadAction("http://kde.org");
action = LocationBar::loadAction(QSL("http://kde.org"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://kde.org"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://kde.org")));
action = LocationBar::loadAction("kde-bookmark-notkeyword");
action = LocationBar::loadAction(QSL("kde-bookmark-notkeyword"));
QCOMPARE(action.type, LocationBar::LoadAction::Search);
action = LocationBar::loadAction("kde-bookmark");
action = LocationBar::loadAction(QSL("kde-bookmark"));
QCOMPARE(action.type, LocationBar::LoadAction::Bookmark);
QCOMPARE(action.bookmark, bookmark);
QCOMPARE(action.loadRequest.url(), QUrl("http://kde.org"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://kde.org")));
}
void LocationBarTest::loadActionSearchTest()
{
SearchEngine engine;
engine.name = "Test Engine";
engine.url = "http://test/%s";
engine.shortcut = "t";
engine.name = QSL("Test Engine");
engine.url = QSL("http://test/%s");
engine.shortcut = QSL("t");
mApp->searchEnginesManager()->addEngine(engine);
mApp->searchEnginesManager()->setActiveEngine(engine);
LocationBar::LoadAction action;
action = LocationBar::loadAction("search term");
action = LocationBar::loadAction(QSL("search term"));
QCOMPARE(action.type, LocationBar::LoadAction::Search);
QCOMPARE(action.loadRequest.url(), QUrl("http://test/search%20term"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://test/search%20term")));
action = LocationBar::loadAction("t search term");
action = LocationBar::loadAction(QSL("t search term"));
QCOMPARE(action.type, LocationBar::LoadAction::Search);
QCOMPARE(action.loadRequest.url(), QUrl("http://test/search%20term"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://test/search%20term")));
action = LocationBar::loadAction(" ttt-notsearch");
action = LocationBar::loadAction(QSL(" ttt-notsearch"));
QCOMPARE(action.type, LocationBar::LoadAction::Search);
QCOMPARE(action.loadRequest.url(), QUrl("http://test/ttt-notsearch"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://test/ttt-notsearch")));
}
void LocationBarTest::loadAction_kdebug389491()
@ -132,54 +132,54 @@ void LocationBarTest::loadAction_kdebug389491()
// "site:website.com searchterm" and "link:website.com" are loaded instead of searched
SearchEngine engine;
engine.name = "Test Engine";
engine.url = "http://test/%s";
engine.shortcut = "t";
engine.name = QSL("Test Engine");
engine.url = QSL("http://test/%s");
engine.shortcut = QSL("t");
mApp->searchEnginesManager()->addEngine(engine);
mApp->searchEnginesManager()->setActiveEngine(engine);
LocationBar::LoadAction action;
action = LocationBar::loadAction("site:website.com searchterm");
action = LocationBar::loadAction(QSL("site:website.com searchterm"));
QCOMPARE(action.type, LocationBar::LoadAction::Search);
QCOMPARE(action.loadRequest.url(), QUrl("http://test/site%3Awebsite.com%20searchterm"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://test/site%3Awebsite.com%20searchterm")));
action = LocationBar::loadAction("link:website.com");
action = LocationBar::loadAction(QSL("link:website.com"));
QCOMPARE(action.type, LocationBar::LoadAction::Search);
QCOMPARE(action.loadRequest.url(), QUrl("http://test/link%3Awebsite.com"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://test/link%3Awebsite.com")));
action = LocationBar::loadAction("http://website.com?search=searchterm and another");
action = LocationBar::loadAction(QSL("http://website.com?search=searchterm and another"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://website.com?search=searchterm and another"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://website.com?search=searchterm and another")));
}
void LocationBarTest::loadActionSpecialSchemesTest()
{
LocationBar::LoadAction action;
action = LocationBar::loadAction("data:image/png;base64,xxxxx");
action = LocationBar::loadAction(QSL("data:image/png;base64,xxxxx"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("data:image/png;base64,xxxxx"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("data:image/png;base64,xxxxx")));
action = LocationBar::loadAction("falkon:about");
action = LocationBar::loadAction(QSL("falkon:about"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("falkon:about"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("falkon:about")));
action = LocationBar::loadAction("file:test.html");
action = LocationBar::loadAction(QSL("file:test.html"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("file:test.html"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("file:test.html")));
action = LocationBar::loadAction("about:blank");
action = LocationBar::loadAction(QSL("about:blank"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("about:blank"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("about:blank")));
action = LocationBar::loadAction("javascript:test");
action = LocationBar::loadAction(QSL("javascript:test"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("javascript:test"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("javascript:test")));
action = LocationBar::loadAction("javascript:alert(' test ');");
action = LocationBar::loadAction(QSL("javascript:alert(' test ');"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("javascript:alert('%20test%20');"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("javascript:alert('%20test%20');")));
}
void LocationBarTest::loadAction_issue2578()
@ -190,27 +190,27 @@ void LocationBarTest::loadAction_issue2578()
LocationBar::LoadAction action;
action = LocationBar::loadAction("github.com");
action = LocationBar::loadAction(QSL("github.com"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://github.com"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://github.com")));
action = LocationBar::loadAction("github");
action = LocationBar::loadAction(QSL("github"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://github"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://github")));
action = LocationBar::loadAction("github/test/path");
action = LocationBar::loadAction(QSL("github/test/path"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://github/test/path"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://github/test/path")));
action = LocationBar::loadAction("localhost");
action = LocationBar::loadAction(QSL("localhost"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://localhost"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://localhost")));
action = LocationBar::loadAction("localhost/test/path");
action = LocationBar::loadAction(QSL("localhost/test/path"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://localhost/test/path"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://localhost/test/path")));
action = LocationBar::loadAction("github.com foo bar");
action = LocationBar::loadAction(QSL("github.com foo bar"));
QCOMPARE(action.type, LocationBar::LoadAction::Invalid);
}
@ -222,9 +222,9 @@ void LocationBarTest::loadAction_kdebug392445()
LocationBar::LoadAction action;
action = LocationBar::loadAction("http://www.example.com/my%20beautiful%20page");
action = LocationBar::loadAction(QSL("http://www.example.com/my%20beautiful%20page"));
QCOMPARE(action.type, LocationBar::LoadAction::Url);
QCOMPARE(action.loadRequest.url(), QUrl("http://www.example.com/my%20beautiful%20page"));
QCOMPARE(action.loadRequest.url(), QUrl(QSL("http://www.example.com/my%20beautiful%20page")));
}
FALKONTEST_MAIN(LocationBarTest)

View File

@ -72,7 +72,7 @@ void PasswordBackendTest::cleanupTestCase()
cleanup();
reloadBackend();
foreach (const PasswordEntry &entry, m_entries) {
for (const PasswordEntry &entry : std::as_const(m_entries)) {
m_backend->addEntry(entry);
}
}

View File

@ -31,16 +31,16 @@ void QmlBookmarksApiTest::cleanupTestCase()
void QmlBookmarksApiTest::testBookmarkTreeNodeType()
{
auto type = BookmarkItem::Type(m_testHelper.evaluate("Falkon.Bookmarks.rootItem().type").toInt());
auto type = BookmarkItem::Type(m_testHelper.evaluate(QSL("Falkon.Bookmarks.rootItem().type")).toInt());
QCOMPARE(mApp->bookmarks()->rootItem()->type(), type);
type = BookmarkItem::Type(m_testHelper.evaluate("Falkon.Bookmarks.toolbarFolder().type").toInt());
type = BookmarkItem::Type(m_testHelper.evaluate(QSL("Falkon.Bookmarks.toolbarFolder().type")).toInt());
QCOMPARE(mApp->bookmarks()->toolbarFolder()->type(), type);
}
void QmlBookmarksApiTest::testBookmarkTreeNode()
{
QObject *bookmark = m_testHelper.evaluateQObject("Falkon.Bookmarks.toolbarFolder()");
QObject *bookmark = m_testHelper.evaluateQObject(QSL("Falkon.Bookmarks.toolbarFolder()"));
QVERIFY(bookmark);
auto toolbarFolder = mApp->bookmarks()->toolbarFolder();
@ -56,11 +56,11 @@ void QmlBookmarksApiTest::testBookmarkTreeNode()
void QmlBookmarksApiTest::testBookmarksCreation()
{
auto item = new BookmarkItem(BookmarkItem::Url);
item->setTitle("Example Domain");
item->setUrl(QUrl("https://example.com/"));
item->setDescription("Testing bookmark description");
item->setTitle(QSL("Example Domain"));
item->setUrl(QUrl(QSL("https://example.com/")));
item->setDescription(QSL("Testing bookmark description"));
QObject *qmlBookmarks = m_testHelper.evaluateQObject("Falkon.Bookmarks");
QObject *qmlBookmarks = m_testHelper.evaluateQObject(QSL("Falkon.Bookmarks"));
QVERIFY(qmlBookmarks);
QSignalSpy qmlBookmarksSpy(qmlBookmarks, SIGNAL(created(QmlBookmarkTreeNode*)));
@ -75,87 +75,87 @@ void QmlBookmarksApiTest::testBookmarksCreation()
qRegisterMetaType<BookmarkItem*>();
QSignalSpy bookmarksSpy(mApp->bookmarks(), &Bookmarks::bookmarkAdded);
auto out = m_testHelper.evaluate("Falkon.Bookmarks.create({"
auto out = m_testHelper.evaluate(QL1S("Falkon.Bookmarks.create({"
" parent: Falkon.Bookmarks.toolbarFolder(),"
" title: 'Example Plugin',"
" url: 'https://another-example.com'"
"});");
"});"));
QVERIFY(out.toBool());
QCOMPARE(bookmarksSpy.count(), 1);
auto* createdItem = qvariant_cast<BookmarkItem*>(bookmarksSpy.at(0).at(0));
QVERIFY(createdItem);
QCOMPARE(createdItem->title(), QString("Example Plugin"));
QCOMPARE(createdItem->title(), QSL("Example Plugin"));
}
void QmlBookmarksApiTest::testBookmarksExistence()
{
// in continuation from testBookmarksCreation
auto result = m_testHelper.evaluate("Falkon.Bookmarks.isBookmarked('https://example.com/')").toBool();
auto result = m_testHelper.evaluate(QSL("Falkon.Bookmarks.isBookmarked('https://example.com/')")).toBool();
QVERIFY(result);
QCOMPARE(mApp->bookmarks()->isBookmarked(QUrl("https://example.com/")), result);
QCOMPARE(mApp->bookmarks()->isBookmarked(QUrl(QSL("https://example.com/"))), result);
}
void QmlBookmarksApiTest::testBookmarksModification()
{
// in continuation from testBookmarksExistence
QObject *qmlBookmarks = m_testHelper.evaluateQObject("Falkon.Bookmarks");
QObject *qmlBookmarks = m_testHelper.evaluateQObject(QSL("Falkon.Bookmarks"));
QVERIFY(qmlBookmarks);
QSignalSpy qmlBookmarksSpy(qmlBookmarks, SIGNAL(changed(QmlBookmarkTreeNode*)));
BookmarkItem* item = mApp->bookmarks()->searchBookmarks("https://example.com/").at(0);
item->setTitle("Modified Example Domain");
BookmarkItem* item = mApp->bookmarks()->searchBookmarks(QSL("https://example.com/")).at(0);
item->setTitle(QSL("Modified Example Domain"));
mApp->bookmarks()->changeBookmark(item);
QCOMPARE(qmlBookmarksSpy.count(), 1);
auto *modified = qvariant_cast<QObject*>(qmlBookmarksSpy.at(0).at(0));
QVERIFY(modified);
QCOMPARE(modified->property("title").toString(), QString("Modified Example Domain"));
QCOMPARE(modified->property("title").toString(), QSL("Modified Example Domain"));
qRegisterMetaType<BookmarkItem*>();
QSignalSpy bookmarksSpy(mApp->bookmarks(), &Bookmarks::bookmarkChanged);
auto out = m_testHelper.evaluate("Falkon.Bookmarks.update(Falkon.Bookmarks.get('https://another-example.com'),{"
auto out = m_testHelper.evaluate(QL1S("Falkon.Bookmarks.update(Falkon.Bookmarks.get('https://another-example.com'),{"
" title: 'Modified Example Plugin'"
"})");
"})"));
QVERIFY(out.toBool());
QCOMPARE(bookmarksSpy.count(), 1);
auto* modifiedItem = qvariant_cast<BookmarkItem*>(bookmarksSpy.at(0).at(0));
QVERIFY(modifiedItem);
QCOMPARE(modifiedItem->title(), QString("Modified Example Plugin"));
QCOMPARE(modifiedItem->title(), QSL("Modified Example Plugin"));
}
void QmlBookmarksApiTest::testBookmarksRemoval()
{
// in continuation from testBookmarksModification
QObject *qmlBookmarks = m_testHelper.evaluateQObject("Falkon.Bookmarks");
QObject *qmlBookmarks = m_testHelper.evaluateQObject(QSL("Falkon.Bookmarks"));
QVERIFY(qmlBookmarks);
QSignalSpy qmlBookmarksSpy(qmlBookmarks, SIGNAL(removed(QmlBookmarkTreeNode*)));
BookmarkItem* item = mApp->bookmarks()->searchBookmarks("https://example.com/").at(0);
BookmarkItem* item = mApp->bookmarks()->searchBookmarks(QSL("https://example.com/")).at(0);
mApp->bookmarks()->removeBookmark(item);
QCOMPARE(qmlBookmarksSpy.count(), 1);
auto *removed = qvariant_cast<QObject*>(qmlBookmarksSpy.at(0).at(0));
QVERIFY(removed);
QCOMPARE(removed->property("title").toString(), QString("Modified Example Domain"));
QCOMPARE(removed->property("title").toString(), QSL("Modified Example Domain"));
qRegisterMetaType<BookmarkItem*>();
QSignalSpy bookmarksSpy(mApp->bookmarks(), &Bookmarks::bookmarkRemoved);
auto out = m_testHelper.evaluate("Falkon.Bookmarks.remove(Falkon.Bookmarks.get('https://another-example.com'))");
auto out = m_testHelper.evaluate(QSL("Falkon.Bookmarks.remove(Falkon.Bookmarks.get('https://another-example.com'))"));
QVERIFY(out.toBool());
QCOMPARE(bookmarksSpy.count(), 1);
auto* removedItem = qvariant_cast<BookmarkItem*>(bookmarksSpy.at(0).at(0));
QVERIFY(removedItem);
QCOMPARE(removedItem->title(), QString("Modified Example Plugin"));
QCOMPARE(removedItem->title(), QSL("Modified Example Plugin"));
}
FALKONTEST_MAIN(QmlBookmarksApiTest)

View File

@ -30,7 +30,7 @@ void QmlClipboardApiTest::cleanupTestCase()
void QmlClipboardApiTest::testClipboard()
{
m_testHelper.evaluate("Falkon.Clipboard.copy('this text is copied')");
m_testHelper.evaluate(QSL("Falkon.Clipboard.copy('this text is copied')"));
QCOMPARE(mApp->clipboard()->text(), QSL("this text is copied"));
}

View File

@ -33,42 +33,42 @@ void QmlCookiesApiTest::cleanupTestCase()
void QmlCookiesApiTest::testCookieAdditionRemoval()
{
QSignalSpy cookieAddSpy(mApp->cookieJar(), &CookieJar::cookieAdded);
m_testHelper.evaluate("Falkon.Cookies.set({"
m_testHelper.evaluate(QL1S("Falkon.Cookies.set({"
" name: 'Example',"
" url: '.example.com',"
" expirationDate: Date.now() + 60*1000"
"})");
"})"));
QTRY_COMPARE(cookieAddSpy.count(), 1);
QNetworkCookie netCookie = qvariant_cast<QNetworkCookie>(cookieAddSpy.at(0).at(0));
QCOMPARE(netCookie.name(), QByteArrayLiteral("Example"));
QObject *object = m_testHelper.evaluateQObject("Falkon.Cookies");
QObject *object = m_testHelper.evaluateQObject(QSL("Falkon.Cookies"));
QVERIFY(object);
QSignalSpy qmlCookieSpy(object, SIGNAL(changed(QVariantMap)));
QNetworkCookie anotherNetCookie;
anotherNetCookie.setName(QString("Hello").toLocal8Bit());
anotherNetCookie.setDomain(".mydomain.com");
anotherNetCookie.setName(QSL("Hello").toLocal8Bit());
anotherNetCookie.setDomain(QSL(".mydomain.com"));
anotherNetCookie.setExpirationDate(QDateTime::currentDateTime().addSecs(60));
mApp->webProfile()->cookieStore()->setCookie(anotherNetCookie);
QTRY_COMPARE(qmlCookieSpy.count(), 1);
QVariantMap addedQmlCookieMap = QVariant(qmlCookieSpy.at(0).at(0)).toMap();
auto *addedQmlCookie = qvariant_cast<QObject*>(addedQmlCookieMap.value("cookie"));
bool removed = addedQmlCookieMap.value("removed").toBool();
auto *addedQmlCookie = qvariant_cast<QObject*>(addedQmlCookieMap.value(QSL("cookie")));
bool removed = addedQmlCookieMap.value(QSL("removed")).toBool();
QCOMPARE(addedQmlCookie->property("name").toString(), QSL("Hello"));
QCOMPARE(removed, false);
mApp->webProfile()->cookieStore()->deleteCookie(netCookie);
QTRY_COMPARE(qmlCookieSpy.count(), 2);
QVariantMap removedQmlCookieMap = QVariant(qmlCookieSpy.at(1).at(0)).toMap();
auto *removedQmlCookie = qvariant_cast<QObject*>(removedQmlCookieMap.value("cookie"));
removed = removedQmlCookieMap.value("removed").toBool();
auto *removedQmlCookie = qvariant_cast<QObject*>(removedQmlCookieMap.value(QSL("cookie")));
removed = removedQmlCookieMap.value(QSL("removed")).toBool();
QCOMPARE(removedQmlCookie->property("name").toString(), QSL("Example"));
QCOMPARE(removed, true);
QSignalSpy cookieRemoveSpy(mApp->cookieJar(), &CookieJar::cookieRemoved);
m_testHelper.evaluate("Falkon.Cookies.remove({"
m_testHelper.evaluate(QL1S("Falkon.Cookies.remove({"
" name: 'Hello',"
" url: '.mydomain.com',"
"})");
"})"));
QTRY_COMPARE(cookieRemoveSpy.count(), 1);
netCookie = qvariant_cast<QNetworkCookie>(cookieRemoveSpy.at(0).at(0));
QCOMPARE(netCookie.name(), QByteArrayLiteral("Hello"));
@ -80,20 +80,20 @@ void QmlCookiesApiTest::testCookieGet()
QSignalSpy cookieAddSpy(mApp->cookieJar(), &CookieJar::cookieAdded);
QNetworkCookie netCookie_1;
netCookie_1.setName(QString("Apple").toLocal8Bit());
netCookie_1.setDomain(".apple-domain.com");
netCookie_1.setName(QSL("Apple").toLocal8Bit());
netCookie_1.setDomain(QSL(".apple-domain.com"));
netCookie_1.setExpirationDate(current.addSecs(60));
mApp->webProfile()->cookieStore()->setCookie(netCookie_1);
QNetworkCookie netCookie_2;
netCookie_2.setName(QString("Mango").toLocal8Bit());
netCookie_2.setDomain(".mango-domain.com");
netCookie_2.setName(QSL("Mango").toLocal8Bit());
netCookie_2.setDomain(QSL(".mango-domain.com"));
netCookie_2.setExpirationDate(current.addSecs(120));
mApp->webProfile()->cookieStore()->setCookie(netCookie_2);
QNetworkCookie netCookie_3;
netCookie_3.setName(QString("Mango").toLocal8Bit());
netCookie_3.setDomain(".yet-another-mango-domain.com");
netCookie_3.setName(QSL("Mango").toLocal8Bit());
netCookie_3.setDomain(QSL(".yet-another-mango-domain.com"));
netCookie_3.setExpirationDate(current.addSecs(180));
mApp->webProfile()->cookieStore()->setCookie(netCookie_3);
@ -101,20 +101,20 @@ void QmlCookiesApiTest::testCookieGet()
QNetworkCookie actualMangoCookie;
for (const QNetworkCookie &cookie : mApp->cookieJar()->getAllCookies()) {
if (cookie.name() == QSL("Mango") && cookie.domain() == QSL(".mango-domain.com")) {
if (QString::fromUtf8(cookie.name()) == QSL("Mango") && cookie.domain() == QSL(".mango-domain.com")) {
actualMangoCookie = cookie;
}
}
QObject *mangoCookie = m_testHelper.evaluateQObject("Falkon.Cookies.get({"
QObject *mangoCookie = m_testHelper.evaluateQObject(QL1S("Falkon.Cookies.get({"
" name: 'Mango',"
" url: '.mango-domain.com'"
"})");
"})"));
QVERIFY(mangoCookie);
QCOMPARE(mangoCookie->property("name").toString(), QSL("Mango"));
QCOMPARE(mangoCookie->property("expirationDate").toDateTime(), actualMangoCookie.expirationDate());
QList<QVariant> mangoCookies = m_testHelper.evaluate("Falkon.Cookies.getAll({name: 'Mango'})").toVariant().toList();
QList<QVariant> mangoCookies = m_testHelper.evaluate(QSL("Falkon.Cookies.getAll({name: 'Mango'})")).toVariant().toList();
QCOMPARE(mangoCookies.length(), 2);
}

View File

@ -36,17 +36,17 @@ void QmlHistoryApiTest::testAddition()
{
qRegisterMetaType<HistoryEntry>();
QSignalSpy historySpy(mApp->history(), &History::historyEntryAdded);
m_testHelper.evaluate("Falkon.History.addUrl({"
m_testHelper.evaluate(QL1S("Falkon.History.addUrl({"
" url: 'https://example.com',"
" title: 'Example Domain'"
"})");
"})"));
QTRY_COMPARE(historySpy.count(), 1);
HistoryEntry entry = qvariant_cast<HistoryEntry>(historySpy.at(0).at(0));
QCOMPARE(entry.title, QSL("Example Domain"));
auto object = m_testHelper.evaluateQObject("Falkon.History");
auto object = m_testHelper.evaluateQObject(QSL("Falkon.History"));
QSignalSpy qmlHistorySpy(object, SIGNAL(visited(QmlHistoryItem*)));
mApp->history()->addHistoryEntry(QUrl("https://sample.com"), "Sample Domain");
mApp->history()->addHistoryEntry(QUrl(QSL("https://sample.com")), QSL("Sample Domain"));
QTRY_COMPARE(qmlHistorySpy.count(), 1);
mApp->history()->clearHistory();
}
@ -54,34 +54,34 @@ void QmlHistoryApiTest::testAddition()
void QmlHistoryApiTest::testSearch()
{
QSignalSpy historySpy(mApp->history(), &History::historyEntryAdded);
mApp->history()->addHistoryEntry(QUrl("https://example.com"), "Example Domain");
mApp->history()->addHistoryEntry(QUrl("https://another-example.com"), "Another Example Domain");
mApp->history()->addHistoryEntry(QUrl("https://sample.com"), "Sample Domain");
mApp->history()->addHistoryEntry(QUrl(QSL("https://example.com")), QSL("Example Domain"));
mApp->history()->addHistoryEntry(QUrl(QSL("https://another-example.com")), QSL("Another Example Domain"));
mApp->history()->addHistoryEntry(QUrl(QSL("https://sample.com")), QSL("Sample Domain"));
QTRY_COMPARE(historySpy.count(), 3);
auto list = m_testHelper.evaluate("Falkon.History.search('example')").toVariant().toList();
auto list = m_testHelper.evaluate(QSL("Falkon.History.search('example')")).toVariant().toList();
QCOMPARE(list.length(), 2);
}
void QmlHistoryApiTest::testVisits()
{
int visits = m_testHelper.evaluate("Falkon.History.getVisits('https://sample.com')").toInt();
int visits = m_testHelper.evaluate(QSL("Falkon.History.getVisits('https://sample.com')")).toInt();
QCOMPARE(visits, 1);
QSignalSpy historySpy(mApp->history(), &History::historyEntryEdited);
mApp->history()->addHistoryEntry(QUrl("https://sample.com"), "Sample Domain");
mApp->history()->addHistoryEntry(QUrl(QSL("https://sample.com")), QSL("Sample Domain"));
QTRY_COMPARE(historySpy.count(), 1);
visits = m_testHelper.evaluate("Falkon.History.getVisits('https://sample.com')").toInt();
visits = m_testHelper.evaluate(QSL("Falkon.History.getVisits('https://sample.com')")).toInt();
QCOMPARE(visits, 2);
}
void QmlHistoryApiTest::testRemoval()
{
QSignalSpy historySpy(mApp->history(), &History::historyEntryDeleted);
m_testHelper.evaluate("Falkon.History.deleteUrl('https://sample.com')");
m_testHelper.evaluate(QSL("Falkon.History.deleteUrl('https://sample.com')"));
QTRY_COMPARE(historySpy.count(), 1);
auto object = m_testHelper.evaluateQObject("Falkon.History");
auto object = m_testHelper.evaluateQObject(QSL("Falkon.History"));
QSignalSpy qmlHistorySpy(object, SIGNAL(visitRemoved(QmlHistoryItem*)));
mApp->history()->deleteHistoryEntry("https://example.com", "Example Domain");
mApp->history()->deleteHistoryEntry(QSL("https://example.com"), QSL("Example Domain"));
QTRY_COMPARE(qmlHistorySpy.count(), 1);
}

View File

@ -37,12 +37,12 @@ void QmlTabsApiTest::testInitWindowCount()
void QmlTabsApiTest::testTabsAPI()
{
// Tab Insertion
QObject *qmlTabsObject = m_testHelper.evaluateQObject("Falkon.Tabs");
QObject *qmlTabsObject = m_testHelper.evaluateQObject(QSL("Falkon.Tabs"));
QVERIFY(qmlTabsObject);
QSignalSpy qmlTabsInsertedSpy(qmlTabsObject, SIGNAL(tabInserted(QVariantMap)));
m_testHelper.evaluate("Falkon.Tabs.addTab({"
m_testHelper.evaluate(QL1S("Falkon.Tabs.addTab({"
" url: 'https://example.com/'"
"})");
"})"));
QCOMPARE(qmlTabsInsertedSpy.count(), 1);
QVariantMap retMap1 = QVariant(qmlTabsInsertedSpy.at(0).at(0)).toMap();
int index1 = retMap1.value(QSL("index"), -1).toInt();
@ -50,15 +50,15 @@ void QmlTabsApiTest::testTabsAPI()
QCOMPARE(index1, 0);
QCOMPARE(windowId1, 0);
QObject *qmlTabObject1 = m_testHelper.evaluateQObject("Falkon.Tabs.get({index: 0})");
QObject *qmlTabObject1 = m_testHelper.evaluateQObject(QSL("Falkon.Tabs.get({index: 0})"));
QVERIFY(qmlTabObject1);
QCOMPARE(qmlTabObject1->property("index").toInt(), 0);
QCOMPARE(qmlTabObject1->property("pinned").toBool(), false);
QTRY_COMPARE(qmlTabObject1->property("url").toString(), QSL("https://example.com/"));
m_testHelper.evaluate("Falkon.Tabs.addTab({"
m_testHelper.evaluate(QL1S("Falkon.Tabs.addTab({"
" url: 'https://another-example.com/',"
"})");
"})"));
QCOMPARE(qmlTabsInsertedSpy.count(), 2);
QVariantMap retMap2 = QVariant(qmlTabsInsertedSpy.at(1).at(0)).toMap();
int index2 = retMap2.value(QSL("index"), -1).toInt();
@ -66,17 +66,17 @@ void QmlTabsApiTest::testTabsAPI()
QCOMPARE(index2, 1);
QCOMPARE(windowId2, 0);
bool pinnedTab = m_testHelper.evaluate("Falkon.Tabs.pinTab({index: 1})").toBool();
bool pinnedTab = m_testHelper.evaluate(QSL("Falkon.Tabs.pinTab({index: 1})")).toBool();
QVERIFY(pinnedTab);
QObject *qmlTabObject2 = m_testHelper.evaluateQObject("Falkon.Tabs.get({index: 0})");
QObject *qmlTabObject2 = m_testHelper.evaluateQObject(QSL("Falkon.Tabs.get({index: 0})"));
QVERIFY(qmlTabObject2);
QCOMPARE(qmlTabObject2->property("index").toInt(), 0);
QCOMPARE(qmlTabObject2->property("pinned").toBool(), true);
QTRY_COMPARE(qmlTabObject2->property("url").toString(), QSL("https://another-example.com/"));
bool unpinnedTab = m_testHelper.evaluate("Falkon.Tabs.unpinTab({index: 0})").toBool();
bool unpinnedTab = m_testHelper.evaluate(QSL("Falkon.Tabs.unpinTab({index: 0})")).toBool();
QVERIFY(unpinnedTab);
QObject *qmlTabObject3 = m_testHelper.evaluateQObject("Falkon.Tabs.get({index: 0})");
QObject *qmlTabObject3 = m_testHelper.evaluateQObject(QSL("Falkon.Tabs.get({index: 0})"));
QVERIFY(qmlTabObject3);
QCOMPARE(qmlTabObject3->property("url").toString(), QSL("https://another-example.com/"));
QCOMPARE(qmlTabObject3->property("index").toInt(), 0);
@ -84,28 +84,28 @@ void QmlTabsApiTest::testTabsAPI()
// Next-Previous-Current
QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 0);
m_testHelper.evaluate("Falkon.Tabs.nextTab()");
m_testHelper.evaluate(QSL("Falkon.Tabs.nextTab()"));
QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 1);
m_testHelper.evaluate("Falkon.Tabs.nextTab()");
m_testHelper.evaluate(QSL("Falkon.Tabs.nextTab()"));
QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 0);
m_testHelper.evaluate("Falkon.Tabs.previousTab()");
m_testHelper.evaluate(QSL("Falkon.Tabs.previousTab()"));
QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 1);
m_testHelper.evaluate("Falkon.Tabs.previousTab()");
m_testHelper.evaluate(QSL("Falkon.Tabs.previousTab()"));
QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 0);
m_testHelper.evaluate("Falkon.Tabs.setCurrentIndex({index: 1})");
m_testHelper.evaluate(QSL("Falkon.Tabs.setCurrentIndex({index: 1})"));
QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 1);
m_testHelper.evaluate("Falkon.Tabs.setCurrentIndex({index: 0})");
m_testHelper.evaluate(QSL("Falkon.Tabs.setCurrentIndex({index: 0})"));
QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 0);
// Move Tab
QSignalSpy qmlTabsMovedSpy(qmlTabsObject, SIGNAL(tabMoved(QVariantMap)));
m_testHelper.evaluate("Falkon.Tabs.moveTab({from: 0, to:1, windowId: 0})");
m_testHelper.evaluate(QSL("Falkon.Tabs.moveTab({from: 0, to:1, windowId: 0})"));
QCOMPARE(qmlTabsMovedSpy.count(), 1);
// Tab Removal
QCOMPARE(mApp->getWindow()->tabCount(), 2);
QSignalSpy qmlTabsRemovedSpy(qmlTabsObject, SIGNAL(tabRemoved(QVariantMap)));
m_testHelper.evaluate("Falkon.Tabs.closeTab({index: 0})");
m_testHelper.evaluate(QSL("Falkon.Tabs.closeTab({index: 0})"));
QCOMPARE(qmlTabsRemovedSpy.count(), 1);
QCOMPARE(mApp->getWindow()->tabCount(), 1);
}

View File

@ -31,8 +31,8 @@ void QmlTopSitesApiTest::cleanupTestCase()
void QmlTopSitesApiTest::testTopSites()
{
mApp->plugins()->speedDial()->addPage(QUrl("https://example.com"), "Example Domain");
auto list = m_testHelper.evaluate("Falkon.TopSites.get()").toVariant().toList();
mApp->plugins()->speedDial()->addPage(QUrl(QSL("https://example.com")), QSL("Example Domain"));
auto list = m_testHelper.evaluate(QSL("Falkon.TopSites.get()")).toVariant().toList();
qDebug() << "Top sites list size=" << list.length();
for( const auto& site : list )
{

View File

@ -34,26 +34,26 @@ void QmlUserScriptApiTest::cleanupTestCase()
void QmlUserScriptApiTest::testCount()
{
int count = m_testHelper.evaluate("Falkon.UserScripts.count").toInt();
int count = m_testHelper.evaluate(QSL("Falkon.UserScripts.count")).toInt();
QCOMPARE(count, mApp->webProfile()->scripts()->count());
}
void QmlUserScriptApiTest::testSize()
{
int size = m_testHelper.evaluate("Falkon.UserScripts.size").toInt();
int size = m_testHelper.evaluate(QSL("Falkon.UserScripts.size")).toInt();
QCOMPARE(size, mApp->webProfile()->scripts()->count());
}
void QmlUserScriptApiTest::testEmpty()
{
bool empty = m_testHelper.evaluate("Falkon.UserScripts.empty").toBool();
bool empty = m_testHelper.evaluate(QSL("Falkon.UserScripts.empty")).toBool();
QCOMPARE(empty, mApp->webProfile()->scripts()->isEmpty());
}
void QmlUserScriptApiTest::testContains()
{
QWebEngineScript script = mApp->webProfile()->scripts()->toList().at(0);
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
QObject *object = m_testHelper.evaluateQObject(QSL("Falkon.UserScripts"));
auto *userScripts = dynamic_cast<QmlUserScripts*>(object);
QVERIFY(userScripts);
auto *userScript = new QmlUserScript();
@ -65,7 +65,7 @@ void QmlUserScriptApiTest::testContains()
void QmlUserScriptApiTest::testFind()
{
QWebEngineScript script = mApp->webProfile()->scripts()->toList().at(0);
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
QObject *object = m_testHelper.evaluateQObject(QSL("Falkon.UserScripts"));
auto *userScripts = dynamic_cast<QmlUserScripts*>(object);
QVERIFY(userScripts);
QObject *scriptFound = userScripts->findScript(script.name());
@ -75,22 +75,22 @@ void QmlUserScriptApiTest::testFind()
void QmlUserScriptApiTest::testInsertRemove()
{
int initialCount = m_testHelper.evaluate("Falkon.UserScripts.count").toInt();
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
int initialCount = m_testHelper.evaluate(QSL("Falkon.UserScripts.count")).toInt();
QObject *object = m_testHelper.evaluateQObject(QSL("Falkon.UserScripts"));
auto *userScripts = dynamic_cast<QmlUserScripts*>(object);
QVERIFY(userScripts);
auto *userScript = new QmlUserScript();
userScript->setProperty("name", "Hello World");
userScript->setProperty("sourceCode", "(function() {"
userScript->setProperty("name", QSL("Hello World"));
userScript->setProperty("sourceCode", QL1S("(function() {"
" alert('Hello World')"
"})()");
"})()"));
userScripts->insert(userScript);
int finalCount = m_testHelper.evaluate("Falkon.UserScripts.count").toInt();
int finalCount = m_testHelper.evaluate(QSL("Falkon.UserScripts.count")).toInt();
QCOMPARE(finalCount, initialCount + 1);
userScripts->remove(userScript);
int ultimateCount = m_testHelper.evaluate("Falkon.UserScripts.count").toInt();
int ultimateCount = m_testHelper.evaluate(QSL("Falkon.UserScripts.count")).toInt();
QCOMPARE(ultimateCount, initialCount);
}

View File

@ -32,13 +32,13 @@ void QmlWindowsApiTest::cleanupTestCase()
void QmlWindowsApiTest::testWindowsAPI()
{
QObject *currentWindowObject = m_testHelper.evaluateQObject("Falkon.Windows.getCurrent()");
QObject *currentWindowObject = m_testHelper.evaluateQObject(QSL("Falkon.Windows.getCurrent()"));
QVERIFY(currentWindowObject);
QCOMPARE(currentWindowObject->property("title").toString(), mApp->getWindow()->windowTitle());
QCOMPARE(currentWindowObject->property("type").toInt(), (int)mApp->getWindow()->windowType());
QCOMPARE(currentWindowObject->property("tabs").toList().length(), mApp->getWindow()->tabCount());
QObject *windowObject = m_testHelper.evaluateQObject("Falkon.Windows");
QObject *windowObject = m_testHelper.evaluateQObject(QSL("Falkon.Windows"));
QVERIFY(windowObject);
QSignalSpy qmlWindowCreatedSignal(windowObject, SIGNAL(created(QmlWindow*)));
qRegisterMetaType<BrowserWindow*>();
@ -48,7 +48,7 @@ void QmlWindowsApiTest::testWindowsAPI()
QTRY_COMPARE(qmlWindowCreatedSignal.count(), 1);
QTRY_COMPARE(windowCreatedSingal.count(), 1);
QObject *newQmlWindow = m_testHelper.evaluateQObject("Falkon.Windows.create({})");
QObject *newQmlWindow = m_testHelper.evaluateQObject(QSL("Falkon.Windows.create({})"));
QVERIFY(newQmlWindow);
QCOMPARE(mApp->windowCount(), 2);
@ -60,12 +60,12 @@ void QmlWindowsApiTest::testWindowsAPI()
QVERIFY(newQmlSignalWindow);
QCOMPARE(newQmlWindow->property("id").toInt(), newQmlSignalWindow->property("id").toInt());
int qmlWindowCount = m_testHelper.evaluate("Falkon.Windows.getAll().length").toInt();
int qmlWindowCount = m_testHelper.evaluate(QSL("Falkon.Windows.getAll().length")).toInt();
QCOMPARE(qmlWindowCount, mApp->windowCount());
QSignalSpy qmlWindowRemovedSignal(windowObject, SIGNAL(removed(QmlWindow*)));
int newQmlWindowId = newQmlSignalWindow->property("id").toInt();
m_testHelper.evaluate(QString("Falkon.Windows.remove(%1)").arg(newQmlWindowId));
m_testHelper.evaluate(QString(QSL("Falkon.Windows.remove(%1)")).arg(newQmlWindowId));
QTRY_COMPARE(qmlWindowRemovedSignal.count(), 1);
}

View File

@ -65,15 +65,15 @@ void QzToolsTest::getFileNameFromUrl_data()
QTest::addColumn<QUrl>("url");
QTest::addColumn<QString>("result");
QTest::newRow("Basic") << QUrl("http://www.google.com/filename.html") << "filename.html";
QTest::newRow("OnlyHost") << QUrl("http://www.google.com/") << "www.google.com";
QTest::newRow("OnlyHostWithoutSlash") << QUrl("http://www.google.com") << "www.google.com";
QTest::newRow("EndingDirectory") << QUrl("http://www.google.com/filename/") << "filename";
QTest::newRow("EmptyUrl") << QUrl("") << "";
QTest::newRow("OnlyScheme") << QUrl("http:") << "";
QTest::newRow("FileSchemeUrl") << QUrl("file:///usr/share/test/file.tx") << "file.tx";
QTest::newRow("FileSchemeUrlDirectory") << QUrl("file:///usr/share/test/") << "test";
QTest::newRow("FileSchemeUrlRoot") << QUrl("file:///") << "";
QTest::newRow("Basic") << QUrl(QSL("http://www.google.com/filename.html")) << QSL("filename.html");
QTest::newRow("OnlyHost") << QUrl(QSL("http://www.google.com/")) << QSL("www.google.com");
QTest::newRow("OnlyHostWithoutSlash") << QUrl(QSL("http://www.google.com")) << QSL("www.google.com");
QTest::newRow("EndingDirectory") << QUrl(QSL("http://www.google.com/filename/")) << QSL("filename");
QTest::newRow("EmptyUrl") << QUrl(QSL("")) << QSL("");
QTest::newRow("OnlyScheme") << QUrl(QSL("http:")) << QSL("");
QTest::newRow("FileSchemeUrl") << QUrl(QSL("file:///usr/share/test/file.tx")) << QSL("file.tx");
QTest::newRow("FileSchemeUrlDirectory") << QUrl(QSL("file:///usr/share/test/")) << QSL("test");
QTest::newRow("FileSchemeUrlRoot") << QUrl(QSL("file:///")) << QSL("");
}
void QzToolsTest::getFileNameFromUrl()
@ -90,37 +90,37 @@ void QzToolsTest::splitCommandArguments_data()
QTest::addColumn<QStringList>("result");
QTest::newRow("Basic") << "/usr/bin/foo -o foo.out"
<< (QStringList() << "/usr/bin/foo" << "-o" << "foo.out");
<< (QStringList() << QSL("/usr/bin/foo") << QSL("-o") << QSL("foo.out"));
QTest::newRow("Empty") << QString()
<< QStringList();
QTest::newRow("OnlySpaces") << QString(" ")
QTest::newRow("OnlySpaces") << QSL(" ")
<< QStringList();
QTest::newRow("OnlyQuotes") << QString(R"("" "")")
QTest::newRow("OnlyQuotes") << QSL(R"("" "")")
<< QStringList();
QTest::newRow("EmptyQuotesAndSpace") << QString(R"("" "" " ")")
<< QStringList(" ");
QTest::newRow("EmptyQuotesAndSpace") << QSL(R"("" "" " ")")
<< QStringList(QSL(" "));
QTest::newRow("MultipleSpaces") << " /usr/foo -o foo.out "
<< (QStringList() << "/usr/foo" << "-o" << "foo.out");
<< (QStringList() << QSL("/usr/foo") << QSL("-o") << QSL("foo.out"));
QTest::newRow("Quotes") << R"("/usr/foo" "-o" "foo.out")"
<< (QStringList() << "/usr/foo" << "-o" << "foo.out");
<< (QStringList() << QSL("/usr/foo") << QSL("-o") << QSL("foo.out"));
QTest::newRow("SingleQuotes") << "'/usr/foo' '-o' 'foo.out'"
<< (QStringList() << "/usr/foo" << "-o" << "foo.out");
<< (QStringList() << QSL("/usr/foo") << QSL("-o") << QSL("foo.out"));
QTest::newRow("SingleAndDoubleQuotes") << " '/usr/foo' \"-o\" 'foo.out' "
<< (QStringList() << "/usr/foo" << "-o" << "foo.out");
<< (QStringList() << QSL("/usr/foo") << QSL("-o") << QSL("foo.out"));
QTest::newRow("SingleInDoubleQuotes") << "/usr/foo \"-o 'ds' \" 'foo.out' "
<< (QStringList() << "/usr/foo" << "-o 'ds' " << "foo.out");
<< (QStringList() << QSL("/usr/foo") << QSL("-o 'ds' ") << QSL("foo.out"));
QTest::newRow("DoubleInSingleQuotes") << "/usr/foo -o 'foo\" d \".out' "
<< (QStringList() << "/usr/foo" << "-o" << "foo\" d \".out");
QTest::newRow("SpacesWithQuotes") << QString(R"( " " " " )")
<< (QStringList() << " " << " ");
<< (QStringList() << QSL("/usr/foo") << QSL("-o") << QSL("foo\" d \".out"));
QTest::newRow("SpacesWithQuotes") << QSL(R"( " " " " )")
<< (QStringList() << QSL(" ") << QSL(" "));
QTest::newRow("QuotesAndSpaces") << "/usr/foo -o \"foo - out\""
<< (QStringList() << "/usr/foo" << "-o" << "foo - out");
<< (QStringList() << QSL("/usr/foo") << QSL("-o") << QSL("foo - out"));
QTest::newRow("EqualAndQuotes") << "/usr/foo -o=\"foo - out\""
<< (QStringList() << "/usr/foo" << "-o=foo - out");
<< (QStringList() << QSL("/usr/foo") << QSL("-o=foo - out"));
QTest::newRow("EqualWithSpaces") << "/usr/foo -o = \"foo - out\""
<< (QStringList() << "/usr/foo" << "-o" << "=" << "foo - out");
<< (QStringList() << QSL("/usr/foo") << QSL("-o") << QSL("=") << QSL("foo - out"));
QTest::newRow("MultipleSpacesAndQuotes") << " /usr/foo -o=\" foo.out \" "
<< (QStringList() << "/usr/foo" << "-o= foo.out ");
<< (QStringList() << QSL("/usr/foo") << QSL("-o= foo.out "));
// Unmatched quotes should be treated as an error
QTest::newRow("UnmatchedQuote") << "/usr/bin/foo -o \"bar"
<< QStringList();
@ -275,17 +275,17 @@ static void createTestDirectoryStructure(const QString &path)
{
QDir().mkdir(path);
QDir dir(path);
dir.mkdir("dir1");
dir.mkdir("dir2");
dir.mkdir("dir3");
dir.cd("dir1");
dir.mkdir("dir1_1");
dir.mkdir("dir1_2");
dir.mkdir("dir1_3");
dir.mkdir(QSL("dir1"));
dir.mkdir(QSL("dir2"));
dir.mkdir(QSL("dir3"));
dir.cd(QSL("dir1"));
dir.mkdir(QSL("dir1_1"));
dir.mkdir(QSL("dir1_2"));
dir.mkdir(QSL("dir1_3"));
dir.cdUp();
dir.cd("dir3");
dir.mkdir("dir3_1");
QFile file(path + "/dir1/dir1_2/file1.txt");
dir.cd(QSL("dir3"));
dir.mkdir(QSL("dir3_1"));
QFile file(path + QSL("/dir1/dir1_2/file1.txt"));
file.open(QFile::WriteOnly);
file.write("test");
file.close();
@ -296,32 +296,32 @@ void QzToolsTest::copyRecursivelyTest()
const QString testDir = createPath("copyRecursivelyTest");
createTestDirectoryStructure(testDir);
QVERIFY(!QFileInfo(testDir + "-copy").exists());
QVERIFY(!QFileInfo(testDir + QSL("-copy")).exists());
// Copy to non-existent target
QCOMPARE(QzTools::copyRecursively(testDir, testDir + "-copy"), true);
QCOMPARE(QzTools::copyRecursively(testDir, testDir + QSL("-copy")), true);
QCOMPARE(QFileInfo(testDir + "-copy").isDir(), true);
QCOMPARE(QFileInfo(testDir + "-copy/dir1").isDir(), true);
QCOMPARE(QFileInfo(testDir + "-copy/dir2").isDir(), true);
QCOMPARE(QFileInfo(testDir + "-copy/dir3").isDir(), true);
QCOMPARE(QFileInfo(testDir + "-copy/dir1/dir1_1").isDir(), true);
QCOMPARE(QFileInfo(testDir + "-copy/dir1/dir1_2").isDir(), true);
QCOMPARE(QFileInfo(testDir + "-copy/dir1/dir1_3").isDir(), true);
QCOMPARE(QFileInfo(testDir + "-copy/dir3/dir3_1").isDir(), true);
QCOMPARE(QFileInfo(testDir + "-copy/dir1/dir1_2/file1.txt").isFile(), true);
QCOMPARE(QFileInfo(testDir + QSL("-copy")).isDir(), true);
QCOMPARE(QFileInfo(testDir + QSL("-copy/dir1")).isDir(), true);
QCOMPARE(QFileInfo(testDir + QSL("-copy/dir2")).isDir(), true);
QCOMPARE(QFileInfo(testDir + QSL("-copy/dir3")).isDir(), true);
QCOMPARE(QFileInfo(testDir + QSL("-copy/dir1/dir1_1")).isDir(), true);
QCOMPARE(QFileInfo(testDir + QSL("-copy/dir1/dir1_2")).isDir(), true);
QCOMPARE(QFileInfo(testDir + QSL("-copy/dir1/dir1_3")).isDir(), true);
QCOMPARE(QFileInfo(testDir + QSL("-copy/dir3/dir3_1")).isDir(), true);
QCOMPARE(QFileInfo(testDir + QSL("-copy/dir1/dir1_2/file1.txt")).isFile(), true);
QFile file(testDir + "-copy/dir1/dir1_2/file1.txt");
QFile file(testDir + QSL("-copy/dir1/dir1_2/file1.txt"));
file.open(QFile::ReadOnly);
QCOMPARE(file.readAll(), QByteArray("test"));
file.close();
// Copy to target that already exists
QCOMPARE(QzTools::copyRecursively(testDir, testDir + "-copy"), false);
QCOMPARE(QzTools::copyRecursively(testDir, testDir + QSL("-copy")), false);
// Cleanup
QCOMPARE(QzTools::removeRecursively(testDir), true);
QCOMPARE(QzTools::removeRecursively(testDir + "-copy"), true);
QCOMPARE(QzTools::removeRecursively(testDir + QSL("-copy")), true);
}
void QzToolsTest::removeRecursivelyTest()
@ -329,23 +329,23 @@ void QzToolsTest::removeRecursivelyTest()
const QString testDir = createPath("removeRecursivelyTest");
createTestDirectoryStructure(testDir);
QCOMPARE(QzTools::copyRecursively(testDir, testDir + "-copy"), true);
QCOMPARE(QzTools::removeRecursively(testDir + "-copy"), true);
QCOMPARE(QFileInfo(testDir + "-copy").exists(), false);
QCOMPARE(QzTools::copyRecursively(testDir, testDir + QSL("-copy")), true);
QCOMPARE(QzTools::removeRecursively(testDir + QSL("-copy")), true);
QCOMPARE(QFileInfo(testDir + QSL("-copy")).exists(), false);
// Remove non-existent path returns success
QCOMPARE(QzTools::removeRecursively(testDir + "-copy"), true);
QCOMPARE(QzTools::removeRecursively(testDir + QSL("-copy")), true);
QCOMPARE(QzTools::copyRecursively(testDir, testDir + "-copy2"), true);
QCOMPARE(QzTools::copyRecursively(testDir, testDir + QSL("-copy2")), true);
QFile dir(testDir + "-copy2");
QFile dir(testDir + QSL("-copy2"));
dir.setPermissions(dir.permissions() & ~(QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther));
QCOMPARE(QzTools::removeRecursively(testDir + "-copy2"), false);
QCOMPARE(QzTools::removeRecursively(testDir + QSL("-copy2")), false);
dir.setPermissions(dir.permissions() | QFile::WriteOwner);
QCOMPARE(QzTools::removeRecursively(testDir + "-copy2"), true);
QCOMPARE(QzTools::removeRecursively(testDir + QSL("-copy2")), true);
// Cleanup
QCOMPARE(QzTools::removeRecursively(testDir), true);
@ -356,21 +356,21 @@ void QzToolsTest::dontFollowSymlinksTest()
const QString testDir = createPath("removeRecursivelyTest");
createTestDirectoryStructure(testDir);
QDir().mkpath(testDir + "/subdir");
QFile::link(testDir, testDir + "/subdir/link");
QDir().mkpath(testDir + QSL("/subdir"));
QFile::link(testDir, testDir + QSL("/subdir/link"));
QVERIFY(QzTools::removeRecursively(testDir + "/subdir"));
QVERIFY(QzTools::removeRecursively(testDir + QSL("/subdir")));
QVERIFY(!QFile::exists(testDir + "/subdir"));
QVERIFY(!QFile::exists(testDir + QSL("/subdir")));
QVERIFY(QFile::exists(testDir));
QDir().mkpath(testDir + "/subdir/normalfolder");
QFile::link("..", testDir + "/subdir/link");
QDir().mkpath(testDir + QSL("/subdir/normalfolder"));
QFile::link(QSL(".."), testDir + QSL("/subdir/link"));
QVERIFY(QzTools::copyRecursively(testDir + "/subdir", testDir + "/subdir2"));
QVERIFY(QzTools::copyRecursively(testDir + QSL("/subdir"), testDir + QSL("/subdir2")));
QCOMPARE(QFile::exists(testDir + "/subdir2/link"), true);
QCOMPARE(QFile::exists(testDir + "/subdir2/normalfolder"), true);
QCOMPARE(QFile::exists(testDir + QSL("/subdir2/link")), true);
QCOMPARE(QFile::exists(testDir + QSL("/subdir2/normalfolder")), true);
// Cleanup
QCOMPARE(QzTools::removeRecursively(testDir), true);
@ -378,7 +378,7 @@ void QzToolsTest::dontFollowSymlinksTest()
QString QzToolsTest::createPath(const char *file) const
{
return m_tmpPath + QL1S("/") + file;
return m_tmpPath + QL1S("/") + QString::fromUtf8(file);
}
QTEST_GUILESS_MAIN(QzToolsTest)

View File

@ -58,7 +58,7 @@ void TabModelTest::basicTest()
rowsInsertedSpy.clear();
w->tabWidget()->addView(QUrl("http://test.com"));
w->tabWidget()->addView(QUrl(QSL("http://test.com")));
QCOMPARE(rowsInsertedSpy.count(), 1);
WebTab *tab1 = w->tabWidget()->webTab(1);
@ -114,7 +114,7 @@ void TabModelTest::dataTest()
QCOMPARE(model.index(0, 0).data(TabModel::RestoredRole).toBool(), tab0->isRestored());
QCOMPARE(model.index(0, 0).data(TabModel::CurrentTabRole).toBool(), true);
w->tabWidget()->addView(QUrl("http://test.com"));
w->tabWidget()->addView(QUrl(QSL("http://test.com")));
delete w;
}
@ -125,7 +125,7 @@ void TabModelTest::pinTabTest()
TabModel model(w);
ModelTest modelTest(&model);
w->tabWidget()->addView(QUrl("http://test.com"));
w->tabWidget()->addView(QUrl(QSL("http://test.com")));
QTRY_COMPARE(model.rowCount(), 2);

View File

@ -257,27 +257,27 @@ void WebTabTest::loadNotRestoredTabTest()
{
WebTab tab;
tab.load(QUrl("qrc:autotests/data/basic_page.html"));
tab.load(QUrl(QSL("qrc:autotests/data/basic_page.html")));
QVERIFY(waitForLoadfinished(&tab));
QTRY_COMPARE(tab.webView()->history()->count(), 1);
tab.unload();
QVERIFY(!tab.isRestored());
tab.load(QUrl("qrc:autotests/data/basic_page2.html"));
tab.load(QUrl(QSL("qrc:autotests/data/basic_page2.html")));
QVERIFY(waitForLoadfinished(&tab));
QTRY_COMPARE(tab.webView()->history()->count(), 2);
QCOMPARE(tab.url(), QUrl("qrc:autotests/data/basic_page2.html"));
QCOMPARE(tab.webView()->history()->currentItem().url(), QUrl("qrc:autotests/data/basic_page2.html"));
QCOMPARE(tab.webView()->history()->backItem().url(), QUrl("qrc:autotests/data/basic_page.html"));
QCOMPARE(tab.url(), QUrl(QSL("qrc:autotests/data/basic_page2.html")));
QCOMPARE(tab.webView()->history()->currentItem().url(), QUrl(QSL("qrc:autotests/data/basic_page2.html")));
QCOMPARE(tab.webView()->history()->backItem().url(), QUrl(QSL("qrc:autotests/data/basic_page.html")));
}
void WebTabTest::saveNotRestoredTabTest()
{
WebTab tab;
tab.load(QUrl("qrc:autotests/data/basic_page.html"));
tab.load(QUrl(QSL("qrc:autotests/data/basic_page.html")));
QVERIFY(waitForLoadfinished(&tab));
QTRY_COMPARE(tab.webView()->history()->count(), 1);
@ -286,7 +286,7 @@ void WebTabTest::saveNotRestoredTabTest()
WebTab::SavedTab saved(&tab);
QVERIFY(saved.isValid());
QCOMPARE(saved.url, QUrl("qrc:autotests/data/basic_page.html"));
QCOMPARE(saved.url, QUrl(QSL("qrc:autotests/data/basic_page.html")));
}
FALKONTEST_MAIN(WebTabTest)

View File

@ -73,7 +73,7 @@ void WebViewTest::loadSignalsChangePageTest()
QSignalSpy loadStartedSpy(&view, &WebView::loadStarted);
QSignalSpy loadFinishedSpy(&view, &WebView::loadFinished);
view.load(QUrl("qrc:autotests/data/basic_page.html"));
view.load(QUrl(QSL("qrc:autotests/data/basic_page.html")));
QTRY_COMPARE(loadStartedSpy.count(), 1);
loadStartedSpy.clear();
@ -93,7 +93,7 @@ void WebViewTest::loadSignalsChangePageTest()
view2.setPage(page3);
QSignalSpy page3LoadStart(page3, &WebPage::loadStarted);
page3->load(QUrl("qrc:autotests/data/basic_page.html"));
page3->load(QUrl(QSL("qrc:autotests/data/basic_page.html")));
QVERIFY(page3LoadStart.wait());
view2.setPage(new QWebEnginePage(&view2));

View File

@ -619,7 +619,7 @@ void FancyTabWidget::SetMode(FancyTabWidget::Mode mode)
side_layout_->insertWidget(0, bar);
tab_bar_ = bar;
foreach (const Item &item, items_) {
for (const Item &item : std::as_const(items_)) {
if (item.type_ == Item::Type_Spacer) {
bar->addSpacer(item.spacer_size_);
}
@ -718,7 +718,7 @@ void FancyTabWidget::MakeTabBar(QTabBar::Shape shape, bool text, bool icons,
side_layout_->insertWidget(0, bar);
}
foreach (const Item &item, items_) {
for (const Item &item : std::as_const(items_)) {
if (item.type_ != Item::Type_Tab) {
continue;
}

View File

@ -302,7 +302,7 @@ void LineEdit::setTextFormat(const LineEdit::TextFormat &format)
{
QList<QInputMethodEvent::Attribute> attributes;
foreach (const QTextLayout::FormatRange &fr, format) {
for (const QTextLayout::FormatRange &fr : format) {
QInputMethodEvent::AttributeType type = QInputMethodEvent::TextFormat;
int start = fr.start - cursorPosition();
int length = fr.length;

View File

@ -111,7 +111,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
#endif
prefix = id.section(QLatin1Char('/'), -1);
}
prefix = QRegExp("[^a-zA-Z]").removeIn(prefix);
prefix = QRegExp(QStringLiteral("[^a-zA-Z]")).removeIn(prefix);
prefix.truncate(6);
QByteArray idc = id.toUtf8();

View File

@ -190,7 +190,7 @@ bool QtLockedFile::unlock()
rmutex = 0;
}
else {
foreach(Qt::HANDLE mutex, rmutexes) {
for (Qt::HANDLE mutex : std::as_const(rmutexes)) {
ReleaseMutex(mutex);
CloseHandle(mutex);
}

View File

@ -127,7 +127,9 @@ void StyleHelper::setBaseColor(const QColor &newcolor)
if (color.isValid() && color != m_baseColor) {
m_baseColor = color;
foreach (QWidget* w, QApplication::topLevelWidgets()) {
auto const l_topLevelWidgets = QApplication::topLevelWidgets();
for (QWidget* w : l_topLevelWidgets) {
w->update();
}
}

View File

@ -111,7 +111,7 @@ bool AdBlockManager::block(QWebEngineUrlRequestInfo &request, QString &ruleFilte
QElapsedTimer timer;
timer.start();
#endif
const QString urlString = request.requestUrl().toEncoded().toLower();
const QString urlString = QString::fromUtf8(request.requestUrl().toEncoded().toLower());
const QString urlDomain = request.requestUrl().host().toLower();
const QString urlScheme = request.requestUrl().scheme().toLower();

View File

@ -76,7 +76,7 @@ static QString getTopLevelDomain(const QUrl &url)
//return qt_ACE_do(tld, ToAceOnly, AllowLeadingDot, {});
// TODO QT6 - QUrl::toAce() uses ForbidLeadingDot, while the old QUrl::topLevelDomain() used AllowLeadingDot. Does this matter?
return QString(QUrl::toAce(tld));
return QString(QString::fromUtf8(QUrl::toAce(tld)));
}
static QString toSecondLevelDomain(const QUrl &url)
@ -235,7 +235,7 @@ bool AdBlockRule::urlMatch(const QUrl &url) const
return false;
}
const QString encodedUrl = url.toEncoded();
const QString encodedUrl = QString::fromUtf8(url.toEncoded());
const QString domain = url.host();
return stringMatch(domain, encodedUrl);

View File

@ -121,7 +121,7 @@ MainApplication::MainApplication(int &argc, char** argv)
setDesktopFileName(QSL("org.kde.falkon"));
#ifdef GIT_REVISION
setApplicationVersion(QSL("%1 (%2)").arg(Qz::VERSION, GIT_REVISION));
setApplicationVersion(QSL("%1 (%2)").arg(QString::fromLatin1(Qz::VERSION), GIT_REVISION));
#else
setApplicationVersion(QString::fromLatin1(Qz::VERSION));
#endif
@ -196,15 +196,15 @@ MainApplication::MainApplication(int &argc, char** argv)
break;
case Qz::CL_OpenUrlInCurrentTab:
startUrl = QUrl::fromUserInput(pair.text);
messages.append("ACTION:OpenUrlInCurrentTab" + pair.text);
messages.append(QSL("ACTION:OpenUrlInCurrentTab") + pair.text);
break;
case Qz::CL_OpenUrlInNewWindow:
startUrl = QUrl::fromUserInput(pair.text);
messages.append("ACTION:OpenUrlInNewWindow" + pair.text);
messages.append(QSL("ACTION:OpenUrlInNewWindow") + pair.text);
break;
case Qz::CL_OpenUrl:
startUrl = QUrl::fromUserInput(pair.text);
messages.append("URL:" + pair.text);
messages.append(QSL("URL:") + pair.text);
break;
case Qz::CL_ExitAction:
m_isClosing = true;
@ -703,7 +703,7 @@ void MainApplication::startPrivateBrowsing(const QUrl &startUrl)
args.append(QSL("--profile=") + ProfileManager::currentProfile());
if (!url.isEmpty()) {
args << url.toEncoded();
args << QString::fromUtf8(url.toEncoded());
}
if (!QProcess::startDetached(applicationFilePath(), args)) {
@ -1220,7 +1220,7 @@ void MainApplication::createJumpList()
frequent->setVisible(true);
const QVector<HistoryEntry> mostList = m_history->mostVisited(7);
for (const HistoryEntry &entry : mostList) {
frequent->addLink(IconProvider::iconForUrl(entry.url), entry.title, applicationFilePath(), QStringList{entry.url.toEncoded()});
frequent->addLink(IconProvider::iconForUrl(entry.url), entry.title, applicationFilePath(), QStringList{(QString::fromUtf8entry.url.toEncoded())});
}
// Tasks
@ -1244,14 +1244,14 @@ RegisterQAppAssociation* MainApplication::associationManager()
{
if (!m_registerQAppAssociation) {
QString desc = tr("Falkon is a new and very fast Qt web browser. Falkon is licensed under GPL version 3 or (at your option) any later version. It is based on QtWebEngine and Qt Framework.");
QString fileIconPath = QApplication::applicationFilePath() + ",1";
QString appIconPath = QApplication::applicationFilePath() + ",0";
m_registerQAppAssociation = new RegisterQAppAssociation("Falkon", QApplication::applicationFilePath(), appIconPath, desc, this);
m_registerQAppAssociation->addCapability(".html", "FalkonHTML", "Falkon HTML Document", fileIconPath, RegisterQAppAssociation::FileAssociation);
m_registerQAppAssociation->addCapability(".htm", "FalkonHTML", "Falkon HTML Document", fileIconPath, RegisterQAppAssociation::FileAssociation);
m_registerQAppAssociation->addCapability("http", "FalkonURL", "Falkon URL", appIconPath, RegisterQAppAssociation::UrlAssociation);
m_registerQAppAssociation->addCapability("https", "FalkonURL", "Falkon URL", appIconPath, RegisterQAppAssociation::UrlAssociation);
m_registerQAppAssociation->addCapability("ftp", "FalkonURL", "Falkon URL", appIconPath, RegisterQAppAssociation::UrlAssociation);
QString fileIconPath = QApplication::applicationFilePath() + QSL(",1");
QString appIconPath = QApplication::applicationFilePath() + QSL(",0");
m_registerQAppAssociation = new RegisterQAppAssociation(QSL("Falkon"), QApplication::applicationFilePath(), appIconPath, desc, this);
m_registerQAppAssociation->addCapability(QSL(".html"), QSL("FalkonHTML"), QSL("Falkon HTML Document"), fileIconPath, RegisterQAppAssociation::FileAssociation);
m_registerQAppAssociation->addCapability(QSL(".htm"), QSL("FalkonHTML"), QSL("Falkon HTML Document"), fileIconPath, RegisterQAppAssociation::FileAssociation);
m_registerQAppAssociation->addCapability(QSL("http"), QSL("FalkonURL"), QSL("Falkon URL"), appIconPath, RegisterQAppAssociation::UrlAssociation);
m_registerQAppAssociation->addCapability(QSL("https"), QSL("FalkonURL"), QSL("Falkon URL"), appIconPath, RegisterQAppAssociation::UrlAssociation);
m_registerQAppAssociation->addCapability(QSL("ftp"), QSL("FalkonURL"), QSL("Falkon URL"), appIconPath, RegisterQAppAssociation::UrlAssociation);
}
return m_registerQAppAssociation;
}

View File

@ -177,7 +177,7 @@ void MainMenu::savePageAs()
void MainMenu::sendLink()
{
const QUrl mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(m_window->weView()->url().toEncoded()) + "&subject=" + QUrl::toPercentEncoding(m_window->weView()->title()));
const QUrl mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(QString::fromUtf8(m_window->weView()->url().toEncoded())) + "&subject=" + QUrl::toPercentEncoding(m_window->weView()->title()));
QDesktopServices::openUrl(mailUrl);
}

View File

@ -166,10 +166,10 @@ void ProfileManager::updateCurrentProfile()
// If file exists, just update the profile to current version
if (versionFile.exists()) {
versionFile.open(QFile::ReadOnly);
QString profileVersion = versionFile.readAll();
QString profileVersion = QString::fromUtf8(versionFile.readAll());
versionFile.close();
updateProfile(Qz::VERSION, profileVersion.trimmed());
updateProfile(QString::fromLatin1(Qz::VERSION), profileVersion.trimmed());
}
else {
copyDataToProfile();
@ -189,7 +189,7 @@ void ProfileManager::updateProfile(const QString &current, const QString &profil
Updater::Version prof(profile);
// Profile is from newer version than running application
if (prof > Updater::Version(Qz::VERSION)) {
if (prof > Updater::Version(QString::fromLatin1(Qz::VERSION))) {
// Only copy data when profile is not from development version
if (prof.revisionNumber != 99) {
copyDataToProfile();
@ -247,8 +247,8 @@ void ProfileManager::copyDataToProfile()
sessionFile.remove();
}
const QString text = "Incompatible profile version has been detected. To avoid losing your profile data, they were "
"backed up in following file:<br/><br/><b>" + browseDataBackup + "<br/></b>";
const QString text = QSL("Incompatible profile version has been detected. To avoid losing your profile data, they were "
"backed up in following file:<br/><br/><b>") + browseDataBackup + QSL("<br/></b>");
QMessageBox::warning(0, QStringLiteral("Falkon: Incompatible profile version"), text);
}
}

View File

@ -25,7 +25,7 @@
#include <QSqlQuery>
#include <QSqlDatabase>
#define CONNECTION "firefox-places-import"
#define CONNECTION QSL("firefox-places-import")
FirefoxImporter::FirefoxImporter(QObject* parent)
: BookmarksImporter(parent)

View File

@ -246,7 +246,7 @@ void BookmarksManager::updateEditBox(BookmarkItem* item)
}
else {
ui->title->setText(item->title());
ui->address->setText(item->url().toEncoded());
ui->address->setText(QString::fromUtf8(item->url().toEncoded()));
ui->keyword->setText(item->keyword());
ui->description->setPlainText(item->description());

View File

@ -165,9 +165,9 @@ void BookmarksMenu::init()
{
setTitle(tr("&Bookmarks"));
addAction(tr("Bookmark &This Page"), this, &BookmarksMenu::bookmarkPage)->setShortcut(QKeySequence("Ctrl+D"));
addAction(tr("Bookmark &This Page"), this, &BookmarksMenu::bookmarkPage)->setShortcut(QKeySequence(QSL("Ctrl+D")));
addAction(tr("Bookmark &All Tabs"), this, &BookmarksMenu::bookmarkAllTabs);
addAction(QIcon::fromTheme("bookmarks-organize"), tr("Organize &Bookmarks"), this, &BookmarksMenu::showBookmarksManager)->setShortcut(QKeySequence("Ctrl+Shift+O"));
addAction(QIcon::fromTheme(QSL("bookmarks-organize")), tr("Organize &Bookmarks"), this, &BookmarksMenu::showBookmarksManager)->setShortcut(QKeySequence(QSL("Ctrl+Shift+O")));
addSeparator();
connect(this, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));

View File

@ -118,7 +118,7 @@ QVariant BookmarksModel::data(const QModelIndex &index, int role) const
return itm->isSidebarExpanded();
case Qt::ToolTipRole:
if (index.column() == 0 && itm->isUrl()) {
return QString("%1\n%2").arg(itm->title(), QString::fromUtf8(itm->url().toEncoded()));
return QSL("%1\n%2").arg(itm->title(), QString::fromUtf8(itm->url().toEncoded()));
}
// fallthrough
case Qt::DisplayRole:
@ -126,7 +126,7 @@ QVariant BookmarksModel::data(const QModelIndex &index, int role) const
case 0:
return itm->title();
case 1:
return itm->url().toEncoded();
return QString::fromUtf8(itm->url().toEncoded());
default:
return {};
}

View File

@ -75,9 +75,9 @@ void BookmarksToolbar::contextMenuRequested(const QPoint &pos)
QAction* actNewWindow = menu.addAction(IconProvider::newWindowIcon(), tr("Open in new window"));
QAction* actNewPrivateWindow = menu.addAction(IconProvider::privateBrowsingIcon(), tr("Open in new private window"));
menu.addSeparator();
QAction* actNewFolder = menu.addAction(QIcon::fromTheme("folder-new"), tr("New Folder"));
QAction* actNewFolder = menu.addAction(QIcon::fromTheme(QSL("folder-new")), tr("New Folder"));
QAction* actEdit = menu.addAction(tr("Edit"));
QAction* actDelete = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
QAction* actDelete = menu.addAction(QIcon::fromTheme(QSL("edit-delete")), tr("Delete"));
menu.addSeparator();
m_actShowOnlyIcons = menu.addAction(tr("Show Only Icons"));
m_actShowOnlyIcons->setCheckable(true);
@ -276,7 +276,7 @@ void BookmarksToolbar::dropEvent(QDropEvent* e)
}
} else {
const QUrl url = mime->urls().at(0);
const QString title = mime->hasText() ? mime->text() : url.toEncoded(QUrl::RemoveScheme);
const QString title = mime->hasText() ? mime->text() : QString::fromUtf8(url.toEncoded(QUrl::RemoveScheme));
bookmark = new BookmarkItem(BookmarkItem::Url);
bookmark->setTitle(title);

View File

@ -240,13 +240,13 @@ QString BookmarksToolbarButton::createTooltip() const
{
if (!m_bookmark->description().isEmpty()) {
if (!m_bookmark->urlString().isEmpty()) {
return QString("%1\n%2").arg(m_bookmark->description(), m_bookmark->urlString());
return QSL("%1\n%2").arg(m_bookmark->description(), m_bookmark->urlString());
}
return m_bookmark->description();
}
if (!m_bookmark->title().isEmpty() && !m_bookmark->url().isEmpty()) {
return QString("%1\n%2").arg(m_bookmark->title(), m_bookmark->urlString());
return QSL("%1\n%2").arg(m_bookmark->title(), m_bookmark->urlString());
}
if (!m_bookmark->title().isEmpty()) {
@ -434,7 +434,7 @@ void BookmarksToolbarButton::dropEvent(QDropEvent *event)
}
} else {
const QUrl url = mime->urls().at(0);
const QString title = mime->hasText() ? mime->text() : url.toEncoded(QUrl::RemoveScheme);
const QString title = mime->hasText() ? mime->text() : QString::fromUtf8(url.toEncoded(QUrl::RemoveScheme));
bookmark = new BookmarkItem(BookmarkItem::Url);
bookmark->setTitle(title);

View File

@ -444,7 +444,7 @@ void BookmarksTools::addFolderContentsToMenu(QObject *receiver, Menu *menu, Book
bool BookmarksTools::migrateBookmarksIfNecessary(Bookmarks* bookmarks)
{
QSqlQuery query(SqlDatabase::instance()->database());
query.exec("SELECT name FROM sqlite_master WHERE type='table' AND name='folders'");
query.exec(QSL("SELECT name FROM sqlite_master WHERE type='table' AND name='folders'"));
if (!query.next()) {
return false;
@ -453,11 +453,11 @@ bool BookmarksTools::migrateBookmarksIfNecessary(Bookmarks* bookmarks)
std::cout << "Bookmarks: Migrating your bookmarks from SQLite to JSON..." << std::endl;
QHash<QString, BookmarkItem*> folders;
folders.insert("bookmarksToolbar", bookmarks->toolbarFolder());
folders.insert("bookmarksMenu", bookmarks->menuFolder());
folders.insert("unsorted", bookmarks->unsortedFolder());
folders.insert(QSL("bookmarksToolbar"), bookmarks->toolbarFolder());
folders.insert(QSL("bookmarksMenu"), bookmarks->menuFolder());
folders.insert(QSL("unsorted"), bookmarks->unsortedFolder());
query.exec("SELECT name, subfolder FROM folders");
query.exec(QSL("SELECT name, subfolder FROM folders"));
while (query.next()) {
const QString title = query.value(0).toString();
bool subfolder = query.value(1).toString() == QLatin1String("yes");
@ -468,7 +468,7 @@ bool BookmarksTools::migrateBookmarksIfNecessary(Bookmarks* bookmarks)
folders.insert(folder->title(), folder);
}
query.exec("SELECT title, folder, url FROM bookmarks ORDER BY position ASC");
query.exec(QSL("SELECT title, folder, url FROM bookmarks ORDER BY position ASC"));
while (query.next()) {
const QString title = query.value(0).toString();
const QString folder = query.value(1).toString();
@ -485,9 +485,9 @@ bool BookmarksTools::migrateBookmarksIfNecessary(Bookmarks* bookmarks)
bookmark->setUrl(url);
}
query.exec("DROP TABLE folders");
query.exec("DROP TABLE bookmarks");
query.exec("VACUUM");
query.exec(QSL("DROP TABLE folders"));
query.exec(QSL("DROP TABLE bookmarks"));
query.exec(QSL("VACUUM"));
std::cout << "Bookmarks: Bookmarks successfully migrated!" << std::endl;
return true;

View File

@ -50,12 +50,12 @@ CookieJar::~CookieJar()
void CookieJar::loadSettings()
{
Settings settings;
settings.beginGroup("Cookie-Settings");
m_allowCookies = settings.value("allowCookies", true).toBool();
m_filterThirdParty = settings.value("filterThirdPartyCookies", false).toBool();
m_filterTrackingCookie = settings.value("filterTrackingCookie", false).toBool();
m_whitelist = settings.value("whitelist", QStringList()).toStringList();
m_blacklist = settings.value("blacklist", QStringList()).toStringList();
settings.beginGroup(QSL("Cookie-Settings"));
m_allowCookies = settings.value(QSL("allowCookies"), true).toBool();
m_filterThirdParty = settings.value(QSL("filterThirdPartyCookies"), false).toBool();
m_filterTrackingCookie = settings.value(QSL("filterTrackingCookie"), false).toBool();
m_whitelist = settings.value(QSL("whitelist"), QStringList()).toStringList();
m_blacklist = settings.value(QSL("blacklist"), QStringList()).toStringList();
settings.endGroup();
}

View File

@ -66,13 +66,13 @@ CookieManager::CookieManager(QWidget *parent)
// Cookie Settings
Settings settings;
settings.beginGroup("Cookie-Settings");
ui->saveCookies->setChecked(settings.value("allowCookies", true).toBool());
ui->filter3rdParty->setChecked(settings.value("filterThirdPartyCookies", false).toBool());
ui->filterTracking->setChecked(settings.value("filterTrackingCookie", false).toBool());
ui->deleteCookiesOnClose->setChecked(settings.value("deleteCookiesOnClose", false).toBool());
ui->whiteList->addItems(settings.value("whitelist", QStringList()).toStringList());
ui->blackList->addItems(settings.value("blacklist", QStringList()).toStringList());
settings.beginGroup(QSL("Cookie-Settings"));
ui->saveCookies->setChecked(settings.value(QSL("allowCookies"), true).toBool());
ui->filter3rdParty->setChecked(settings.value(QSL("filterThirdPartyCookies"), false).toBool());
ui->filterTracking->setChecked(settings.value(QSL("filterTrackingCookie"), false).toBool());
ui->deleteCookiesOnClose->setChecked(settings.value(QSL("deleteCookiesOnClose"), false).toBool());
ui->whiteList->addItems(settings.value(QSL("whitelist"), QStringList()).toStringList());
ui->blackList->addItems(settings.value(QSL("blacklist"), QStringList()).toStringList());
settings.endGroup();
ui->search->setPlaceholderText(tr("Search"));
@ -84,7 +84,7 @@ CookieManager::CookieManager(QWidget *parent)
ui->whiteList->sortItems(Qt::AscendingOrder);
ui->blackList->sortItems(Qt::AscendingOrder);
auto* removeShortcut = new QShortcut(QKeySequence("Del"), this);
auto* removeShortcut = new QShortcut(QKeySequence(QSL("Del")), this);
connect(removeShortcut, &QShortcut::activated, this, &CookieManager::deletePressed);
connect(ui->search, &QLineEdit::textChanged, this, &CookieManager::filterString);
@ -97,7 +97,7 @@ CookieManager::CookieManager(QWidget *parent)
addCookie(cookie);
}
QzTools::setWmClass("Cookies", this);
QzTools::setWmClass(QSL("Cookies"), this);
}
void CookieManager::removeAll()
@ -171,12 +171,12 @@ void CookieManager::currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem
const QNetworkCookie cookie = qvariant_cast<QNetworkCookie>(current->data(0, Qt::UserRole + 10));
ui->name->setText(cookie.name());
ui->value->setText(cookie.value());
ui->name->setText(QString::fromUtf8(cookie.name()));
ui->value->setText(QString::fromUtf8(cookie.value()));
ui->server->setText(cookie.domain());
ui->path->setText(cookie.path());
cookie.isSecure() ? ui->secure->setText(tr("Secure only")) : ui->secure->setText(tr("All connections"));
cookie.isSessionCookie() ? ui->expiration->setText(tr("Session cookie")) : ui->expiration->setText(QDateTime(cookie.expirationDate()).toString("hh:mm:ss dddd d. MMMM yyyy"));
cookie.isSessionCookie() ? ui->expiration->setText(tr("Session cookie")) : ui->expiration->setText(QDateTime(cookie.expirationDate()).toString(QSL("hh:mm:ss dddd d. MMMM yyyy")));
ui->removeOne->setText(tr("Remove cookie"));
}
@ -274,7 +274,7 @@ void CookieManager::filterString(const QString &string)
}
else {
for (int i = 0; i < ui->cookieTree->topLevelItemCount(); ++i) {
QString text = "." + ui->cookieTree->topLevelItem(i)->text(0);
QString text = QSL(".") + ui->cookieTree->topLevelItem(i)->text(0);
ui->cookieTree->topLevelItem(i)->setHidden(!text.contains(string, Qt::CaseInsensitive));
ui->cookieTree->topLevelItem(i)->setExpanded(true);
}
@ -301,8 +301,8 @@ void CookieManager::addCookie(const QNetworkCookie &cookie)
item = new QTreeWidgetItem(newParent);
}
item->setText(0, "." + domain);
item->setText(1, cookie.name());
item->setText(0, QSL(".") + domain);
item->setText(1, QString::fromUtf8(cookie.name()));
item->setData(0, Qt::UserRole + 10, QVariant::fromValue(cookie));
ui->cookieTree->addTopLevelItem(item);
@ -340,13 +340,13 @@ void CookieManager::closeEvent(QCloseEvent* e)
}
Settings settings;
settings.beginGroup("Cookie-Settings");
settings.setValue("allowCookies", ui->saveCookies->isChecked());
settings.setValue("filterThirdPartyCookies", ui->filter3rdParty->isChecked());
settings.setValue("filterTrackingCookie", ui->filterTracking->isChecked());
settings.setValue("deleteCookiesOnClose", ui->deleteCookiesOnClose->isChecked());
settings.setValue("whitelist", whitelist);
settings.setValue("blacklist", blacklist);
settings.beginGroup(QSL("Cookie-Settings"));
settings.setValue(QSL("allowCookies"), ui->saveCookies->isChecked());
settings.setValue(QSL("filterThirdPartyCookies"), ui->filter3rdParty->isChecked());
settings.setValue(QSL("filterTrackingCookie"), ui->filterTracking->isChecked());
settings.setValue(QSL("deleteCookiesOnClose"), ui->deleteCookiesOnClose->isChecked());
settings.setValue(QSL("whitelist"), whitelist);
settings.setValue(QSL("blacklist"), blacklist);
settings.endGroup();
mApp->cookieJar()->loadSettings();

View File

@ -175,7 +175,7 @@ void DownloadItem::receivedOrTotalBytesChanged()
m_total = total;
updateDownloadInfo(m_currSpeed, m_received, m_total);
emit progressChanged(m_currSpeed, m_received, m_total);
Q_EMIT progressChanged(m_currSpeed, m_received, m_total);
}
int DownloadItem::progress()
@ -304,21 +304,21 @@ void DownloadItem::mouseDoubleClickEvent(QMouseEvent* e)
void DownloadItem::customContextMenuRequested(const QPoint &pos)
{
QMenu menu;
menu.addAction(QIcon::fromTheme("document-open"), tr("Open File"), this, &DownloadItem::openFile);
menu.addAction(QIcon::fromTheme(QSL("document-open")), tr("Open File"), this, &DownloadItem::openFile);
menu.addAction(tr("Open Folder"), this, &DownloadItem::openFolder);
menu.addSeparator();
menu.addAction(QIcon::fromTheme("edit-copy"), tr("Copy Download Link"), this, &DownloadItem::copyDownloadLink);
menu.addAction(QIcon::fromTheme(QSL("edit-copy")), tr("Copy Download Link"), this, &DownloadItem::copyDownloadLink);
menu.addSeparator();
menu.addAction(QIcon::fromTheme("process-stop"), tr("Cancel downloading"), this, &DownloadItem::stop)->setEnabled(m_downloading);
menu.addAction(QIcon::fromTheme(QSL("process-stop")), tr("Cancel downloading"), this, &DownloadItem::stop)->setEnabled(m_downloading);
if (m_download->isPaused()) {
menu.addAction(QIcon::fromTheme("media-playback-start"), tr("Resume downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
menu.addAction(QIcon::fromTheme(QSL("media-playback-start")), tr("Resume downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
} else {
menu.addAction(QIcon::fromTheme("media-playback-pause"), tr("Pause downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
menu.addAction(QIcon::fromTheme(QSL("media-playback-pause")), tr("Pause downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
}
menu.addAction(QIcon::fromTheme("list-remove"), tr("Remove From List"), this, &DownloadItem::clear)->setEnabled(!m_downloading);
menu.addAction(QIcon::fromTheme(QSL("list-remove")), tr("Remove From List"), this, &DownloadItem::clear)->setEnabled(!m_downloading);
if (m_downloading || ui->downloadInfo->text().startsWith(tr("Cancelled")) || ui->downloadInfo->text().startsWith(tr("Error"))) {
menu.actions().at(0)->setEnabled(false);
@ -359,8 +359,8 @@ void DownloadItem::openFolder()
winFileName.append(QSL(".download"));
}
winFileName.replace(QLatin1Char('/'), "\\");
QString shExArg = "/e,/select,\"" + winFileName + "\"";
winFileName.replace(QLatin1Char('/'), QSL("\\"));
QString shExArg = QSL("/e,/select,\"") + winFileName + QSL("\"");
ShellExecute(NULL, NULL, TEXT("explorer.exe"), shExArg.toStdWString().c_str(), NULL, SW_SHOW);
#else
QDesktopServices::openUrl(QUrl::fromLocalFile(m_path));

View File

@ -64,17 +64,17 @@ DownloadManager::DownloadManager(QWidget* parent)
QtWin::extendFrameIntoClientArea(this, -1, -1, -1, -1);
}
#endif
ui->clearButton->setIcon(QIcon::fromTheme("edit-clear"));
ui->clearButton->setIcon(QIcon::fromTheme(QSL("edit-clear")));
QzTools::centerWidgetOnScreen(this);
connect(ui->clearButton, &QAbstractButton::clicked, this, &DownloadManager::clearList);
auto* clearShortcut = new QShortcut(QKeySequence("CTRL+L"), this);
auto* clearShortcut = new QShortcut(QKeySequence(QSL("CTRL+L")), this);
connect(clearShortcut, &QShortcut::activated, this, &DownloadManager::clearList);
loadSettings();
QzTools::setWmClass("Download Manager", this);
QzTools::setWmClass(QSL("Download Manager"), this);
connect(m_model, &DownloadManagerModel::downloadAdded, this, &DownloadManager::downloadAdded);
}
@ -82,15 +82,15 @@ DownloadManager::DownloadManager(QWidget* parent)
void DownloadManager::loadSettings()
{
Settings settings;
settings.beginGroup("DownloadManager");
m_downloadPath = settings.value("defaultDownloadPath", QString()).toString();
m_lastDownloadPath = settings.value("lastDownloadPath", QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)).toString();
m_closeOnFinish = settings.value("CloseManagerOnFinish", false).toBool();
m_useNativeDialog = settings.value("useNativeDialog", DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG).toBool();
settings.beginGroup(QSL("DownloadManager"));
m_downloadPath = settings.value(QSL("defaultDownloadPath"), QString()).toString();
m_lastDownloadPath = settings.value(QSL("lastDownloadPath"), QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)).toString();
m_closeOnFinish = settings.value(QSL("CloseManagerOnFinish"), false).toBool();
m_useNativeDialog = settings.value(QSL("useNativeDialog"), DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG).toBool();
m_useExternalManager = settings.value("UseExternalManager", false).toBool();
m_externalExecutable = settings.value("ExternalManagerExecutable", QString()).toString();
m_externalArguments = settings.value("ExternalManagerArguments", QString()).toString();
m_useExternalManager = settings.value(QSL("UseExternalManager"), false).toBool();
m_externalExecutable = settings.value(QSL("ExternalManagerExecutable"), QString()).toString();
m_externalArguments = settings.value(QSL("ExternalManagerArguments"), QString()).toString();
settings.endGroup();
if (!m_externalArguments.contains(QLatin1String("%d"))) {
@ -174,7 +174,7 @@ QWinTaskbarButton *DownloadManager::taskbarButton()
void DownloadManager::startExternalManager(const QUrl &url)
{
QString arguments = m_externalArguments;
arguments.replace(QLatin1String("%d"), url.toEncoded());
arguments.replace(QLatin1String("%d"), QString::fromUtf8(url.toEncoded()));
QzTools::startExternalProcess(m_externalExecutable, arguments);
m_lastDownloadOption = ExternalManager;

View File

@ -42,14 +42,14 @@ void DownloadManagerModel::addDownload(DownloadItem *item)
{
m_downloads.append(item);
connect(item, &DownloadItem::deleteItem, this, &DownloadManagerModel::removeDownload);
emit downloadAdded(item);
Q_EMIT downloadAdded(item);
}
void DownloadManagerModel::removeDownload(DownloadItem *item)
{
if (item && !item->isDownloading()) {
delete item;
emit downloadRemoved(item);
Q_EMIT downloadRemoved(item);
}
}

View File

@ -37,7 +37,7 @@ public:
private:
QList<DownloadItem *> m_downloads;
signals:
Q_SIGNALS:
void downloadAdded(DownloadItem *item);
void downloadRemoved(DownloadItem *item);
};

View File

@ -31,7 +31,7 @@ DownloadOptionsDialog::DownloadOptionsDialog(const QString &fileName, QWebEngine
{
ui->setupUi(this);
ui->fileName->setText("<b>" + fileName + "</b>");
ui->fileName->setText(QSL("<b>") + fileName + QSL("</b>"));
ui->fromServer->setText(m_downloadItem->url().host());
const QIcon fileIcon = IconProvider::instance()->standardIcon(QStyle::SP_FileIcon);

View File

@ -46,8 +46,8 @@ HistoryModel* History::model()
void History::loadSettings()
{
Settings settings;
settings.beginGroup("Web-Browser-Settings");
m_isSaving = settings.value("allowHistory", true).toBool();
settings.beginGroup(QSL("Web-Browser-Settings"));
m_isSaving = settings.value(QSL("allowHistory"), true).toBool();
settings.endGroup();
}
@ -96,7 +96,7 @@ void History::addHistoryEntry(const QUrl &url, QString title)
entry.count = 1;
entry.date = QDateTime::currentDateTime();
entry.url = url;
entry.urlString = url.toEncoded();
entry.urlString = QString::fromUtf8(url.toEncoded());
entry.title = title;
Q_EMIT historyEntryAdded(entry);
});
@ -118,7 +118,7 @@ void History::addHistoryEntry(const QUrl &url, QString title)
before.count = count;
before.date = date;
before.url = url;
before.urlString = url.toEncoded();
before.urlString = QString::fromUtf8(url.toEncoded());
before.title = oldTitle;
HistoryEntry after = before;
@ -150,7 +150,7 @@ void History::deleteHistoryEntry(const QList<int> &list)
for (int index : list) {
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT count, date, url, title FROM history WHERE id=?");
query.prepare(QSL("SELECT count, date, url, title FROM history WHERE id=?"));
query.addBindValue(index);
query.exec();
@ -163,14 +163,14 @@ void History::deleteHistoryEntry(const QList<int> &list)
entry.count = query.value(0).toInt();
entry.date = QDateTime::fromMSecsSinceEpoch(query.value(1).toLongLong());
entry.url = query.value(2).toUrl();
entry.urlString = entry.url.toEncoded();
entry.urlString = QString::fromUtf8(entry.url.toEncoded());
entry.title = query.value(3).toString();
query.prepare("DELETE FROM history WHERE id=?");
query.prepare(QSL("DELETE FROM history WHERE id=?"));
query.addBindValue(index);
query.exec();
query.prepare("DELETE FROM icons WHERE url=?");
query.prepare(QSL("DELETE FROM icons WHERE url=?"));
query.addBindValue(entry.url.toEncoded(QUrl::RemoveFragment));
query.exec();
@ -195,7 +195,7 @@ void History::deleteHistoryEntry(const QString &url)
void History::deleteHistoryEntry(const QString &url, const QString &title)
{
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT id FROM history WHERE url=? AND title=?");
query.prepare(QSL("SELECT id FROM history WHERE url=? AND title=?"));
query.bindValue(0, url);
query.bindValue(1, title);
query.exec();
@ -214,7 +214,7 @@ QList<int> History::indexesFromTimeRange(qint64 start, qint64 end)
}
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT id FROM history WHERE date BETWEEN ? AND ?");
query.prepare(QSL("SELECT id FROM history WHERE date BETWEEN ? AND ?"));
query.addBindValue(end);
query.addBindValue(start);
query.exec();
@ -230,7 +230,7 @@ QVector<HistoryEntry> History::mostVisited(int count)
{
QVector<HistoryEntry> list;
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare(QString("SELECT count, date, id, title, url FROM history ORDER BY count DESC LIMIT %1").arg(count));
query.prepare(QSL("SELECT count, date, id, title, url FROM history ORDER BY count DESC LIMIT %1").arg(count));
query.exec();
while (query.next()) {
HistoryEntry entry;
@ -303,8 +303,8 @@ QList<HistoryEntry> History::searchHistoryEntry(const QString &text)
QList<HistoryEntry> list;
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare(QSL("SELECT count, date, id, title, url FROM history WHERE title LIKE ? OR url LIKE ?"));
query.bindValue(0, QString("%%1%").arg(text));
query.bindValue(1, QString("%%1%").arg(text));
query.bindValue(0, QSL("%%1%").arg(text));
query.bindValue(1, QSL("%%1%").arg(text));
query.exec();
while (query.next()) {
HistoryEntry entry;

View File

@ -241,10 +241,10 @@ void HistoryMenu::init()
act = addAction(IconProvider::standardIcon(QStyle::SP_ArrowForward), tr("&Forward"), this, &HistoryMenu::goForward);
act->setShortcut(QzTools::actionShortcut(QKeySequence::Forward, Qt::ALT + Qt::Key_Right, QKeySequence::Back, Qt::ALT + Qt::Key_Left));
act = addAction(QIcon::fromTheme("go-home"), tr("&Home"), this, &HistoryMenu::goHome);
act = addAction(QIcon::fromTheme(QSL("go-home")), tr("&Home"), this, &HistoryMenu::goHome);
act->setShortcut(QKeySequence(Qt::ALT | Qt::Key_Home));
act = addAction(QIcon::fromTheme("deep-history", QIcon(":/icons/menu/history.svg")), tr("Show &All History"), this, &HistoryMenu::showHistoryManager);
act = addAction(QIcon::fromTheme(QSL("deep-history"), QIcon(QSL(":/icons/menu/history.svg"))), tr("Show &All History"), this, &HistoryMenu::showHistoryManager);
act->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_H));
addSeparator();

View File

@ -29,10 +29,10 @@ static QString dateTimeToString(const QDateTime &dateTime)
{
const QDateTime current = QDateTime::currentDateTime();
if (current.date() == dateTime.date()) {
return dateTime.time().toString("h:mm");
return dateTime.time().toString(QSL("h:mm"));
}
return dateTime.toString("d.M.yyyy h:mm");
return dateTime.toString(QSL("d.M.yyyy h:mm"));
}
HistoryModel::HistoryModel(History* history)
@ -87,7 +87,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
case Qt::EditRole:
return index.column() == 0 ? item->title : QVariant();
case Qt::DecorationRole:
return index.column() == 0 ? QIcon::fromTheme(QSL("view-calendar"), QIcon(":/icons/menu/history_entry.svg")) : QVariant();
return index.column() == 0 ? QIcon::fromTheme(QSL("view-calendar"), QIcon(QSL(":/icons/menu/history_entry.svg"))) : QVariant();
}
return {};
@ -114,7 +114,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
return -1;
case Qt::ToolTipRole:
if (index.column() == 0) {
return QString("%1\n%2").arg(entry.title, entry.urlString);
return QSL("%1\n%2").arg(entry.title, entry.urlString);
}
// fallthrough
case Qt::DisplayRole:
@ -295,7 +295,7 @@ void HistoryModel::fetchMore(const QModelIndex &parent)
}
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT id, count, title, url, date FROM history WHERE date BETWEEN ? AND ? ORDER BY date DESC");
query.prepare(QSL("SELECT id, count, title, url, date FROM history WHERE date BETWEEN ? AND ? ORDER BY date DESC"));
query.addBindValue(parentItem->endTimestamp());
query.addBindValue(parentItem->startTimestamp());
query.exec();
@ -309,7 +309,7 @@ void HistoryModel::fetchMore(const QModelIndex &parent)
entry.title = query.value(2).toString();
entry.url = query.value(3).toUrl();
entry.date = QDateTime::fromMSecsSinceEpoch(query.value(4).toLongLong());
entry.urlString = entry.url.toEncoded();
entry.urlString = QString::fromUtf8(entry.url.toEncoded());
if (!idList.contains(entry.id)) {
list.append(entry);
@ -445,7 +445,7 @@ void HistoryModel::checkEmptyParentItem(HistoryItem* item)
void HistoryModel::init()
{
QSqlQuery query(SqlDatabase::instance()->database());
query.exec("SELECT MIN(date) FROM history");
query.exec(QSL("SELECT MIN(date) FROM history"));
if (!query.next()) {
return;
}
@ -487,11 +487,11 @@ void HistoryModel::init()
timestamp = QDateTime(startDate, QTime(23, 59, 59), QTimeZone::systemTimeZone()).toMSecsSinceEpoch();
endTimestamp = QDateTime(endDate, QTime(), QTimeZone::systemTimeZone()).toMSecsSinceEpoch();
itemName = QString("%1 %2").arg(History::titleCaseLocalizedMonth(timestampDate.month()), QString::number(timestampDate.year()));
itemName = QSL("%1 %2").arg(History::titleCaseLocalizedMonth(timestampDate.month()), QString::number(timestampDate.year()));
}
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT id FROM history WHERE date BETWEEN ? AND ? LIMIT 1");
query.prepare(QSL("SELECT id FROM history WHERE date BETWEEN ? AND ? LIMIT 1"));
query.addBindValue(endTimestamp);
query.addBindValue(timestamp);
query.exec();

View File

@ -67,7 +67,7 @@ QSqlQuery LocationCompleterModel::createDomainQuery(const QString &text)
}
bool withoutWww = text.startsWith(QLatin1Char('w')) && !text.startsWith(QLatin1String("www."));
QString query = "SELECT url FROM history WHERE ";
QString query = QSL("SELECT url FROM history WHERE ");
if (withoutWww) {
query.append(QLatin1String("url NOT LIKE ? AND url NOT LIKE ? AND "));
@ -82,16 +82,16 @@ QSqlQuery LocationCompleterModel::createDomainQuery(const QString &text)
sqlQuery.prepare(query);
if (withoutWww) {
sqlQuery.addBindValue(QString("http://www.%"));
sqlQuery.addBindValue(QString("https://www.%"));
sqlQuery.addBindValue(QString("http://%1%").arg(text));
sqlQuery.addBindValue(QString("https://%1%").arg(text));
sqlQuery.addBindValue(QSL("http://www.%"));
sqlQuery.addBindValue(QSL("https://www.%"));
sqlQuery.addBindValue(QSL("http://%1%").arg(text));
sqlQuery.addBindValue(QSL("https://%1%").arg(text));
}
else {
sqlQuery.addBindValue(QString("http://%1%").arg(text));
sqlQuery.addBindValue(QString("https://%1%").arg(text));
sqlQuery.addBindValue(QString("http://www.%1%").arg(text));
sqlQuery.addBindValue(QString("https://www.%1%").arg(text));
sqlQuery.addBindValue(QSL("http://%1%").arg(text));
sqlQuery.addBindValue(QSL("https://%1%").arg(text));
sqlQuery.addBindValue(QSL("http://www.%1%").arg(text));
sqlQuery.addBindValue(QSL("https://www.%1%").arg(text));
}
return sqlQuery;
@ -122,13 +122,13 @@ QSqlQuery LocationCompleterModel::createHistoryQuery(const QString &searchString
sqlQuery.prepare(query);
if (exactMatch) {
sqlQuery.addBindValue(QString("%%1%").arg(searchString));
sqlQuery.addBindValue(QString("%%1%").arg(searchString));
sqlQuery.addBindValue(QSL("%%1%").arg(searchString));
sqlQuery.addBindValue(QSL("%%1%").arg(searchString));
}
else {
for (const QString &str : qAsConst(searchList)) {
sqlQuery.addBindValue(QString("%%1%").arg(str));
sqlQuery.addBindValue(QString("%%1%").arg(str));
sqlQuery.addBindValue(QSL("%%1%").arg(str));
sqlQuery.addBindValue(QSL("%%1%").arg(str));
}
}

View File

@ -162,7 +162,7 @@ void LocationCompleterRefreshJob::completeFromHistory()
}
auto* item = new QStandardItem();
item->setText(bookmark->url().toEncoded());
item->setText(QString::fromUtf8(bookmark->url().toEncoded()));
item->setData(-1, LocationCompleterModel::IdRole);
item->setData(bookmark->title(), LocationCompleterModel::TitleRole);
item->setData(bookmark->url(), LocationCompleterModel::UrlRole);
@ -193,7 +193,7 @@ void LocationCompleterRefreshJob::completeFromHistory()
}
auto* item = new QStandardItem();
item->setText(url.toEncoded());
item->setText(QString::fromUtf8(url.toEncoded()));
item->setData(query.value(0), LocationCompleterModel::IdRole);
item->setData(query.value(2), LocationCompleterModel::TitleRole);
item->setData(url, LocationCompleterModel::UrlRole);
@ -215,7 +215,7 @@ void LocationCompleterRefreshJob::completeMostVisited()
auto* item = new QStandardItem();
const QUrl url = query.value(1).toUrl();
item->setText(url.toEncoded());
item->setText(QString::fromUtf8(url.toEncoded()));
item->setData(query.value(0), LocationCompleterModel::IdRole);
item->setData(query.value(2), LocationCompleterModel::TitleRole);
item->setData(url, LocationCompleterModel::UrlRole);

View File

@ -489,7 +489,7 @@ void LocationBar::focusInEvent(QFocusEvent* event)
clearTextFormat();
LineEdit::focusInEvent(event);
if (m_window && Settings().value("Browser-View-Settings/instantBookmarksToolbar").toBool()) {
if (m_window && Settings().value(QSL("Browser-View-Settings/instantBookmarksToolbar")).toBool()) {
m_window->bookmarksToolbar()->show();
}
}
@ -512,7 +512,7 @@ void LocationBar::focusOutEvent(QFocusEvent* event)
refreshTextFormat();
if (m_window && Settings().value("Browser-View-Settings/instantBookmarksToolbar").toBool()) {
if (m_window && Settings().value(QSL("Browser-View-Settings/instantBookmarksToolbar")).toBool()) {
m_window->bookmarksToolbar()->hide();
}
}
@ -660,10 +660,10 @@ void LocationBar::loadFinished()
void LocationBar::loadSettings()
{
Settings settings;
settings.beginGroup("AddressBar");
m_progressStyle = static_cast<ProgressStyle>(settings.value("ProgressStyle", 0).toInt());
bool customColor = settings.value("UseCustomProgressColor", false).toBool();
m_progressColor = customColor ? settings.value("CustomProgressColor", palette().color(QPalette::Highlight)).value<QColor>() : QColor();
settings.beginGroup(QSL("AddressBar"));
m_progressStyle = static_cast<ProgressStyle>(settings.value(QSL("ProgressStyle"), 0).toInt());
bool customColor = settings.value(QSL("UseCustomProgressColor"), false).toBool();
m_progressColor = customColor ? settings.value(QSL("CustomProgressColor"), palette().color(QPalette::Highlight)).value<QColor>() : QColor();
settings.endGroup();
}

View File

@ -150,8 +150,8 @@ void WebSearchBar::openSearchEnginesDialog()
void WebSearchBar::enableSearchSuggestions(bool enable)
{
Settings settings;
settings.beginGroup("SearchEngines");
settings.setValue("showSuggestions", enable);
settings.beginGroup(QSL("SearchEngines"));
settings.setValue(QSL("showSuggestions"), enable);
settings.endGroup();
qzSettings->showWSBSearchSuggestions = enable;
@ -213,8 +213,8 @@ void WebSearchBar::searchChanged(const ButtonWithMenu::Item &item)
void WebSearchBar::instantSearchChanged(bool enable)
{
Settings settings;
settings.beginGroup("SearchEngines");
settings.setValue("SearchOnEngineChange", enable);
settings.beginGroup(QSL("SearchEngines"));
settings.setValue(QSL("SearchOnEngineChange"), enable);
settings.endGroup();
qzSettings->searchOnEngineChange = enable;
}

View File

@ -268,18 +268,18 @@ void NetworkManager::unregisterExtensionSchemeHandler(ExtensionSchemeHandler *ha
void NetworkManager::loadSettings()
{
Settings settings;
settings.beginGroup("Language");
QStringList langs = settings.value("acceptLanguage", AcceptLanguage::defaultLanguage()).toStringList();
settings.beginGroup(QSL("Language"));
QStringList langs = settings.value(QSL("acceptLanguage"), AcceptLanguage::defaultLanguage()).toStringList();
settings.endGroup();
mApp->webProfile()->setHttpAcceptLanguage(AcceptLanguage::generateHeader(langs));
mApp->webProfile()->setHttpAcceptLanguage(QString::fromLatin1(AcceptLanguage::generateHeader(langs)));
QNetworkProxy proxy;
settings.beginGroup("Web-Proxy");
const int proxyType = settings.value("ProxyType", 2).toInt();
proxy.setHostName(settings.value("HostName", QString()).toString());
proxy.setPort(settings.value("Port", 8080).toInt());
proxy.setUser(settings.value("Username", QString()).toString());
proxy.setPassword(settings.value("Password", QString()).toString());
settings.beginGroup(QSL("Web-Proxy"));
const int proxyType = settings.value(QSL("ProxyType"), 2).toInt();
proxy.setHostName(settings.value(QSL("HostName"), QString()).toString());
proxy.setPort(settings.value(QSL("Port"), 8080).toInt());
proxy.setUser(settings.value(QSL("Username"), QString()).toString());
proxy.setPassword(settings.value(QSL("Password"), QString()).toString());
settings.endGroup();
if (proxyType == 0) {
@ -300,16 +300,16 @@ void NetworkManager::loadSettings()
m_urlInterceptor->loadSettings();
settings.beginGroup("Web-Browser-Settings");
m_ignoredSslHosts = settings.value("IgnoredSslHosts", QStringList()).toStringList();
settings.beginGroup(QSL("Web-Browser-Settings"));
m_ignoredSslHosts = settings.value(QSL("IgnoredSslHosts"), QStringList()).toStringList();
settings.endGroup();
}
void NetworkManager::saveIgnoredSslHosts()
{
Settings settings;
settings.beginGroup("Web-Browser-Settings");
settings.setValue("IgnoredSslHosts", m_ignoredSslHosts);
settings.beginGroup(QSL("Web-Browser-Settings"));
settings.setValue(QSL("IgnoredSslHosts"), m_ignoredSslHosts);
settings.endGroup();
}

View File

@ -84,8 +84,8 @@ void NetworkUrlInterceptor::loadSettings()
QMutexLocker lock(&m_mutex);
Settings settings;
settings.beginGroup("Web-Browser-Settings");
m_sendDNT = settings.value("DoNotTrack", false).toBool();
settings.beginGroup(QSL("Web-Browser-Settings"));
m_sendDNT = settings.value(QSL("DoNotTrack"), false).toBool();
settings.endGroup();
m_usePerDomainUserAgent = mApp->userAgentManager()->usePerDomainUserAgents();

View File

@ -53,7 +53,7 @@ void FalkonSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job)
}
QStringList knownPages;
knownPages << "about" << "start" << "speeddial" << "config" << "restore";
knownPages << QSL("about") << QSL("start") << QSL("speeddial") << QSL("config") << QSL("restore");
if (knownPages.contains(job->requestUrl().path()))
job->reply(QByteArrayLiteral("text/html"), new FalkonSchemeReply(job, job));
@ -76,7 +76,7 @@ bool FalkonSchemeHandler::handleRequest(QWebEngineUrlRequestJob *job)
job->redirect(QUrl(QSL("falkon:start")));
return true;
} else if (job->requestUrl().path() == QL1S("reportbug")) {
job->redirect(QUrl(Qz::BUGSADDRESS));
job->redirect(QUrl(QString::fromLatin1(Qz::BUGSADDRESS)));
return true;
}
@ -149,14 +149,14 @@ QString FalkonSchemeReply::startPage()
return sPage;
}
sPage.append(QzTools::readAllFileContents(":html/start.html"));
sPage.append(QzTools::readAllFileContents(QSL(":html/start.html")));
sPage.replace(QLatin1String("%ABOUT-IMG%"), QSL("qrc:icons/other/startpage.svg"));
sPage.replace(QLatin1String("%ABOUT-IMG-DARK%"), QSL("qrc:icons/other/startpage-dark.svg"));
sPage.replace(QLatin1String("%TITLE%"), tr("Start Page"));
sPage.replace(QLatin1String("%BUTTON-LABEL%"), tr("Search on Web"));
sPage.replace(QLatin1String("%SEARCH-BY%"), tr("Search results provided by DuckDuckGo"));
sPage.replace(QLatin1String("%WWW%"), Qz::WIKIADDRESS);
sPage.replace(QLatin1String("%WWW%"), QString::fromLatin1(Qz::WIKIADDRESS));
sPage.replace(QLatin1String("%ABOUT-FALKON%"), tr("About Falkon"));
sPage.replace(QLatin1String("%PRIVATE-BROWSING%"), mApp->isPrivate() ? tr("<h1>Private Browsing</h1>") : QString());
sPage = QzTools::applyDirectionToPage(sPage);
@ -169,10 +169,10 @@ QString FalkonSchemeReply::aboutPage()
static QString aPage;
if (aPage.isEmpty()) {
aPage.append(QzTools::readAllFileContents(":html/about.html"));
aPage.append(QzTools::readAllFileContents(QSL(":html/about.html")));
aPage.replace(QLatin1String("%ABOUT-IMG%"), QSL("qrc:icons/other/about.svg"));
aPage.replace(QLatin1String("%ABOUT-IMG-DARK%"), QSL("qrc:icons/other/about-dark.svg"));
aPage.replace(QLatin1String("%COPYRIGHT-INCLUDE%"), QzTools::readAllFileContents(":html/copyright").toHtmlEscaped());
aPage.replace(QLatin1String("%COPYRIGHT-INCLUDE%"), QzTools::readAllFileContents(QSL(":html/copyright")).toHtmlEscaped());
aPage.replace(QLatin1String("%TITLE%"), tr("About Falkon"));
aPage.replace(QLatin1String("%ABOUT-FALKON%"), tr("About Falkon"));
@ -180,15 +180,15 @@ QString FalkonSchemeReply::aboutPage()
aPage.replace(QLatin1String("%COPYRIGHT%"), tr("Copyright"));
aPage.replace(QLatin1String("%VERSION-INFO%"),
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"),
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"),
#ifdef FALKON_GIT_REVISION
QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION)));
QSL("%1 (%2)").arg(QString::fromLatin1(Qz::VERSION), QL1S(FALKON_GIT_REVISION))));
#else
Qz::VERSION));
QString::fromLatin1(Qz::VERSION)));
#endif
aPage.replace(QLatin1String("%MAIN-DEVELOPER%"), tr("Main developer"));
aPage.replace(QLatin1String("%MAIN-DEVELOPER-TEXT%"), authorString(Qz::AUTHOR, "nowrep@gmail.com"));
aPage.replace(QLatin1String("%MAIN-DEVELOPER-TEXT%"), authorString(Qz::AUTHOR, QSL("nowrep@gmail.com")));
aPage = QzTools::applyDirectionToPage(aPage);
}
@ -200,7 +200,7 @@ QString FalkonSchemeReply::speeddialPage()
static QString dPage;
if (dPage.isEmpty()) {
dPage.append(QzTools::readAllFileContents(":html/speeddial.html"));
dPage.append(QzTools::readAllFileContents(QSL(":html/speeddial.html")));
dPage.replace(QLatin1String("%IMG_PLUS%"), QLatin1String("qrc:html/plus.svg"));
dPage.replace(QLatin1String("%IMG_CLOSE%"), QLatin1String("qrc:html/close.svg"));
dPage.replace(QLatin1String("%IMG_EDIT%"), QLatin1String("qrc:html/edit.svg"));
@ -240,7 +240,7 @@ QString FalkonSchemeReply::speeddialPage()
QString page = dPage;
SpeedDial* dial = mApp->plugins()->speedDial();
page.replace(QLatin1String("%INITIAL-SCRIPT%"), dial->initialScript().toUtf8().toBase64());
page.replace(QLatin1String("%INITIAL-SCRIPT%"), QString::fromLatin1(dial->initialScript().toUtf8().toBase64()));
page.replace(QLatin1String("%IMG_BACKGROUND%"), dial->backgroundImage());
page.replace(QLatin1String("%URL_BACKGROUND%"), dial->backgroundImageUrl());
page.replace(QLatin1String("%B_SIZE%"), dial->backgroundImageSize());
@ -256,7 +256,7 @@ QString FalkonSchemeReply::restorePage()
static QString rPage;
if (rPage.isEmpty()) {
rPage.append(QzTools::readAllFileContents(":html/restore.html"));
rPage.append(QzTools::readAllFileContents(QSL(":html/restore.html")));
rPage.replace(QLatin1String("%IMAGE%"), QzTools::pixmapToDataUrl(IconProvider::standardIcon(QStyle::SP_MessageBoxWarning).pixmap(45)).toString());
rPage.replace(QLatin1String("%TITLE%"), tr("Restore Session"));
rPage.replace(QLatin1String("%OOPS%"), tr("Oops, Falkon crashed."));
@ -279,7 +279,7 @@ QString FalkonSchemeReply::configPage()
static QString cPage;
if (cPage.isEmpty()) {
cPage.append(QzTools::readAllFileContents(":html/config.html"));
cPage.append(QzTools::readAllFileContents(QSL(":html/config.html")));
cPage.replace(QLatin1String("%ABOUT-IMG%"), QSL("qrc:icons/other/about.svg"));
cPage.replace(QLatin1String("%ABOUT-IMG-DARK%"), QSL("qrc:icons/other/about-dark.svg"));
@ -312,24 +312,24 @@ QString FalkonSchemeReply::configPage()
};
cPage.replace(QLatin1String("%VERSION-INFO%"),
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"),
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"),
#ifdef FALKON_GIT_REVISION
QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION)
QSL("%1 (%2)").arg(QString::fromLatin1(Qz::VERSION), QL1S(FALKON_GIT_REVISION))
#else
Qz::VERSION
QString::fromLatin1(Qz::VERSION)
#endif
) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Qt version"), qVersion()) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("QtWebEngine version"), QSL(QTWEBENGINECORE_VERSION_STR)) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), QzTools::operatingSystemLong()));
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Qt version"), QString::fromLatin1(qVersion())) +
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("QtWebEngine version"), QSL(QTWEBENGINECORE_VERSION_STR)) +
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), QzTools::operatingSystemLong()));
cPage.replace(QLatin1String("%PATHS-TEXT%"),
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Profile"), DataPaths::currentProfilePath()) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Settings"), DataPaths::currentProfilePath() + "/settings.ini") +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Saved session"), SessionManager::defaultSessionPath()) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Data"), allPaths(DataPaths::AppData)) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Themes"), allPaths(DataPaths::Themes)) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Extensions"), allPaths(DataPaths::Plugins)));
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Profile"), DataPaths::currentProfilePath()) +
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Settings"), DataPaths::currentProfilePath() + QSL("/settings.ini")) +
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Saved session"), SessionManager::defaultSessionPath()) +
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Data"), allPaths(DataPaths::AppData)) +
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Themes"), allPaths(DataPaths::Themes)) +
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Extensions"), allPaths(DataPaths::Plugins)));
#ifdef QT_DEBUG
QString debugBuild = tr("<b>Enabled</b>");
@ -348,11 +348,11 @@ QString FalkonSchemeReply::configPage()
QString portableBuild = mApp->isPortable() ? tr("<b>Enabled</b>") : tr("Disabled");
cPage.replace(QLatin1String("%BUILD-CONFIG-TEXT%"),
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Debug build"), debugBuild) +
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Debug build"), debugBuild) +
#ifdef Q_OS_WIN
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Windows 7 API"), w7APIEnabled) +
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Windows 7 API"), w7APIEnabled) +
#endif
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Portable build"), portableBuild));
QSL("<dt>%1</dt><dd>%2<dd>").arg(tr("Portable build"), portableBuild));
cPage = QzTools::applyDirectionToPage(cPage);
}
@ -365,12 +365,12 @@ QString FalkonSchemeReply::configPage()
for (const Plugins::Plugin &plugin : availablePlugins) {
PluginSpec spec = plugin.pluginSpec;
pluginsString.append(QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td></tr>").arg(
pluginsString.append(QSL("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td></tr>").arg(
spec.name, spec.version, spec.author.toHtmlEscaped(), spec.description));
}
if (pluginsString.isEmpty()) {
pluginsString = QString("<tr><td colspan=4 class=\"no-available-plugins\">%1</td></tr>").arg(tr("No available extensions."));
pluginsString = QSL("<tr><td colspan=4 class=\"no-available-plugins\">%1</td></tr>").arg(tr("No available extensions."));
}
page.replace(QLatin1String("%PLUGINS-INFO%"), pluginsString);
@ -379,7 +379,7 @@ QString FalkonSchemeReply::configPage()
QSettings* settings = Settings::globalSettings();
const auto groups = settings->childGroups();
for (const QString &group : groups) {
QString groupString = QString("<tr><th colspan=\"2\">[%1]</th></tr>").arg(group);
QString groupString = QSL("<tr><th colspan=\"2\">[%1]</th></tr>").arg(group);
settings->beginGroup(group);
const auto keys = settings->childKeys();
@ -394,12 +394,12 @@ QString FalkonSchemeReply::configPage()
case QVariant::Point: {
const QPoint point = keyValue.toPoint();
keyString = QString("QPoint(%1, %2)").arg(point.x()).arg(point.y());
keyString = QSL("QPoint(%1, %2)").arg(point.x()).arg(point.y());
break;
}
case QVariant::StringList:
keyString = keyValue.toStringList().join(",");
keyString = keyValue.toStringList().join(QSL(","));
break;
default:
@ -410,7 +410,7 @@ QString FalkonSchemeReply::configPage()
keyString = QLatin1String("\"empty\"");
}
groupString.append(QString("<tr><td>%1</td><td>%2</td></tr>").arg(key, keyString.toHtmlEscaped()));
groupString.append(QSL("<tr><td>%1</td><td>%2</td></tr>").arg(key, keyString.toHtmlEscaped()));
}
settings->endGroup();

View File

@ -40,15 +40,15 @@ DesktopNotificationsFactory::DesktopNotificationsFactory(QObject* parent)
void DesktopNotificationsFactory::loadSettings()
{
Settings settings;
settings.beginGroup("Notifications");
m_enabled = settings.value("Enabled", true).toBool();
m_timeout = settings.value("Timeout", 6000).toInt();
settings.beginGroup(QSL("Notifications"));
m_enabled = settings.value(QSL("Enabled"), true).toBool();
m_timeout = settings.value(QSL("Timeout"), 6000).toInt();
#if defined(Q_OS_UNIX) && !defined(DISABLE_DBUS)
m_notifType = settings.value("UseNativeDesktop", true).toBool() ? DesktopNative : PopupWidget;
m_notifType = settings.value(QSL("UseNativeDesktop"), true).toBool() ? DesktopNative : PopupWidget;
#else
m_notifType = PopupWidget;
#endif
m_position = settings.value("Position", QPoint(10, 10)).toPoint();
m_position = settings.value(QSL("Position"), QPoint(10, 10)).toPoint();
settings.endGroup();
}
@ -94,7 +94,7 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS
{QStringLiteral("desktop-entry"), QGuiApplication::desktopFileName()}
};
QDBusInterface dbus("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus());
QDBusInterface dbus(QSL("org.freedesktop.Notifications"), QSL("/org/freedesktop/Notifications"), QSL("org.freedesktop.Notifications"), QDBusConnection::sessionBus());
QVariantList args;
args.append(QLatin1String("Falkon"));
args.append(m_uint);
@ -104,7 +104,7 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS
args.append(QStringList());
args.append(hints);
args.append(m_timeout);
dbus.callWithCallback("Notify", args, this, SLOT(updateLastId(QDBusMessage)), SLOT(error(QDBusError)));
dbus.callWithCallback(QSL("Notify"), args, this, SLOT(updateLastId(QDBusMessage)), SLOT(error(QDBusError)));
#endif
break;
}

View File

@ -245,7 +245,7 @@ QByteArray OpenSearchEngine::getPostData(const QString &searchTerm) const
return {};
}
QUrl retVal = QUrl("http://foo.bar");
QUrl retVal = QUrl(QSL("http://foo.bar"));
QUrlQuery query(retVal);
Parameters::const_iterator end = m_searchParameters.constEnd();
@ -530,7 +530,7 @@ void OpenSearchEngine::setSuggestionsUrl(const QString &string)
QString OpenSearchEngine::getSuggestionsUrl()
{
return suggestionsUrl("searchstring").toString().replace(QLatin1String("searchstring"), QLatin1String("%s"));
return suggestionsUrl(QSL("searchstring")).toString().replace(QLatin1String("searchstring"), QLatin1String("%s"));
}
QByteArray OpenSearchEngine::getSuggestionsParameters()

View File

@ -97,7 +97,7 @@ OpenSearchEngine* OpenSearchReader::read(QIODevice* device)
OpenSearchEngine* OpenSearchReader::read()
{
auto* engine = new OpenSearchEngine();
m_searchXml = device()->peek(1024 * 5);
m_searchXml = QString::fromLatin1(device()->peek(1024 * 5));
if (!m_searchXml.contains(QLatin1String("http://a9.com/-/spec/opensearch/1.1/")) &&
!m_searchXml.contains(QLatin1String("http://www.mozilla.org/2006/browser/search/"))

View File

@ -108,7 +108,7 @@ void SearchEnginesDialog::editEngine()
dialog.setName(engine.name);
dialog.setUrl(engine.url);
dialog.setPostData(engine.postData);
dialog.setPostData(QString::fromUtf8(engine.postData));
dialog.setShortcut(engine.shortcut);
dialog.setIcon(engine.icon);

View File

@ -69,9 +69,9 @@ SearchEnginesManager::SearchEnginesManager(QObject* parent)
, m_saveScheduled(false)
{
Settings settings;
settings.beginGroup("SearchEngines");
m_startingEngineName = settings.value("activeEngine", "DuckDuckGo").toString();
m_defaultEngineName = settings.value("DefaultEngine", "DuckDuckGo").toString();
settings.beginGroup(QSL("SearchEngines"));
m_startingEngineName = settings.value(QSL("activeEngine"), QSL("DuckDuckGo")).toString();
m_defaultEngineName = settings.value(QSL("DefaultEngine"), QSL("DuckDuckGo")).toString();
settings.endGroup();
connect(this, &SearchEnginesManager::enginesChanged, this, &SearchEnginesManager::scheduleSave);
@ -82,7 +82,7 @@ void SearchEnginesManager::loadSettings()
m_settingsLoaded = true;
QSqlQuery query(SqlDatabase::instance()->database());
query.exec("SELECT name, icon, url, shortcut, suggestionsUrl, suggestionsParameters, postData FROM search_engines");
query.exec(QSL("SELECT name, icon, url, shortcut, suggestionsUrl, suggestionsParameters, postData FROM search_engines"));
while (query.next()) {
Engine en;
@ -158,33 +158,33 @@ LoadRequest SearchEnginesManager::searchResult(const QString &string)
void SearchEnginesManager::restoreDefaults()
{
Engine duck;
duck.name = "DuckDuckGo";
duck.icon = QIcon(":/icons/sites/duck.png");
duck.url = "https://duckduckgo.com/?q=%s&t=qupzilla";
duck.shortcut = "d";
duck.suggestionsUrl = "https://ac.duckduckgo.com/ac/?q=%s&type=list";
duck.name = QSL("DuckDuckGo");
duck.icon = QIcon(QSL(":/icons/sites/duck.png"));
duck.url = QSL("https://duckduckgo.com/?q=%s&t=qupzilla");
duck.shortcut = QSL("d");
duck.suggestionsUrl = QSL("https://ac.duckduckgo.com/ac/?q=%s&type=list");
Engine sp;
sp.name = "StartPage";
sp.icon = QIcon(":/icons/sites/startpage.png");
sp.url = "https://startpage.com/do/search";
sp.name = QSL("StartPage");
sp.icon = QIcon(QSL(":/icons/sites/startpage.png"));
sp.url = QSL("https://startpage.com/do/search");
sp.postData = "query=%s&cat=web&language=english";
sp.shortcut = "sp";
sp.suggestionsUrl = "https://startpage.com/cgi-bin/csuggest?output=json&lang=english&query=%s";
sp.shortcut = QSL("sp");
sp.suggestionsUrl = QSL("https://startpage.com/cgi-bin/csuggest?output=json&lang=english&query=%s");
Engine wiki;
wiki.name = "Wikipedia (en)";
wiki.icon = QIcon(":/icons/sites/wikipedia.png");
wiki.url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&fulltext=Search";
wiki.shortcut = "w";
wiki.suggestionsUrl = "https://en.wikipedia.org/w/api.php?action=opensearch&search=%s&namespace=0";
wiki.name = QSL("Wikipedia (en)");
wiki.icon = QIcon(QSL(":/icons/sites/wikipedia.png"));
wiki.url = QSL("https://en.wikipedia.org/wiki/Special:Search?search=%s&fulltext=Search");
wiki.shortcut = QSL("w");
wiki.suggestionsUrl = QSL("https://en.wikipedia.org/w/api.php?action=opensearch&search=%s&namespace=0");
Engine google;
google.name = "Google";
google.icon = QIcon(":icons/sites/google.png");
google.url = "https://www.google.com/search?client=falkon&q=%s";
google.shortcut = "g";
google.suggestionsUrl = "https://suggestqueries.google.com/complete/search?output=firefox&q=%s";
google.name = QSL("Google");
google.icon = QIcon(QSL(":icons/sites/google.png"));
google.url = QSL("https://www.google.com/search?client=falkon&q=%s");
google.shortcut = QSL("g");
google.suggestionsUrl = QSL("https://suggestqueries.google.com/complete/search?output=firefox&q=%s");
addEngine(duck);
addEngine(sp);
@ -218,7 +218,7 @@ void SearchEnginesManager::engineChangedImage()
for (Engine e : qAsConst(m_allEngines)) {
if (e.name == engine->name() &&
e.url.contains(engine->searchUrl("%s").toString()) &&
e.url.contains(engine->searchUrl(QSL("%s")).toString()) &&
!engine->image().isNull()
) {
int index = m_allEngines.indexOf(e);
@ -270,7 +270,7 @@ void SearchEnginesManager::addEngineFromForm(const QVariantMap &formData, WebVie
QUrl parameterUrl = actionUrl;
if (isPost) {
parameterUrl = QUrl("http://foo.bar");
parameterUrl = QUrl(QSL("http://foo.bar"));
}
const QString &inputName = formData.value(QSL("inputName")).toString();
@ -302,7 +302,7 @@ void SearchEnginesManager::addEngineFromForm(const QVariantMap &formData, WebVie
SearchEngine engine;
engine.name = view->title();
engine.icon = view->icon();
engine.url = actionUrl.toEncoded();
engine.url = QString::fromUtf8(actionUrl.toEncoded());
if (isPost) {
QByteArray data = parameterUrl.toEncoded(QUrl::RemoveScheme);
@ -316,7 +316,7 @@ void SearchEnginesManager::addEngineFromForm(const QVariantMap &formData, WebVie
dialog.setName(engine.name);
dialog.setIcon(engine.icon);
dialog.setUrl(engine.url);
dialog.setPostData(engine.postData);
dialog.setPostData(QString::fromUtf8(engine.postData));
if (dialog.exec() != QDialog::Accepted) {
return;
@ -341,7 +341,7 @@ void SearchEnginesManager::addEngine(OpenSearchEngine* engine)
Engine en;
en.name = engine->name();
en.url = engine->searchUrl("searchstring").toString().replace(QLatin1String("searchstring"), QLatin1String("%s"));
en.url = engine->searchUrl(QSL("searchstring")).toString().replace(QLatin1String("searchstring"), QLatin1String("%s"));
if (engine->image().isNull()) {
en.icon = iconForSearchEngine(engine->searchUrl(QString()));
@ -352,7 +352,7 @@ void SearchEnginesManager::addEngine(OpenSearchEngine* engine)
en.suggestionsUrl = engine->getSuggestionsUrl();
en.suggestionsParameters = engine->getSuggestionsParameters();
en.postData = engine->getPostData("searchstring").replace("searchstring", "%s");
en.postData = engine->getPostData(QSL("searchstring")).replace("searchstring", "%s");
addEngine(en);
@ -449,7 +449,7 @@ void SearchEnginesManager::removeEngine(const Engine &engine)
}
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("DELETE FROM search_engines WHERE name=? AND url=?");
query.prepare(QSL("DELETE FROM search_engines WHERE name=? AND url=?"));
query.bindValue(0, engine.name);
query.bindValue(1, engine.url);
query.exec();
@ -476,9 +476,9 @@ QVector<SearchEngine> SearchEnginesManager::allEngines()
void SearchEnginesManager::saveSettings()
{
Settings settings;
settings.beginGroup("SearchEngines");
settings.setValue("activeEngine", m_activeEngine.name);
settings.setValue("DefaultEngine", m_defaultEngine.name);
settings.beginGroup(QSL("SearchEngines"));
settings.setValue(QSL("activeEngine"), m_activeEngine.name);
settings.setValue(QSL("DefaultEngine"), m_defaultEngine.name);
settings.endGroup();
if (!m_saveScheduled) {
@ -493,10 +493,10 @@ void SearchEnginesManager::saveSettings()
// But as long as user is not playing with search engines every run it is acceptable.
QSqlQuery query(SqlDatabase::instance()->database());
query.exec("DELETE FROM search_engines");
query.exec(QSL("DELETE FROM search_engines"));
for (const Engine &en : qAsConst(m_allEngines)) {
query.prepare("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters, postData) VALUES (?, ?, ?, ?, ?, ?, ?)");
query.prepare(QSL("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters, postData) VALUES (?, ?, ?, ?, ?, ?, ?)"));
query.addBindValue(en.name);
query.addBindValue(iconToBase64(en.icon));
query.addBindValue(en.url);

View File

@ -47,17 +47,17 @@ AboutDialog::~AboutDialog()
void AboutDialog::showAbout()
{
QString aboutHtml;
aboutHtml += "<div style='margin:0px 20px;'>";
aboutHtml += QSL("<div style='margin:0px 20px;'>");
aboutHtml += tr("<p><b>Application version %1</b><br/>").arg(
#ifdef FALKON_GIT_REVISION
QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION)
QString(QSL("%1 (%2)")).arg(QString::fromLatin1(Qz::VERSION), QL1S(FALKON_GIT_REVISION))
#else
Qz::VERSION
QString::fromLatin1(Qz::VERSION)
#endif
);
aboutHtml += tr("<b>QtWebEngine version %1</b></p>").arg(QStringLiteral(QTWEBENGINECORE_VERSION_STR));
aboutHtml += QStringLiteral("<p>&copy; %1 %2<br/>").arg(Qz::COPYRIGHT, Qz::AUTHOR);
aboutHtml += QStringLiteral("<a href=%1>%1</a></p>").arg(Qz::WWWADDRESS);
aboutHtml += QStringLiteral("<p>&copy; %1 %2<br/>").arg(QString::fromLatin1(Qz::COPYRIGHT), QString::fromLatin1(Qz::AUTHOR));
aboutHtml += QStringLiteral("<a href=%1>%1</a></p>").arg(QString::fromLatin1(Qz::WWWADDRESS));
aboutHtml += QStringLiteral("<p>") + mApp->userAgentManager()->defaultUserAgent() + QStringLiteral("</p>");
aboutHtml += QStringLiteral("</div>");
ui->textLabel->setText(aboutHtml);

View File

@ -37,9 +37,9 @@ BrowsingLibrary::BrowsingLibrary(BrowserWindow* window, QWidget* parent)
ui->setupUi(this);
Settings settings;
settings.beginGroup("BrowsingLibrary");
resize(settings.value("size", QSize(760, 470)).toSize());
m_historyManager->restoreState(settings.value("historyState", QByteArray()).toByteArray());
settings.beginGroup(QSL("BrowsingLibrary"));
resize(settings.value(QSL("size"), QSize(760, 470)).toSize());
m_historyManager->restoreState(settings.value(QSL("historyState"), QByteArray()).toByteArray());
settings.endGroup();
QzTools::centerWidgetOnScreen(this);
@ -65,7 +65,7 @@ BrowsingLibrary::BrowsingLibrary(BrowserWindow* window, QWidget* parent)
connect(ui->tabs, &FancyTabWidget::CurrentChanged, ui->searchLine, &QLineEdit::clear);
connect(ui->searchLine, &QLineEdit::textChanged, this, &BrowsingLibrary::search);
QzTools::setWmClass("Browsing Library", this);
QzTools::setWmClass(QSL("Browsing Library"), this);
}
void BrowsingLibrary::search()
@ -113,9 +113,9 @@ void BrowsingLibrary::showBookmarks(BrowserWindow* window)
void BrowsingLibrary::closeEvent(QCloseEvent* e)
{
Settings settings;
settings.beginGroup("BrowsingLibrary");
settings.setValue("size", size());
settings.setValue("historyState", m_historyManager->saveState());
settings.beginGroup(QSL("BrowsingLibrary"));
settings.setValue(QSL("size"), size());
settings.setValue(QSL("historyState"), m_historyManager->saveState());
settings.endGroup();
e->accept();
}

View File

@ -54,8 +54,8 @@ ClearPrivateData::ClearPrivateData(QWidget* parent)
connect(ui->editCookies, &QAbstractButton::clicked, this, &ClearPrivateData::showCookieManager);
Settings settings;
settings.beginGroup("ClearPrivateData");
restoreState(settings.value("state", QByteArray()).toByteArray());
settings.beginGroup(QSL("ClearPrivateData"));
restoreState(settings.value(QSL("state"), QByteArray()).toByteArray());
settings.endGroup();
}
@ -91,8 +91,8 @@ void ClearPrivateData::clearCache()
void ClearPrivateData::closeEvent(QCloseEvent* e)
{
Settings settings;
settings.beginGroup("ClearPrivateData");
settings.setValue("state", saveState());
settings.beginGroup(QSL("ClearPrivateData"));
settings.setValue(QSL("state"), saveState());
settings.endGroup();
e->accept();

View File

@ -38,8 +38,8 @@ IconChooser::IconChooser(QWidget* parent)
void IconChooser::chooseFile()
{
const QString fileTypes = QString("%3(*.png *.jpg *.jpeg *.gif)").arg(tr("Image files"));
const QString path = QzTools::getOpenFileName("IconChooser-ChangeIcon", this, tr("Choose icon..."), QDir::homePath(), fileTypes);
const QString fileTypes = QSL("%3(*.png *.jpg *.jpeg *.gif)").arg(tr("Image files"));
const QString path = QzTools::getOpenFileName(QSL("IconChooser-ChangeIcon"), this, tr("Choose icon..."), QDir::homePath(), fileTypes);
if (path.isEmpty()) {
return;

View File

@ -32,7 +32,7 @@ LicenseViewer::LicenseViewer(QWidget* parent)
m_textBrowser = new QTextBrowser(this);
QFont serifFont = m_textBrowser->font();
serifFont.setFamily("Courier");
serifFont.setFamily(QSL("Courier"));
m_textBrowser->setFont(serifFont);
auto* buttonBox = new QDialogButtonBox(this);

View File

@ -26,52 +26,52 @@ QzSettings::QzSettings()
void QzSettings::loadSettings()
{
Settings settings;
settings.beginGroup("AddressBar");
selectAllOnDoubleClick = settings.value("SelectAllTextOnDoubleClick", true).toBool();
selectAllOnClick = settings.value("SelectAllTextOnClick", false).toBool();
showLoadingProgress = settings.value("ShowLoadingProgress", false).toBool();
showLocationSuggestions = settings.value("showSuggestions", 0).toInt();
showSwitchTab = settings.value("showSwitchTab", true).toBool();
alwaysShowGoIcon = settings.value("alwaysShowGoIcon", false).toBool();
useInlineCompletion = settings.value("useInlineCompletion", true).toBool();
showZoomLabel = settings.value("showZoomLabel", true).toBool();
completionPopupExpandToWindow = settings.value("CompletionPopupExpandToWindow", false).toBool();
settings.beginGroup(QSL("AddressBar"));
selectAllOnDoubleClick = settings.value(QSL("SelectAllTextOnDoubleClick"), true).toBool();
selectAllOnClick = settings.value(QSL("SelectAllTextOnClick"), false).toBool();
showLoadingProgress = settings.value(QSL("ShowLoadingProgress"), false).toBool();
showLocationSuggestions = settings.value(QSL("showSuggestions"), 0).toInt();
showSwitchTab = settings.value(QSL("showSwitchTab"), true).toBool();
alwaysShowGoIcon = settings.value(QSL("alwaysShowGoIcon"), false).toBool();
useInlineCompletion = settings.value(QSL("useInlineCompletion"), true).toBool();
showZoomLabel = settings.value(QSL("showZoomLabel"), true).toBool();
completionPopupExpandToWindow = settings.value(QSL("CompletionPopupExpandToWindow"), false).toBool();
settings.endGroup();
settings.beginGroup("SearchEngines");
searchOnEngineChange = settings.value("SearchOnEngineChange", true).toBool();
searchFromAddressBar = settings.value("SearchFromAddressBar", true).toBool();
searchWithDefaultEngine = settings.value("SearchWithDefaultEngine", true).toBool();
showABSearchSuggestions = settings.value("showSearchSuggestions", true).toBool();
showWSBSearchSuggestions = settings.value("showSuggestions", true).toBool();
settings.beginGroup(QSL("SearchEngines"));
searchOnEngineChange = settings.value(QSL("SearchOnEngineChange"), true).toBool();
searchFromAddressBar = settings.value(QSL("SearchFromAddressBar"), true).toBool();
searchWithDefaultEngine = settings.value(QSL("SearchWithDefaultEngine"), true).toBool();
showABSearchSuggestions = settings.value(QSL("showSearchSuggestions"), true).toBool();
showWSBSearchSuggestions = settings.value(QSL("showSuggestions"), true).toBool();
settings.endGroup();
settings.beginGroup("Web-Browser-Settings");
defaultZoomLevel = settings.value("DefaultZoomLevel", WebView::zoomLevels().indexOf(100)).toInt();
loadTabsOnActivation = settings.value("LoadTabsOnActivation", true).toBool();
autoOpenProtocols = settings.value("AutomaticallyOpenProtocols", QStringList()).toStringList();
blockedProtocols = settings.value("BlockOpeningProtocols", QStringList()).toStringList();
allowedSchemes = settings.value("AllowedSchemes", QStringList()).toStringList();
blockedSchemes = settings.value("BlockedSchemes", QStringList()).toStringList();
settings.beginGroup(QSL("Web-Browser-Settings"));
defaultZoomLevel = settings.value(QSL("DefaultZoomLevel"), WebView::zoomLevels().indexOf(100)).toInt();
loadTabsOnActivation = settings.value(QSL("LoadTabsOnActivation"), true).toBool();
autoOpenProtocols = settings.value(QSL("AutomaticallyOpenProtocols"), QStringList()).toStringList();
blockedProtocols = settings.value(QSL("BlockOpeningProtocols"), QStringList()).toStringList();
allowedSchemes = settings.value(QSL("AllowedSchemes"), QStringList()).toStringList();
blockedSchemes = settings.value(QSL("BlockedSchemes"), QStringList()).toStringList();
settings.endGroup();
settings.beginGroup("Browser-Tabs-Settings");
newTabPosition = settings.value("OpenNewTabsSelected", false).toBool() ? Qz::NT_CleanSelectedTab : Qz::NT_CleanNotSelectedTab;
tabsOnTop = settings.value("TabsOnTop", true).toBool();
openPopupsInTabs = settings.value("OpenPopupsInTabs", false).toBool();
alwaysSwitchTabsWithWheel = settings.value("AlwaysSwitchTabsWithWheel", false).toBool();
settings.beginGroup(QSL("Browser-Tabs-Settings"));
newTabPosition = settings.value(QSL("OpenNewTabsSelected"), false).toBool() ? Qz::NT_CleanSelectedTab : Qz::NT_CleanNotSelectedTab;
tabsOnTop = settings.value(QSL("TabsOnTop"), true).toBool();
openPopupsInTabs = settings.value(QSL("OpenPopupsInTabs"), false).toBool();
alwaysSwitchTabsWithWheel = settings.value(QSL("AlwaysSwitchTabsWithWheel"), false).toBool();
settings.endGroup();
}
void QzSettings::saveSettings()
{
Settings settings;
settings.beginGroup("Web-Browser-Settings");
settings.setValue("AutomaticallyOpenProtocols", autoOpenProtocols);
settings.setValue("BlockOpeningProtocols", blockedProtocols);
settings.beginGroup(QSL("Web-Browser-Settings"));
settings.setValue(QSL("AutomaticallyOpenProtocols"), autoOpenProtocols);
settings.setValue(QSL("BlockOpeningProtocols"), blockedProtocols);
settings.endGroup();
settings.beginGroup("Browser-Tabs-Settings");
settings.setValue("TabsOnTop", tabsOnTop);
settings.beginGroup(QSL("Browser-Tabs-Settings"));
settings.setValue(QSL("TabsOnTop"), tabsOnTop);
settings.endGroup();
}

View File

@ -79,16 +79,16 @@ void RegisterQAppAssociation::setAppInfo(const QString &appRegisteredName, const
bool RegisterQAppAssociation::isPerMachineRegisteration()
{
return (_UserRootKey == "HKEY_LOCAL_MACHINE");
return (_UserRootKey == QSL("HKEY_LOCAL_MACHINE"));
}
void RegisterQAppAssociation::setPerMachineRegisteration(bool enable)
{
if (enable) {
_UserRootKey = "HKEY_LOCAL_MACHINE";
_UserRootKey = QSL("HKEY_LOCAL_MACHINE");
}
else {
_UserRootKey = "HKEY_CURRENT_USER";
_UserRootKey = QSL("HKEY_CURRENT_USER");
}
}
@ -98,13 +98,13 @@ bool RegisterQAppAssociation::registerAppCapabilities()
return true;
}
// Vista and newer
QSettings regLocalMachine("HKEY_LOCAL_MACHINE", QSettings::NativeFormat);
QString capabilitiesKey = regLocalMachine.value("Software/RegisteredApplications/" + _appRegisteredName).toString();
QSettings regLocalMachine(QSL("HKEY_LOCAL_MACHINE"), QSettings::NativeFormat);
QString capabilitiesKey = regLocalMachine.value(QSL("Software/RegisteredApplications/") + _appRegisteredName).toString();
if (capabilitiesKey.isEmpty()) {
regLocalMachine.setValue("Software/RegisteredApplications/" + _appRegisteredName,
QString("Software\\" + _appRegisteredName + "\\Capabilities"));
capabilitiesKey = regLocalMachine.value("Software/RegisteredApplications/" + _appRegisteredName).toString();
regLocalMachine.setValue(QSL("Software/RegisteredApplications/") + _appRegisteredName,
QString(QSL("Software\\") + _appRegisteredName + QSL("\\Capabilities")));
capabilitiesKey = regLocalMachine.value(QSL("Software/RegisteredApplications/") + _appRegisteredName).toString();
if (capabilitiesKey.isEmpty()) {
QMessageBox::warning(mApp->getWindow(), tr("Warning!"),
@ -114,7 +114,7 @@ bool RegisterQAppAssociation::registerAppCapabilities()
}
}
capabilitiesKey.replace("\\", "/");
capabilitiesKey.replace(QSL("\\"), QSL("/"));
QHash<QString, QPair<QString, QString> >::const_iterator it = _assocDescHash.constBegin();
while (it != _assocDescHash.constEnd()) {
@ -122,22 +122,22 @@ bool RegisterQAppAssociation::registerAppCapabilities()
++it;
}
regLocalMachine.setValue(capabilitiesKey + "/ApplicationDescription", _appDesc);
regLocalMachine.setValue(capabilitiesKey + "/ApplicationIcon", _appIcon);
regLocalMachine.setValue(capabilitiesKey + "/ApplicationName", _appRegisteredName);
regLocalMachine.setValue(capabilitiesKey + QSL("/ApplicationDescription"), _appDesc);
regLocalMachine.setValue(capabilitiesKey + QSL("/ApplicationIcon"), _appIcon);
regLocalMachine.setValue(capabilitiesKey + QSL("/ApplicationName"), _appRegisteredName);
QHash<QString, QString>::const_iterator i = _fileAssocHash.constBegin();
while (i != _fileAssocHash.constEnd()) {
regLocalMachine.setValue(capabilitiesKey + "/FileAssociations/" + i.key(), i.value());
regLocalMachine.setValue(capabilitiesKey + QSL("/FileAssociations/") + i.key(), i.value());
++i;
}
i = _urlAssocHash.constBegin();
while (i != _urlAssocHash.constEnd()) {
regLocalMachine.setValue(capabilitiesKey + "/URLAssociations/" + i.key(), i.value());
regLocalMachine.setValue(capabilitiesKey + QSL("/URLAssociations/") + i.key(), i.value());
++i;
}
regLocalMachine.setValue(capabilitiesKey + "/Startmenu/StartMenuInternet", _appPath);
regLocalMachine.setValue(capabilitiesKey + QSL("/Startmenu/StartMenuInternet"), _appPath);
return true;
}
@ -173,10 +173,10 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
AT_FILEEXTENSION);
break;
case UrlAssociation: {
QSettings regCurrentUserRoot("HKEY_CURRENT_USER", QSettings::NativeFormat);
QSettings regCurrentUserRoot(QSL("HKEY_CURRENT_USER"), QSettings::NativeFormat);
QString currentUrlDefault =
regCurrentUserRoot.value("Software/Microsoft/Windows/Shell/Associations/UrlAssociations/"
+ assocName + "/UserChoice/Progid").toString();
regCurrentUserRoot.value(QSL("Software/Microsoft/Windows/Shell/Associations/UrlAssociations/")
+ assocName + QSL("/UserChoice/Progid")).toString();
hr = pAAR->SetAppAsDefault(_appRegisteredName.toStdWString().c_str(),
assocName.toStdWString().c_str(),
AT_URLPROTOCOL);
@ -184,9 +184,9 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
!currentUrlDefault.isEmpty() &&
currentUrlDefault != _urlAssocHash.value(assocName)
) {
regCurrentUserRoot.setValue("Software/Classes"
regCurrentUserRoot.setValue(QSL("Software/Classes")
+ assocName
+ "/shell/open/command/backup_progid", currentUrlDefault);
+ QSL("/shell/open/command/backup_progid"), currentUrlDefault);
}
}
break;
@ -201,36 +201,36 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
}
else { // Older than Vista
QSettings regUserRoot(_UserRootKey, QSettings::NativeFormat);
regUserRoot.beginGroup("Software/Classes");
QSettings regClassesRoot("HKEY_CLASSES_ROOT", QSettings::NativeFormat);
regUserRoot.beginGroup(QSL("Software/Classes"));
QSettings regClassesRoot(QSL("HKEY_CLASSES_ROOT"), QSettings::NativeFormat);
switch (type) {
case FileAssociation: {
QString progId = _fileAssocHash.value(assocName);
createProgId(progId);
QString currentDefault = regClassesRoot.value(assocName + "/Default").toString();
QString currentDefault = regClassesRoot.value(assocName + QSL("/Default")).toString();
if (!currentDefault.isEmpty() &&
currentDefault != progId &&
regUserRoot.value(assocName + "/backup_val").toString() != progId
regUserRoot.value(assocName + QSL("/backup_val")).toString() != progId
) {
regUserRoot.setValue(assocName + "/backup_val", currentDefault);
regUserRoot.setValue(assocName + QSL("/backup_val"), currentDefault);
}
regUserRoot.setValue(assocName + "/.", progId);
regUserRoot.setValue(assocName + QSL("/."), progId);
}
break;
case UrlAssociation: {
QString progId = _urlAssocHash.value(assocName);
createProgId(progId);
QString currentDefault = regClassesRoot.value(assocName + "/shell/open/command/Default").toString();
QString command = "\"" + _appPath + "\" \"%1\"";
QString currentDefault = regClassesRoot.value(assocName + QSL("/shell/open/command/Default")).toString();
QString command = QSL("\"") + _appPath + QSL("\" \"%1\"");
if (!currentDefault.isEmpty() &&
currentDefault != command &&
regUserRoot.value(assocName + "/shell/open/command/backup_val").toString() != command
regUserRoot.value(assocName + QSL("/shell/open/command/backup_val")).toString() != command
) {
regUserRoot.setValue(assocName + "/shell/open/command/backup_val", currentDefault);
regUserRoot.setValue(assocName + QSL("/shell/open/command/backup_val"), currentDefault);
}
regUserRoot.setValue(assocName + "/shell/open/command/.", command);
regUserRoot.setValue(assocName + "/URL Protocol", "");
regUserRoot.setValue(assocName + QSL("/shell/open/command/."), command);
regUserRoot.setValue(assocName + QSL("/URL Protocol"), QSL(""));
break;
}
default:
@ -325,25 +325,25 @@ bool RegisterQAppAssociation::showNativeDefaultAppSettingsUi()
void RegisterQAppAssociation::createProgId(const QString &progId)
{
QSettings regUserRoot(_UserRootKey, QSettings::NativeFormat);
regUserRoot.beginGroup("Software/Classes");
regUserRoot.beginGroup(QSL("Software/Classes"));
QPair<QString, QString> pair = _assocDescHash.value(progId);
regUserRoot.setValue(progId + "/.", pair.first);
regUserRoot.setValue(progId + "/shell/.", "open");
regUserRoot.setValue(progId + "/DefaultIcon/.", pair.second);
regUserRoot.setValue(progId + "/shell/open/command/.", QString("\"" + _appPath + "\" \"%1\""));
regUserRoot.setValue(progId + QSL("/."), pair.first);
regUserRoot.setValue(progId + QSL("/shell/."), QSL("open"));
regUserRoot.setValue(progId + QSL("/DefaultIcon/."), pair.second);
regUserRoot.setValue(progId + QSL("/shell/open/command/."), QString(QSL("\"") + _appPath + QSL("\" \"%1\"")));
regUserRoot.endGroup();
}
bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, AssociationType type)
{
if (isVistaOrNewer()) {
QSettings regCurrentUserRoot("HKEY_CURRENT_USER", QSettings::NativeFormat);
QSettings regCurrentUserRoot(QSL("HKEY_CURRENT_USER"), QSettings::NativeFormat);
switch (type) {
case FileAssociation: {
regCurrentUserRoot.beginGroup("Software/Microsoft/Windows/CurrentVersion/Explorer/FileExts");
regCurrentUserRoot.beginGroup(QSL("Software/Microsoft/Windows/CurrentVersion/Explorer/FileExts"));
if (regCurrentUserRoot.childGroups().contains(assocName, Qt::CaseInsensitive)) {
return (_fileAssocHash.value(assocName)
== regCurrentUserRoot.value(assocName + "/UserChoice/Progid"));
== regCurrentUserRoot.value(assocName + QSL("/UserChoice/Progid")));
}
else {
regCurrentUserRoot.endGroup();
@ -352,10 +352,10 @@ bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, Association
break;
}
case UrlAssociation: {
regCurrentUserRoot.beginGroup("Software/Microsoft/Windows/Shell/Associations/UrlAssociations");
regCurrentUserRoot.beginGroup(QSL("Software/Microsoft/Windows/Shell/Associations/UrlAssociations"));
if (regCurrentUserRoot.childGroups().contains(assocName, Qt::CaseInsensitive)) {
return (_urlAssocHash.value(assocName)
== regCurrentUserRoot.value(assocName + "/UserChoice/Progid"));
== regCurrentUserRoot.value(assocName + QSL("/UserChoice/Progid")));
}
else {
regCurrentUserRoot.endGroup();
@ -369,7 +369,7 @@ bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, Association
}
}
else {
QSettings regClassesRoot("HKEY_CLASSES_ROOT", QSettings::NativeFormat);
QSettings regClassesRoot(QSL("HKEY_CLASSES_ROOT"), QSettings::NativeFormat);
{
if (!regClassesRoot.childGroups().contains(assocName, Qt::CaseInsensitive)) {
return false;
@ -378,13 +378,13 @@ bool RegisterQAppAssociation::isDefaultApp(const QString &assocName, Association
switch (type) {
case FileAssociation: {
return (_fileAssocHash.value(assocName)
== regClassesRoot.value(assocName + "/Default"));
== regClassesRoot.value(assocName + QSL("/Default")));
}
break;
case UrlAssociation: {
QString currentDefault = regClassesRoot.value(assocName + "/shell/open/command/Default").toString();
currentDefault.remove("\"");
currentDefault.remove("%1");
QString currentDefault = regClassesRoot.value(assocName + QSL("/shell/open/command/Default")).toString();
currentDefault.remove(QSL("\""));
currentDefault.remove(QSL("%1"));
currentDefault = currentDefault.trimmed();
return (_appPath == currentDefault);
}

View File

@ -56,12 +56,12 @@ SiteInfo::SiteInfo(WebView *view)
delegate->setUniformItemSizes(true);
ui->listWidget->setItemDelegate(delegate);
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("document-properties", QIcon(":/icons/preferences/document-properties.png")));
ui->listWidget->item(1)->setIcon(QIcon::fromTheme("applications-graphics", QIcon(":/icons/preferences/applications-graphics.png")));
ui->listWidget->item(0)->setIcon(QIcon::fromTheme(QSL("document-properties"), QIcon(QSL(":/icons/preferences/document-properties.png"))));
ui->listWidget->item(1)->setIcon(QIcon::fromTheme(QSL("applications-graphics"), QIcon(QSL(":/icons/preferences/applications-graphics.png"))));
ui->listWidget->item(0)->setSelected(true);
// General
ui->heading->setText(QString("<b>%1</b>:").arg(m_view->title()));
ui->heading->setText(QSL("<b>%1</b>:").arg(m_view->title()));
ui->siteAddress->setText(m_view->url().toString());
if (m_view->url().scheme() == QL1S("https"))
@ -128,19 +128,19 @@ SiteInfo::SiteInfo(WebView *view)
connect(ui->treeImages, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(imagesCustomContextMenuRequested(QPoint)));
connect(ui->treeTags, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(tagsCustomContextMenuRequested(QPoint)));
auto *shortcutTagsCopyAll = new QShortcut(QKeySequence("Ctrl+C"), ui->treeTags);
auto *shortcutTagsCopyAll = new QShortcut(QKeySequence(QSL("Ctrl+C")), ui->treeTags);
shortcutTagsCopyAll->setContext(Qt::WidgetShortcut);
connect(shortcutTagsCopyAll, &QShortcut::activated, [=]{copySelectedItems(ui->treeTags, false);});
auto *shortcutTagsCopyValues = new QShortcut(QKeySequence("Ctrl+Shift+C"), ui->treeTags);
auto *shortcutTagsCopyValues = new QShortcut(QKeySequence(QSL("Ctrl+Shift+C")), ui->treeTags);
shortcutTagsCopyValues->setContext(Qt::WidgetShortcut);
connect(shortcutTagsCopyValues, &QShortcut::activated, [=]{copySelectedItems(ui->treeTags, true);});
auto *shortcutImagesCopyAll = new QShortcut(QKeySequence("Ctrl+C"), ui->treeImages);
auto *shortcutImagesCopyAll = new QShortcut(QKeySequence(QSL("Ctrl+C")), ui->treeImages);
shortcutImagesCopyAll->setContext(Qt::WidgetShortcut);
connect(shortcutImagesCopyAll, &QShortcut::activated, [=]{copySelectedItems(ui->treeImages, false);});
auto *shortcutImagesCopyValues = new QShortcut(QKeySequence("Ctrl+Shift+C"), ui->treeImages);
auto *shortcutImagesCopyValues = new QShortcut(QKeySequence(QSL("Ctrl+Shift+C")), ui->treeImages);
shortcutImagesCopyValues->setContext(Qt::WidgetShortcut);
connect(shortcutImagesCopyValues, &QShortcut::activated, [=]{copySelectedItems(ui->treeImages, true);});
@ -150,7 +150,7 @@ SiteInfo::SiteInfo(WebView *view)
ui->treeTags->setContextMenuPolicy(Qt::CustomContextMenu);
ui->treeTags->sortByColumn(-1, Qt::AscendingOrder);
QzTools::setWmClass("Site Info", this);
QzTools::setWmClass(QSL("Site Info"), this);
}
bool SiteInfo::canShowSiteInfo(const QUrl &url)
@ -172,10 +172,10 @@ void SiteInfo::imagesCustomContextMenuRequested(const QPoint &p)
}
QMenu menu;
menu.addAction(QIcon::fromTheme("edit-copy"), tr("Copy Image Location"), this, [=]{copySelectedItems(ui->treeImages, false);}, QKeySequence("Ctrl+C"));
menu.addAction(tr("Copy Image Name"), this, [=]{copySelectedItems(ui->treeImages, true);}, QKeySequence("Ctrl+Shift+C"));
menu.addAction(QIcon::fromTheme(QSL("edit-copy")), tr("Copy Image Location"), this, [=]{copySelectedItems(ui->treeImages, false);}, QKeySequence(QSL("Ctrl+C")));
menu.addAction(tr("Copy Image Name"), this, [=]{copySelectedItems(ui->treeImages, true);}, QKeySequence(QSL("Ctrl+Shift+C")));
menu.addSeparator();
menu.addAction(QIcon::fromTheme("document-save"), tr("Save Image to Disk"), this, SLOT(saveImage()));
menu.addAction(QIcon::fromTheme(QSL("document-save")), tr("Save Image to Disk"), this, SLOT(saveImage()));
menu.exec(ui->treeImages->viewport()->mapToGlobal(p));
}
@ -187,8 +187,8 @@ void SiteInfo::tagsCustomContextMenuRequested(const QPoint &p)
}
QMenu menu;
menu.addAction(tr("Copy Values"), this, [=]{copySelectedItems(ui->treeTags, false);}, QKeySequence("Ctrl+C"));
menu.addAction(tr("Copy Tags and Values"), this, [=]{copySelectedItems(ui->treeTags, true);}, QKeySequence("Ctrl+Shift+C"));
menu.addAction(tr("Copy Values"), this, [=]{copySelectedItems(ui->treeTags, false);}, QKeySequence(QSL("Ctrl+C")));
menu.addAction(tr("Copy Tags and Values"), this, [=]{copySelectedItems(ui->treeTags, true);}, QKeySequence(QSL("Ctrl+Shift+C")));
menu.exec(ui->treeTags->viewport()->mapToGlobal(p));
}
@ -237,7 +237,7 @@ void SiteInfo::saveImage()
imageFileName.append(QL1S(".png"));
}
QString filePath = QzTools::getSaveFileName("SiteInfo-DownloadImage", this, tr("Save image..."),
QString filePath = QzTools::getSaveFileName(QSL("SiteInfo-DownloadImage"), this, tr("Save image..."),
QDir::homePath() + QDir::separator() + imageFileName,
QSL("*.png"));
if (filePath.isEmpty()) {

View File

@ -43,33 +43,33 @@ SiteInfoWidget::SiteInfoWidget(BrowserWindow* window, QWidget* parent)
if (view->url().scheme() == QL1S("https")) {
ui->secureLabel->setText(tr("Your connection to this site is <b>secured</b>."));
ui->secureIcon->setPixmap(QPixmap(":/icons/locationbar/safe.png"));
ui->secureIcon->setPixmap(QPixmap(QSL(":/icons/locationbar/safe.png")));
}
else {
ui->secureLabel->setText(tr("Your connection to this site is <b>unsecured</b>."));
ui->secureIcon->setPixmap(QPixmap(":/icons/locationbar/unsafe.png"));
ui->secureIcon->setPixmap(QPixmap(QSL(":/icons/locationbar/unsafe.png")));
}
QString scheme = view->url().scheme();
QString host = view->url().host();
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("SELECT sum(count) FROM history WHERE url LIKE ?");
query.addBindValue(QString("%1://%2%").arg(scheme, host));
query.prepare(QSL("SELECT sum(count) FROM history WHERE url LIKE ?"));
query.addBindValue(QSL("%1://%2%").arg(scheme, host));
query.exec();
if (query.next()) {
int count = query.value(0).toInt();
if (count > 3) {
ui->historyLabel->setText(tr("This is your <b>%1</b> visit of this site.").arg(QString::number(count) + QLatin1Char('.')));
ui->historyIcon->setPixmap(QPixmap(":/icons/locationbar/visit3.png"));
ui->historyIcon->setPixmap(QPixmap(QSL(":/icons/locationbar/visit3.png")));
}
else if (count == 0) {
ui->historyLabel->setText(tr("You have <b>never</b> visited this site before."));
ui->historyIcon->setPixmap(QPixmap(":/icons/locationbar/visit1.png"));
ui->historyIcon->setPixmap(QPixmap(QSL(":/icons/locationbar/visit1.png")));
}
else {
ui->historyIcon->setPixmap(QPixmap(":/icons/locationbar/visit2.png"));
ui->historyIcon->setPixmap(QPixmap(QSL(":/icons/locationbar/visit2.png")));
QString text;
if (count == 1) {
text = tr("first");

View File

@ -108,7 +108,7 @@ bool Updater::Version::operator <=(const Updater::Version &other) const
QString Updater::Version::versionString() const
{
return QString("%1.%2.%3").arg(majorVersion, minorVersion, revisionNumber);
return QSL("%1.%2.%3").arg(majorVersion, minorVersion, revisionNumber);
}
Updater::Updater(BrowserWindow* window, QObject* parent)
@ -120,8 +120,8 @@ Updater::Updater(BrowserWindow* window, QObject* parent)
void Updater::start()
{
QUrl url = QUrl(QString("%1/update.php?v=%2&os=%3").arg(Qz::WWWADDRESS,
Qz::VERSION,
QUrl url = QUrl(QSL("%1/update.php?v=%2&os=%3").arg(QString::fromLatin1(Qz::WWWADDRESS),
QString::fromLatin1(Qz::VERSION),
QzTools::operatingSystem()));
startDownloadingUpdateInfo(url);
@ -140,15 +140,15 @@ void Updater::downCompleted()
if (!reply)
return;
QString html = reply->readAll();
QString html = QString::fromUtf8(reply->readAll());
if (html.startsWith(QLatin1String("Version:"))) {
html.remove(QLatin1String("Version:"));
Version current(Qz::VERSION);
Version current(QString::fromLatin1(Qz::VERSION));
Version updated(html);
if (current.isValid && updated.isValid && current < updated) {
mApp->desktopNotifications()->showNotification(QIcon(":icons/falkon.svg").pixmap(48), tr("Update available"), tr("New version of Falkon is ready to download."));
mApp->desktopNotifications()->showNotification(QIcon(QSL(":icons/falkon.svg")).pixmap(48), tr("Update available"), tr("New version of Falkon is ready to download."));
}
}

View File

@ -29,20 +29,20 @@ UserAgentManager::UserAgentManager(QObject* parent)
, m_usePerDomainUserAgent(false)
{
m_defaultUserAgent = mApp->webProfile()->httpUserAgent();
m_defaultUserAgent.replace(QRegularExpression(QSL("(QtWebEngine/[^\\s]+)")), QSL("Falkon/%1 \\1").arg(Qz::VERSION));
m_defaultUserAgent.replace(QRegularExpression(QSL("(QtWebEngine/[^\\s]+)")), QSL("Falkon/%1 \\1").arg(QString::fromLatin1(Qz::VERSION)));
}
void UserAgentManager::loadSettings()
{
Settings settings;
settings.beginGroup("Web-Browser-Settings");
m_globalUserAgent = settings.value("UserAgent", QString()).toString();
settings.beginGroup(QSL("Web-Browser-Settings"));
m_globalUserAgent = settings.value(QSL("UserAgent"), QString()).toString();
settings.endGroup();
settings.beginGroup("User-Agent-Settings");
m_usePerDomainUserAgent = settings.value("UsePerDomainUA", false).toBool();
QStringList domainList = settings.value("DomainList", QStringList()).toStringList();
QStringList userAgentsList = settings.value("UserAgentsList", QStringList()).toStringList();
settings.beginGroup(QSL("User-Agent-Settings"));
m_usePerDomainUserAgent = settings.value(QSL("UsePerDomainUA"), false).toBool();
QStringList domainList = settings.value(QSL("DomainList"), QStringList()).toStringList();
QStringList userAgentsList = settings.value(QSL("UserAgentsList"), QStringList()).toStringList();
settings.endGroup();
m_usePerDomainUserAgent = (m_usePerDomainUserAgent && domainList.count() == userAgentsList.count());

View File

@ -157,8 +157,8 @@ void Plugins::loadSettings()
}
Settings settings;
settings.beginGroup("Plugin-Settings");
m_allowedPlugins = settings.value("AllowedPlugins", defaultAllowedPlugins).toStringList();
settings.beginGroup(QSL("Plugin-Settings"));
m_allowedPlugins = settings.value(QSL("AllowedPlugins"), defaultAllowedPlugins).toStringList();
settings.endGroup();
}

View File

@ -46,7 +46,7 @@ QString QmlCookie::name() const
if (!m_cookie) {
return {};
}
return QString(m_cookie->name());
return QString(QString::fromUtf8(m_cookie->name()));
}
QString QmlCookie::path() const
@ -78,5 +78,5 @@ QString QmlCookie::value() const
if (!m_cookie) {
return {};
}
return QString(m_cookie->value());
return QString(QString::fromUtf8(m_cookie->value()));
}

View File

@ -52,7 +52,7 @@ QNetworkCookie QmlCookies::getNetworkCookie(const QVariantMap &map)
const QString url = map.value(QSL("url")).toString();
QVector<QNetworkCookie> cookies = mApp->cookieJar()->getAllCookies();
for (const QNetworkCookie &cookie : qAsConst(cookies)) {
if (cookie.name() == name && cookie.domain() == url) {
if (QString::fromUtf8(cookie.name()) == name && cookie.domain() == url) {
return cookie;
}
}
@ -75,7 +75,7 @@ QList<QObject*> QmlCookies::getAll(const QVariantMap &map)
const bool session = map.value(QSL("session")).toBool();
QVector<QNetworkCookie> cookies = mApp->cookieJar()->getAllCookies();
for (QNetworkCookie cookie : qAsConst(cookies)) {
if ((!map.contains(QSL("name")) || cookie.name() == name)
if ((!map.contains(QSL("name")) || QString::fromUtf8(cookie.name()) == name)
&& (!map.contains(QSL("url")) || cookie.domain() == url)
&& (!map.contains(QSL("path")) || cookie.path() == path)
&& (!map.contains(QSL("secure")) || cookie.isSecure() == secure)

View File

@ -33,7 +33,7 @@ void QmlI18n::initTranslations()
const bool isLanguageSet = qEnvironmentVariableIsSet("LANGUAGE");
const QByteArray language = qgetenv("LANGUAGE");
qputenv("LANGUAGE", QLocale::system().name().toUtf8());
bindtextdomain(m_domain.toUtf8(), localeDir.toUtf8());
bindtextdomain(m_domain.toUtf8().constData(), localeDir.toUtf8().constData());
if (!isLanguageSet) {
qunsetenv("LANGUAGE");
} else {
@ -43,10 +43,10 @@ void QmlI18n::initTranslations()
QString QmlI18n::i18n(const QString &string)
{
return QString::fromUtf8(dgettext(m_domain.toUtf8(), string.toUtf8()));
return QString::fromUtf8(dgettext(m_domain.toUtf8().constData(), string.toUtf8().constData()));
}
QString QmlI18n::i18np(const QString &string1, const QString &string2, int count)
{
return QString::fromUtf8(dngettext(m_domain.toUtf8(), string1.toUtf8(), string2.toUtf8(), count));
return QString::fromUtf8(dngettext(m_domain.toUtf8().constData(), string1.toUtf8().constData(), string2.toUtf8().constData(), count));
}

View File

@ -46,7 +46,7 @@ void QmlAction::setProperties(const QVariantMap &map)
} else if (key == QSL("shortcut")) {
m_action->setShortcut(QKeySequence(map.value(key).toString()));
} else {
m_action->setProperty(key.toUtf8(), map.value(key));
m_action->setProperty(key.toUtf8().constData(), map.value(key));
}
}
}

View File

@ -61,7 +61,7 @@ QmlMenu *QmlMenu::addMenu(const QVariantMap &map)
newMenu->setIcon(icon);
continue;
}
newMenu->setProperty(key.toUtf8(), map.value(key));
newMenu->setProperty(key.toUtf8().constData(), map.value(key));
}
m_menu->addMenu(newMenu);
auto *newQmlMenu = new QmlMenu(newMenu, m_engine, this);

View File

@ -93,7 +93,7 @@ void QmlPlugins::registerQmlTypes()
});
// Cookies
qmlRegisterUncreatableType<QmlCookie>(url, majorVersion, minorVersion, "Cookie", "Unable to register type: Cookie");
qmlRegisterUncreatableType<QmlCookie>(url, majorVersion, minorVersion, "Cookie", QSL("Unable to register type: Cookie"));
qmlRegisterSingletonType<QmlCookies>(url, majorVersion, minorVersion, "Cookies", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
Q_UNUSED(engine)

View File

@ -53,28 +53,28 @@ void SpeedDial::loadSettings()
m_loaded = true;
Settings settings;
settings.beginGroup("SpeedDial");
QString allPages = settings.value("pages", QString()).toString();
setBackgroundImage(settings.value("background", QString()).toString());
m_backgroundImageSize = settings.value("backsize", "auto").toString();
m_maxPagesInRow = settings.value("pagesrow", 4).toInt();
m_sizeOfSpeedDials = settings.value("sdsize", 231).toInt();
m_sdcentered = settings.value("sdcenter", false).toBool();
settings.beginGroup(QSL("SpeedDial"));
QString allPages = settings.value(QSL("pages"), QString()).toString();
setBackgroundImage(settings.value(QSL("background"), QString()).toString());
m_backgroundImageSize = settings.value(QSL("backsize"), QSL("auto")).toString();
m_maxPagesInRow = settings.value(QSL("pagesrow"), 4).toInt();
m_sizeOfSpeedDials = settings.value(QSL("sdsize"), 231).toInt();
m_sdcentered = settings.value(QSL("sdcenter"), false).toBool();
settings.endGroup();
if (allPages.isEmpty()) {
allPages = "url:\"https://www.falkon.org\"|title:\"Falkon\";"
"url:\"https://store.falkon.org\"|title:\"Falkon Store\";"
"url:\"https://www.kde.org\"|title:\"KDE Planet\";"
"url:\"https://planet.kde.org\"|title:\"KDE Community\";";
allPages = QL1S("url:\"https://www.falkon.org\"|title:\"Falkon\";"
"url:\"https://store.falkon.org\"|title:\"Falkon Store\";"
"url:\"https://www.kde.org\"|title:\"KDE Planet\";"
"url:\"https://planet.kde.org\"|title:\"KDE Community\";");
}
changed(allPages);
m_thumbnailsDir = DataPaths::currentProfilePath() + "/thumbnails/";
m_thumbnailsDir = DataPaths::currentProfilePath() + QSL("/thumbnails/");
// If needed, create thumbnails directory
if (!QDir(m_thumbnailsDir).exists()) {
QDir(DataPaths::currentProfilePath()).mkdir("thumbnails");
QDir(DataPaths::currentProfilePath()).mkdir(QSL("thumbnails"));
}
}
@ -83,13 +83,13 @@ void SpeedDial::saveSettings()
ENSURE_LOADED;
Settings settings;
settings.beginGroup("SpeedDial");
settings.setValue("pages", generateAllPages());
settings.setValue("background", m_backgroundImageUrl);
settings.setValue("backsize", m_backgroundImageSize);
settings.setValue("pagesrow", m_maxPagesInRow);
settings.setValue("sdsize", m_sizeOfSpeedDials);
settings.setValue("sdcenter", m_sdcentered);
settings.beginGroup(QSL("SpeedDial"));
settings.setValue(QSL("pages"), generateAllPages());
settings.setValue(QSL("background"), m_backgroundImageUrl);
settings.setValue(QSL("backsize"), m_backgroundImageSize);
settings.setValue(QSL("pagesrow"), m_maxPagesInRow);
settings.setValue(QSL("sdsize"), m_sizeOfSpeedDials);
settings.setValue(QSL("sdcenter"), m_sdcentered);
settings.endGroup();
}
@ -208,10 +208,10 @@ QString SpeedDial::initialScript()
QVariantList pages;
for (const Page &page : qAsConst(m_pages)) {
QString imgSource = m_thumbnailsDir + QCryptographicHash::hash(page.url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png";
QString imgSource = m_thumbnailsDir + QString::fromLatin1(QCryptographicHash::hash(page.url.toUtf8(), QCryptographicHash::Md4).toHex()) + QSL(".png");
if (!QFile(imgSource).exists()) {
imgSource = "qrc:html/loading.gif";
imgSource = QSL("qrc:html/loading.gif");
if (!page.isValid()) {
imgSource.clear();
@ -228,7 +228,7 @@ QString SpeedDial::initialScript()
pages.append(map);
}
m_initialScript = QJsonDocument::fromVariant(pages).toJson(QJsonDocument::Compact);
m_initialScript = QString::fromUtf8(QJsonDocument::fromVariant(pages).toJson(QJsonDocument::Compact));
return m_initialScript;
}
@ -273,7 +273,7 @@ void SpeedDial::loadThumbnail(const QString &url, bool loadTitle)
void SpeedDial::removeImageForUrl(const QString &url)
{
QString fileName = m_thumbnailsDir + QCryptographicHash::hash(url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png";
QString fileName = m_thumbnailsDir + QString::fromLatin1(QCryptographicHash::hash(url.toUtf8(), QCryptographicHash::Md4).toHex()) + QSL(".png");
if (QFile(fileName).exists()) {
QFile(fileName).remove();
@ -282,13 +282,13 @@ void SpeedDial::removeImageForUrl(const QString &url)
QStringList SpeedDial::getOpenFileName()
{
const QString fileTypes = QString("%3(*.png *.jpg *.jpeg *.bmp *.gif *.svg *.tiff)").arg(tr("Image files"));
const QString image = QzTools::getOpenFileName("SpeedDial-GetOpenFileName", 0, tr("Click to select image..."), QDir::homePath(), fileTypes);
const QString fileTypes = QSL("%3(*.png *.jpg *.jpeg *.bmp *.gif *.svg *.tiff)").arg(tr("Image files"));
const QString image = QzTools::getOpenFileName(QSL("SpeedDial-GetOpenFileName"), 0, tr("Click to select image..."), QDir::homePath(), fileTypes);
if (image.isEmpty())
return {};
return {QzTools::pixmapToDataUrl(QPixmap(image)).toString(), QUrl::fromLocalFile(image).toEncoded()};
return {QzTools::pixmapToDataUrl(QPixmap(image)).toString(), QString::fromUtf8(QUrl::fromLocalFile(image).toEncoded())};
}
QString SpeedDial::urlFromUserInput(const QString &url)
@ -334,10 +334,10 @@ void SpeedDial::thumbnailCreated(const QPixmap &pixmap)
bool loadTitle = thumbnailer->loadTitle();
QString title = thumbnailer->title();
QString url = thumbnailer->url().toString();
QString fileName = m_thumbnailsDir + QCryptographicHash::hash(url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png";
QString fileName = m_thumbnailsDir + QString::fromLatin1(QCryptographicHash::hash(url.toUtf8(), QCryptographicHash::Md4).toHex()) + QSL(".png");
if (pixmap.isNull()) {
fileName = ":/html/broken-page.svg";
fileName = QSL(":/html/broken-page.svg");
title = tr("Unable to load");
}
else {
@ -375,7 +375,7 @@ QString SpeedDial::generateAllPages()
QString allPages;
for (const Page &page : qAsConst(m_pages)) {
const QString string = QString(R"(url:"%1"|title:"%2";)").arg(page.url, page.title);
const QString string = QSL(R"(url:"%1"|title:"%2";)").arg(page.url, page.title);
allPages.append(string);
}

View File

@ -81,10 +81,10 @@ PopupWindow::PopupWindow(PopupWebView* view)
m_menuBar = new QMenuBar(this);
auto* menuFile = new QMenu(tr("File"));
menuFile->addAction(QIcon::fromTheme("mail-message-new"), tr("Send Link..."), m_view, &WebView::sendPageByMail);
menuFile->addAction(QIcon::fromTheme("document-print"), tr("&Print..."), m_view, &WebView::printPage)->setShortcut(QKeySequence("Ctrl+P"));
menuFile->addAction(QIcon::fromTheme(QSL("mail-message-new")), tr("Send Link..."), m_view, &WebView::sendPageByMail);
menuFile->addAction(QIcon::fromTheme(QSL("document-print")), tr("&Print..."), m_view, &WebView::printPage)->setShortcut(QKeySequence(QSL("Ctrl+P")));
menuFile->addSeparator();
menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close"), this, &QWidget::close)->setShortcut(QKeySequence("Ctrl+W"));
menuFile->addAction(QIcon::fromTheme(QSL("window-close")), tr("Close"), this, &QWidget::close)->setShortcut(QKeySequence(QSL("Ctrl+W")));
m_menuBar->addMenu(menuFile);
m_menuEdit = new QMenu(tr("Edit"));
@ -96,25 +96,25 @@ PopupWindow::PopupWindow(PopupWebView* view)
m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Paste));
m_menuEdit->addSeparator();
m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::SelectAll));
m_menuEdit->addAction(QIcon::fromTheme("edit-find"), tr("Find"), this, &PopupWindow::searchOnPage)->setShortcut(QKeySequence("Ctrl+F"));
m_menuEdit->addAction(QIcon::fromTheme(QSL("edit-find")), tr("Find"), this, &PopupWindow::searchOnPage)->setShortcut(QKeySequence(QSL("Ctrl+F")));
m_menuBar->addMenu(m_menuEdit);
m_menuView = new QMenu(tr("View"));
m_actionStop = m_menuView->addAction(QIcon::fromTheme(QSL("process-stop")), tr("&Stop"), m_view, &QWebEngineView::stop);
m_actionStop->setShortcut(QKeySequence("Esc"));
m_actionStop->setShortcut(QKeySequence(QSL("Esc")));
m_actionReload = m_menuView->addAction(QIcon::fromTheme(QSL("view-refresh")), tr("&Reload"), m_view, &QWebEngineView::reload);
m_actionReload->setShortcut(QKeySequence("F5"));
m_actionReload->setShortcut(QKeySequence(QSL("F5")));
m_menuView->addSeparator();
m_menuView->addAction(QIcon::fromTheme("zoom-in"), tr("Zoom &In"), m_view, &WebView::zoomIn)->setShortcut(QKeySequence("Ctrl++"));
m_menuView->addAction(QIcon::fromTheme("zoom-out"), tr("Zoom &Out"), m_view, &WebView::zoomOut)->setShortcut(QKeySequence("Ctrl+-"));
m_menuView->addAction(QIcon::fromTheme("zoom-original"), tr("Reset"), m_view, &WebView::zoomReset)->setShortcut(QKeySequence("Ctrl+0"));
m_menuView->addAction(QIcon::fromTheme(QSL("zoom-in")), tr("Zoom &In"), m_view, &WebView::zoomIn)->setShortcut(QKeySequence(QSL("Ctrl++")));
m_menuView->addAction(QIcon::fromTheme(QSL("zoom-out")), tr("Zoom &Out"), m_view, &WebView::zoomOut)->setShortcut(QKeySequence(QSL("Ctrl+-")));
m_menuView->addAction(QIcon::fromTheme(QSL("zoom-original")), tr("Reset"), m_view, &WebView::zoomReset)->setShortcut(QKeySequence(QSL("Ctrl+0")));
m_menuView->addSeparator();
m_menuView->addAction(QIcon::fromTheme("text-html"), tr("&Page Source"), m_view, &WebView::showSource)->setShortcut(QKeySequence("Ctrl+U"));
m_menuView->addAction(QIcon::fromTheme(QSL("text-html")), tr("&Page Source"), m_view, &WebView::showSource)->setShortcut(QKeySequence(QSL("Ctrl+U")));
m_menuBar->addMenu(m_menuView);
// Make shortcuts available even with hidden menubar
QList<QAction*> actions = m_menuBar->actions();
foreach (QAction* action, actions) {
for (QAction* action : std::as_const(actions)) {
if (action->menu()) {
actions += action->menu()->actions();
}
@ -273,7 +273,7 @@ void PopupWindow::titleChanged()
void PopupWindow::setWindowGeometry(QRect newRect)
{
if (!Settings().value("allowJavaScriptGeometryChange", true).toBool())
if (!Settings().value(QSL("allowJavaScriptGeometryChange"), true).toBool())
return;
// left/top was set while width/height not

View File

@ -64,7 +64,7 @@ QByteArray AcceptLanguage::generateHeader(const QStringList &langs)
int counter = 8;
for (int i = 1; i < langs.count(); i++) {
QString s = "," + langs.at(i) + ";q=0.";
QString s = QSL(",") + langs.at(i) + QSL(";q=0.");
s.append(QString::number(counter));
if (counter != 2) {
counter -= 2;
@ -86,8 +86,8 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
ui->listWidget->setLayoutDirection(Qt::LeftToRight);
Settings settings;
settings.beginGroup("Language");
const QStringList langs = settings.value("acceptLanguage", defaultLanguage()).toStringList();
settings.beginGroup(QSL("Language"));
const QStringList langs = settings.value(QSL("acceptLanguage"), defaultLanguage()).toStringList();
settings.endGroup();
for (const QString &code : langs) {
@ -99,7 +99,7 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
label = tr("Personal [%1]").arg(code);
}
else {
label = QString("%1/%2 [%3]").arg(loc.languageToString(loc.language()), loc.countryToString(loc.country()), code);
label = QSL("%1/%2 [%3]").arg(loc.languageToString(loc.language()), loc.countryToString(loc.country()), code);
}
ui->listWidget->addItem(label);
@ -216,8 +216,8 @@ void AcceptLanguage::accept()
}
Settings settings;
settings.beginGroup("Language");
settings.setValue("acceptLanguage", langs);
settings.beginGroup(QSL("Language"));
settings.setValue(QSL("acceptLanguage"), langs);
mApp->networkManager()->loadSettings();

View File

@ -70,7 +70,7 @@ AutoFillManager::AutoFillManager(QWidget* parent)
ui->search->setPlaceholderText(tr("Search"));
// Password backends
ui->currentBackend->setText(QString("<b>%1</b>").arg(m_passwordManager->activeBackend()->name()));
ui->currentBackend->setText(QSL("<b>%1</b>").arg(m_passwordManager->activeBackend()->name()));
ui->backendOptions->setVisible(m_passwordManager->activeBackend()->hasSettings());
// Load passwords
@ -89,7 +89,7 @@ void AutoFillManager::loadPasswords()
auto* item = new QTreeWidgetItem(ui->treePass);
item->setText(0, entry.host);
item->setText(1, entry.username);
item->setText(2, "*****");
item->setText(2, QSL("*****"));
QVariant v;
v.setValue(entry);
@ -98,7 +98,7 @@ void AutoFillManager::loadPasswords()
}
QSqlQuery query(SqlDatabase::instance()->database());
query.exec("SELECT server, id FROM autofill_exceptions");
query.exec(QSL("SELECT server, id FROM autofill_exceptions"));
ui->treeExcept->clear();
while (query.next()) {
auto* item = new QTreeWidgetItem(ui->treeExcept);
@ -165,7 +165,7 @@ void AutoFillManager::showPasswords()
if (!item) {
continue;
}
item->setText(2, "*****");
item->setText(2, QSL("*****"));
}
ui->showPasswords->setText(tr("Show Passwords"));
@ -277,7 +277,7 @@ void AutoFillManager::removeExcept()
}
QString id = curItem->data(0, Qt::UserRole + 10).toString();
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare("DELETE FROM autofill_exceptions WHERE id=?");
query.prepare(QSL("DELETE FROM autofill_exceptions WHERE id=?"));
query.addBindValue(id);
query.exec();
@ -287,7 +287,7 @@ void AutoFillManager::removeExcept()
void AutoFillManager::removeAllExcept()
{
QSqlQuery query(SqlDatabase::instance()->database());
query.exec("DELETE FROM autofill_exceptions");
query.exec(QSL("DELETE FROM autofill_exceptions"));
ui->treeExcept->clear();
}
@ -299,7 +299,7 @@ void AutoFillManager::showExceptions()
void AutoFillManager::importPasswords()
{
m_fileName = QzTools::getOpenFileName("AutoFill-ImportPasswords", this, tr("Choose file..."), QDir::homePath() + "/passwords.xml", "*.xml");
m_fileName = QzTools::getOpenFileName(QSL("AutoFill-ImportPasswords"), this, tr("Choose file..."), QDir::homePath() + QSL("/passwords.xml"), QSL("*.xml"));
if (m_fileName.isEmpty()) {
return;
@ -310,7 +310,7 @@ void AutoFillManager::importPasswords()
void AutoFillManager::exportPasswords()
{
m_fileName = QzTools::getSaveFileName("AutoFill-ExportPasswords", this, tr("Choose file..."), QDir::homePath() + "/passwords.xml", "*.xml");
m_fileName = QzTools::getSaveFileName(QSL("AutoFill-ExportPasswords"), this, tr("Choose file..."), QDir::homePath() + QSL("/passwords.xml"), QSL("*.xml"));
if (m_fileName.isEmpty()) {
return;
@ -360,7 +360,7 @@ void AutoFillManager::slotExportPasswords()
void AutoFillManager::currentPasswordBackendChanged()
{
ui->currentBackend->setText(QString("<b>%1</b>").arg(m_passwordManager->activeBackend()->name()));
ui->currentBackend->setText(QSL("<b>%1</b>").arg(m_passwordManager->activeBackend()->name()));
ui->backendOptions->setVisible(m_passwordManager->activeBackend()->hasSettings());
QTimer::singleShot(0, this, &AutoFillManager::loadPasswords);

View File

@ -36,8 +36,8 @@ CertificateManager::CertificateManager(QWidget* parent)
ui->listWidget->setLayoutDirection(Qt::LeftToRight);
Settings settings;
settings.beginGroup("Web-Browser-Settings");
m_ignoredSslHosts = settings.value("IgnoredSslHosts", QStringList()).toStringList();
settings.beginGroup(QSL("Web-Browser-Settings"));
m_ignoredSslHosts = settings.value(QSL("IgnoredSslHosts"), QStringList()).toStringList();
settings.endGroup();
ui->listWidget->addItems(m_ignoredSslHosts);
@ -101,8 +101,8 @@ void CertificateManager::removeException()
void CertificateManager::accept()
{
Settings settings;
settings.beginGroup("Web-Browser-Settings");
settings.setValue("IgnoredSslHosts", m_ignoredSslHosts);
settings.beginGroup(QSL("Web-Browser-Settings"));
settings.setValue(QSL("IgnoredSslHosts"), m_ignoredSslHosts);
settings.endGroup();
mApp->networkManager()->loadSettings();

View File

@ -31,22 +31,22 @@ JsOptions::JsOptions(QWidget* parent)
ui->setupUi(this);
Settings settings;
settings.beginGroup("Web-Browser-Settings");
ui->jscanOpenWindow->setChecked(settings.value("allowJavaScriptOpenWindow", false).toBool());
ui->jscanActivateWindow->setChecked(settings.value("allowJavaScriptActivateWindow", false).toBool());
ui->jscanAccessClipboard->setChecked(settings.value("allowJavaScriptAccessClipboard", true).toBool());
ui->jscanPaste->setChecked(settings.value("allowJavaScriptPaste", true).toBool());
settings.beginGroup(QSL("Web-Browser-Settings"));
ui->jscanOpenWindow->setChecked(settings.value(QSL("allowJavaScriptOpenWindow"), false).toBool());
ui->jscanActivateWindow->setChecked(settings.value(QSL("allowJavaScriptActivateWindow"), false).toBool());
ui->jscanAccessClipboard->setChecked(settings.value(QSL("allowJavaScriptAccessClipboard"), true).toBool());
ui->jscanPaste->setChecked(settings.value(QSL("allowJavaScriptPaste"), true).toBool());
settings.endGroup();
}
void JsOptions::accept()
{
Settings settings;
settings.beginGroup("Web-Browser-Settings");
settings.setValue("allowJavaScriptOpenWindow", ui->jscanOpenWindow->isChecked());
settings.setValue("allowJavaScriptActivateWindow", ui->jscanActivateWindow->isChecked());
settings.setValue("allowJavaScriptAccessClipboard", ui->jscanAccessClipboard->isChecked());
settings.setValue("allowJavaScriptPaste", ui->jscanPaste->isChecked());
settings.beginGroup(QSL("Web-Browser-Settings"));
settings.setValue(QSL("allowJavaScriptOpenWindow"), ui->jscanOpenWindow->isChecked());
settings.setValue(QSL("allowJavaScriptActivateWindow"), ui->jscanActivateWindow->isChecked());
settings.setValue(QSL("allowJavaScriptAccessClipboard"), ui->jscanAccessClipboard->isChecked());
settings.setValue(QSL("allowJavaScriptPaste"), ui->jscanPaste->isChecked());
settings.endGroup();
QDialog::close();

View File

@ -42,8 +42,8 @@ PluginsManager::PluginsManager(QWidget* parent)
//Application Extensions
Settings settings;
settings.beginGroup("Plugin-Settings");
bool appPluginsEnabled = settings.value("EnablePlugins", true).toBool();
settings.beginGroup(QSL("Plugin-Settings"));
bool appPluginsEnabled = settings.value(QSL("EnablePlugins"), true).toBool();
settings.endGroup();
ui->list->setEnabled(appPluginsEnabled);
@ -83,8 +83,8 @@ void PluginsManager::save()
}
Settings settings;
settings.beginGroup("Plugin-Settings");
settings.setValue("AllowedPlugins", allowedPlugins);
settings.beginGroup(QSL("Plugin-Settings"));
settings.setValue(QSL("AllowedPlugins"), allowedPlugins);
settings.endGroup();
}

View File

@ -77,7 +77,7 @@ static QString createLanguageItem(const QString &lang)
return QString::fromUtf8("Castellano");
}
if (lang == QLatin1String("nqo")) {
return {"N'ko (nqo)"};
return QSL("N'ko (nqo)");
}
if (lang == QLatin1String("sr")) {
return QString::fromUtf8("српски екавски");
@ -134,19 +134,19 @@ Preferences::Preferences(BrowserWindow* window)
Settings settings;
//GENERAL URLs
settings.beginGroup("Web-URL-Settings");
m_homepage = settings.value("homepage", QUrl(QSL("falkon:start"))).toUrl();
m_newTabUrl = settings.value("newTabUrl", QUrl(QSL("falkon:speeddial"))).toUrl();
ui->homepage->setText(m_homepage.toEncoded());
ui->newTabUrl->setText(m_newTabUrl.toEncoded());
settings.beginGroup(QSL("Web-URL-Settings"));
m_homepage = settings.value(QSL("homepage"), QUrl(QSL("falkon:start"))).toUrl();
m_newTabUrl = settings.value(QSL("newTabUrl"), QUrl(QSL("falkon:speeddial"))).toUrl();
ui->homepage->setText(QString::fromUtf8(m_homepage.toEncoded()));
ui->newTabUrl->setText(QString::fromUtf8(m_newTabUrl.toEncoded()));
settings.endGroup();
ui->afterLaunch->setCurrentIndex(mApp->afterLaunch());
ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", true).toBool());
ui->dontLoadTabsUntilSelected->setChecked(settings.value("Web-Browser-Settings/LoadTabsOnActivation", true).toBool());
ui->checkUpdates->setChecked(settings.value(QSL("Web-Browser-Settings/CheckUpdates"), true).toBool());
ui->dontLoadTabsUntilSelected->setChecked(settings.value(QSL("Web-Browser-Settings/LoadTabsOnActivation"), true).toBool());
#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
if (!mApp->isPortable()) {
ui->checkDefaultBrowser->setChecked(settings.value("Web-Browser-Settings/CheckDefaultBrowser",
ui->checkDefaultBrowser->setChecked(settings.value(QSL("Web-Browser-Settings/CheckDefaultBrowser"),
DEFAULT_CHECK_DEFAULTBROWSER).toBool());
if (mApp->associationManager()->isDefaultForAllCapabilities()) {
ui->checkNowDefaultBrowser->setText(tr("Default"));
@ -215,141 +215,141 @@ Preferences::Preferences(BrowserWindow* window)
startProfileIndexChanged(ui->startProfile->currentIndex());
//APPEREANCE
settings.beginGroup("Browser-View-Settings");
ui->showStatusbar->setChecked(settings.value("showStatusBar", false).toBool());
settings.beginGroup(QSL("Browser-View-Settings"));
ui->showStatusbar->setChecked(settings.value(QSL("showStatusBar"), false).toBool());
// NOTE: instantBookmarksToolbar and showBookmarksToolbar cannot be both enabled at the same time
ui->instantBookmarksToolbar->setChecked(settings.value("instantBookmarksToolbar", false).toBool());
ui->showBookmarksToolbar->setChecked(settings.value("showBookmarksToolbar", false).toBool());
ui->instantBookmarksToolbar->setDisabled(settings.value("showBookmarksToolbar", false).toBool());
ui->showBookmarksToolbar->setDisabled(settings.value("instantBookmarksToolbar").toBool());
ui->instantBookmarksToolbar->setChecked(settings.value(QSL("instantBookmarksToolbar"), false).toBool());
ui->showBookmarksToolbar->setChecked(settings.value(QSL("showBookmarksToolbar"), false).toBool());
ui->instantBookmarksToolbar->setDisabled(settings.value(QSL("showBookmarksToolbar"), false).toBool());
ui->showBookmarksToolbar->setDisabled(settings.value(QSL("instantBookmarksToolbar")).toBool());
connect(ui->instantBookmarksToolbar, &QAbstractButton::toggled, ui->showBookmarksToolbar, &QWidget::setDisabled);
connect(ui->showBookmarksToolbar, &QAbstractButton::toggled, ui->instantBookmarksToolbar, &QWidget::setDisabled);
ui->showNavigationToolbar->setChecked(settings.value("showNavigationToolbar", true).toBool());
int currentSettingsPage = settings.value("settingsDialogPage", 0).toInt(0);
ui->showNavigationToolbar->setChecked(settings.value(QSL("showNavigationToolbar"), true).toBool());
int currentSettingsPage = settings.value(QSL("settingsDialogPage"), 0).toInt(0);
settings.endGroup();
//TABS
settings.beginGroup("Browser-Tabs-Settings");
ui->hideTabsOnTab->setChecked(settings.value("hideTabsWithOneTab", false).toBool());
ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
ui->openNewTabAfterActive->setChecked(settings.value("newTabAfterActive", true).toBool());
ui->openNewEmptyTabAfterActive->setChecked(settings.value("newEmptyTabAfterActive", false).toBool());
ui->openPopupsInTabs->setChecked(settings.value("OpenPopupsInTabs", false).toBool());
ui->alwaysSwitchTabsWithWheel->setChecked(settings.value("AlwaysSwitchTabsWithWheel", false).toBool());
ui->switchToNewTabs->setChecked(settings.value("OpenNewTabsSelected", false).toBool());
ui->dontCloseOnLastTab->setChecked(settings.value("dontCloseWithOneTab", false).toBool());
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
ui->showClosedTabsButton->setChecked(settings.value("showClosedTabsButton", false).toBool());
ui->showCloseOnInactive->setCurrentIndex(settings.value("showCloseOnInactiveTabs", 0).toInt());
settings.beginGroup(QSL("Browser-Tabs-Settings"));
ui->hideTabsOnTab->setChecked(settings.value(QSL("hideTabsWithOneTab"), false).toBool());
ui->activateLastTab->setChecked(settings.value(QSL("ActivateLastTabWhenClosingActual"), false).toBool());
ui->openNewTabAfterActive->setChecked(settings.value(QSL("newTabAfterActive"), true).toBool());
ui->openNewEmptyTabAfterActive->setChecked(settings.value(QSL("newEmptyTabAfterActive"), false).toBool());
ui->openPopupsInTabs->setChecked(settings.value(QSL("OpenPopupsInTabs"), false).toBool());
ui->alwaysSwitchTabsWithWheel->setChecked(settings.value(QSL("AlwaysSwitchTabsWithWheel"), false).toBool());
ui->switchToNewTabs->setChecked(settings.value(QSL("OpenNewTabsSelected"), false).toBool());
ui->dontCloseOnLastTab->setChecked(settings.value(QSL("dontCloseWithOneTab"), false).toBool());
ui->askWhenClosingMultipleTabs->setChecked(settings.value(QSL("AskOnClosing"), false).toBool());
ui->showClosedTabsButton->setChecked(settings.value(QSL("showClosedTabsButton"), false).toBool());
ui->showCloseOnInactive->setCurrentIndex(settings.value(QSL("showCloseOnInactiveTabs"), 0).toInt());
settings.endGroup();
//AddressBar
settings.beginGroup("AddressBar");
ui->addressbarCompletion->setCurrentIndex(settings.value("showSuggestions", 0).toInt());
ui->useInlineCompletion->setChecked(settings.value("useInlineCompletion", true).toBool());
ui->completionShowSwitchTab->setChecked(settings.value("showSwitchTab", true).toBool());
ui->alwaysShowGoIcon->setChecked(settings.value("alwaysShowGoIcon", false).toBool());
ui->showZoomLabel->setChecked(settings.value("showZoomLabel", true).toBool());
ui->selectAllOnFocus->setChecked(settings.value("SelectAllTextOnDoubleClick", true).toBool());
ui->selectAllOnClick->setChecked(settings.value("SelectAllTextOnClick", false).toBool());
ui->completionPopupExpandToWindow->setChecked(settings.value("CompletionPopupExpandToWindow", false).toBool());
bool showPBinAB = settings.value("ShowLoadingProgress", false).toBool();
settings.beginGroup(QSL("AddressBar"));
ui->addressbarCompletion->setCurrentIndex(settings.value(QSL("showSuggestions"), 0).toInt());
ui->useInlineCompletion->setChecked(settings.value(QSL("useInlineCompletion"), true).toBool());
ui->completionShowSwitchTab->setChecked(settings.value(QSL("showSwitchTab"), true).toBool());
ui->alwaysShowGoIcon->setChecked(settings.value(QSL("alwaysShowGoIcon"), false).toBool());
ui->showZoomLabel->setChecked(settings.value(QSL("showZoomLabel"), true).toBool());
ui->selectAllOnFocus->setChecked(settings.value(QSL("SelectAllTextOnDoubleClick"), true).toBool());
ui->selectAllOnClick->setChecked(settings.value(QSL("SelectAllTextOnClick"), false).toBool());
ui->completionPopupExpandToWindow->setChecked(settings.value(QSL("CompletionPopupExpandToWindow"), false).toBool());
bool showPBinAB = settings.value(QSL("ShowLoadingProgress"), false).toBool();
ui->showLoadingInAddressBar->setChecked(showPBinAB);
ui->adressProgressSettings->setEnabled(showPBinAB);
ui->progressStyleSelector->setCurrentIndex(settings.value("ProgressStyle", 0).toInt());
bool pbInABuseCC = settings.value("UseCustomProgressColor", false).toBool();
ui->progressStyleSelector->setCurrentIndex(settings.value(QSL("ProgressStyle"), 0).toInt());
bool pbInABuseCC = settings.value(QSL("UseCustomProgressColor"), false).toBool();
ui->checkBoxCustomProgressColor->setChecked(pbInABuseCC);
ui->progressBarColorSelector->setEnabled(pbInABuseCC);
QColor pbColor = settings.value("CustomProgressColor", palette().color(QPalette::Highlight)).value<QColor>();
QColor pbColor = settings.value(QSL("CustomProgressColor"), palette().color(QPalette::Highlight)).value<QColor>();
setProgressBarColorIcon(pbColor);
connect(ui->customColorToolButton, &QAbstractButton::clicked, this, &Preferences::selectCustomProgressBarColor);
connect(ui->resetProgressBarcolor, SIGNAL(clicked()), SLOT(setProgressBarColorIcon()));
settings.endGroup();
settings.beginGroup("SearchEngines");
bool searchFromAB = settings.value("SearchFromAddressBar", true).toBool();
settings.beginGroup(QSL("SearchEngines"));
bool searchFromAB = settings.value(QSL("SearchFromAddressBar"), true).toBool();
ui->searchFromAddressBar->setChecked(searchFromAB);
ui->searchWithDefaultEngine->setEnabled(searchFromAB);
ui->searchWithDefaultEngine->setChecked(settings.value("SearchWithDefaultEngine", true).toBool());
ui->searchWithDefaultEngine->setChecked(settings.value(QSL("SearchWithDefaultEngine"), true).toBool());
ui->showABSearchSuggestions->setEnabled(searchFromAB);
ui->showABSearchSuggestions->setChecked(settings.value("showSearchSuggestions", true).toBool());
ui->showABSearchSuggestions->setChecked(settings.value(QSL("showSearchSuggestions"), true).toBool());
connect(ui->searchFromAddressBar, &QAbstractButton::toggled, this, &Preferences::searchFromAddressBarChanged);
settings.endGroup();
// BROWSING
settings.beginGroup("Web-Browser-Settings");
ui->allowPlugins->setChecked(settings.value("allowPlugins", true).toBool());
settings.beginGroup(QSL("Web-Browser-Settings"));
ui->allowPlugins->setChecked(settings.value(QSL("allowPlugins"), true).toBool());
connect(ui->allowPlugins, &QAbstractButton::toggled, this, &Preferences::allowPluginsToggled);
ui->allowJavaScript->setChecked(settings.value("allowJavaScript", true).toBool());
ui->linksInFocusChain->setChecked(settings.value("IncludeLinkInFocusChain", false).toBool());
ui->spatialNavigation->setChecked(settings.value("SpatialNavigation", false).toBool());
ui->animateScrolling->setChecked(settings.value("AnimateScrolling", true).toBool());
ui->wheelScroll->setValue(settings.value("wheelScrollLines", qApp->wheelScrollLines()).toInt());
ui->xssAuditing->setChecked(settings.value("XSSAuditing", false).toBool());
ui->printEBackground->setChecked(settings.value("PrintElementBackground", true).toBool());
ui->useNativeScrollbars->setChecked(settings.value("UseNativeScrollbars", false).toBool());
ui->disableVideoAutoPlay->setChecked(settings.value("DisableVideoAutoPlay", false).toBool());
ui->webRTCPublicIpOnly->setChecked(settings.value("WebRTCPublicIpOnly", true).toBool());
ui->dnsPrefetch->setChecked(settings.value("DNSPrefetch", true).toBool());
ui->intPDFViewer->setChecked(settings.value("intPDFViewer", false).toBool());
ui->allowJavaScript->setChecked(settings.value(QSL("allowJavaScript"), true).toBool());
ui->linksInFocusChain->setChecked(settings.value(QSL("IncludeLinkInFocusChain"), false).toBool());
ui->spatialNavigation->setChecked(settings.value(QSL("SpatialNavigation"), false).toBool());
ui->animateScrolling->setChecked(settings.value(QSL("AnimateScrolling"), true).toBool());
ui->wheelScroll->setValue(settings.value(QSL("wheelScrollLines"), qApp->wheelScrollLines()).toInt());
ui->xssAuditing->setChecked(settings.value(QSL("XSSAuditing"), false).toBool());
ui->printEBackground->setChecked(settings.value(QSL("PrintElementBackground"), true).toBool());
ui->useNativeScrollbars->setChecked(settings.value(QSL("UseNativeScrollbars"), false).toBool());
ui->disableVideoAutoPlay->setChecked(settings.value(QSL("DisableVideoAutoPlay"), false).toBool());
ui->webRTCPublicIpOnly->setChecked(settings.value(QSL("WebRTCPublicIpOnly"), true).toBool());
ui->dnsPrefetch->setChecked(settings.value(QSL("DNSPrefetch"), true).toBool());
ui->intPDFViewer->setChecked(settings.value(QSL("intPDFViewer"), false).toBool());
ui->intPDFViewer->setEnabled(ui->allowPlugins->isChecked());
ui->screenCaptureEnabled->setChecked(settings.value("screenCaptureEnabled", false).toBool());
ui->hardwareAccel->setChecked(settings.value("hardwareAccel", false).toBool());
ui->screenCaptureEnabled->setChecked(settings.value(QSL("screenCaptureEnabled"), false).toBool());
ui->hardwareAccel->setChecked(settings.value(QSL("hardwareAccel"), false).toBool());
const auto levels = WebView::zoomLevels();
for (int level : levels) {
ui->defaultZoomLevel->addItem(tr("%1%").arg(QString::number(level)));
}
ui->defaultZoomLevel->setCurrentIndex(settings.value("DefaultZoomLevel", WebView::zoomLevels().indexOf(100)).toInt());
ui->closeAppWithCtrlQ->setChecked(settings.value("closeAppWithCtrlQ", true).toBool());
ui->defaultZoomLevel->setCurrentIndex(settings.value(QSL("DefaultZoomLevel"), WebView::zoomLevels().indexOf(100)).toInt());
ui->closeAppWithCtrlQ->setChecked(settings.value(QSL("closeAppWithCtrlQ"), true).toBool());
//Cache
ui->allowCache->setChecked(settings.value("AllowLocalCache", true).toBool());
ui->removeCache->setChecked(settings.value("deleteCacheOnClose", false).toBool());
ui->cacheMB->setValue(settings.value("LocalCacheSize", 50).toInt());
ui->cachePath->setText(settings.value("CachePath", mApp->webProfile()->cachePath()).toString());
ui->allowCache->setChecked(settings.value(QSL("AllowLocalCache"), true).toBool());
ui->removeCache->setChecked(settings.value(QSL("deleteCacheOnClose"), false).toBool());
ui->cacheMB->setValue(settings.value(QSL("LocalCacheSize"), 50).toInt());
ui->cachePath->setText(settings.value(QSL("CachePath"), mApp->webProfile()->cachePath()).toString());
connect(ui->allowCache, &QAbstractButton::clicked, this, &Preferences::allowCacheChanged);
connect(ui->changeCachePath, &QAbstractButton::clicked, this, &Preferences::changeCachePathClicked);
allowCacheChanged(ui->allowCache->isChecked());
//PASSWORD MANAGER
ui->allowPassManager->setChecked(settings.value("SavePasswordsOnSites", true).toBool());
ui->autoCompletePasswords->setChecked(settings.value("AutoCompletePasswords", true).toBool());
ui->allowPassManager->setChecked(settings.value(QSL("SavePasswordsOnSites"), true).toBool());
ui->autoCompletePasswords->setChecked(settings.value(QSL("AutoCompletePasswords"), true).toBool());
//PRIVACY
//Web storage
ui->saveHistory->setChecked(settings.value("allowHistory", true).toBool());
ui->deleteHistoryOnClose->setChecked(settings.value("deleteHistoryOnClose", false).toBool());
ui->saveHistory->setChecked(settings.value(QSL("allowHistory"), true).toBool());
ui->deleteHistoryOnClose->setChecked(settings.value(QSL("deleteHistoryOnClose"), false).toBool());
if (!ui->saveHistory->isChecked()) {
ui->deleteHistoryOnClose->setEnabled(false);
}
connect(ui->saveHistory, &QAbstractButton::toggled, this, &Preferences::saveHistoryChanged);
// Html5Storage
ui->html5storage->setChecked(settings.value("HTML5StorageEnabled", true).toBool());
ui->deleteHtml5storageOnClose->setChecked(settings.value("deleteHTML5StorageOnClose", false).toBool());
ui->html5storage->setChecked(settings.value(QSL("HTML5StorageEnabled"), true).toBool());
ui->deleteHtml5storageOnClose->setChecked(settings.value(QSL("deleteHTML5StorageOnClose"), false).toBool());
connect(ui->html5storage, &QAbstractButton::toggled, this, &Preferences::allowHtml5storageChanged);
// Other
ui->doNotTrack->setChecked(settings.value("DoNotTrack", false).toBool());
ui->doNotTrack->setChecked(settings.value(QSL("DoNotTrack"), false).toBool());
//CSS Style
ui->userStyleSheet->setText(settings.value("userStyleSheet", "").toString());
ui->userStyleSheet->setText(settings.value(QSL("userStyleSheet"), QSL("")).toString());
connect(ui->chooseUserStylesheet, &QAbstractButton::clicked, this, &Preferences::chooseUserStyleClicked);
settings.endGroup();
//DOWNLOADS
settings.beginGroup("DownloadManager");
ui->downLoc->setText(settings.value("defaultDownloadPath", "").toString());
ui->closeDownManOnFinish->setChecked(settings.value("CloseManagerOnFinish", false).toBool());
settings.beginGroup(QSL("DownloadManager"));
ui->downLoc->setText(settings.value(QSL("defaultDownloadPath"), QSL("")).toString());
ui->closeDownManOnFinish->setChecked(settings.value(QSL("CloseManagerOnFinish"), false).toBool());
if (ui->downLoc->text().isEmpty()) {
ui->askEverytime->setChecked(true);
}
else {
ui->useDefined->setChecked(true);
}
ui->useExternalDownManager->setChecked(settings.value("UseExternalManager", false).toBool());
ui->externalDownExecutable->setText(settings.value("ExternalManagerExecutable", "").toString());
ui->externalDownArguments->setText(settings.value("ExternalManagerArguments", "").toString());
ui->useExternalDownManager->setChecked(settings.value(QSL("UseExternalManager"), false).toBool());
ui->externalDownExecutable->setText(settings.value(QSL("ExternalManagerExecutable"), QSL("")).toString());
ui->externalDownArguments->setText(settings.value(QSL("ExternalManagerArguments"), QSL("")).toString());
connect(ui->useExternalDownManager, &QAbstractButton::toggled, this, &Preferences::useExternalDownManagerChanged);
@ -362,7 +362,7 @@ Preferences::Preferences(BrowserWindow* window)
settings.endGroup();
//FONTS
settings.beginGroup("Browser-Fonts");
settings.beginGroup(QSL("Browser-Fonts"));
QWebEngineSettings* webSettings = mApp->webSettings();
auto defaultFont = [&](QWebEngineSettings::FontFamily font) -> const QString {
const QString family = webSettings->fontFamily(font);
@ -377,33 +377,33 @@ Preferences::Preferences(BrowserWindow* window)
return QFontDatabase::systemFont(QFontDatabase::GeneralFont).family();
}
};
ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", defaultFont(QWebEngineSettings::StandardFont)).toString()));
ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", defaultFont(QWebEngineSettings::CursiveFont)).toString()));
ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", defaultFont(QWebEngineSettings::FantasyFont)).toString()));
ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", defaultFont(QWebEngineSettings::FixedFont)).toString()));
ui->fontSansSerif->setCurrentFont(QFont(settings.value("SansSerifFont", defaultFont(QWebEngineSettings::SansSerifFont)).toString()));
ui->fontSerif->setCurrentFont(QFont(settings.value("SerifFont", defaultFont(QWebEngineSettings::SerifFont)).toString()));
ui->sizeDefault->setValue(settings.value("DefaultFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFontSize)).toInt());
ui->sizeFixed->setValue(settings.value("FixedFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFixedFontSize)).toInt());
ui->sizeMinimum->setValue(settings.value("MinimumFontSize", webSettings->fontSize(QWebEngineSettings::MinimumFontSize)).toInt());
ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", webSettings->fontSize(QWebEngineSettings::MinimumLogicalFontSize)).toInt());
ui->fontStandard->setCurrentFont(QFont(settings.value(QSL("StandardFont"), defaultFont(QWebEngineSettings::StandardFont)).toString()));
ui->fontCursive->setCurrentFont(QFont(settings.value(QSL("CursiveFont"), defaultFont(QWebEngineSettings::CursiveFont)).toString()));
ui->fontFantasy->setCurrentFont(QFont(settings.value(QSL("FantasyFont"), defaultFont(QWebEngineSettings::FantasyFont)).toString()));
ui->fontFixed->setCurrentFont(QFont(settings.value(QSL("FixedFont"), defaultFont(QWebEngineSettings::FixedFont)).toString()));
ui->fontSansSerif->setCurrentFont(QFont(settings.value(QSL("SansSerifFont"), defaultFont(QWebEngineSettings::SansSerifFont)).toString()));
ui->fontSerif->setCurrentFont(QFont(settings.value(QSL("SerifFont"), defaultFont(QWebEngineSettings::SerifFont)).toString()));
ui->sizeDefault->setValue(settings.value(QSL("DefaultFontSize"), webSettings->fontSize(QWebEngineSettings::DefaultFontSize)).toInt());
ui->sizeFixed->setValue(settings.value(QSL("FixedFontSize"), webSettings->fontSize(QWebEngineSettings::DefaultFixedFontSize)).toInt());
ui->sizeMinimum->setValue(settings.value(QSL("MinimumFontSize"), webSettings->fontSize(QWebEngineSettings::MinimumFontSize)).toInt());
ui->sizeMinimumLogical->setValue(settings.value(QSL("MinimumLogicalFontSize"), webSettings->fontSize(QWebEngineSettings::MinimumLogicalFontSize)).toInt());
settings.endGroup();
//KEYBOARD SHORTCUTS
settings.beginGroup("Shortcuts");
ui->switchTabsAlt->setChecked(settings.value("useTabNumberShortcuts", true).toBool());
ui->loadSpeedDialsCtrl->setChecked(settings.value("useSpeedDialNumberShortcuts", true).toBool());
ui->singleKeyShortcuts->setChecked(settings.value("useSingleKeyShortcuts", false).toBool());
settings.beginGroup(QSL("Shortcuts"));
ui->switchTabsAlt->setChecked(settings.value(QSL("useTabNumberShortcuts"), true).toBool());
ui->loadSpeedDialsCtrl->setChecked(settings.value(QSL("useSpeedDialNumberShortcuts"), true).toBool());
ui->singleKeyShortcuts->setChecked(settings.value(QSL("useSingleKeyShortcuts"), false).toBool());
settings.endGroup();
//NOTIFICATIONS
ui->useNativeSystemNotifications->setEnabled(mApp->desktopNotifications()->supportsNativeNotifications());
DesktopNotificationsFactory::Type notifyType;
settings.beginGroup("Notifications");
ui->notificationTimeout->setValue(settings.value("Timeout", 6000).toInt() / 1000);
settings.beginGroup(QSL("Notifications"));
ui->notificationTimeout->setValue(settings.value(QSL("Timeout"), 6000).toInt() / 1000);
#if defined(Q_OS_UNIX) && !defined(DISABLE_DBUS)
notifyType = settings.value("UseNativeDesktop", true).toBool() ? DesktopNotificationsFactory::DesktopNative : DesktopNotificationsFactory::PopupWidget;
notifyType = settings.value(QSL("UseNativeDesktop"), true).toBool() ? DesktopNotificationsFactory::DesktopNative : DesktopNotificationsFactory::PopupWidget;
#else
notifyType = DesktopNotificationsFactory::PopupWidget;
#endif
@ -416,8 +416,8 @@ Preferences::Preferences(BrowserWindow* window)
connect(ui->notificationPreview, &QPushButton::clicked, this, &Preferences::showNotificationPreview);
ui->doNotUseNotifications->setChecked(!settings.value("Enabled", true).toBool());
m_notifPosition = settings.value("Position", QPoint(10, 10)).toPoint();
ui->doNotUseNotifications->setChecked(!settings.value(QSL("Enabled"), true).toBool());
m_notifPosition = settings.value(QSL("Position"), QPoint(10, 10)).toPoint();
settings.endGroup();
//SPELLCHECK
@ -488,8 +488,8 @@ Preferences::Preferences(BrowserWindow* window)
}
// Proxy Configuration
settings.beginGroup("Web-Proxy");
int proxyType = settings.value("ProxyType", 2).toInt();
settings.beginGroup(QSL("Web-Proxy"));
int proxyType = settings.value(QSL("ProxyType"), 2).toInt();
if (proxyType == 0) {
ui->noProxy->setChecked(true);
} else if (proxyType == 2) {
@ -502,10 +502,10 @@ Preferences::Preferences(BrowserWindow* window)
ui->proxyType->setCurrentIndex(1);
}
ui->proxyServer->setText(settings.value("HostName", "").toString());
ui->proxyPort->setText(settings.value("Port", 8080).toString());
ui->proxyUsername->setText(settings.value("Username", "").toString());
ui->proxyPassword->setText(settings.value("Password", "").toString());
ui->proxyServer->setText(settings.value(QSL("HostName"), QSL("")).toString());
ui->proxyPort->setText(settings.value(QSL("Port"), 8080).toString());
ui->proxyUsername->setText(settings.value(QSL("Username"), QSL("")).toString());
ui->proxyPassword->setText(settings.value(QSL("Password"), QSL("")).toString());
settings.endGroup();
setManualProxyConfigurationEnabled(ui->manualProxy->isChecked());
@ -543,7 +543,7 @@ Preferences::Preferences(BrowserWindow* window)
restoreGeometry(settings.value(QSL("Geometry")).toByteArray());
settings.endGroup();
QzTools::setWmClass("Preferences", this);
QzTools::setWmClass(QSL("Preferences"), this);
}
void Preferences::allowPluginsToggled(bool checked)
@ -553,7 +553,7 @@ void Preferences::allowPluginsToggled(bool checked)
void Preferences::chooseExternalDownloadManager()
{
QString path = QzTools::getOpenFileName("Preferences-ExternalDownloadManager", this, tr("Choose executable location..."), QDir::homePath());
QString path = QzTools::getOpenFileName(QSL("Preferences-ExternalDownloadManager"), this, tr("Choose executable location..."), QDir::homePath());
if (path.isEmpty()) {
return;
}
@ -569,7 +569,7 @@ void Preferences::showStackedPage(QListWidgetItem* item)
int index = ui->listWidget->currentRow();
ui->caption->setText("<b>" + item->text() + "</b>");
ui->caption->setText(QSL("<b>") + item->text() + QSL("</b>"));
ui->stackedWidget->setCurrentIndex(index);
if (m_notification) {
@ -646,7 +646,7 @@ void Preferences::useActualNewTab()
void Preferences::chooseDownPath()
{
QString userFileName = QzTools::getExistingDirectory("Preferences-ChooseDownPath", this, tr("Choose download location..."), QDir::homePath());
QString userFileName = QzTools::getExistingDirectory(QSL("Preferences-ChooseDownPath"), this, tr("Choose download location..."), QDir::homePath());
if (userFileName.isEmpty()) {
return;
}
@ -660,7 +660,7 @@ void Preferences::chooseDownPath()
void Preferences::chooseUserStyleClicked()
{
QString file = QzTools::getOpenFileName("Preferences-UserStyle", this, tr("Choose stylesheet location..."), QDir::homePath(), "*.css");
QString file = QzTools::getOpenFileName(QSL("Preferences-UserStyle"), this, tr("Choose stylesheet location..."), QDir::homePath(), QSL("*.css"));
if (file.isEmpty()) {
return;
}
@ -779,7 +779,7 @@ void Preferences::afterLaunchChanged(int value)
void Preferences::changeCachePathClicked()
{
QString path = QzTools::getExistingDirectory("Preferences-CachePath", this, tr("Choose cache path..."), ui->cachePath->text());
QString path = QzTools::getExistingDirectory(QSL("Preferences-CachePath"), this, tr("Choose cache path..."), ui->cachePath->text());
if (path.isEmpty()) {
return;
}
@ -858,8 +858,8 @@ void Preferences::startProfileIndexChanged(int index)
void Preferences::closeEvent(QCloseEvent* event)
{
Settings settings;
settings.beginGroup("Browser-View-Settings");
settings.setValue("settingsDialogPage", ui->stackedWidget->currentIndex());
settings.beginGroup(QSL("Browser-View-Settings"));
settings.setValue(QSL("settingsDialogPage"), ui->stackedWidget->currentIndex());
settings.endGroup();
event->accept();
@ -871,25 +871,25 @@ void Preferences::saveSettings()
//GENERAL URLs
QUrl homepage = QUrl::fromUserInput(ui->homepage->text());
settings.beginGroup("Web-URL-Settings");
settings.setValue("homepage", homepage);
settings.setValue("afterLaunch", ui->afterLaunch->currentIndex());
settings.beginGroup(QSL("Web-URL-Settings"));
settings.setValue(QSL("homepage"), homepage);
settings.setValue(QSL("afterLaunch"), ui->afterLaunch->currentIndex());
switch (ui->newTab->currentIndex()) {
case 0:
settings.setValue("newTabUrl", QUrl());
settings.setValue(QSL("newTabUrl"), QUrl());
break;
case 1:
settings.setValue("newTabUrl", homepage);
settings.setValue(QSL("newTabUrl"), homepage);
break;
case 2:
settings.setValue("newTabUrl", QUrl(QSL("falkon:speeddial")));
settings.setValue(QSL("newTabUrl"), QUrl(QSL("falkon:speeddial")));
break;
case 3:
settings.setValue("newTabUrl", QUrl::fromUserInput(ui->newTabUrl->text()));
settings.setValue(QSL("newTabUrl"), QUrl::fromUserInput(ui->newTabUrl->text()));
break;
default:
@ -905,121 +905,121 @@ void Preferences::saveSettings()
*/
//WINDOW
settings.beginGroup("Browser-View-Settings");
settings.setValue("showStatusBar", ui->showStatusbar->isChecked());
settings.setValue("instantBookmarksToolbar", ui->instantBookmarksToolbar->isChecked());
settings.setValue("showBookmarksToolbar", ui->showBookmarksToolbar->isChecked());
settings.setValue("showNavigationToolbar", ui->showNavigationToolbar->isChecked());
settings.beginGroup(QSL("Browser-View-Settings"));
settings.setValue(QSL("showStatusBar"), ui->showStatusbar->isChecked());
settings.setValue(QSL("instantBookmarksToolbar"), ui->instantBookmarksToolbar->isChecked());
settings.setValue(QSL("showBookmarksToolbar"), ui->showBookmarksToolbar->isChecked());
settings.setValue(QSL("showNavigationToolbar"), ui->showNavigationToolbar->isChecked());
settings.endGroup();
//TABS
settings.beginGroup("Browser-Tabs-Settings");
settings.setValue("hideTabsWithOneTab", ui->hideTabsOnTab->isChecked());
settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked());
settings.setValue("newTabAfterActive", ui->openNewTabAfterActive->isChecked());
settings.setValue("newEmptyTabAfterActive", ui->openNewEmptyTabAfterActive->isChecked());
settings.setValue("OpenPopupsInTabs", ui->openPopupsInTabs->isChecked());
settings.setValue("AlwaysSwitchTabsWithWheel", ui->alwaysSwitchTabsWithWheel->isChecked());
settings.setValue("OpenNewTabsSelected", ui->switchToNewTabs->isChecked());
settings.setValue("dontCloseWithOneTab", ui->dontCloseOnLastTab->isChecked());
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked());
settings.setValue("showClosedTabsButton", ui->showClosedTabsButton->isChecked());
settings.setValue("showCloseOnInactiveTabs", ui->showCloseOnInactive->currentIndex());
settings.beginGroup(QSL("Browser-Tabs-Settings"));
settings.setValue(QSL("hideTabsWithOneTab"), ui->hideTabsOnTab->isChecked());
settings.setValue(QSL("ActivateLastTabWhenClosingActual"), ui->activateLastTab->isChecked());
settings.setValue(QSL("newTabAfterActive"), ui->openNewTabAfterActive->isChecked());
settings.setValue(QSL("newEmptyTabAfterActive"), ui->openNewEmptyTabAfterActive->isChecked());
settings.setValue(QSL("OpenPopupsInTabs"), ui->openPopupsInTabs->isChecked());
settings.setValue(QSL("AlwaysSwitchTabsWithWheel"), ui->alwaysSwitchTabsWithWheel->isChecked());
settings.setValue(QSL("OpenNewTabsSelected"), ui->switchToNewTabs->isChecked());
settings.setValue(QSL("dontCloseWithOneTab"), ui->dontCloseOnLastTab->isChecked());
settings.setValue(QSL("AskOnClosing"), ui->askWhenClosingMultipleTabs->isChecked());
settings.setValue(QSL("showClosedTabsButton"), ui->showClosedTabsButton->isChecked());
settings.setValue(QSL("showCloseOnInactiveTabs"), ui->showCloseOnInactive->currentIndex());
settings.endGroup();
//DOWNLOADS
settings.beginGroup("DownloadManager");
settings.beginGroup(QSL("DownloadManager"));
if (ui->askEverytime->isChecked()) {
settings.setValue("defaultDownloadPath", "");
settings.setValue(QSL("defaultDownloadPath"), QSL(""));
}
else {
settings.setValue("defaultDownloadPath", ui->downLoc->text());
settings.setValue(QSL("defaultDownloadPath"), ui->downLoc->text());
}
settings.setValue("CloseManagerOnFinish", ui->closeDownManOnFinish->isChecked());
settings.setValue("UseExternalManager", ui->useExternalDownManager->isChecked());
settings.setValue("ExternalManagerExecutable", ui->externalDownExecutable->text());
settings.setValue("ExternalManagerArguments", ui->externalDownArguments->text());
settings.setValue(QSL("CloseManagerOnFinish"), ui->closeDownManOnFinish->isChecked());
settings.setValue(QSL("UseExternalManager"), ui->useExternalDownManager->isChecked());
settings.setValue(QSL("ExternalManagerExecutable"), ui->externalDownExecutable->text());
settings.setValue(QSL("ExternalManagerArguments"), ui->externalDownArguments->text());
settings.endGroup();
//FONTS
settings.beginGroup("Browser-Fonts");
settings.setValue("StandardFont", ui->fontStandard->currentFont().family());
settings.setValue("CursiveFont", ui->fontCursive->currentFont().family());
settings.setValue("FantasyFont", ui->fontFantasy->currentFont().family());
settings.setValue("FixedFont", ui->fontFixed->currentFont().family());
settings.setValue("SansSerifFont", ui->fontSansSerif->currentFont().family());
settings.setValue("SerifFont", ui->fontSerif->currentFont().family());
settings.beginGroup(QSL("Browser-Fonts"));
settings.setValue(QSL("StandardFont"), ui->fontStandard->currentFont().family());
settings.setValue(QSL("CursiveFont"), ui->fontCursive->currentFont().family());
settings.setValue(QSL("FantasyFont"), ui->fontFantasy->currentFont().family());
settings.setValue(QSL("FixedFont"), ui->fontFixed->currentFont().family());
settings.setValue(QSL("SansSerifFont"), ui->fontSansSerif->currentFont().family());
settings.setValue(QSL("SerifFont"), ui->fontSerif->currentFont().family());
settings.setValue("DefaultFontSize", ui->sizeDefault->value());
settings.setValue("FixedFontSize", ui->sizeFixed->value());
settings.setValue("MinimumFontSize", ui->sizeMinimum->value());
settings.setValue("MinimumLogicalFontSize", ui->sizeMinimumLogical->value());
settings.setValue(QSL("DefaultFontSize"), ui->sizeDefault->value());
settings.setValue(QSL("FixedFontSize"), ui->sizeFixed->value());
settings.setValue(QSL("MinimumFontSize"), ui->sizeMinimum->value());
settings.setValue(QSL("MinimumLogicalFontSize"), ui->sizeMinimumLogical->value());
settings.endGroup();
//KEYBOARD SHORTCUTS
settings.beginGroup("Shortcuts");
settings.setValue("useTabNumberShortcuts", ui->switchTabsAlt->isChecked());
settings.setValue("useSpeedDialNumberShortcuts", ui->loadSpeedDialsCtrl->isChecked());
settings.setValue("useSingleKeyShortcuts", ui->singleKeyShortcuts->isChecked());
settings.beginGroup(QSL("Shortcuts"));
settings.setValue(QSL("useTabNumberShortcuts"), ui->switchTabsAlt->isChecked());
settings.setValue(QSL("useSpeedDialNumberShortcuts"), ui->loadSpeedDialsCtrl->isChecked());
settings.setValue(QSL("useSingleKeyShortcuts"), ui->singleKeyShortcuts->isChecked());
settings.endGroup();
//BROWSING
settings.beginGroup("Web-Browser-Settings");
settings.setValue("allowPlugins", ui->allowPlugins->isChecked());
settings.setValue("allowJavaScript", ui->allowJavaScript->isChecked());
settings.setValue("IncludeLinkInFocusChain", ui->linksInFocusChain->isChecked());
settings.setValue("SpatialNavigation", ui->spatialNavigation->isChecked());
settings.setValue("AnimateScrolling", ui->animateScrolling->isChecked());
settings.setValue("wheelScrollLines", ui->wheelScroll->value());
settings.setValue("DoNotTrack", ui->doNotTrack->isChecked());
settings.setValue("CheckUpdates", ui->checkUpdates->isChecked());
settings.setValue("LoadTabsOnActivation", ui->dontLoadTabsUntilSelected->isChecked());
settings.setValue("DefaultZoomLevel", ui->defaultZoomLevel->currentIndex());
settings.setValue("XSSAuditing", ui->xssAuditing->isChecked());
settings.setValue("PrintElementBackground", ui->printEBackground->isChecked());
settings.setValue("closeAppWithCtrlQ", ui->closeAppWithCtrlQ->isChecked());
settings.setValue("UseNativeScrollbars", ui->useNativeScrollbars->isChecked());
settings.setValue("DisableVideoAutoPlay", ui->disableVideoAutoPlay->isChecked());
settings.setValue("WebRTCPublicIpOnly", ui->webRTCPublicIpOnly->isChecked());
settings.setValue("DNSPrefetch", ui->dnsPrefetch->isChecked());
settings.setValue("intPDFViewer", ui->intPDFViewer->isChecked());
settings.setValue("screenCaptureEnabled", ui->screenCaptureEnabled->isChecked());
settings.setValue("hardwareAccel", ui->hardwareAccel->isChecked());
settings.beginGroup(QSL("Web-Browser-Settings"));
settings.setValue(QSL("allowPlugins"), ui->allowPlugins->isChecked());
settings.setValue(QSL("allowJavaScript"), ui->allowJavaScript->isChecked());
settings.setValue(QSL("IncludeLinkInFocusChain"), ui->linksInFocusChain->isChecked());
settings.setValue(QSL("SpatialNavigation"), ui->spatialNavigation->isChecked());
settings.setValue(QSL("AnimateScrolling"), ui->animateScrolling->isChecked());
settings.setValue(QSL("wheelScrollLines"), ui->wheelScroll->value());
settings.setValue(QSL("DoNotTrack"), ui->doNotTrack->isChecked());
settings.setValue(QSL("CheckUpdates"), ui->checkUpdates->isChecked());
settings.setValue(QSL("LoadTabsOnActivation"), ui->dontLoadTabsUntilSelected->isChecked());
settings.setValue(QSL("DefaultZoomLevel"), ui->defaultZoomLevel->currentIndex());
settings.setValue(QSL("XSSAuditing"), ui->xssAuditing->isChecked());
settings.setValue(QSL("PrintElementBackground"), ui->printEBackground->isChecked());
settings.setValue(QSL("closeAppWithCtrlQ"), ui->closeAppWithCtrlQ->isChecked());
settings.setValue(QSL("UseNativeScrollbars"), ui->useNativeScrollbars->isChecked());
settings.setValue(QSL("DisableVideoAutoPlay"), ui->disableVideoAutoPlay->isChecked());
settings.setValue(QSL("WebRTCPublicIpOnly"), ui->webRTCPublicIpOnly->isChecked());
settings.setValue(QSL("DNSPrefetch"), ui->dnsPrefetch->isChecked());
settings.setValue(QSL("intPDFViewer"), ui->intPDFViewer->isChecked());
settings.setValue(QSL("screenCaptureEnabled"), ui->screenCaptureEnabled->isChecked());
settings.setValue(QSL("hardwareAccel"), ui->hardwareAccel->isChecked());
#ifdef Q_OS_WIN
settings.setValue("CheckDefaultBrowser", ui->checkDefaultBrowser->isChecked());
settings.setValue(QSL("CheckDefaultBrowser"), ui->checkDefaultBrowser->isChecked());
#endif
//Cache
settings.setValue("AllowLocalCache", ui->allowCache->isChecked());
settings.setValue("deleteCacheOnClose", ui->removeCache->isChecked());
settings.setValue("LocalCacheSize", ui->cacheMB->value());
settings.setValue("CachePath", ui->cachePath->text());
settings.setValue(QSL("AllowLocalCache"), ui->allowCache->isChecked());
settings.setValue(QSL("deleteCacheOnClose"), ui->removeCache->isChecked());
settings.setValue(QSL("LocalCacheSize"), ui->cacheMB->value());
settings.setValue(QSL("CachePath"), ui->cachePath->text());
//CSS Style
settings.setValue("userStyleSheet", ui->userStyleSheet->text());
settings.setValue(QSL("userStyleSheet"), ui->userStyleSheet->text());
//PASSWORD MANAGER
settings.setValue("SavePasswordsOnSites", ui->allowPassManager->isChecked());
settings.setValue("AutoCompletePasswords", ui->autoCompletePasswords->isChecked());
settings.setValue(QSL("SavePasswordsOnSites"), ui->allowPassManager->isChecked());
settings.setValue(QSL("AutoCompletePasswords"), ui->autoCompletePasswords->isChecked());
//PRIVACY
//Web storage
settings.setValue("allowHistory", ui->saveHistory->isChecked());
settings.setValue("deleteHistoryOnClose", ui->deleteHistoryOnClose->isChecked());
settings.setValue("HTML5StorageEnabled", ui->html5storage->isChecked());
settings.setValue("deleteHTML5StorageOnClose", ui->deleteHtml5storageOnClose->isChecked());
settings.setValue(QSL("allowHistory"), ui->saveHistory->isChecked());
settings.setValue(QSL("deleteHistoryOnClose"), ui->deleteHistoryOnClose->isChecked());
settings.setValue(QSL("HTML5StorageEnabled"), ui->html5storage->isChecked());
settings.setValue(QSL("deleteHTML5StorageOnClose"), ui->deleteHtml5storageOnClose->isChecked());
settings.endGroup();
//NOTIFICATIONS
settings.beginGroup("Notifications");
settings.setValue("Timeout", ui->notificationTimeout->value() * 1000);
settings.setValue("Enabled", !ui->doNotUseNotifications->isChecked());
settings.setValue("UseNativeDesktop", ui->useNativeSystemNotifications->isChecked());
settings.setValue("Position", m_notification.data() ? m_notification.data()->pos() : m_notifPosition);
settings.beginGroup(QSL("Notifications"));
settings.setValue(QSL("Timeout"), ui->notificationTimeout->value() * 1000);
settings.setValue(QSL("Enabled"), !ui->doNotUseNotifications->isChecked());
settings.setValue(QSL("UseNativeDesktop"), ui->useNativeSystemNotifications->isChecked());
settings.setValue(QSL("Position"), m_notification.data() ? m_notification.data()->pos() : m_notifPosition);
settings.endGroup();
//SPELLCHECK
settings.beginGroup(QSL("SpellCheck"));
settings.setValue("Enabled", ui->spellcheckEnabled->isChecked());
settings.setValue(QSL("Enabled"), ui->spellcheckEnabled->isChecked());
QStringList languages;
for (int i = 0; i < ui->spellcheckLanguages->count(); ++i) {
QListWidgetItem *item = ui->spellcheckLanguages->item(i);
@ -1027,30 +1027,30 @@ void Preferences::saveSettings()
languages.append(item->data(Qt::UserRole).toString());
}
}
settings.setValue("Languages", languages);
settings.setValue(QSL("Languages"), languages);
settings.endGroup();
//OTHER
//AddressBar
settings.beginGroup("AddressBar");
settings.setValue("showSuggestions", ui->addressbarCompletion->currentIndex());
settings.setValue("useInlineCompletion", ui->useInlineCompletion->isChecked());
settings.setValue("alwaysShowGoIcon", ui->alwaysShowGoIcon->isChecked());
settings.setValue("showZoomLabel", ui->showZoomLabel->isChecked());
settings.setValue("showSwitchTab", ui->completionShowSwitchTab->isChecked());
settings.setValue("SelectAllTextOnDoubleClick", ui->selectAllOnFocus->isChecked());
settings.setValue("SelectAllTextOnClick", ui->selectAllOnClick->isChecked());
settings.setValue("CompletionPopupExpandToWindow", ui->completionPopupExpandToWindow->isChecked());
settings.setValue("ShowLoadingProgress", ui->showLoadingInAddressBar->isChecked());
settings.setValue("ProgressStyle", ui->progressStyleSelector->currentIndex());
settings.setValue("UseCustomProgressColor", ui->checkBoxCustomProgressColor->isChecked());
settings.setValue("CustomProgressColor", ui->customColorToolButton->property("ProgressColor").value<QColor>());
settings.beginGroup(QSL("AddressBar"));
settings.setValue(QSL("showSuggestions"), ui->addressbarCompletion->currentIndex());
settings.setValue(QSL("useInlineCompletion"), ui->useInlineCompletion->isChecked());
settings.setValue(QSL("alwaysShowGoIcon"), ui->alwaysShowGoIcon->isChecked());
settings.setValue(QSL("showZoomLabel"), ui->showZoomLabel->isChecked());
settings.setValue(QSL("showSwitchTab"), ui->completionShowSwitchTab->isChecked());
settings.setValue(QSL("SelectAllTextOnDoubleClick"), ui->selectAllOnFocus->isChecked());
settings.setValue(QSL("SelectAllTextOnClick"), ui->selectAllOnClick->isChecked());
settings.setValue(QSL("CompletionPopupExpandToWindow"), ui->completionPopupExpandToWindow->isChecked());
settings.setValue(QSL("ShowLoadingProgress"), ui->showLoadingInAddressBar->isChecked());
settings.setValue(QSL("ProgressStyle"), ui->progressStyleSelector->currentIndex());
settings.setValue(QSL("UseCustomProgressColor"), ui->checkBoxCustomProgressColor->isChecked());
settings.setValue(QSL("CustomProgressColor"), ui->customColorToolButton->property("ProgressColor").value<QColor>());
settings.endGroup();
settings.beginGroup("SearchEngines");
settings.setValue("SearchFromAddressBar", ui->searchFromAddressBar->isChecked());
settings.setValue("SearchWithDefaultEngine", ui->searchWithDefaultEngine->isChecked());
settings.setValue("showSearchSuggestions", ui->showABSearchSuggestions->isChecked());
settings.beginGroup(QSL("SearchEngines"));
settings.setValue(QSL("SearchFromAddressBar"), ui->searchFromAddressBar->isChecked());
settings.setValue(QSL("SearchWithDefaultEngine"), ui->searchWithDefaultEngine->isChecked());
settings.setValue(QSL("showSearchSuggestions"), ui->showABSearchSuggestions->isChecked());
settings.endGroup();
//Proxy Configuration
@ -1065,12 +1065,12 @@ void Preferences::saveSettings()
proxyType = 4;
}
settings.beginGroup("Web-Proxy");
settings.setValue("ProxyType", proxyType);
settings.setValue("HostName", ui->proxyServer->text());
settings.setValue("Port", ui->proxyPort->text().toInt());
settings.setValue("Username", ui->proxyUsername->text());
settings.setValue("Password", ui->proxyPassword->text());
settings.beginGroup(QSL("Web-Proxy"));
settings.setValue(QSL("ProxyType"), proxyType);
settings.setValue(QSL("HostName"), ui->proxyServer->text());
settings.setValue(QSL("Port"), ui->proxyPort->text().toInt());
settings.setValue(QSL("Username"), ui->proxyUsername->text());
settings.setValue(QSL("Password"), ui->proxyPassword->text());
settings.endGroup();
ProfileManager::setStartingProfile(ui->startProfile->currentText());

View File

@ -40,8 +40,8 @@ ThemeManager::ThemeManager(QWidget* parent, Preferences* preferences)
ui->remove->setIcon(QIcon::fromTheme(QSL("edit-delete")));
Settings settings;
settings.beginGroup("Themes");
m_activeTheme = settings.value("activeTheme", DEFAULT_THEME_NAME).toString();
settings.beginGroup(QSL("Themes"));
m_activeTheme = settings.value(QSL("activeTheme"), DEFAULT_THEME_NAME).toString();
settings.endGroup();
const QStringList themePaths = DataPaths::allPaths(DataPaths::Themes);
@ -129,7 +129,7 @@ ThemeManager::Theme ThemeManager::parseTheme(const QString &path, const QString
Theme info;
info.isValid = false;
if (!QFile(path + QStringLiteral("main.css")).exists() || !QFile(path + "metadata.desktop").exists()) {
if (!QFile(path + QStringLiteral("main.css")).exists() || !QFile(path + QSL("metadata.desktop")).exists()) {
info.isValid = false;
return info;
}
@ -171,8 +171,8 @@ void ThemeManager::save()
}
Settings settings;
settings.beginGroup("Themes");
settings.setValue("activeTheme", currentItem->data(Qt::UserRole));
settings.beginGroup(QSL("Themes"));
settings.setValue(QSL("activeTheme"), currentItem->data(Qt::UserRole));
settings.endGroup();
}

View File

@ -49,10 +49,10 @@ UserAgentDialog::UserAgentDialog(QWidget* parent)
QRegularExpression chromeRx(QSL("Chrome/([^\\s]+)"));
const QString chromeVersion = chromeRx.match(m_manager->defaultUserAgent()).captured(1);
m_knownUserAgents << QString("Opera/9.80 (%1) Presto/2.12.388 Version/12.16").arg(os)
<< QString("Mozilla/5.0 (%1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%2 Safari/537.36").arg(os, chromeVersion)
<< QString("Mozilla/5.0 (%1) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12").arg(os)
<< QString("Mozilla/5.0 (%1; rv:102.0) Gecko/20100101 Firefox/102.0").arg(os);
m_knownUserAgents << QSL("Opera/9.80 (%1) Presto/2.12.388 Version/12.16").arg(os)
<< QSL("Mozilla/5.0 (%1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%2 Safari/537.36").arg(os, chromeVersion)
<< QSL("Mozilla/5.0 (%1) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12").arg(os)
<< QSL("Mozilla/5.0 (%1; rv:102.0) Gecko/20100101 Firefox/102.0").arg(os);
ui->globalComboBox->addItems(m_knownUserAgents);
@ -167,14 +167,14 @@ void UserAgentDialog::accept()
}
Settings settings;
settings.beginGroup("Web-Browser-Settings");
settings.setValue("UserAgent", globalUserAgent);
settings.beginGroup(QSL("Web-Browser-Settings"));
settings.setValue(QSL("UserAgent"), globalUserAgent);
settings.endGroup();
settings.beginGroup("User-Agent-Settings");
settings.setValue("UsePerDomainUA", ui->changePerSite->isChecked());
settings.setValue("DomainList", domainList);
settings.setValue("UserAgentsList", userAgentsList);
settings.beginGroup(QSL("User-Agent-Settings"));
settings.setValue(QSL("UsePerDomainUA"), ui->changePerSite->isChecked());
settings.setValue(QSL("DomainList"), domainList);
settings.setValue(QSL("UserAgentsList"), userAgentsList);
settings.endGroup();
m_manager->loadSettings();

View File

@ -132,7 +132,7 @@ void SessionManager::renameSession(QString sessionFilePath, SessionManager::Sess
if (!ok)
return;
const QString newSessionPath = QString("%1/%2.dat").arg(DataPaths::path(DataPaths::Sessions), newName);
const QString newSessionPath = QSL("%1/%2.dat").arg(DataPaths::path(DataPaths::Sessions), newName);
if (QFile::exists(newSessionPath)) {
QMessageBox::information(mApp->activeWindow(), tr("Error!"), tr("The session file \"%1\" exists. Please enter another name.").arg(newName));
renameSession(sessionFilePath, flags);
@ -161,12 +161,12 @@ void SessionManager::saveSession()
bool ok;
QString sessionName = QInputDialog::getText(mApp->activeWindow(), tr("Save Session"),
tr("Please enter a name to save session:"), QLineEdit::Normal,
tr("Saved Session (%1)").arg(QDateTime::currentDateTime().toString("dd MMM yyyy HH-mm-ss")), &ok);
tr("Saved Session (%1)").arg(QDateTime::currentDateTime().toString(QSL("dd MMM yyyy HH-mm-ss"))), &ok);
if (!ok)
return;
const QString filePath = QString("%1/%2.dat").arg(DataPaths::path(DataPaths::Sessions), sessionName);
const QString filePath = QSL("%1/%2.dat").arg(DataPaths::path(DataPaths::Sessions), sessionName);
if (QFile::exists(filePath)) {
QMessageBox::information(mApp->activeWindow(), tr("Error!"), tr("The session file \"%1\" exists. Please enter another name.").arg(sessionName));
saveSession();
@ -209,7 +209,7 @@ void SessionManager::newSession()
bool ok;
QString sessionName = QInputDialog::getText(mApp->activeWindow(), tr("New Session"),
tr("Please enter a name to create new session:"), QLineEdit::Normal,
tr("New Session (%1)").arg(QDateTime::currentDateTime().toString("dd MMM yyyy HH-mm-ss")), &ok);
tr("New Session (%1)").arg(QDateTime::currentDateTime().toString(QSL("dd MMM yyyy HH-mm-ss"))), &ok);
if (!ok)
return;
@ -312,8 +312,8 @@ void SessionManager::loadSettings()
QDir sessionsDir(DataPaths::path(DataPaths::Sessions));
Settings settings;
settings.beginGroup("Web-Browser-Settings");
m_lastActiveSessionPath = settings.value("lastActiveSessionPath", defaultSessionPath()).toString();
settings.beginGroup(QSL("Web-Browser-Settings"));
m_lastActiveSessionPath = settings.value(QSL("lastActiveSessionPath"), defaultSessionPath()).toString();
settings.endGroup();
if (QDir::isRelativePath(m_lastActiveSessionPath)) {
@ -330,8 +330,8 @@ void SessionManager::saveSettings()
QDir sessionsDir(DataPaths::path(DataPaths::Sessions));
Settings settings;
settings.beginGroup("Web-Browser-Settings");
settings.setValue("lastActiveSessionPath", sessionsDir.relativeFilePath(m_lastActiveSessionPath));
settings.beginGroup(QSL("Web-Browser-Settings"));
settings.setValue(QSL("lastActiveSessionPath"), sessionsDir.relativeFilePath(m_lastActiveSessionPath));
settings.endGroup();
}

View File

@ -105,7 +105,7 @@ void BookmarksSidebar::createContextMenu(const QPoint &pos)
QAction* actNewPrivateWindow = menu.addAction(IconProvider::privateBrowsingIcon(), tr("Open in new private window"));
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()));

View File

@ -107,15 +107,15 @@ void SideBarManager::createMenu(QMenu* menu)
QAction* act = menu->addAction(SideBar::tr("Bookmarks"), this, &SideBarManager::slotShowSideBar);
act->setCheckable(true);
act->setShortcut(QKeySequence("Ctrl+Shift+B"));
act->setData("Bookmarks");
act->setShortcut(QKeySequence(QSL("Ctrl+Shift+B")));
act->setData(QSL("Bookmarks"));
act->setChecked(m_activeBar == QL1S("Bookmarks"));
group->addAction(act);
act = menu->addAction(SideBar::tr("History"), this, &SideBarManager::slotShowSideBar);
act->setCheckable(true);
act->setShortcut(QKeySequence("Ctrl+H"));
act->setData("History");
act->setShortcut(QKeySequence(QSL("Ctrl+H")));
act->setData(QSL("History"));
act->setChecked(m_activeBar == QL1S("History"));
group->addAction(act);

View File

@ -94,7 +94,7 @@ TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget)
, m_activeTabWidth(0)
, m_forceHidden(false)
{
setObjectName("tabbar");
setObjectName(QSL("tabbar"));
setElideMode(Qt::ElideRight);
setFocusPolicy(Qt::NoFocus);
setTabsClosable(false);
@ -126,10 +126,10 @@ TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget)
void TabBar::loadSettings()
{
Settings settings;
settings.beginGroup("Browser-Tabs-Settings");
m_hideTabBarWithOneTab = settings.value("hideTabsWithOneTab", false).toBool();
bool activateLastTab = settings.value("ActivateLastTabWhenClosingActual", false).toBool();
m_showCloseOnInactive = settings.value("showCloseOnInactiveTabs", 0).toInt(0);
settings.beginGroup(QSL("Browser-Tabs-Settings"));
m_hideTabBarWithOneTab = settings.value(QSL("hideTabsWithOneTab"), false).toBool();
bool activateLastTab = settings.value(QSL("ActivateLastTabWhenClosingActual"), false).toBool();
m_showCloseOnInactive = settings.value(QSL("showCloseOnInactiveTabs"), 0).toInt(0);
settings.endGroup();
setSelectionBehaviorOnRemove(activateLastTab ? QTabBar::SelectPreviousTab : QTabBar::SelectRightTab);

View File

@ -53,7 +53,7 @@ TabContextMenu::TabContextMenu(int index, BrowserWindow *window, Options options
static bool canCloseTabs(const QString &settingsKey, const QString &title, const QString &description)
{
Settings settings;
bool ask = settings.value("Browser-Tabs-Settings/" + settingsKey, true).toBool();
bool ask = settings.value(QSL("Browser-Tabs-Settings/") + settingsKey, true).toBool();
if (ask) {
CheckBoxDialog dialog(QMessageBox::Yes | QMessageBox::No, mApp->activeWindow());
@ -68,7 +68,7 @@ static bool canCloseTabs(const QString &settingsKey, const QString &title, const
}
if (dialog.isChecked()) {
settings.setValue("Browser-Tabs-Settings/" + settingsKey, false);
settings.setValue(QSL("Browser-Tabs-Settings/") + settingsKey, false);
}
}
@ -120,10 +120,10 @@ void TabContextMenu::init()
addAction(QIcon::fromTheme(QSL("view-refresh")), tr("&Reload Tab"), this, SLOT(reloadTab()));
}
addAction(QIcon::fromTheme("tab-duplicate"), tr("&Duplicate Tab"), this, SLOT(duplicateTab()));
addAction(QIcon::fromTheme(QSL("tab-duplicate")), tr("&Duplicate Tab"), this, SLOT(duplicateTab()));
if (m_options & ShowDetachTabAction && (mApp->windowCount() > 1 || tabWidget->count() > 1)) {
addAction(QIcon::fromTheme("tab-detach"), tr("D&etach Tab"), this, SLOT(detachTab()));
addAction(QIcon::fromTheme(QSL("tab-detach")), tr("D&etach Tab"), this, SLOT(detachTab()));
}
addAction(webTab->isPinned() ? tr("Un&pin Tab") : tr("&Pin Tab"), this, &TabContextMenu::pinTab);
@ -148,7 +148,7 @@ void TabContextMenu::init()
}
addAction(m_window->action(QSL("Other/RestoreClosedTab")));
addAction(QIcon::fromTheme("window-close"), tr("Cl&ose Tab"), this, &TabContextMenu::closeTab);
addAction(QIcon::fromTheme(QSL("window-close")), tr("Cl&ose Tab"), this, &TabContextMenu::closeTab);
} else {
addAction(IconProvider::newTabIcon(), tr("&New tab"), m_window, &BrowserWindow::addTab);
addSeparator();

View File

@ -157,15 +157,15 @@ BrowserWindow *TabWidget::browserWindow() const
void TabWidget::loadSettings()
{
Settings settings;
settings.beginGroup("Browser-Tabs-Settings");
m_dontCloseWithOneTab = settings.value("dontCloseWithOneTab", false).toBool();
m_showClosedTabsButton = settings.value("showClosedTabsButton", false).toBool();
m_newTabAfterActive = settings.value("newTabAfterActive", true).toBool();
m_newEmptyTabAfterActive = settings.value("newEmptyTabAfterActive", false).toBool();
settings.beginGroup(QSL("Browser-Tabs-Settings"));
m_dontCloseWithOneTab = settings.value(QSL("dontCloseWithOneTab"), false).toBool();
m_showClosedTabsButton = settings.value(QSL("showClosedTabsButton"), false).toBool();
m_newTabAfterActive = settings.value(QSL("newTabAfterActive"), true).toBool();
m_newEmptyTabAfterActive = settings.value(QSL("newEmptyTabAfterActive"), false).toBool();
settings.endGroup();
settings.beginGroup("Web-URL-Settings");
m_urlOnNewTab = settings.value("newTabUrl", "falkon:speeddial").toUrl();
settings.beginGroup(QSL("Web-URL-Settings"));
m_urlOnNewTab = settings.value(QSL("newTabUrl"), QSL("falkon:speeddial")).toUrl();
settings.endGroup();
m_tabBar->loadSettings();

View File

@ -323,15 +323,15 @@ CertificateInfoWidget::CertificateInfoWidget(const QSslCertificate &cert, QWidge
ui->issuedToCN->setText(showCertInfo(cert.subjectInfo(QSslCertificate::CommonName)));
ui->issuedToO->setText(showCertInfo(cert.subjectInfo(QSslCertificate::Organization)));
ui->issuedToOU->setText(showCertInfo(cert.subjectInfo(QSslCertificate::OrganizationalUnitName)));
ui->issuedToSN->setText(showCertInfo(cert.serialNumber()));
ui->issuedToSN->setText(showCertInfo(QString::fromLatin1(cert.serialNumber())));
//Issued By
ui->issuedByCN->setText(showCertInfo(cert.issuerInfo(QSslCertificate::CommonName)));
ui->issuedByO->setText(showCertInfo(cert.issuerInfo(QSslCertificate::Organization)));
ui->issuedByOU->setText(showCertInfo(cert.issuerInfo(QSslCertificate::OrganizationalUnitName)));
//Validity
QLocale locale = QLocale::system();
ui->validityIssuedOn->setText(locale.toString(cert.effectiveDate(), "dddd d. MMMM yyyy"));
ui->validityExpiresOn->setText(locale.toString(cert.expiryDate(), "dddd d. MMMM yyyy"));
ui->validityIssuedOn->setText(locale.toString(cert.effectiveDate(), QSL("dddd d. MMMM yyyy")));
ui->validityExpiresOn->setText(locale.toString(cert.expiryDate(), QSL("dddd d. MMMM yyyy")));
}
CertificateInfoWidget::~CertificateInfoWidget()

View File

@ -126,31 +126,31 @@ QWebEnginePage::Feature HTML5PermissionsDialog::currentFeature() const
void HTML5PermissionsDialog::loadSettings()
{
Settings settings;
settings.beginGroup("HTML5Notifications");
settings.beginGroup(QSL("HTML5Notifications"));
m_granted[QWebEnginePage::Notifications] = settings.value("NotificationsGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::Notifications] = settings.value("NotificationsDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::Notifications] = settings.value(QSL("NotificationsGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::Notifications] = settings.value(QSL("NotificationsDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::Geolocation] = settings.value("GeolocationGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::Geolocation] = settings.value("GeolocationDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::Geolocation] = settings.value(QSL("GeolocationGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::Geolocation] = settings.value(QSL("GeolocationDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::MediaAudioCapture] = settings.value("MediaAudioCaptureGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::MediaAudioCapture] = settings.value("MediaAudioCaptureDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::MediaAudioCapture] = settings.value(QSL("MediaAudioCaptureGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::MediaAudioCapture] = settings.value(QSL("MediaAudioCaptureDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::MediaVideoCapture] = settings.value("MediaVideoCaptureGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::MediaVideoCapture] = settings.value("MediaVideoCaptureDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::MediaVideoCapture] = settings.value(QSL("MediaVideoCaptureGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::MediaVideoCapture] = settings.value(QSL("MediaVideoCaptureDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::MediaAudioVideoCapture] = settings.value("MediaAudioVideoCaptureGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::MediaAudioVideoCapture] = settings.value("MediaAudioVideoCaptureDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::MediaAudioVideoCapture] = settings.value(QSL("MediaAudioVideoCaptureGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::MediaAudioVideoCapture] = settings.value(QSL("MediaAudioVideoCaptureDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::MouseLock] = settings.value("MouseLockGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::MouseLock] = settings.value("MouseLockDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::MouseLock] = settings.value(QSL("MouseLockGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::MouseLock] = settings.value(QSL("MouseLockDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::DesktopVideoCapture] = settings.value(QSL("DesktopVideoCaptureGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::DesktopVideoCapture] = settings.value(QSL("DesktopVideoCaptureDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::DesktopAudioVideoCapture] = settings.value(QSL("DesktopAudioVideoCaptureGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::DesktopAudioVideoCapture] = settings.value(QSL("DesktopAudioVideoCaptureDenied"), QStringList()).toStringList();
settings.endGroup();
}
@ -158,31 +158,31 @@ void HTML5PermissionsDialog::loadSettings()
void HTML5PermissionsDialog::saveSettings()
{
Settings settings;
settings.beginGroup("HTML5Notifications");
settings.beginGroup(QSL("HTML5Notifications"));
settings.setValue("NotificationsGranted", m_granted[QWebEnginePage::Notifications]);
settings.setValue("NotificationsDenied", m_denied[QWebEnginePage::Notifications]);
settings.setValue(QSL("NotificationsGranted"), m_granted[QWebEnginePage::Notifications]);
settings.setValue(QSL("NotificationsDenied"), m_denied[QWebEnginePage::Notifications]);
settings.setValue("GeolocationGranted", m_granted[QWebEnginePage::Geolocation]);
settings.setValue("GeolocationDenied", m_denied[QWebEnginePage::Geolocation]);
settings.setValue(QSL("GeolocationGranted"), m_granted[QWebEnginePage::Geolocation]);
settings.setValue(QSL("GeolocationDenied"), m_denied[QWebEnginePage::Geolocation]);
settings.setValue("MediaAudioCaptureGranted", m_granted[QWebEnginePage::MediaAudioCapture]);
settings.setValue("MediaAudioCaptureDenied", m_denied[QWebEnginePage::MediaAudioCapture]);
settings.setValue(QSL("MediaAudioCaptureGranted"), m_granted[QWebEnginePage::MediaAudioCapture]);
settings.setValue(QSL("MediaAudioCaptureDenied"), m_denied[QWebEnginePage::MediaAudioCapture]);
settings.setValue("MediaVideoCaptureGranted", m_granted[QWebEnginePage::MediaVideoCapture]);
settings.setValue("MediaVideoCaptureDenied", m_denied[QWebEnginePage::MediaVideoCapture]);
settings.setValue(QSL("MediaVideoCaptureGranted"), m_granted[QWebEnginePage::MediaVideoCapture]);
settings.setValue(QSL("MediaVideoCaptureDenied"), m_denied[QWebEnginePage::MediaVideoCapture]);
settings.setValue("MediaAudioVideoCaptureGranted", m_granted[QWebEnginePage::MediaAudioVideoCapture]);
settings.setValue("MediaAudioVideoCaptureDenied", m_denied[QWebEnginePage::MediaAudioVideoCapture]);
settings.setValue(QSL("MediaAudioVideoCaptureGranted"), m_granted[QWebEnginePage::MediaAudioVideoCapture]);
settings.setValue(QSL("MediaAudioVideoCaptureDenied"), m_denied[QWebEnginePage::MediaAudioVideoCapture]);
settings.setValue("MouseLockGranted", m_granted[QWebEnginePage::MouseLock]);
settings.setValue("MouseLockDenied", m_denied[QWebEnginePage::MouseLock]);
settings.setValue(QSL("MouseLockGranted"), m_granted[QWebEnginePage::MouseLock]);
settings.setValue(QSL("MouseLockDenied"), m_denied[QWebEnginePage::MouseLock]);
settings.setValue("DesktopVideoCaptureGranted", m_granted[QWebEnginePage::DesktopVideoCapture]);
settings.setValue("DesktopVideoCaptureDenied", m_denied[QWebEnginePage::DesktopVideoCapture]);
settings.setValue(QSL("DesktopVideoCaptureGranted"), m_granted[QWebEnginePage::DesktopVideoCapture]);
settings.setValue(QSL("DesktopVideoCaptureDenied"), m_denied[QWebEnginePage::DesktopVideoCapture]);
settings.setValue("DesktopAudioVideoCaptureGranted", m_granted[QWebEnginePage::DesktopAudioVideoCapture]);
settings.setValue("DesktopAudioVideoCaptureDenied", m_denied[QWebEnginePage::DesktopAudioVideoCapture]);
settings.setValue(QSL("DesktopAudioVideoCaptureGranted"), m_granted[QWebEnginePage::DesktopAudioVideoCapture]);
settings.setValue(QSL("DesktopAudioVideoCaptureDenied"), m_denied[QWebEnginePage::DesktopAudioVideoCapture]);
settings.endGroup();

View File

@ -77,31 +77,31 @@ void HTML5PermissionsManager::rememberPermissions(const QUrl &origin, const QWeb
void HTML5PermissionsManager::loadSettings()
{
Settings settings;
settings.beginGroup("HTML5Notifications");
settings.beginGroup(QSL("HTML5Notifications"));
m_granted[QWebEnginePage::Notifications] = settings.value("NotificationsGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::Notifications] = settings.value("NotificationsDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::Notifications] = settings.value(QSL("NotificationsGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::Notifications] = settings.value(QSL("NotificationsDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::Geolocation] = settings.value("GeolocationGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::Geolocation] = settings.value("GeolocationDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::Geolocation] = settings.value(QSL("GeolocationGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::Geolocation] = settings.value(QSL("GeolocationDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::MediaAudioCapture] = settings.value("MediaAudioCaptureGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::MediaAudioCapture] = settings.value("MediaAudioCaptureDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::MediaAudioCapture] = settings.value(QSL("MediaAudioCaptureGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::MediaAudioCapture] = settings.value(QSL("MediaAudioCaptureDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::MediaVideoCapture] = settings.value("MediaVideoCaptureGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::MediaVideoCapture] = settings.value("MediaVideoCaptureDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::MediaVideoCapture] = settings.value(QSL("MediaVideoCaptureGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::MediaVideoCapture] = settings.value(QSL("MediaVideoCaptureDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::MediaAudioVideoCapture] = settings.value("MediaAudioVideoCaptureGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::MediaAudioVideoCapture] = settings.value("MediaAudioVideoCaptureDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::MediaAudioVideoCapture] = settings.value(QSL("MediaAudioVideoCaptureGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::MediaAudioVideoCapture] = settings.value(QSL("MediaAudioVideoCaptureDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::MouseLock] = settings.value("MouseLockGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::MouseLock] = settings.value("MouseLockDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::MouseLock] = settings.value(QSL("MouseLockGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::MouseLock] = settings.value(QSL("MouseLockDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::DesktopVideoCapture] = settings.value(QSL("DesktopVideoCaptureGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::DesktopVideoCapture] = settings.value(QSL("DesktopVideoCaptureDenied"), QStringList()).toStringList();
m_granted[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureGranted", QStringList()).toStringList();
m_denied[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureDenied", QStringList()).toStringList();
m_granted[QWebEnginePage::DesktopAudioVideoCapture] = settings.value(QSL("DesktopAudioVideoCaptureGranted"), QStringList()).toStringList();
m_denied[QWebEnginePage::DesktopAudioVideoCapture] = settings.value(QSL("DesktopAudioVideoCaptureDenied"), QStringList()).toStringList();
settings.endGroup();
}
@ -109,31 +109,31 @@ void HTML5PermissionsManager::loadSettings()
void HTML5PermissionsManager::saveSettings()
{
Settings settings;
settings.beginGroup("HTML5Notifications");
settings.beginGroup(QSL("HTML5Notifications"));
settings.setValue("NotificationsGranted", m_granted[QWebEnginePage::Notifications]);
settings.setValue("NotificationsDenied", m_denied[QWebEnginePage::Notifications]);
settings.setValue(QSL("NotificationsGranted"), m_granted[QWebEnginePage::Notifications]);
settings.setValue(QSL("NotificationsDenied"), m_denied[QWebEnginePage::Notifications]);
settings.setValue("GeolocationGranted", m_granted[QWebEnginePage::Geolocation]);
settings.setValue("GeolocationDenied", m_denied[QWebEnginePage::Geolocation]);
settings.setValue(QSL("GeolocationGranted"), m_granted[QWebEnginePage::Geolocation]);
settings.setValue(QSL("GeolocationDenied"), m_denied[QWebEnginePage::Geolocation]);
settings.setValue("MediaAudioCaptureGranted", m_granted[QWebEnginePage::MediaAudioCapture]);
settings.setValue("MediaAudioCaptureDenied", m_denied[QWebEnginePage::MediaAudioCapture]);
settings.setValue(QSL("MediaAudioCaptureGranted"), m_granted[QWebEnginePage::MediaAudioCapture]);
settings.setValue(QSL("MediaAudioCaptureDenied"), m_denied[QWebEnginePage::MediaAudioCapture]);
settings.setValue("MediaVideoCaptureGranted", m_granted[QWebEnginePage::MediaVideoCapture]);
settings.setValue("MediaVideoCaptureDenied", m_denied[QWebEnginePage::MediaVideoCapture]);
settings.setValue(QSL("MediaVideoCaptureGranted"), m_granted[QWebEnginePage::MediaVideoCapture]);
settings.setValue(QSL("MediaVideoCaptureDenied"), m_denied[QWebEnginePage::MediaVideoCapture]);
settings.setValue("MediaAudioVideoCaptureGranted", m_granted[QWebEnginePage::MediaAudioVideoCapture]);
settings.setValue("MediaAudioVideoCaptureDenied", m_denied[QWebEnginePage::MediaAudioVideoCapture]);
settings.setValue(QSL("MediaAudioVideoCaptureGranted"), m_granted[QWebEnginePage::MediaAudioVideoCapture]);
settings.setValue(QSL("MediaAudioVideoCaptureDenied"), m_denied[QWebEnginePage::MediaAudioVideoCapture]);
settings.setValue("MouseLockGranted", m_granted[QWebEnginePage::MouseLock]);
settings.setValue("MouseLockDenied", m_denied[QWebEnginePage::MouseLock]);
settings.setValue(QSL("MouseLockGranted"), m_granted[QWebEnginePage::MouseLock]);
settings.setValue(QSL("MouseLockDenied"), m_denied[QWebEnginePage::MouseLock]);
settings.setValue("DesktopVideoCaptureGranted", m_granted[QWebEnginePage::DesktopVideoCapture]);
settings.setValue("DesktopVideoCaptureDenied", m_denied[QWebEnginePage::DesktopVideoCapture]);
settings.setValue(QSL("DesktopVideoCaptureGranted"), m_granted[QWebEnginePage::DesktopVideoCapture]);
settings.setValue(QSL("DesktopVideoCaptureDenied"), m_denied[QWebEnginePage::DesktopVideoCapture]);
settings.setValue("DesktopAudioVideoCaptureGranted", m_granted[QWebEnginePage::DesktopAudioVideoCapture]);
settings.setValue("DesktopAudioVideoCaptureDenied", m_denied[QWebEnginePage::DesktopAudioVideoCapture]);
settings.setValue(QSL("DesktopAudioVideoCaptureGranted"), m_granted[QWebEnginePage::DesktopAudioVideoCapture]);
settings.setValue(QSL("DesktopAudioVideoCaptureDenied"), m_denied[QWebEnginePage::DesktopAudioVideoCapture]);
settings.endGroup();
}

View File

@ -39,7 +39,7 @@ HTML5PermissionsNotification::HTML5PermissionsNotification(const QUrl &origin, Q
ui->close->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton));
const QString site = m_origin.host().isEmpty() ? tr("this site") : QString("<b>%1</b>").arg(m_origin.host());
const QString site = m_origin.host().isEmpty() ? tr("this site") : QSL("<b>%1</b>").arg(m_origin.host());
switch (feature) {
case QWebEnginePage::Notifications:

View File

@ -204,7 +204,7 @@ QImage IconProvider::imageForUrl(const QUrl &url, bool allowNull)
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare(QSL("SELECT icon FROM icons WHERE url GLOB ? LIMIT 1"));
query.addBindValue(QString("%1*").arg(QzTools::escapeSqlGlobString(QString::fromUtf8(encodedUrl))));
query.addBindValue(QSL("%1*").arg(QzTools::escapeSqlGlobString(QString::fromUtf8(encodedUrl))));
query.exec();
auto *img = new QImage;
@ -238,7 +238,7 @@ QImage IconProvider::imageForDomain(const QUrl &url, bool allowNull)
QSqlQuery query(SqlDatabase::instance()->database());
query.prepare(QSL("SELECT icon FROM icons WHERE url GLOB ? LIMIT 1"));
query.addBindValue(QString("*%1*").arg(QzTools::escapeSqlGlobString(url.host())));
query.addBindValue(QSL("*%1*").arg(QzTools::escapeSqlGlobString(url.host())));
query.exec();
if (query.next()) {

View File

@ -81,7 +81,7 @@ QPixmap QzTools::pixmapFromByteArray(const QByteArray &data)
QUrl QzTools::pixmapToDataUrl(const QPixmap &pix)
{
const QString data(pixmapToByteArray(pix));
const QString data(QString::fromLatin1(pixmapToByteArray(pix)));
return data.isEmpty() ? QUrl() : QUrl(QSL("data:image/png;base64,") + data);
}
@ -325,8 +325,8 @@ QString QzTools::filterCharsFromFilename(const QString &name)
QString QzTools::lastPathForFileDialog(const QString &dialogName, const QString &fallbackPath)
{
Settings settings;
settings.beginGroup("LastFileDialogsPaths");
QString path = settings.value("FileDialogs/" + dialogName).toString();
settings.beginGroup(QSL("LastFileDialogsPaths"));
QString path = settings.value(QSL("FileDialogs/") + dialogName).toString();
settings.endGroup();
return path.isEmpty() ? fallbackPath : path;
@ -339,7 +339,7 @@ void QzTools::saveLastPathForFileDialog(const QString &dialogName, const QString
}
Settings settings;
settings.beginGroup("LastFileDialogsPaths");
settings.beginGroup(QSL("LastFileDialogsPaths"));
settings.setValue(dialogName, path);
settings.endGroup();
}
@ -498,7 +498,7 @@ QIcon QzTools::iconFromFileName(const QString &fileName)
}
QFileIconProvider iconProvider;
QTemporaryFile tempFile(DataPaths::path(DataPaths::Temp) + "/XXXXXX." + tempInfo.suffix());
QTemporaryFile tempFile(DataPaths::path(DataPaths::Temp) + QSL("/XXXXXX.") + tempInfo.suffix());
tempFile.open();
tempInfo.setFile(tempFile.fileName());
@ -510,7 +510,7 @@ QIcon QzTools::iconFromFileName(const QString &fileName)
QString QzTools::resolveFromPath(const QString &name)
{
const QString path = qgetenv("PATH").trimmed();
const QString path = QString::fromUtf8(qgetenv("PATH").trimmed());
if (path.isEmpty()) {
return {};
@ -620,7 +620,7 @@ bool QzTools::containsSpace(const QString &str)
QString QzTools::getExistingDirectory(const QString &name, QWidget* parent, const QString &caption, const QString &dir, QFileDialog::Options options)
{
Settings settings;
settings.beginGroup("FileDialogPaths");
settings.beginGroup(QSL("FileDialogPaths"));
QString lastDir = settings.value(name, dir).toString();
@ -656,7 +656,7 @@ static QString getFilename(const QString &path)
QString QzTools::getOpenFileName(const QString &name, QWidget* parent, const QString &caption, const QString &dir, const QString &filter, QString* selectedFilter, QFileDialog::Options options)
{
Settings settings;
settings.beginGroup("FileDialogPaths");
settings.beginGroup(QSL("FileDialogPaths"));
QString lastDir = settings.value(name, QString()).toString();
QString fileName = getFilename(dir);
@ -681,7 +681,7 @@ QString QzTools::getOpenFileName(const QString &name, QWidget* parent, const QSt
QStringList QzTools::getOpenFileNames(const QString &name, QWidget* parent, const QString &caption, const QString &dir, const QString &filter, QString* selectedFilter, QFileDialog::Options options)
{
Settings settings;
settings.beginGroup("FileDialogPaths");
settings.beginGroup(QSL("FileDialogPaths"));
QString lastDir = settings.value(name, QString()).toString();
QString fileName = getFilename(dir);
@ -706,7 +706,7 @@ QStringList QzTools::getOpenFileNames(const QString &name, QWidget* parent, cons
QString QzTools::getSaveFileName(const QString &name, QWidget* parent, const QString &caption, const QString &dir, const QString &filter, QString* selectedFilter, QFileDialog::Options options)
{
Settings settings;
settings.beginGroup("FileDialogPaths");
settings.beginGroup(QSL("FileDialogPaths"));
QString lastDir = settings.value(name, QString()).toString();
QString fileName = getFilename(dir);
@ -770,10 +770,10 @@ QStringList QzTools::splitCommandArguments(const QString &command)
return {};
}
QChar SPACE(' ');
QChar EQUAL('=');
QChar BSLASH('\\');
QChar QUOTE('"');
QChar SPACE(QL1C(' '));
QChar EQUAL(QL1C('='));
QChar BSLASH(QL1C('\\'));
QChar QUOTE(QL1C('"'));
QStringList r;
int equalPos = -1; // Position of = in opt="value"
@ -847,7 +847,7 @@ bool QzTools::startExternalProcess(const QString &executable, const QString &arg
bool success = QProcess::startDetached(executable, arguments);
if (!success) {
QString info = "<ul><li><b>%1</b>%2</li><li><b>%3</b>%4</li></ul>";
QString info = QSL("<ul><li><b>%1</b>%2</li><li><b>%3</b>%4</li></ul>");
info = info.arg(QObject::tr("Executable: "), executable,
QObject::tr("Arguments: "), arguments.join(QLatin1Char(' ')));
@ -901,99 +901,99 @@ void QzTools::setWmClass(const QString &name, const QWidget* widget)
QString QzTools::operatingSystem()
{
#ifdef Q_OS_MACOS
QString str = "Mac OS X";
QString str = QSL("Mac OS X");
SInt32 majorVersion;
SInt32 minorVersion;
if (Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr && Gestalt(gestaltSystemVersionMinor, &minorVersion) == noErr) {
str.append(QString(" %1.%2").arg(majorVersion).arg(minorVersion));
str.append(QSL(" %1.%2").arg(majorVersion).arg(minorVersion));
}
return str;
#endif
#ifdef Q_OS_LINUX
return "Linux";
return QSL("Linux");
#endif
#ifdef Q_OS_BSD4
return "BSD 4.4";
return QSL("BSD 4.4");
#endif
#ifdef Q_OS_BSDI
return "BSD/OS";
return QSL("BSD/OS");
#endif
#ifdef Q_OS_FREEBSD
return "FreeBSD";
return QSL("FreeBSD");
#endif
#ifdef Q_OS_HPUX
return "HP-UX";
return QSL("HP-UX");
#endif
#ifdef Q_OS_HURD
return "GNU Hurd";
return QSL("GNU Hurd");
#endif
#ifdef Q_OS_LYNX
return "LynxOS";
return QSL("LynxOS");
#endif
#ifdef Q_OS_NETBSD
return "NetBSD";
return QSL("NetBSD");
#endif
#ifdef Q_OS_OS2
return "OS/2";
return QSL("OS/2");
#endif
#ifdef Q_OS_OPENBSD
return "OpenBSD";
return QSL("OpenBSD");
#endif
#ifdef Q_OS_OSF
return "HP Tru64 UNIX";
return QSL("HP Tru64 UNIX");
#endif
#ifdef Q_OS_SOLARIS
return "Sun Solaris";
return QSL("Sun Solaris");
#endif
#ifdef Q_OS_UNIXWARE
return "UnixWare 7 / Open UNIX 8";
return QSL("UnixWare 7 / Open UNIX 8");
#endif
#ifdef Q_OS_UNIX
return "Unix";
return QSL("Unix");
#endif
#ifdef Q_OS_HAIKU
return "Haiku";
return QSL("Haiku");
#endif
#ifdef Q_OS_WIN32
QString str = "Windows";
QString str = QSL("Windows");
switch (QSysInfo::windowsVersion()) {
case QSysInfo::WV_NT:
str.append(" NT");
str.append(QSL(" NT"));
break;
case QSysInfo::WV_2000:
str.append(" 2000");
str.append(QSL(" 2000"));
break;
case QSysInfo::WV_XP:
str.append(" XP");
str.append(QSL(" XP"));
break;
case QSysInfo::WV_2003:
str.append(" XP Pro x64");
str.append(QSL(" XP Pro x64"));
break;
case QSysInfo::WV_VISTA:
str.append(" Vista");
str.append(QSL(" Vista"));
break;
case QSysInfo::WV_WINDOWS7:
str.append(" 7");
str.append(QSL(" 7"));
break;
case QSysInfo::WV_WINDOWS8:
str.append(" 8");
str.append(QSL(" 8"));
break;
case QSysInfo::WV_WINDOWS8_1:
str.append(" 8.1");
str.append(QSL(" 8.1"));
break;
case QSysInfo::WV_WINDOWS10:
str.append(" 10");
str.append(QSL(" 10"));
break;
default:

View File

@ -232,7 +232,7 @@ QString Scripts::sendPostData(const QUrl &url, const QByteArray &data)
"form.appendChild(val);");
QString values;
QUrlQuery query(data);
QUrlQuery query(QString::fromUtf8(data));
const auto &queryItems = query.queryItems(QUrl::FullyDecoded);
for (int i = 0; i < queryItems.size(); ++i) {
@ -273,7 +273,7 @@ QString Scripts::completeFormData(const QByteArray &data)
""
"})()");
QString d = data;
QString d = QString::fromUtf8(data);
d.replace(QL1S("'"), QL1S("\\'"));
return source.arg(d);
}

View File

@ -328,7 +328,7 @@ void WebPage::handleUnknownProtocol(const QUrl &url)
CheckBoxDialog dialog(QMessageBox::Yes | QMessageBox::No, view());
dialog.setDefaultButton(QMessageBox::Yes);
const QString wrappedUrl = QzTools::alignTextToWidth(url.toString(), "<br/>", dialog.fontMetrics(), 450);
const QString wrappedUrl = QzTools::alignTextToWidth(url.toString(), QSL("<br/>"), dialog.fontMetrics(), 450);
const QString text = tr("Falkon cannot handle <b>%1:</b> links. The requested link "
"is <ul><li>%2</li></ul>Do you want Falkon to try "
"open this link in system application?").arg(protocol, wrappedUrl);
@ -413,7 +413,7 @@ void WebPage::renderProcessTerminated(QWebEnginePage::RenderProcessTerminationSt
return;
QTimer::singleShot(0, this, [this]() {
QString page = QzTools::readAllFileContents(":html/tabcrash.html");
QString page = QzTools::readAllFileContents(QSL(":html/tabcrash.html"));
page.replace(QL1S("%IMAGE%"), QzTools::pixmapToDataUrl(IconProvider::standardIcon(QStyle::SP_MessageBoxWarning).pixmap(45)).toString());
page.replace(QL1S("%TITLE%"), tr("Failed loading page"));
page.replace(QL1S("%HEADING%"), tr("Failed loading page"));
@ -421,7 +421,7 @@ void WebPage::renderProcessTerminated(QWebEnginePage::RenderProcessTerminationSt
page.replace(QL1S("%LI-2%"), tr("Try reloading the page or closing some tabs to make more memory available."));
page.replace(QL1S("%RELOAD-PAGE%"), tr("Reload page"));
page = QzTools::applyDirectionToPage(page);
setHtml(page.toUtf8(), url());
setHtml(page, url());
});
}
@ -480,11 +480,11 @@ QStringList WebPage::chooseFiles(QWebEnginePage::FileSelectionMode mode, const Q
switch (mode) {
case FileSelectOpen:
files = QStringList(QzTools::getOpenFileName("WebPage-ChooseFile", view(), tr("Choose file..."), suggestedFileName));
files = QStringList(QzTools::getOpenFileName(QSL("WebPage-ChooseFile"), view(), tr("Choose file..."), suggestedFileName));
break;
case FileSelectOpenMultiple:
files = QzTools::getOpenFileNames("WebPage-ChooseFile", view(), tr("Choose files..."), suggestedFileName);
files = QzTools::getOpenFileNames(QSL("WebPage-ChooseFile"), view(), tr("Choose files..."), suggestedFileName);
break;
default:
@ -622,7 +622,7 @@ void WebPage::javaScriptAlert(const QUrl &securityOrigin, const QString &msg)
if (!kEnableJsNonBlockDialogs) {
QString title = tr("JavaScript alert");
if (!url().host().isEmpty()) {
title.append(QString(" - %1").arg(url().host()));
title.append(QSL(" - %1").arg(url().host()));
}
CheckBoxDialog dialog(QMessageBox::Ok, view());

View File

@ -387,7 +387,7 @@ void WebView::printPage()
Q_ASSERT(m_page);
auto *printer = new QPrinter();
printer->setCreator(tr("Falkon %1 (%2)").arg(Qz::VERSION, Qz::WWWADDRESS));
printer->setCreator(tr("Falkon %1 (%2)").arg(QString::fromLatin1(Qz::VERSION), QString::fromLatin1(Qz::WWWADDRESS)));
printer->setDocName(QzTools::filterCharsFromFilename(title()));
auto *dialog = new QPrintDialog(printer, this);
@ -482,14 +482,14 @@ void WebView::sendTextByMail()
void WebView::sendPageByMail()
{
const QUrl mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(url().toEncoded()) + "&subject=" + QUrl::toPercentEncoding(title()));
const QUrl mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(QString::fromUtf8(url().toEncoded())) + "&subject=" + QUrl::toPercentEncoding(title()));
QDesktopServices::openUrl(mailUrl);
}
void WebView::copyLinkToClipboard()
{
if (auto* action = qobject_cast<QAction*>(sender())) {
QApplication::clipboard()->setText(action->data().toUrl().toEncoded());
QApplication::clipboard()->setText(QString::fromUtf8(action->data().toUrl().toEncoded()));
}
}
@ -753,7 +753,7 @@ void WebView::createPageContextMenu(QMenu* menu)
// Special menu for Speed Dial page
if (url().toString() == QL1S("falkon:speeddial")) {
menu->addSeparator();
menu->addAction(QIcon::fromTheme("list-add"), tr("&Add New Page"), this, &WebView::addSpeedDial);
menu->addAction(QIcon::fromTheme(QSL("list-add")), tr("&Add New Page"), this, &WebView::addSpeedDial);
menu->addAction(IconProvider::settingsIcon(), tr("&Configure Speed Dial"), this, &WebView::configureSpeedDial);
menu->addSeparator();
menu->addAction(QIcon::fromTheme(QSL("view-refresh")), tr("Reload All Dials"), this, &WebView::reloadAllSpeedDials);
@ -775,22 +775,22 @@ void WebView::createPageContextMenu(QMenu* menu)
});
menu->addSeparator();
menu->addAction(QIcon::fromTheme("bookmark-new"), tr("Book&mark page"), this, &WebView::bookmarkLink);
menu->addAction(QIcon::fromTheme("document-save"), tr("&Save page as..."), this, &WebView::savePageAs);
menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy page link"), this, &WebView::copyLinkToClipboard)->setData(url());
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send page link..."), this, &WebView::sendPageByMail);
menu->addAction(QIcon::fromTheme(QSL("bookmark-new")), tr("Book&mark page"), this, &WebView::bookmarkLink);
menu->addAction(QIcon::fromTheme(QSL("document-save")), tr("&Save page as..."), this, &WebView::savePageAs);
menu->addAction(QIcon::fromTheme(QSL("edit-copy")), tr("&Copy page link"), this, &WebView::copyLinkToClipboard)->setData(url());
menu->addAction(QIcon::fromTheme(QSL("mail-message-new")), tr("Send page link..."), this, &WebView::sendPageByMail);
menu->addSeparator();
menu->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &all"), this, &WebView::editSelectAll);
menu->addAction(QIcon::fromTheme(QSL("edit-select-all")), tr("Select &all"), this, &WebView::editSelectAll);
menu->addSeparator();
const QString scheme = url().scheme();
if (scheme != QL1S("view-source") && WebPage::internalSchemes().contains(scheme)) {
menu->addAction(QIcon::fromTheme("text-html"), tr("Show so&urce code"), this, &WebView::showSource);
menu->addAction(QIcon::fromTheme(QSL("text-html")), tr("Show so&urce code"), this, &WebView::showSource);
}
if (SiteInfo::canShowSiteInfo(url()))
menu->addAction(QIcon::fromTheme("dialog-information"), tr("Show info ab&out site"), this, &WebView::showSiteInfo);
menu->addAction(QIcon::fromTheme(QSL("dialog-information")), tr("Show info ab&out site"), this, &WebView::showSiteInfo);
}
void WebView::createLinkContextMenu(QMenu* menu, const WebHitTestResult &hitTest)
@ -807,15 +807,15 @@ void WebView::createLinkContextMenu(QMenu* menu, const WebHitTestResult &hitTest
QVariantList bData;
bData << hitTest.linkUrl() << hitTest.linkTitle();
menu->addAction(QIcon::fromTheme("bookmark-new"), tr("B&ookmark link"), this, &WebView::bookmarkLink)->setData(bData);
menu->addAction(QIcon::fromTheme(QSL("bookmark-new")), tr("B&ookmark link"), this, &WebView::bookmarkLink)->setData(bData);
menu->addAction(QIcon::fromTheme("document-save"), tr("&Save link as..."), this, &WebView::downloadLinkToDisk);
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send link..."), this, &WebView::sendTextByMail)->setData(hitTest.linkUrl().toEncoded());
menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy link address"), this, &WebView::copyLinkToClipboard)->setData(hitTest.linkUrl());
menu->addAction(QIcon::fromTheme(QSL("document-save")), tr("&Save link as..."), this, &WebView::downloadLinkToDisk);
menu->addAction(QIcon::fromTheme(QSL("mail-message-new")), tr("Send link..."), this, &WebView::sendTextByMail)->setData(hitTest.linkUrl().toEncoded());
menu->addAction(QIcon::fromTheme(QSL("edit-copy")), tr("&Copy link address"), this, &WebView::copyLinkToClipboard)->setData(hitTest.linkUrl());
menu->addSeparator();
if (!selectedText().isEmpty()) {
pageAction(QWebEnginePage::Copy)->setIcon(QIcon::fromTheme("edit-copy"));
pageAction(QWebEnginePage::Copy)->setIcon(QIcon::fromTheme(QSL("edit-copy")));
menu->addAction(pageAction(QWebEnginePage::Copy));
}
}
@ -831,14 +831,14 @@ void WebView::createImageContextMenu(QMenu* menu, const WebHitTestResult &hitTes
menu->addAction(act);
}
menu->addAction(tr("Copy image"), this, &WebView::copyImageToClipboard);
menu->addAction(QIcon::fromTheme("edit-copy"), tr("Copy image ad&dress"), this, &WebView::copyLinkToClipboard)->setData(hitTest.imageUrl());
menu->addAction(QIcon::fromTheme(QSL("edit-copy")), tr("Copy image ad&dress"), this, &WebView::copyLinkToClipboard)->setData(hitTest.imageUrl());
menu->addSeparator();
menu->addAction(QIcon::fromTheme("document-save"), tr("&Save image as..."), this, &WebView::downloadImageToDisk);
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send image..."), this, &WebView::sendTextByMail)->setData(hitTest.imageUrl().toEncoded());
menu->addAction(QIcon::fromTheme(QSL("document-save")), tr("&Save image as..."), this, &WebView::downloadImageToDisk);
menu->addAction(QIcon::fromTheme(QSL("mail-message-new")), tr("Send image..."), this, &WebView::sendTextByMail)->setData(hitTest.imageUrl().toEncoded());
menu->addSeparator();
if (!selectedText().isEmpty()) {
pageAction(QWebEnginePage::Copy)->setIcon(QIcon::fromTheme("edit-copy"));
pageAction(QWebEnginePage::Copy)->setIcon(QIcon::fromTheme(QSL("edit-copy")));
menu->addAction(pageAction(QWebEnginePage::Copy));
}
}
@ -853,7 +853,7 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const WebHitTestResult
if (!menu->actions().contains(pageAction(QWebEnginePage::Copy))) {
menu->addAction(pageAction(QWebEnginePage::Copy));
}
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send text..."), this, &WebView::sendTextByMail)->setData(selectedText);
menu->addAction(QIcon::fromTheme(QSL("mail-message-new")), tr("Send text..."), this, &WebView::sendTextByMail)->setData(selectedText);
menu->addSeparator();
// #379: Remove newlines
@ -865,7 +865,7 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const WebHitTestResult
QUrl guessedUrl = QUrl::fromUserInput(selectedString);
if (isUrlValid(guessedUrl)) {
auto* act = new Action(QIcon::fromTheme("document-open-remote"), tr("Go to &web address"));
auto* act = new Action(QIcon::fromTheme(QSL("document-open-remote")), tr("Go to &web address"));
act->setData(guessedUrl);
connect(act, &QAction::triggered, this, &WebView::openActionUrl);
@ -907,12 +907,12 @@ void WebView::createMediaContextMenu(QMenu *menu, const WebHitTestResult &hitTes
bool muted = hitTest.mediaMuted();
menu->addSeparator();
menu->addAction(paused ? tr("&Play") : tr("&Pause"), this, &WebView::toggleMediaPause)->setIcon(QIcon::fromTheme(paused ? "media-playback-start" : "media-playback-pause"));
menu->addAction(muted ? tr("Un&mute") : tr("&Mute"), this, &WebView::toggleMediaMute)->setIcon(QIcon::fromTheme(muted ? "audio-volume-muted" : "audio-volume-high"));
menu->addAction(paused ? tr("&Play") : tr("&Pause"), this, &WebView::toggleMediaPause)->setIcon(QIcon::fromTheme(paused ? QSL("media-playback-start") : QSL("media-playback-pause")));
menu->addAction(muted ? tr("Un&mute") : tr("&Mute"), this, &WebView::toggleMediaMute)->setIcon(QIcon::fromTheme(muted ? QSL("audio-volume-muted") : QSL("audio-volume-high")));
menu->addSeparator();
menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy Media Address"), this, &WebView::copyLinkToClipboard)->setData(hitTest.mediaUrl());
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("&Send Media Address"), this, &WebView::sendTextByMail)->setData(hitTest.mediaUrl().toEncoded());
menu->addAction(QIcon::fromTheme("document-save"), tr("Save Media To &Disk"), this, &WebView::downloadMediaToDisk);
menu->addAction(QIcon::fromTheme(QSL("edit-copy")), tr("&Copy Media Address"), this, &WebView::copyLinkToClipboard)->setData(hitTest.mediaUrl());
menu->addAction(QIcon::fromTheme(QSL("mail-message-new")), tr("&Send Media Address"), this, &WebView::sendTextByMail)->setData(hitTest.mediaUrl().toEncoded());
menu->addAction(QIcon::fromTheme(QSL("document-save")), tr("Save Media To &Disk"), this, &WebView::downloadMediaToDisk);
}
void WebView::checkForForm(QAction *action, const QPoint &pos)
@ -946,17 +946,17 @@ void WebView::createSearchEngine()
void WebView::addSpeedDial()
{
page()->runJavaScript("addSpeedDial()", WebPage::SafeJsWorld);
page()->runJavaScript(QSL("addSpeedDial()"), WebPage::SafeJsWorld);
}
void WebView::configureSpeedDial()
{
page()->runJavaScript("configureSpeedDial()", WebPage::SafeJsWorld);
page()->runJavaScript(QSL("configureSpeedDial()"), WebPage::SafeJsWorld);
}
void WebView::reloadAllSpeedDials()
{
page()->runJavaScript("reloadAll()", WebPage::SafeJsWorld);
page()->runJavaScript(QSL("reloadAll()"), WebPage::SafeJsWorld);
}
void WebView::toggleMediaPause()
@ -973,37 +973,37 @@ void WebView::initializeActions()
{
QAction* undoAction = pageAction(QWebEnginePage::Undo);
undoAction->setText(tr("&Undo"));
undoAction->setShortcut(QKeySequence("Ctrl+Z"));
undoAction->setShortcut(QKeySequence(QSL("Ctrl+Z")));
undoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
undoAction->setIcon(QIcon::fromTheme(QSL("edit-undo")));
QAction* redoAction = pageAction(QWebEnginePage::Redo);
redoAction->setText(tr("&Redo"));
redoAction->setShortcut(QKeySequence("Ctrl+Shift+Z"));
redoAction->setShortcut(QKeySequence(QSL("Ctrl+Shift+Z")));
redoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
redoAction->setIcon(QIcon::fromTheme(QSL("edit-redo")));
QAction* cutAction = pageAction(QWebEnginePage::Cut);
cutAction->setText(tr("&Cut"));
cutAction->setShortcut(QKeySequence("Ctrl+X"));
cutAction->setShortcut(QKeySequence(QSL("Ctrl+X")));
cutAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
cutAction->setIcon(QIcon::fromTheme(QSL("edit-cut")));
QAction* copyAction = pageAction(QWebEnginePage::Copy);
copyAction->setText(tr("&Copy"));
copyAction->setShortcut(QKeySequence("Ctrl+C"));
copyAction->setShortcut(QKeySequence(QSL("Ctrl+C")));
copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
copyAction->setIcon(QIcon::fromTheme(QSL("edit-copy")));
QAction* pasteAction = pageAction(QWebEnginePage::Paste);
pasteAction->setText(tr("&Paste"));
pasteAction->setShortcut(QKeySequence("Ctrl+V"));
pasteAction->setShortcut(QKeySequence(QSL("Ctrl+V")));
pasteAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
pasteAction->setIcon(QIcon::fromTheme(QSL("edit-paste")));
QAction* selectAllAction = pageAction(QWebEnginePage::SelectAll);
selectAllAction->setText(tr("Select All"));
selectAllAction->setShortcut(QKeySequence("Ctrl+A"));
selectAllAction->setShortcut(QKeySequence(QSL("Ctrl+A")));
selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
selectAllAction->setIcon(QIcon::fromTheme(QSL("edit-select-all")));

View File

@ -35,8 +35,8 @@ SearchToolBar::SearchToolBar(WebView* view, QWidget* parent)
ui->setupUi(this);
ui->closeButton->setIcon(IconProvider::instance()->standardIcon(QStyle::SP_DialogCloseButton));
ui->next->setShortcut(QKeySequence("Ctrl+G"));
ui->previous->setShortcut(QKeySequence("Ctrl+Shift+G"));
ui->next->setShortcut(QKeySequence(QSL("Ctrl+G")));
ui->previous->setShortcut(QKeySequence(QSL("Ctrl+Shift+G")));
ui->resultsInfo->hide();
connect(view->page(), &QWebEnginePage::findTextFinished, this, &SearchToolBar::showSearchResults);
@ -47,10 +47,10 @@ SearchToolBar::SearchToolBar(WebView* view, QWidget* parent)
connect(ui->previous, &QAbstractButton::clicked, this, &SearchToolBar::findPrevious);
connect(ui->caseSensitive, &QAbstractButton::clicked, this, &SearchToolBar::caseSensitivityChanged);
auto* findNextAction = new QShortcut(QKeySequence("F3"), this);
auto* findNextAction = new QShortcut(QKeySequence(QSL("F3")), this);
connect(findNextAction, &QShortcut::activated, this, &SearchToolBar::findNext);
auto* findPreviousAction = new QShortcut(QKeySequence("Shift+F3"), this);
auto* findPreviousAction = new QShortcut(QKeySequence(QSL("Shift+F3")), this);
connect(findPreviousAction, &QShortcut::activated, this, &SearchToolBar::findPrevious);
parent->installEventFilter(this);

View File

@ -59,7 +59,7 @@ int main(int argc, char* argv[])
for (int i = 0; i < argc; ++i)
args[i] = argv[i];
QString stylecmd = QL1S("-style=") + style;
QString stylecmd = QL1S("-style=") + QString::fromUtf8(style);
args[argc++] = qstrdup(stylecmd.toUtf8().constData());
argv = args;
}

View File

@ -49,7 +49,7 @@ void AutoScrollPlugin::unload()
bool AutoScrollPlugin::testPlugin()
{
// Require the version that the plugin was built with
return (Qz::VERSION == QLatin1String(FALKON_VERSION));
return (QString::fromLatin1(Qz::VERSION) == QLatin1String(FALKON_VERSION));
}
void AutoScrollPlugin::showSettings(QWidget* parent)

Some files were not shown because too many files have changed in this diff Show More