mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 18:26:34 +01:00
Modernize code
This commit is contained in:
parent
4543c74436
commit
3fa1e81105
@ -25,7 +25,7 @@
|
|||||||
void DatabaseEncryptedPasswordBackendTest::reloadBackend()
|
void DatabaseEncryptedPasswordBackendTest::reloadBackend()
|
||||||
{
|
{
|
||||||
delete m_backend;
|
delete m_backend;
|
||||||
DatabaseEncryptedPasswordBackend* backend = new DatabaseEncryptedPasswordBackend;
|
auto* backend = new DatabaseEncryptedPasswordBackend;
|
||||||
|
|
||||||
if (m_testMasterPassword.isEmpty()) {
|
if (m_testMasterPassword.isEmpty()) {
|
||||||
m_testMasterPassword = AesInterface::passwordToHash(QString::fromUtf8(AesInterface::createRandomData(8)));
|
m_testMasterPassword = AesInterface::passwordToHash(QString::fromUtf8(AesInterface::createRandomData(8)));
|
||||||
|
@ -82,7 +82,7 @@ void LocationBarTest::loadActionBasicTest()
|
|||||||
|
|
||||||
void LocationBarTest::loadActionBookmarksTest()
|
void LocationBarTest::loadActionBookmarksTest()
|
||||||
{
|
{
|
||||||
BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url);
|
auto* bookmark = new BookmarkItem(BookmarkItem::Url);
|
||||||
bookmark->setTitle("KDE Bookmark title");
|
bookmark->setTitle("KDE Bookmark title");
|
||||||
bookmark->setUrl(QUrl("http://kde.org"));
|
bookmark->setUrl(QUrl("http://kde.org"));
|
||||||
bookmark->setKeyword("kde-bookmark");
|
bookmark->setKeyword("kde-bookmark");
|
||||||
|
@ -49,7 +49,7 @@ void QmlBookmarksApiTest::testBookmarkTreeNode()
|
|||||||
QCOMPARE(toolbarFolder->urlString(), bookmark->property("url").toString());
|
QCOMPARE(toolbarFolder->urlString(), bookmark->property("url").toString());
|
||||||
QCOMPARE(toolbarFolder->description(), bookmark->property("description").toString());
|
QCOMPARE(toolbarFolder->description(), bookmark->property("description").toString());
|
||||||
QCOMPARE(!mApp->bookmarks()->canBeModified(toolbarFolder), bookmark->property("unmodifiable").toBool());
|
QCOMPARE(!mApp->bookmarks()->canBeModified(toolbarFolder), bookmark->property("unmodifiable").toBool());
|
||||||
QObject* parent = qvariant_cast<QObject*>(bookmark->property("parent"));
|
auto* parent = qvariant_cast<QObject*>(bookmark->property("parent"));
|
||||||
QVERIFY(parent);
|
QVERIFY(parent);
|
||||||
QCOMPARE(mApp->bookmarks()->rootItem()->title(), parent->property("title").toString());
|
QCOMPARE(mApp->bookmarks()->rootItem()->title(), parent->property("title").toString());
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ void QmlBookmarksApiTest::testBookmarksCreation()
|
|||||||
|
|
||||||
QCOMPARE(qmlBookmarksSpy.count(), 1);
|
QCOMPARE(qmlBookmarksSpy.count(), 1);
|
||||||
|
|
||||||
QObject *created = qvariant_cast<QObject*>(qmlBookmarksSpy.at(0).at(0));
|
auto *created = qvariant_cast<QObject*>(qmlBookmarksSpy.at(0).at(0));
|
||||||
QVERIFY(created);
|
QVERIFY(created);
|
||||||
QCOMPARE(item->title(), created->property("title").toString());
|
QCOMPARE(item->title(), created->property("title").toString());
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ void QmlBookmarksApiTest::testBookmarksCreation()
|
|||||||
QVERIFY(out.toBool());
|
QVERIFY(out.toBool());
|
||||||
|
|
||||||
QCOMPARE(bookmarksSpy.count(), 1);
|
QCOMPARE(bookmarksSpy.count(), 1);
|
||||||
BookmarkItem* createdItem = qvariant_cast<BookmarkItem*>(bookmarksSpy.at(0).at(0));
|
auto* createdItem = qvariant_cast<BookmarkItem*>(bookmarksSpy.at(0).at(0));
|
||||||
QVERIFY(createdItem);
|
QVERIFY(createdItem);
|
||||||
QCOMPARE(createdItem->title(), QString("Example Plugin"));
|
QCOMPARE(createdItem->title(), QString("Example Plugin"));
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ void QmlBookmarksApiTest::testBookmarksModification()
|
|||||||
|
|
||||||
QCOMPARE(qmlBookmarksSpy.count(), 1);
|
QCOMPARE(qmlBookmarksSpy.count(), 1);
|
||||||
|
|
||||||
QObject *modified = qvariant_cast<QObject*>(qmlBookmarksSpy.at(0).at(0));
|
auto *modified = qvariant_cast<QObject*>(qmlBookmarksSpy.at(0).at(0));
|
||||||
QVERIFY(modified);
|
QVERIFY(modified);
|
||||||
QCOMPARE(modified->property("title").toString(), QString("Modified Example Domain"));
|
QCOMPARE(modified->property("title").toString(), QString("Modified Example Domain"));
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ void QmlBookmarksApiTest::testBookmarksModification()
|
|||||||
QVERIFY(out.toBool());
|
QVERIFY(out.toBool());
|
||||||
|
|
||||||
QCOMPARE(bookmarksSpy.count(), 1);
|
QCOMPARE(bookmarksSpy.count(), 1);
|
||||||
BookmarkItem* modifiedItem = qvariant_cast<BookmarkItem*>(bookmarksSpy.at(0).at(0));
|
auto* modifiedItem = qvariant_cast<BookmarkItem*>(bookmarksSpy.at(0).at(0));
|
||||||
QVERIFY(modifiedItem);
|
QVERIFY(modifiedItem);
|
||||||
QCOMPARE(modifiedItem->title(), QString("Modified Example Plugin"));
|
QCOMPARE(modifiedItem->title(), QString("Modified Example Plugin"));
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ void QmlBookmarksApiTest::testBookmarksRemoval()
|
|||||||
|
|
||||||
QCOMPARE(qmlBookmarksSpy.count(), 1);
|
QCOMPARE(qmlBookmarksSpy.count(), 1);
|
||||||
|
|
||||||
QObject *removed = qvariant_cast<QObject*>(qmlBookmarksSpy.at(0).at(0));
|
auto *removed = qvariant_cast<QObject*>(qmlBookmarksSpy.at(0).at(0));
|
||||||
QVERIFY(removed);
|
QVERIFY(removed);
|
||||||
QCOMPARE(removed->property("title").toString(), QString("Modified Example Domain"));
|
QCOMPARE(removed->property("title").toString(), QString("Modified Example Domain"));
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ void QmlBookmarksApiTest::testBookmarksRemoval()
|
|||||||
QVERIFY(out.toBool());
|
QVERIFY(out.toBool());
|
||||||
|
|
||||||
QCOMPARE(bookmarksSpy.count(), 1);
|
QCOMPARE(bookmarksSpy.count(), 1);
|
||||||
BookmarkItem* removedItem = qvariant_cast<BookmarkItem*>(bookmarksSpy.at(0).at(0));
|
auto* removedItem = qvariant_cast<BookmarkItem*>(bookmarksSpy.at(0).at(0));
|
||||||
QVERIFY(removedItem);
|
QVERIFY(removedItem);
|
||||||
QCOMPARE(removedItem->title(), QString("Modified Example Plugin"));
|
QCOMPARE(removedItem->title(), QString("Modified Example Plugin"));
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ void QmlCookiesApiTest::testCookieAdditionRemoval()
|
|||||||
mApp->webProfile()->cookieStore()->setCookie(anotherNetCookie);
|
mApp->webProfile()->cookieStore()->setCookie(anotherNetCookie);
|
||||||
QTRY_COMPARE(qmlCookieSpy.count(), 1);
|
QTRY_COMPARE(qmlCookieSpy.count(), 1);
|
||||||
QVariantMap addedQmlCookieMap = QVariant(qmlCookieSpy.at(0).at(0)).toMap();
|
QVariantMap addedQmlCookieMap = QVariant(qmlCookieSpy.at(0).at(0)).toMap();
|
||||||
QObject *addedQmlCookie = qvariant_cast<QObject*>(addedQmlCookieMap.value("cookie"));
|
auto *addedQmlCookie = qvariant_cast<QObject*>(addedQmlCookieMap.value("cookie"));
|
||||||
bool removed = addedQmlCookieMap.value("removed").toBool();
|
bool removed = addedQmlCookieMap.value("removed").toBool();
|
||||||
QCOMPARE(addedQmlCookie->property("name").toString(), QSL("Hello"));
|
QCOMPARE(addedQmlCookie->property("name").toString(), QSL("Hello"));
|
||||||
QCOMPARE(removed, false);
|
QCOMPARE(removed, false);
|
||||||
@ -60,7 +60,7 @@ void QmlCookiesApiTest::testCookieAdditionRemoval()
|
|||||||
mApp->webProfile()->cookieStore()->deleteCookie(netCookie);
|
mApp->webProfile()->cookieStore()->deleteCookie(netCookie);
|
||||||
QTRY_COMPARE(qmlCookieSpy.count(), 2);
|
QTRY_COMPARE(qmlCookieSpy.count(), 2);
|
||||||
QVariantMap removedQmlCookieMap = QVariant(qmlCookieSpy.at(1).at(0)).toMap();
|
QVariantMap removedQmlCookieMap = QVariant(qmlCookieSpy.at(1).at(0)).toMap();
|
||||||
QObject *removedQmlCookie = qvariant_cast<QObject*>(removedQmlCookieMap.value("cookie"));
|
auto *removedQmlCookie = qvariant_cast<QObject*>(removedQmlCookieMap.value("cookie"));
|
||||||
removed = removedQmlCookieMap.value("removed").toBool();
|
removed = removedQmlCookieMap.value("removed").toBool();
|
||||||
QCOMPARE(removedQmlCookie->property("name").toString(), QSL("Example"));
|
QCOMPARE(removedQmlCookie->property("name").toString(), QSL("Example"));
|
||||||
QCOMPARE(removed, true);
|
QCOMPARE(removed, true);
|
||||||
|
@ -37,7 +37,7 @@ void QmlTopSitesApiTest::testTopSites()
|
|||||||
qDebug() << "Top sites list size=" << list.length();
|
qDebug() << "Top sites list size=" << list.length();
|
||||||
for( const auto& site : list )
|
for( const auto& site : list )
|
||||||
{
|
{
|
||||||
QObject* object = qvariant_cast<QObject*>(site);
|
auto* object = qvariant_cast<QObject*>(site);
|
||||||
if (object)
|
if (object)
|
||||||
{
|
{
|
||||||
qDebug() << ".." << object->property("title") << object->property("url");
|
qDebug() << ".." << object->property("title") << object->property("url");
|
||||||
@ -48,7 +48,7 @@ void QmlTopSitesApiTest::testTopSites()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QCOMPARE(list.length(), 1);
|
QCOMPARE(list.length(), 1);
|
||||||
QObject* object = qvariant_cast<QObject*>(list.at(0));
|
auto* object = qvariant_cast<QObject*>(list.at(0));
|
||||||
QVERIFY(object);
|
QVERIFY(object);
|
||||||
QCOMPARE(object->property("title").toString(), QSL("Example Domain"));
|
QCOMPARE(object->property("title").toString(), QSL("Example Domain"));
|
||||||
QCOMPARE(object->property("url").toString(), QSL("https://example.com"));
|
QCOMPARE(object->property("url").toString(), QSL("https://example.com"));
|
||||||
|
@ -55,9 +55,9 @@ void QmlUserScriptApiTest::testContains()
|
|||||||
{
|
{
|
||||||
QWebEngineScript script = mApp->webProfile()->scripts()->toList().at(0);
|
QWebEngineScript script = mApp->webProfile()->scripts()->toList().at(0);
|
||||||
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
|
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
|
||||||
QmlUserScripts *userScripts = dynamic_cast<QmlUserScripts*>(object);
|
auto *userScripts = dynamic_cast<QmlUserScripts*>(object);
|
||||||
QVERIFY(userScripts);
|
QVERIFY(userScripts);
|
||||||
QmlUserScript *userScript = new QmlUserScript();
|
auto *userScript = new QmlUserScript();
|
||||||
userScript->setWebEngineScript(script);
|
userScript->setWebEngineScript(script);
|
||||||
bool contains = userScripts->contains(userScript);
|
bool contains = userScripts->contains(userScript);
|
||||||
QCOMPARE(contains, true);
|
QCOMPARE(contains, true);
|
||||||
@ -67,7 +67,7 @@ void QmlUserScriptApiTest::testFind()
|
|||||||
{
|
{
|
||||||
QWebEngineScript script = mApp->webProfile()->scripts()->toList().at(0);
|
QWebEngineScript script = mApp->webProfile()->scripts()->toList().at(0);
|
||||||
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
|
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
|
||||||
QmlUserScripts *userScripts = dynamic_cast<QmlUserScripts*>(object);
|
auto *userScripts = dynamic_cast<QmlUserScripts*>(object);
|
||||||
QVERIFY(userScripts);
|
QVERIFY(userScripts);
|
||||||
QObject *scriptFound = userScripts->findScript(script.name());
|
QObject *scriptFound = userScripts->findScript(script.name());
|
||||||
QVERIFY(scriptFound);
|
QVERIFY(scriptFound);
|
||||||
@ -78,9 +78,9 @@ void QmlUserScriptApiTest::testInsertRemove()
|
|||||||
{
|
{
|
||||||
int initialCount = m_testHelper.evaluate("Falkon.UserScripts.count").toInt();
|
int initialCount = m_testHelper.evaluate("Falkon.UserScripts.count").toInt();
|
||||||
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
|
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
|
||||||
QmlUserScripts *userScripts = dynamic_cast<QmlUserScripts*>(object);
|
auto *userScripts = dynamic_cast<QmlUserScripts*>(object);
|
||||||
QVERIFY(userScripts);
|
QVERIFY(userScripts);
|
||||||
QmlUserScript *userScript = new QmlUserScript();
|
auto *userScript = new QmlUserScript();
|
||||||
userScript->setProperty("name", "Hello World");
|
userScript->setProperty("name", "Hello World");
|
||||||
userScript->setProperty("sourceCode", "(function() {"
|
userScript->setProperty("sourceCode", "(function() {"
|
||||||
" alert('Hello World')"
|
" alert('Hello World')"
|
||||||
|
@ -57,7 +57,7 @@ void QmlWindowsApiTest::testWindowsAPI()
|
|||||||
QTRY_COMPARE(qmlWindowCreatedSignal.count(), 2);
|
QTRY_COMPARE(qmlWindowCreatedSignal.count(), 2);
|
||||||
QTRY_COMPARE(windowCreatedSingal.count(), 2);
|
QTRY_COMPARE(windowCreatedSingal.count(), 2);
|
||||||
|
|
||||||
QObject *newQmlSignalWindow = qvariant_cast<QObject*>(qmlWindowCreatedSignal.at(1).at(0));
|
auto *newQmlSignalWindow = qvariant_cast<QObject*>(qmlWindowCreatedSignal.at(1).at(0));
|
||||||
QVERIFY(newQmlSignalWindow);
|
QVERIFY(newQmlSignalWindow);
|
||||||
QCOMPARE(newQmlWindow->property("id").toInt(), newQmlSignalWindow->property("id").toInt());
|
QCOMPARE(newQmlWindow->property("id").toInt(), newQmlSignalWindow->property("id").toInt());
|
||||||
|
|
||||||
|
@ -95,13 +95,13 @@ void QzToolsTest::splitCommandArguments_data()
|
|||||||
<< QStringList();
|
<< QStringList();
|
||||||
QTest::newRow("OnlySpaces") << QString(" ")
|
QTest::newRow("OnlySpaces") << QString(" ")
|
||||||
<< QStringList();
|
<< QStringList();
|
||||||
QTest::newRow("OnlyQuotes") << QString("\"\" \"\"")
|
QTest::newRow("OnlyQuotes") << QString(R"("" "")")
|
||||||
<< QStringList();
|
<< QStringList();
|
||||||
QTest::newRow("EmptyQuotesAndSpace") << QString("\"\" \"\" \" \"")
|
QTest::newRow("EmptyQuotesAndSpace") << QString(R"("" "" " ")")
|
||||||
<< QStringList(" ");
|
<< QStringList(" ");
|
||||||
QTest::newRow("MultipleSpaces") << " /usr/foo -o foo.out "
|
QTest::newRow("MultipleSpaces") << " /usr/foo -o foo.out "
|
||||||
<< (QStringList() << "/usr/foo" << "-o" << "foo.out");
|
<< (QStringList() << "/usr/foo" << "-o" << "foo.out");
|
||||||
QTest::newRow("Quotes") << "\"/usr/foo\" \"-o\" \"foo.out\""
|
QTest::newRow("Quotes") << R"("/usr/foo" "-o" "foo.out")"
|
||||||
<< (QStringList() << "/usr/foo" << "-o" << "foo.out");
|
<< (QStringList() << "/usr/foo" << "-o" << "foo.out");
|
||||||
QTest::newRow("SingleQuotes") << "'/usr/foo' '-o' 'foo.out'"
|
QTest::newRow("SingleQuotes") << "'/usr/foo' '-o' 'foo.out'"
|
||||||
<< (QStringList() << "/usr/foo" << "-o" << "foo.out");
|
<< (QStringList() << "/usr/foo" << "-o" << "foo.out");
|
||||||
@ -111,7 +111,7 @@ void QzToolsTest::splitCommandArguments_data()
|
|||||||
<< (QStringList() << "/usr/foo" << "-o 'ds' " << "foo.out");
|
<< (QStringList() << "/usr/foo" << "-o 'ds' " << "foo.out");
|
||||||
QTest::newRow("DoubleInSingleQuotes") << "/usr/foo -o 'foo\" d \".out' "
|
QTest::newRow("DoubleInSingleQuotes") << "/usr/foo -o 'foo\" d \".out' "
|
||||||
<< (QStringList() << "/usr/foo" << "-o" << "foo\" d \".out");
|
<< (QStringList() << "/usr/foo" << "-o" << "foo\" d \".out");
|
||||||
QTest::newRow("SpacesWithQuotes") << QString(" \" \" \" \" ")
|
QTest::newRow("SpacesWithQuotes") << QString(R"( " " " " )")
|
||||||
<< (QStringList() << " " << " ");
|
<< (QStringList() << " " << " ");
|
||||||
QTest::newRow("QuotesAndSpaces") << "/usr/foo -o \"foo - out\""
|
QTest::newRow("QuotesAndSpaces") << "/usr/foo -o \"foo - out\""
|
||||||
<< (QStringList() << "/usr/foo" << "-o" << "foo - out");
|
<< (QStringList() << "/usr/foo" << "-o" << "foo - out");
|
||||||
|
@ -50,7 +50,7 @@ void SqlDatabaseTest::sqlQueryJobTest()
|
|||||||
|
|
||||||
QCOMPARE(db.tables().count(), 0);
|
QCOMPARE(db.tables().count(), 0);
|
||||||
|
|
||||||
SqlQueryJob *job = new SqlQueryJob();
|
auto *job = new SqlQueryJob();
|
||||||
job->setQuery(QSL("CREATE TABLE test1 (data TEXT, id INTEGER PRIMARY KEY)"));
|
job->setQuery(QSL("CREATE TABLE test1 (data TEXT, id INTEGER PRIMARY KEY)"));
|
||||||
job->start();
|
job->start();
|
||||||
QVERIFY(waitForFinished(job));
|
QVERIFY(waitForFinished(job));
|
||||||
|
@ -67,7 +67,7 @@ void WebViewTest::cleanupTestCase()
|
|||||||
void WebViewTest::loadSignalsChangePageTest()
|
void WebViewTest::loadSignalsChangePageTest()
|
||||||
{
|
{
|
||||||
TestWebView view;
|
TestWebView view;
|
||||||
WebPage *page1 = new WebPage;
|
auto *page1 = new WebPage;
|
||||||
view.setPage(page1);
|
view.setPage(page1);
|
||||||
|
|
||||||
QSignalSpy loadStartedSpy(&view, &WebView::loadStarted);
|
QSignalSpy loadStartedSpy(&view, &WebView::loadStarted);
|
||||||
@ -78,7 +78,7 @@ void WebViewTest::loadSignalsChangePageTest()
|
|||||||
QTRY_COMPARE(loadStartedSpy.count(), 1);
|
QTRY_COMPARE(loadStartedSpy.count(), 1);
|
||||||
loadStartedSpy.clear();
|
loadStartedSpy.clear();
|
||||||
|
|
||||||
WebPage *page2 = new WebPage;
|
auto *page2 = new WebPage;
|
||||||
view.setPage(page2);
|
view.setPage(page2);
|
||||||
|
|
||||||
// WebPage: Workaround for broken load started/finished signals in QtWebEngine 5.10
|
// WebPage: Workaround for broken load started/finished signals in QtWebEngine 5.10
|
||||||
@ -89,7 +89,7 @@ void WebViewTest::loadSignalsChangePageTest()
|
|||||||
loadFinishedSpy.clear();
|
loadFinishedSpy.clear();
|
||||||
|
|
||||||
QWebEngineView view2;
|
QWebEngineView view2;
|
||||||
WebPage *page3 = new WebPage;
|
auto *page3 = new WebPage;
|
||||||
view2.setPage(page3);
|
view2.setPage(page3);
|
||||||
|
|
||||||
QSignalSpy page3LoadStart(page3, &WebPage::loadStarted);
|
QSignalSpy page3LoadStart(page3, &WebPage::loadStarted);
|
||||||
|
24
src/lib/3rdparty/fancytabwidget.cpp
vendored
24
src/lib/3rdparty/fancytabwidget.cpp
vendored
@ -56,7 +56,7 @@ void FancyTabProxyStyle::drawControl(
|
|||||||
QPainter* p, const QWidget* widget) const
|
QPainter* p, const QWidget* widget) const
|
||||||
{
|
{
|
||||||
|
|
||||||
const QStyleOptionTab* v_opt = qstyleoption_cast<const QStyleOptionTab*>(option);
|
const auto* v_opt = qstyleoption_cast<const QStyleOptionTab*>(option);
|
||||||
|
|
||||||
if (element != CE_TabBarTab || !v_opt) {
|
if (element != CE_TabBarTab || !v_opt) {
|
||||||
QProxyStyle::drawControl(element, option, p, widget);
|
QProxyStyle::drawControl(element, option, p, widget);
|
||||||
@ -127,10 +127,10 @@ void FancyTabProxyStyle::drawControl(
|
|||||||
|
|
||||||
const QString tab_hover = widget->property("tab_hover").toString();
|
const QString tab_hover = widget->property("tab_hover").toString();
|
||||||
int fader = widget->property(fader_key.toUtf8().constData()).toInt();
|
int fader = widget->property(fader_key.toUtf8().constData()).toInt();
|
||||||
QPropertyAnimation* animation = widget->property(animation_key.toUtf8().constData()).value<QPropertyAnimation*>();
|
auto* animation = widget->property(animation_key.toUtf8().constData()).value<QPropertyAnimation*>();
|
||||||
|
|
||||||
if (!animation) {
|
if (!animation) {
|
||||||
QWidget* mut_widget = const_cast<QWidget*>(widget);
|
auto* mut_widget = const_cast<QWidget*>(widget);
|
||||||
fader = 0;
|
fader = 0;
|
||||||
mut_widget->setProperty(fader_key.toUtf8().constData(), fader);
|
mut_widget->setProperty(fader_key.toUtf8().constData(), fader);
|
||||||
animation = new QPropertyAnimation(mut_widget, fader_key.toUtf8(), mut_widget);
|
animation = new QPropertyAnimation(mut_widget, fader_key.toUtf8(), mut_widget);
|
||||||
@ -193,9 +193,9 @@ void FancyTabProxyStyle::polish(QPalette &palette)
|
|||||||
|
|
||||||
bool FancyTabProxyStyle::eventFilter(QObject* o, QEvent* e)
|
bool FancyTabProxyStyle::eventFilter(QObject* o, QEvent* e)
|
||||||
{
|
{
|
||||||
QTabBar* bar = qobject_cast<QTabBar*>(o);
|
auto* bar = qobject_cast<QTabBar*>(o);
|
||||||
if (bar && (e->type() == QEvent::MouseMove || e->type() == QEvent::Leave)) {
|
if (bar && (e->type() == QEvent::MouseMove || e->type() == QEvent::Leave)) {
|
||||||
QMouseEvent* event = static_cast<QMouseEvent*>(e);
|
auto* event = static_cast<QMouseEvent*>(e);
|
||||||
const QString old_hovered_tab = bar->property("tab_hover").toString();
|
const QString old_hovered_tab = bar->property("tab_hover").toString();
|
||||||
const QString hovered_tab = e->type() == QEvent::Leave ? QString() : bar->tabText(bar->tabAt(event->pos()));
|
const QString hovered_tab = e->type() == QEvent::Leave ? QString() : bar->tabText(bar->tabAt(event->pos()));
|
||||||
bar->setProperty("tab_hover", hovered_tab);
|
bar->setProperty("tab_hover", hovered_tab);
|
||||||
@ -250,7 +250,7 @@ FancyTabBar::FancyTabBar(QWidget* parent)
|
|||||||
setMouseTracking(true); // Needed for hover events
|
setMouseTracking(true); // Needed for hover events
|
||||||
m_triggerTimer.setSingleShot(true);
|
m_triggerTimer.setSingleShot(true);
|
||||||
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout;
|
auto* layout = new QVBoxLayout;
|
||||||
layout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding));
|
layout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding));
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
@ -366,7 +366,7 @@ void FancyTabBar::mousePressEvent(QMouseEvent* e)
|
|||||||
|
|
||||||
void FancyTabBar::addTab(const QIcon &icon, const QString &label)
|
void FancyTabBar::addTab(const QIcon &icon, const QString &label)
|
||||||
{
|
{
|
||||||
FancyTab* tab = new FancyTab(this);
|
auto* tab = new FancyTab(this);
|
||||||
tab->icon = icon;
|
tab->icon = icon;
|
||||||
tab->text = label;
|
tab->text = label;
|
||||||
m_tabs.append(tab);
|
m_tabs.append(tab);
|
||||||
@ -512,7 +512,7 @@ FancyTabWidget::FancyTabWidget(QWidget* parent)
|
|||||||
top_layout_->setSpacing(0);
|
top_layout_->setSpacing(0);
|
||||||
top_layout_->addLayout(stack_);
|
top_layout_->addLayout(stack_);
|
||||||
|
|
||||||
QHBoxLayout* main_layout = new QHBoxLayout;
|
auto* main_layout = new QHBoxLayout;
|
||||||
main_layout->setContentsMargins(0, 0, 0, 0);
|
main_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
main_layout->setSpacing(1);
|
main_layout->setSpacing(1);
|
||||||
main_layout->addWidget(side_widget_);
|
main_layout->addWidget(side_widget_);
|
||||||
@ -576,10 +576,10 @@ int FancyTabWidget::current_index() const
|
|||||||
|
|
||||||
void FancyTabWidget::SetCurrentIndex(int index)
|
void FancyTabWidget::SetCurrentIndex(int index)
|
||||||
{
|
{
|
||||||
if (FancyTabBar* bar = qobject_cast<FancyTabBar*>(tab_bar_)) {
|
if (auto* bar = qobject_cast<FancyTabBar*>(tab_bar_)) {
|
||||||
bar->setCurrentIndex(index);
|
bar->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
else if (QTabBar* bar = qobject_cast<QTabBar*>(tab_bar_)) {
|
else if (auto* bar = qobject_cast<QTabBar*>(tab_bar_)) {
|
||||||
bar->setCurrentIndex(index);
|
bar->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -614,7 +614,7 @@ void FancyTabWidget::SetMode(Mode mode)
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
case Mode_LargeSidebar: {
|
case Mode_LargeSidebar: {
|
||||||
FancyTabBar* bar = new FancyTabBar(this);
|
auto* bar = new FancyTabBar(this);
|
||||||
side_layout_->insertWidget(0, bar);
|
side_layout_->insertWidget(0, bar);
|
||||||
tab_bar_ = bar;
|
tab_bar_ = bar;
|
||||||
|
|
||||||
@ -697,7 +697,7 @@ void FancyTabWidget::AddMenuItem(QSignalMapper* mapper, QActionGroup* group,
|
|||||||
void FancyTabWidget::MakeTabBar(QTabBar::Shape shape, bool text, bool icons,
|
void FancyTabWidget::MakeTabBar(QTabBar::Shape shape, bool text, bool icons,
|
||||||
bool fancy)
|
bool fancy)
|
||||||
{
|
{
|
||||||
QTabBar* bar = new QTabBar(this);
|
auto* bar = new QTabBar(this);
|
||||||
bar->setShape(shape);
|
bar->setShape(shape);
|
||||||
bar->setDocumentMode(true);
|
bar->setDocumentMode(true);
|
||||||
bar->setUsesScrollButtons(true);
|
bar->setUsesScrollButtons(true);
|
||||||
|
20
src/lib/3rdparty/lineedit.cpp
vendored
20
src/lib/3rdparty/lineedit.cpp
vendored
@ -99,42 +99,42 @@ void LineEdit::init()
|
|||||||
connect(m_leftWidget, &SideWidget::sizeHintChanged, this, &LineEdit::updateTextMargins);
|
connect(m_leftWidget, &SideWidget::sizeHintChanged, this, &LineEdit::updateTextMargins);
|
||||||
connect(m_rightWidget, &SideWidget::sizeHintChanged, this, &LineEdit::updateTextMargins);
|
connect(m_rightWidget, &SideWidget::sizeHintChanged, this, &LineEdit::updateTextMargins);
|
||||||
|
|
||||||
QAction* undoAction = new QAction(QIcon::fromTheme(QSL("edit-undo")), tr("&Undo"), this);
|
auto* undoAction = new QAction(QIcon::fromTheme(QSL("edit-undo")), tr("&Undo"), this);
|
||||||
undoAction->setShortcut(QKeySequence(QSL("Ctrl+Z")));
|
undoAction->setShortcut(QKeySequence(QSL("Ctrl+Z")));
|
||||||
undoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
undoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||||
connect(undoAction, &QAction::triggered, this, &QLineEdit::undo);
|
connect(undoAction, &QAction::triggered, this, &QLineEdit::undo);
|
||||||
|
|
||||||
QAction* redoAction = new QAction(QIcon::fromTheme(QSL("edit-redo")), tr("&Redo"), this);
|
auto* redoAction = new QAction(QIcon::fromTheme(QSL("edit-redo")), tr("&Redo"), this);
|
||||||
redoAction->setShortcut(QKeySequence(QSL("Ctrl+Shift+Z")));
|
redoAction->setShortcut(QKeySequence(QSL("Ctrl+Shift+Z")));
|
||||||
redoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
redoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||||
connect(redoAction, &QAction::triggered, this, &QLineEdit::redo);
|
connect(redoAction, &QAction::triggered, this, &QLineEdit::redo);
|
||||||
|
|
||||||
QAction* cutAction = new QAction(QIcon::fromTheme(QSL("edit-cut")), tr("Cu&t"), this);
|
auto* cutAction = new QAction(QIcon::fromTheme(QSL("edit-cut")), tr("Cu&t"), this);
|
||||||
cutAction->setShortcut(QKeySequence(QSL("Ctrl+X")));
|
cutAction->setShortcut(QKeySequence(QSL("Ctrl+X")));
|
||||||
cutAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
cutAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||||
connect(cutAction, &QAction::triggered, this, &QLineEdit::cut);
|
connect(cutAction, &QAction::triggered, this, &QLineEdit::cut);
|
||||||
|
|
||||||
QAction* copyAction = new QAction(QIcon::fromTheme(QSL("edit-copy")), tr("&Copy"), this);
|
auto* copyAction = new QAction(QIcon::fromTheme(QSL("edit-copy")), tr("&Copy"), this);
|
||||||
copyAction->setShortcut(QKeySequence(QSL("Ctrl+C")));
|
copyAction->setShortcut(QKeySequence(QSL("Ctrl+C")));
|
||||||
copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||||
connect(copyAction, &QAction::triggered, this, &QLineEdit::copy);
|
connect(copyAction, &QAction::triggered, this, &QLineEdit::copy);
|
||||||
|
|
||||||
QAction* pasteAction = new QAction(QIcon::fromTheme(QSL("edit-paste")), tr("&Paste"), this);
|
auto* pasteAction = new QAction(QIcon::fromTheme(QSL("edit-paste")), tr("&Paste"), this);
|
||||||
pasteAction->setShortcut(QKeySequence(QSL("Ctrl+V")));
|
pasteAction->setShortcut(QKeySequence(QSL("Ctrl+V")));
|
||||||
pasteAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
pasteAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||||
connect(pasteAction, &QAction::triggered, this, &QLineEdit::paste);
|
connect(pasteAction, &QAction::triggered, this, &QLineEdit::paste);
|
||||||
|
|
||||||
QAction* pasteAndGoAction = new QAction(this);
|
auto* pasteAndGoAction = new QAction(this);
|
||||||
pasteAndGoAction->setShortcut(QKeySequence(QSL("Ctrl+Shift+V")));
|
pasteAndGoAction->setShortcut(QKeySequence(QSL("Ctrl+Shift+V")));
|
||||||
pasteAndGoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
pasteAndGoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||||
|
|
||||||
QAction* deleteAction = new QAction(QIcon::fromTheme(QSL("edit-delete")), tr("Delete"), this);
|
auto* deleteAction = new QAction(QIcon::fromTheme(QSL("edit-delete")), tr("Delete"), this);
|
||||||
connect(deleteAction, &QAction::triggered, this, &LineEdit::slotDelete);
|
connect(deleteAction, &QAction::triggered, this, &LineEdit::slotDelete);
|
||||||
|
|
||||||
QAction* clearAllAction = new QAction(QIcon::fromTheme(QSL("edit-clear")), tr("Clear All"), this);
|
auto* clearAllAction = new QAction(QIcon::fromTheme(QSL("edit-clear")), tr("Clear All"), this);
|
||||||
connect(clearAllAction, &QAction::triggered, this, &QLineEdit::clear);
|
connect(clearAllAction, &QAction::triggered, this, &QLineEdit::clear);
|
||||||
|
|
||||||
QAction* selectAllAction = new QAction(QIcon::fromTheme(QSL("edit-select-all")), tr("Select All"), this);
|
auto* selectAllAction = new QAction(QIcon::fromTheme(QSL("edit-select-all")), tr("Select All"), this);
|
||||||
selectAllAction->setShortcut(QKeySequence(QSL("Ctrl+A")));
|
selectAllAction->setShortcut(QKeySequence(QSL("Ctrl+A")));
|
||||||
selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||||
connect(selectAllAction, &QAction::triggered, this, &QLineEdit::selectAll);
|
connect(selectAllAction, &QAction::triggered, this, &QLineEdit::selectAll);
|
||||||
@ -190,7 +190,7 @@ bool LineEdit::event(QEvent* event)
|
|||||||
// Modified QLineEdit::createStandardContextMenu to support icons and PasteAndGo action
|
// Modified QLineEdit::createStandardContextMenu to support icons and PasteAndGo action
|
||||||
QMenu* LineEdit::createContextMenu()
|
QMenu* LineEdit::createContextMenu()
|
||||||
{
|
{
|
||||||
QMenu* popup = new QMenu(this);
|
auto* popup = new QMenu(this);
|
||||||
popup->setObjectName(QSL("qt_edit_menu"));
|
popup->setObjectName(QSL("qt_edit_menu"));
|
||||||
|
|
||||||
if (!isReadOnly()) {
|
if (!isReadOnly()) {
|
||||||
|
2
src/lib/3rdparty/lineedit.h
vendored
2
src/lib/3rdparty/lineedit.h
vendored
@ -73,7 +73,7 @@ class FALKON_EXPORT LineEdit : public QLineEdit
|
|||||||
Q_PROPERTY(int minHeight READ minHeight WRITE setMinHeight)
|
Q_PROPERTY(int minHeight READ minHeight WRITE setMinHeight)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef QList<QTextLayout::FormatRange> TextFormat;
|
using TextFormat = QList<QTextLayout::FormatRange>;
|
||||||
|
|
||||||
enum WidgetPosition {
|
enum WidgetPosition {
|
||||||
LeftSide,
|
LeftSide,
|
||||||
|
@ -56,8 +56,8 @@ typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*);
|
|||||||
static PProcessIdToSessionId pProcessIdToSessionId = 0;
|
static PProcessIdToSessionId pProcessIdToSessionId = 0;
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_UNIX)
|
#if defined(Q_OS_UNIX)
|
||||||
|
#include <ctime>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <time.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
|
|||||||
}
|
}
|
||||||
m_dbusRegistered = QDBusConnection::sessionBus().registerService(id);
|
m_dbusRegistered = QDBusConnection::sessionBus().registerService(id);
|
||||||
if (m_dbusRegistered) {
|
if (m_dbusRegistered) {
|
||||||
QtSingleAppDBusInterface *iface = new QtSingleAppDBusInterface(this);
|
auto *iface = new QtSingleAppDBusInterface(this);
|
||||||
connect(iface, &QtSingleAppDBusInterface::messageReceived, this, &QtLocalPeer::messageReceived);
|
connect(iface, &QtSingleAppDBusInterface::messageReceived, this, &QtLocalPeer::messageReceived);
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/"), this);
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/"), this);
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,10 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <string.h>
|
#include <cerrno>
|
||||||
#include <errno.h>
|
#include <cstring>
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "qtlockedfile.h"
|
#include "qtlockedfile.h"
|
||||||
|
|
||||||
|
4
src/lib/3rdparty/squeezelabelv2.cpp
vendored
4
src/lib/3rdparty/squeezelabelv2.cpp
vendored
@ -109,8 +109,8 @@ void SqueezeLabelV2::mouseMoveEvent(QMouseEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDrag* drag = new QDrag(this);
|
auto* drag = new QDrag(this);
|
||||||
QMimeData* mime = new QMimeData;
|
auto* mime = new QMimeData;
|
||||||
mime->setText(m_originalText);
|
mime->setText(m_originalText);
|
||||||
|
|
||||||
drag->setMimeData(mime);
|
drag->setMimeData(mime);
|
||||||
|
4
src/lib/3rdparty/stylehelper.h
vendored
4
src/lib/3rdparty/stylehelper.h
vendored
@ -64,8 +64,8 @@ public:
|
|||||||
static QColor shadowColor(bool lightColored = false);
|
static QColor shadowColor(bool lightColored = false);
|
||||||
static QColor borderColor(bool lightColored = false);
|
static QColor borderColor(bool lightColored = false);
|
||||||
|
|
||||||
static QColor sidebarHighlight() { return QColor(255, 255, 255, 40); }
|
static QColor sidebarHighlight() { return {255, 255, 255, 40}; }
|
||||||
static QColor sidebarShadow() { return QColor(0, 0, 0, 40); }
|
static QColor sidebarShadow() { return {0, 0, 0, 40}; }
|
||||||
|
|
||||||
// Sets the base color and makes sure all top level widgets are updated
|
// Sets the base color and makes sure all top level widgets are updated
|
||||||
static void setBaseColor(const QColor &color);
|
static void setBaseColor(const QColor &color);
|
||||||
|
@ -49,7 +49,7 @@ private:
|
|||||||
QString title;
|
QString title;
|
||||||
QString url;
|
QString url;
|
||||||
|
|
||||||
Subscription() {}
|
Subscription() = default;
|
||||||
|
|
||||||
Subscription(const QString &t, const QString &u) {
|
Subscription(const QString &t, const QString &u) {
|
||||||
title = t;
|
title = t;
|
||||||
|
@ -45,7 +45,7 @@ AdBlockDialog::AdBlockDialog(QWidget* parent)
|
|||||||
#endif
|
#endif
|
||||||
adblockCheckBox->setChecked(m_manager->isEnabled());
|
adblockCheckBox->setChecked(m_manager->isEnabled());
|
||||||
|
|
||||||
QMenu* menu = new QMenu(buttonOptions);
|
auto* menu = new QMenu(buttonOptions);
|
||||||
m_actionAddRule = menu->addAction(tr("Add Rule"), this, &AdBlockDialog::addRule);
|
m_actionAddRule = menu->addAction(tr("Add Rule"), this, &AdBlockDialog::addRule);
|
||||||
m_actionRemoveRule = menu->addAction(tr("Remove Rule"), this, &AdBlockDialog::removeRule);
|
m_actionRemoveRule = menu->addAction(tr("Remove Rule"), this, &AdBlockDialog::removeRule);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
@ -76,7 +76,7 @@ void AdBlockDialog::showRule(const AdBlockRule* rule) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < tabWidget->count(); ++i) {
|
for (int i = 0; i < tabWidget->count(); ++i) {
|
||||||
AdBlockTreeWidget* treeWidget = qobject_cast<AdBlockTreeWidget*>(tabWidget->widget(i));
|
auto* treeWidget = qobject_cast<AdBlockTreeWidget*>(tabWidget->widget(i));
|
||||||
|
|
||||||
if (subscription == treeWidget->subscription()) {
|
if (subscription == treeWidget->subscription()) {
|
||||||
treeWidget->showRule(rule);
|
treeWidget->showRule(rule);
|
||||||
@ -107,7 +107,7 @@ void AdBlockDialog::addSubscription()
|
|||||||
QString url = dialog.url();
|
QString url = dialog.url();
|
||||||
|
|
||||||
if (AdBlockSubscription* subscription = m_manager->addSubscription(title, url)) {
|
if (AdBlockSubscription* subscription = m_manager->addSubscription(title, url)) {
|
||||||
AdBlockTreeWidget* tree = new AdBlockTreeWidget(subscription, tabWidget);
|
auto* tree = new AdBlockTreeWidget(subscription, tabWidget);
|
||||||
int index = tabWidget->insertTab(tabWidget->count() - 1, tree, subscription->title());
|
int index = tabWidget->insertTab(tabWidget->count() - 1, tree, subscription->title());
|
||||||
|
|
||||||
tabWidget->setCurrentIndex(index);
|
tabWidget->setCurrentIndex(index);
|
||||||
@ -163,7 +163,7 @@ void AdBlockDialog::learnAboutRules()
|
|||||||
void AdBlockDialog::loadSubscriptions()
|
void AdBlockDialog::loadSubscriptions()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < tabWidget->count(); ++i) {
|
for (int i = 0; i < tabWidget->count(); ++i) {
|
||||||
AdBlockTreeWidget* treeWidget = qobject_cast<AdBlockTreeWidget*>(tabWidget->widget(i));
|
auto* treeWidget = qobject_cast<AdBlockTreeWidget*>(tabWidget->widget(i));
|
||||||
treeWidget->refresh();
|
treeWidget->refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ void AdBlockDialog::load()
|
|||||||
|
|
||||||
const auto subscriptions = m_manager->subscriptions();
|
const auto subscriptions = m_manager->subscriptions();
|
||||||
for (AdBlockSubscription* subscription : subscriptions) {
|
for (AdBlockSubscription* subscription : subscriptions) {
|
||||||
AdBlockTreeWidget* tree = new AdBlockTreeWidget(subscription, tabWidget);
|
auto* tree = new AdBlockTreeWidget(subscription, tabWidget);
|
||||||
tabWidget->addTab(tree, subscription->title());
|
tabWidget->addTab(tree, subscription->title());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ QString AdBlockIcon::name() const
|
|||||||
|
|
||||||
void AdBlockIcon::toggleCustomFilter()
|
void AdBlockIcon::toggleCustomFilter()
|
||||||
{
|
{
|
||||||
QAction* action = qobject_cast<QAction*>(sender());
|
auto* action = qobject_cast<QAction*>(sender());
|
||||||
if (!action) {
|
if (!action) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ void AdBlockIcon::toggleCustomFilter()
|
|||||||
customList->removeFilter(filter);
|
customList->removeFilter(filter);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
AdBlockRule* rule = new AdBlockRule(filter, customList);
|
auto* rule = new AdBlockRule(filter, customList);
|
||||||
customList->addRule(rule);
|
customList->addRule(rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ void AdBlockIcon::clicked(ClickController *controller)
|
|||||||
|
|
||||||
const QUrl pageUrl = view->url();
|
const QUrl pageUrl = view->url();
|
||||||
|
|
||||||
QMenu *menu = new QMenu();
|
auto *menu = new QMenu();
|
||||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
menu->addAction(tr("Show AdBlock &Settings"), manager, SLOT(showDialog()));
|
menu->addAction(tr("Show AdBlock &Settings"), manager, SLOT(showDialog()));
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
@ -211,7 +211,7 @@ AdBlockSubscription* AdBlockManager::addSubscription(const QString &title, const
|
|||||||
file.write(data);
|
file.write(data);
|
||||||
file.commit();
|
file.commit();
|
||||||
|
|
||||||
AdBlockSubscription* subscription = new AdBlockSubscription(title, this);
|
auto* subscription = new AdBlockSubscription(title, this);
|
||||||
subscription->setUrl(QUrl(url));
|
subscription->setUrl(QUrl(url));
|
||||||
subscription->setFilePath(filePath);
|
subscription->setFilePath(filePath);
|
||||||
subscription->loadSubscription(m_disabledRules);
|
subscription->loadSubscription(m_disabledRules);
|
||||||
@ -243,7 +243,7 @@ bool AdBlockManager::removeSubscription(AdBlockSubscription* subscription)
|
|||||||
AdBlockCustomList* AdBlockManager::customList() const
|
AdBlockCustomList* AdBlockManager::customList() const
|
||||||
{
|
{
|
||||||
for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) {
|
for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) {
|
||||||
AdBlockCustomList* list = qobject_cast<AdBlockCustomList*>(subscription);
|
auto* list = qobject_cast<AdBlockCustomList*>(subscription);
|
||||||
|
|
||||||
if (list) {
|
if (list) {
|
||||||
return list;
|
return list;
|
||||||
@ -305,7 +305,7 @@ void AdBlockManager::load()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
AdBlockSubscription* subscription = new AdBlockSubscription(title, this);
|
auto* subscription = new AdBlockSubscription(title, this);
|
||||||
subscription->setUrl(url);
|
subscription->setUrl(url);
|
||||||
subscription->setFilePath(absolutePath);
|
subscription->setFilePath(absolutePath);
|
||||||
|
|
||||||
@ -314,19 +314,19 @@ void AdBlockManager::load()
|
|||||||
|
|
||||||
// Add EasyList + NoCoinList if subscriptions are empty
|
// Add EasyList + NoCoinList if subscriptions are empty
|
||||||
if (m_subscriptions.isEmpty()) {
|
if (m_subscriptions.isEmpty()) {
|
||||||
AdBlockSubscription *easyList = new AdBlockSubscription(tr("EasyList"), this);
|
auto *easyList = new AdBlockSubscription(tr("EasyList"), this);
|
||||||
easyList->setUrl(QUrl(ADBLOCK_EASYLIST_URL));
|
easyList->setUrl(QUrl(ADBLOCK_EASYLIST_URL));
|
||||||
easyList->setFilePath(DataPaths::currentProfilePath() + QLatin1String("/adblock/easylist.txt"));
|
easyList->setFilePath(DataPaths::currentProfilePath() + QLatin1String("/adblock/easylist.txt"));
|
||||||
m_subscriptions.append(easyList);
|
m_subscriptions.append(easyList);
|
||||||
|
|
||||||
AdBlockSubscription *noCoinList = new AdBlockSubscription(tr("NoCoin List"), this);
|
auto *noCoinList = new AdBlockSubscription(tr("NoCoin List"), this);
|
||||||
noCoinList->setUrl(QUrl(ADBLOCK_NOCOINLIST_URL));
|
noCoinList->setUrl(QUrl(ADBLOCK_NOCOINLIST_URL));
|
||||||
noCoinList->setFilePath(DataPaths::currentProfilePath() + QLatin1String("/adblock/nocoinlist.txt"));
|
noCoinList->setFilePath(DataPaths::currentProfilePath() + QLatin1String("/adblock/nocoinlist.txt"));
|
||||||
m_subscriptions.append(noCoinList);
|
m_subscriptions.append(noCoinList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append CustomList
|
// Append CustomList
|
||||||
AdBlockCustomList* customList = new AdBlockCustomList(this);
|
auto* customList = new AdBlockCustomList(this);
|
||||||
m_subscriptions.append(customList);
|
m_subscriptions.append(customList);
|
||||||
|
|
||||||
// Load all subscriptions
|
// Load all subscriptions
|
||||||
@ -413,7 +413,7 @@ bool AdBlockManager::canBeBlocked(const QUrl &url) const
|
|||||||
QString AdBlockManager::elementHidingRules(const QUrl &url) const
|
QString AdBlockManager::elementHidingRules(const QUrl &url) const
|
||||||
{
|
{
|
||||||
if (!isEnabled() || !canRunOnScheme(url.scheme()) || m_matcher->genericElemHideDisabledForUrl(url))
|
if (!isEnabled() || !canRunOnScheme(url.scheme()) || m_matcher->genericElemHideDisabledForUrl(url))
|
||||||
return QString();
|
return {};
|
||||||
|
|
||||||
return m_matcher->elementHidingRules();
|
return m_matcher->elementHidingRules();
|
||||||
}
|
}
|
||||||
@ -421,7 +421,7 @@ QString AdBlockManager::elementHidingRules(const QUrl &url) const
|
|||||||
QString AdBlockManager::elementHidingRulesForDomain(const QUrl &url) const
|
QString AdBlockManager::elementHidingRulesForDomain(const QUrl &url) const
|
||||||
{
|
{
|
||||||
if (!isEnabled() || !canRunOnScheme(url.scheme()) || m_matcher->elemHideDisabledForUrl(url))
|
if (!isEnabled() || !canRunOnScheme(url.scheme()) || m_matcher->elemHideDisabledForUrl(url))
|
||||||
return QString();
|
return {};
|
||||||
|
|
||||||
return m_matcher->elementHidingRulesForDomain(url.host());
|
return m_matcher->elementHidingRulesForDomain(url.host());
|
||||||
}
|
}
|
||||||
@ -452,7 +452,7 @@ AdBlockDialog *AdBlockManager::showDialog(QWidget *parent)
|
|||||||
|
|
||||||
void AdBlockManager::showRule()
|
void AdBlockManager::showRule()
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
const AdBlockRule* rule = static_cast<const AdBlockRule*>(action->data().value<void*>());
|
const AdBlockRule* rule = static_cast<const AdBlockRule*>(action->data().value<void*>());
|
||||||
|
|
||||||
if (rule) {
|
if (rule) {
|
||||||
|
@ -97,7 +97,7 @@ void AdBlockPlugin::webPageDeleted(WebPage *page)
|
|||||||
|
|
||||||
void AdBlockPlugin::mainWindowCreated(BrowserWindow *window)
|
void AdBlockPlugin::mainWindowCreated(BrowserWindow *window)
|
||||||
{
|
{
|
||||||
AdBlockIcon *icon = new AdBlockIcon(window);
|
auto *icon = new AdBlockIcon(window);
|
||||||
m_icons[window] = icon;
|
m_icons[window] = icon;
|
||||||
window->statusBar()->addButton(icon);
|
window->statusBar()->addButton(icon);
|
||||||
window->navigationBar()->addToolButton(icon);
|
window->navigationBar()->addToolButton(icon);
|
||||||
|
@ -60,7 +60,7 @@ static QString toSecondLevelDomain(const QUrl &url)
|
|||||||
const QString urlHost = url.host();
|
const QString urlHost = url.host();
|
||||||
|
|
||||||
if (topLevelDomain.isEmpty() || urlHost.isEmpty()) {
|
if (topLevelDomain.isEmpty() || urlHost.isEmpty()) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QString domain = urlHost.left(urlHost.size() - topLevelDomain.size());
|
QString domain = urlHost.left(urlHost.size() - topLevelDomain.size());
|
||||||
@ -95,7 +95,7 @@ AdBlockRule::~AdBlockRule()
|
|||||||
|
|
||||||
AdBlockRule* AdBlockRule::copy() const
|
AdBlockRule* AdBlockRule::copy() const
|
||||||
{
|
{
|
||||||
AdBlockRule* rule = new AdBlockRule();
|
auto* rule = new AdBlockRule();
|
||||||
rule->m_subscription = m_subscription;
|
rule->m_subscription = m_subscription;
|
||||||
rule->m_type = m_type;
|
rule->m_type = m_type;
|
||||||
rule->m_options = m_options;
|
rule->m_options = m_options;
|
||||||
|
@ -124,7 +124,7 @@ void AdBlockSubscription::loadSubscription(const QStringList &disabledRules)
|
|||||||
if (line.isEmpty()) {
|
if (line.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
AdBlockRule *rule = new AdBlockRule(line, this);
|
auto *rule = new AdBlockRule(line, this);
|
||||||
if (disabledRules.contains(rule->filter())) {
|
if (disabledRules.contains(rule->filter())) {
|
||||||
rule->setEnabled(false);
|
rule->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ void AdBlockTreeWidget::itemChanged(QTreeWidgetItem* item)
|
|||||||
}
|
}
|
||||||
else if (m_subscription->canEditRules()) {
|
else if (m_subscription->canEditRules()) {
|
||||||
// Custom rule has been changed
|
// Custom rule has been changed
|
||||||
AdBlockRule* newRule = new AdBlockRule(item->text(0), m_subscription);
|
auto* newRule = new AdBlockRule(item->text(0), m_subscription);
|
||||||
const AdBlockRule* rule = m_subscription->replaceRule(newRule, offset);
|
const AdBlockRule* rule = m_subscription->replaceRule(newRule, offset);
|
||||||
|
|
||||||
adjustItemFeatures(item, rule);
|
adjustItemFeatures(item, rule);
|
||||||
@ -143,10 +143,10 @@ void AdBlockTreeWidget::addRule()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AdBlockRule* rule = new AdBlockRule(newRule, m_subscription);
|
auto* rule = new AdBlockRule(newRule, m_subscription);
|
||||||
int offset = m_subscription->addRule(rule);
|
int offset = m_subscription->addRule(rule);
|
||||||
|
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
auto* item = new QTreeWidgetItem();
|
||||||
item->setText(0, newRule);
|
item->setText(0, newRule);
|
||||||
item->setData(0, Qt::UserRole + 10, offset);
|
item->setData(0, Qt::UserRole + 10, offset);
|
||||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||||
@ -254,7 +254,7 @@ void AdBlockTreeWidget::refresh()
|
|||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (const AdBlockRule* rule : allRules) {
|
for (const AdBlockRule* rule : allRules) {
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem(m_topItem);
|
auto* item = new QTreeWidgetItem(m_topItem);
|
||||||
item->setText(0, rule->filter());
|
item->setText(0, rule->filter());
|
||||||
item->setData(0, Qt::UserRole + 10, index);
|
item->setData(0, Qt::UserRole + 10, index);
|
||||||
|
|
||||||
|
@ -87,8 +87,7 @@
|
|||||||
static const int savedWindowVersion = 2;
|
static const int savedWindowVersion = 2;
|
||||||
|
|
||||||
BrowserWindow::SavedWindow::SavedWindow()
|
BrowserWindow::SavedWindow::SavedWindow()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
BrowserWindow::SavedWindow::SavedWindow(BrowserWindow *window)
|
BrowserWindow::SavedWindow::SavedWindow(BrowserWindow *window)
|
||||||
{
|
{
|
||||||
@ -356,7 +355,7 @@ void BrowserWindow::setupUi()
|
|||||||
}
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
QWidget* widget = new QWidget(this);
|
auto* widget = new QWidget(this);
|
||||||
widget->setCursor(Qt::ArrowCursor);
|
widget->setCursor(Qt::ArrowCursor);
|
||||||
setCentralWidget(widget);
|
setCentralWidget(widget);
|
||||||
|
|
||||||
@ -397,7 +396,7 @@ void BrowserWindow::setupUi()
|
|||||||
m_statusBar->addPermanentWidget(m_progressBar);
|
m_statusBar->addPermanentWidget(m_progressBar);
|
||||||
m_statusBar->addPermanentWidget(m_ipLabel);
|
m_statusBar->addPermanentWidget(m_ipLabel);
|
||||||
|
|
||||||
DownloadsButton *downloadsButton = new DownloadsButton(this);
|
auto *downloadsButton = new DownloadsButton(this);
|
||||||
m_statusBar->addButton(downloadsButton);
|
m_statusBar->addButton(downloadsButton);
|
||||||
m_navigationToolbar->addToolButton(downloadsButton);
|
m_navigationToolbar->addToolButton(downloadsButton);
|
||||||
|
|
||||||
@ -461,26 +460,26 @@ void BrowserWindow::setupMenu()
|
|||||||
m_mainMenu->initSuperMenu(m_superMenu);
|
m_mainMenu->initSuperMenu(m_superMenu);
|
||||||
|
|
||||||
// Setup other shortcuts
|
// Setup other shortcuts
|
||||||
QShortcut* reloadBypassCacheAction = new QShortcut(QKeySequence(QSL("Ctrl+F5")), this);
|
auto* reloadBypassCacheAction = new QShortcut(QKeySequence(QSL("Ctrl+F5")), this);
|
||||||
QShortcut* reloadBypassCacheAction2 = new QShortcut(QKeySequence(QSL("Ctrl+Shift+R")), this);
|
auto* reloadBypassCacheAction2 = new QShortcut(QKeySequence(QSL("Ctrl+Shift+R")), this);
|
||||||
connect(reloadBypassCacheAction, &QShortcut::activated, this, &BrowserWindow::reloadBypassCache);
|
connect(reloadBypassCacheAction, &QShortcut::activated, this, &BrowserWindow::reloadBypassCache);
|
||||||
connect(reloadBypassCacheAction2, &QShortcut::activated, this, &BrowserWindow::reloadBypassCache);
|
connect(reloadBypassCacheAction2, &QShortcut::activated, this, &BrowserWindow::reloadBypassCache);
|
||||||
|
|
||||||
QShortcut* closeTabAction = new QShortcut(QKeySequence(QSL("Ctrl+W")), this);
|
auto* closeTabAction = new QShortcut(QKeySequence(QSL("Ctrl+W")), this);
|
||||||
QShortcut* closeTabAction2 = new QShortcut(QKeySequence(QSL("Ctrl+F4")), this);
|
auto* closeTabAction2 = new QShortcut(QKeySequence(QSL("Ctrl+F4")), this);
|
||||||
connect(closeTabAction, &QShortcut::activated, this, &BrowserWindow::closeTab);
|
connect(closeTabAction, &QShortcut::activated, this, &BrowserWindow::closeTab);
|
||||||
connect(closeTabAction2, &QShortcut::activated, this, &BrowserWindow::closeTab);
|
connect(closeTabAction2, &QShortcut::activated, this, &BrowserWindow::closeTab);
|
||||||
|
|
||||||
QShortcut* reloadAction = new QShortcut(QKeySequence(QSL("Ctrl+R")), this);
|
auto* reloadAction = new QShortcut(QKeySequence(QSL("Ctrl+R")), this);
|
||||||
connect(reloadAction, &QShortcut::activated, this, &BrowserWindow::reload);
|
connect(reloadAction, &QShortcut::activated, this, &BrowserWindow::reload);
|
||||||
|
|
||||||
QShortcut* openLocationAction = new QShortcut(QKeySequence(QSL("Alt+D")), this);
|
auto* openLocationAction = new QShortcut(QKeySequence(QSL("Alt+D")), this);
|
||||||
connect(openLocationAction, &QShortcut::activated, this, &BrowserWindow::openLocation);
|
connect(openLocationAction, &QShortcut::activated, this, &BrowserWindow::openLocation);
|
||||||
|
|
||||||
QShortcut* inspectorAction = new QShortcut(QKeySequence(QSL("F12")), this);
|
auto* inspectorAction = new QShortcut(QKeySequence(QSL("F12")), this);
|
||||||
connect(inspectorAction, &QShortcut::activated, this, &BrowserWindow::toggleWebInspector);
|
connect(inspectorAction, &QShortcut::activated, this, &BrowserWindow::toggleWebInspector);
|
||||||
|
|
||||||
QShortcut* restoreClosedWindow = new QShortcut(QKeySequence(QSL("Ctrl+Shift+N")), this);
|
auto* restoreClosedWindow = new QShortcut(QKeySequence(QSL("Ctrl+Shift+N")), this);
|
||||||
connect(restoreClosedWindow, &QShortcut::activated, mApp->closedWindowsManager(), &ClosedWindowsManager::restoreClosedWindow);
|
connect(restoreClosedWindow, &QShortcut::activated, mApp->closedWindowsManager(), &ClosedWindowsManager::restoreClosedWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +499,7 @@ void BrowserWindow::updateStartupFocus()
|
|||||||
QAction* BrowserWindow::createEncodingAction(const QString &codecName,
|
QAction* BrowserWindow::createEncodingAction(const QString &codecName,
|
||||||
const QString &activeCodecName, QMenu* menu)
|
const QString &activeCodecName, QMenu* menu)
|
||||||
{
|
{
|
||||||
QAction* action = new QAction(codecName, menu);
|
auto* action = new QAction(codecName, menu);
|
||||||
action->setData(codecName);
|
action->setData(codecName);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
connect(action, &QAction::triggered, this, &BrowserWindow::changeEncoding);
|
connect(action, &QAction::triggered, this, &BrowserWindow::changeEncoding);
|
||||||
@ -522,10 +521,10 @@ void BrowserWindow::createEncodingSubMenu(const QString &name, QStringList &code
|
|||||||
return collator.compare(a, b) < 0;
|
return collator.compare(a, b) < 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
QMenu* subMenu = new QMenu(name, menu);
|
auto* subMenu = new QMenu(name, menu);
|
||||||
const QString activeCodecName = mApp->webSettings()->defaultTextEncoding();
|
const QString activeCodecName = mApp->webSettings()->defaultTextEncoding();
|
||||||
|
|
||||||
QActionGroup *group = new QActionGroup(subMenu);
|
auto *group = new QActionGroup(subMenu);
|
||||||
|
|
||||||
for (const QString &codecName : qAsConst(codecNames)) {
|
for (const QString &codecName : qAsConst(codecNames)) {
|
||||||
QAction *act = createEncodingAction(codecName, activeCodecName, subMenu);
|
QAction *act = createEncodingAction(codecName, activeCodecName, subMenu);
|
||||||
@ -654,7 +653,7 @@ TabbedWebView* BrowserWindow::weView() const
|
|||||||
|
|
||||||
TabbedWebView* BrowserWindow::weView(int index) const
|
TabbedWebView* BrowserWindow::weView(int index) const
|
||||||
{
|
{
|
||||||
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
|
auto* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
|
||||||
if (!webTab) {
|
if (!webTab) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -740,7 +739,7 @@ void BrowserWindow::setWindowTitle(const QString &t)
|
|||||||
|
|
||||||
void BrowserWindow::changeEncoding()
|
void BrowserWindow::changeEncoding()
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
const QString encoding = action->data().toString();
|
const QString encoding = action->data().toString();
|
||||||
mApp->webSettings()->setDefaultTextEncoding(encoding);
|
mApp->webSettings()->setDefaultTextEncoding(encoding);
|
||||||
|
|
||||||
@ -788,7 +787,7 @@ void BrowserWindow::loadActionUrl(QObject* obj)
|
|||||||
obj = sender();
|
obj = sender();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QAction* action = qobject_cast<QAction*>(obj)) {
|
if (auto* action = qobject_cast<QAction*>(obj)) {
|
||||||
loadAddress(action->data().toUrl());
|
loadAddress(action->data().toUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -799,7 +798,7 @@ void BrowserWindow::loadActionUrlInNewTab(QObject* obj)
|
|||||||
obj = sender();
|
obj = sender();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QAction* action = qobject_cast<QAction*>(obj)) {
|
if (auto* action = qobject_cast<QAction*>(obj)) {
|
||||||
m_tabWidget->addView(action->data().toUrl(), Qz::NT_SelectedTabAtTheEnd);
|
m_tabWidget->addView(action->data().toUrl(), Qz::NT_SelectedTabAtTheEnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1216,7 +1215,7 @@ void BrowserWindow::hideNavigationSlot()
|
|||||||
bool BrowserWindow::event(QEvent *event)
|
bool BrowserWindow::event(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::WindowStateChange) {
|
if (event->type() == QEvent::WindowStateChange) {
|
||||||
QWindowStateChangeEvent *e = static_cast<QWindowStateChangeEvent*>(event);
|
auto *e = static_cast<QWindowStateChangeEvent*>(event);
|
||||||
if (!(e->oldState() & Qt::WindowFullScreen) && windowState() & Qt::WindowFullScreen) {
|
if (!(e->oldState() & Qt::WindowFullScreen) && windowState() & Qt::WindowFullScreen) {
|
||||||
// Enter fullscreen
|
// Enter fullscreen
|
||||||
m_statusBarVisible = m_statusBar->isVisible();
|
m_statusBarVisible = m_statusBar->isVisible();
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
QString text;
|
QString text;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QVector<ActionPair> ActionPairList;
|
using ActionPairList = QVector<ActionPair>;
|
||||||
|
|
||||||
explicit CommandLineOptions();
|
explicit CommandLineOptions();
|
||||||
ActionPairList getActions();
|
ActionPairList getActions();
|
||||||
|
@ -34,8 +34,7 @@ DataPaths::DataPaths()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DataPaths::~DataPaths()
|
DataPaths::~DataPaths()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void DataPaths::setCurrentProfilePath(const QString &profilePath)
|
void DataPaths::setCurrentProfilePath(const QString &profilePath)
|
||||||
@ -89,7 +88,7 @@ QString DataPaths::locate(Path type, const QString &file)
|
|||||||
return fullPath;
|
return fullPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
@ -445,7 +445,7 @@ BrowserWindow* MainApplication::createWindow(Qz::BrowserWindowType type, const Q
|
|||||||
type = Qz::BW_FirstAppWindow;
|
type = Qz::BW_FirstAppWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserWindow* window = new BrowserWindow(type, startUrl);
|
auto* window = new BrowserWindow(type, startUrl);
|
||||||
connect(window, &QObject::destroyed, this, &MainApplication::windowDestroyed);
|
connect(window, &QObject::destroyed, this, &MainApplication::windowDestroyed);
|
||||||
|
|
||||||
m_windows.prepend(window);
|
m_windows.prepend(window);
|
||||||
@ -682,7 +682,7 @@ void MainApplication::addNewTab(const QUrl &url)
|
|||||||
void MainApplication::startPrivateBrowsing(const QUrl &startUrl)
|
void MainApplication::startPrivateBrowsing(const QUrl &startUrl)
|
||||||
{
|
{
|
||||||
QUrl url = startUrl;
|
QUrl url = startUrl;
|
||||||
if (QAction* act = qobject_cast<QAction*>(sender())) {
|
if (auto* act = qobject_cast<QAction*>(sender())) {
|
||||||
url = act->data().toUrl();
|
url = act->data().toUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,7 +863,7 @@ void MainApplication::messageReceived(const QString &message)
|
|||||||
actWin = downloadManager();
|
actWin = downloadManager();
|
||||||
}
|
}
|
||||||
else if (text == QLatin1String("ToggleFullScreen") && actWin) {
|
else if (text == QLatin1String("ToggleFullScreen") && actWin) {
|
||||||
BrowserWindow* qz = static_cast<BrowserWindow*>(actWin);
|
auto* qz = static_cast<BrowserWindow*>(actWin);
|
||||||
qz->toggleFullScreen();
|
qz->toggleFullScreen();
|
||||||
}
|
}
|
||||||
else if (text.startsWith(QLatin1String("OpenUrlInCurrentTab"))) {
|
else if (text.startsWith(QLatin1String("OpenUrlInCurrentTab"))) {
|
||||||
@ -892,7 +892,7 @@ void MainApplication::messageReceived(const QString &message)
|
|||||||
actWin->activateWindow();
|
actWin->activateWindow();
|
||||||
actWin->setFocus();
|
actWin->setFocus();
|
||||||
|
|
||||||
BrowserWindow* win = qobject_cast<BrowserWindow*>(actWin);
|
auto* win = qobject_cast<BrowserWindow*>(actWin);
|
||||||
|
|
||||||
if (win && !actUrl.isEmpty()) {
|
if (win && !actUrl.isEmpty()) {
|
||||||
win->loadAddress(actUrl);
|
win->loadAddress(actUrl);
|
||||||
@ -910,7 +910,7 @@ void MainApplication::windowDestroyed(QObject* window)
|
|||||||
|
|
||||||
void MainApplication::onFocusChanged()
|
void MainApplication::onFocusChanged()
|
||||||
{
|
{
|
||||||
BrowserWindow* activeBrowserWindow = qobject_cast<BrowserWindow*>(activeWindow());
|
auto* activeBrowserWindow = qobject_cast<BrowserWindow*>(activeWindow());
|
||||||
|
|
||||||
if (activeBrowserWindow) {
|
if (activeBrowserWindow) {
|
||||||
m_lastActiveWindow = activeBrowserWindow;
|
m_lastActiveWindow = activeBrowserWindow;
|
||||||
|
@ -81,7 +81,7 @@ void MainMenu::initSuperMenu(QMenu* superMenu) const
|
|||||||
superMenu->addAction(m_actions[QSL("File/OpenFile")]);
|
superMenu->addAction(m_actions[QSL("File/OpenFile")]);
|
||||||
if (mApp->sessionManager()) {
|
if (mApp->sessionManager()) {
|
||||||
superMenu->addSeparator();
|
superMenu->addSeparator();
|
||||||
QMenu* sessionsSubmenu = new QMenu(tr("Sessions"));
|
auto* sessionsSubmenu = new QMenu(tr("Sessions"));
|
||||||
connect(sessionsSubmenu, SIGNAL(aboutToShow()), mApp->sessionManager(), SLOT(aboutToShowSessionsMenu()));
|
connect(sessionsSubmenu, SIGNAL(aboutToShow()), mApp->sessionManager(), SLOT(aboutToShowSessionsMenu()));
|
||||||
superMenu->addMenu(sessionsSubmenu);
|
superMenu->addMenu(sessionsSubmenu);
|
||||||
superMenu->addAction(m_actions[QSL("File/SessionManager")]);
|
superMenu->addAction(m_actions[QSL("File/SessionManager")]);
|
||||||
@ -119,7 +119,7 @@ QAction* MainMenu::action(const QString &name) const
|
|||||||
|
|
||||||
void MainMenu::showAboutDialog()
|
void MainMenu::showAboutDialog()
|
||||||
{
|
{
|
||||||
AboutDialog* dialog = new AboutDialog(m_window);
|
auto* dialog = new AboutDialog(m_window);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ void MainMenu::webSearch()
|
|||||||
void MainMenu::showSiteInfo()
|
void MainMenu::showSiteInfo()
|
||||||
{
|
{
|
||||||
if (m_window && SiteInfo::canShowSiteInfo(m_window->weView()->url())) {
|
if (m_window && SiteInfo::canShowSiteInfo(m_window->weView()->url())) {
|
||||||
SiteInfo* info = new SiteInfo(m_window->weView());
|
auto* info = new SiteInfo(m_window->weView());
|
||||||
info->show();
|
info->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -309,7 +309,7 @@ void MainMenu::showDownloadManager()
|
|||||||
|
|
||||||
void MainMenu::showCookieManager()
|
void MainMenu::showCookieManager()
|
||||||
{
|
{
|
||||||
CookieManager* m = new CookieManager(m_window);
|
auto* m = new CookieManager(m_window);
|
||||||
m->show();
|
m->show();
|
||||||
m->raise();
|
m->raise();
|
||||||
}
|
}
|
||||||
@ -321,7 +321,7 @@ void MainMenu::toggleWebInspector()
|
|||||||
|
|
||||||
void MainMenu::showClearRecentHistoryDialog()
|
void MainMenu::showClearRecentHistoryDialog()
|
||||||
{
|
{
|
||||||
ClearPrivateData* dialog = new ClearPrivateData(m_window);
|
auto* dialog = new ClearPrivateData(m_window);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ void MainMenu::aboutToShowSuperMenu()
|
|||||||
|
|
||||||
void MainMenu::aboutToShowToolbarsMenu()
|
void MainMenu::aboutToShowToolbarsMenu()
|
||||||
{
|
{
|
||||||
QMenu* menu = qobject_cast<QMenu*>(sender());
|
auto* menu = qobject_cast<QMenu*>(sender());
|
||||||
Q_ASSERT(menu);
|
Q_ASSERT(menu);
|
||||||
|
|
||||||
if (m_window) {
|
if (m_window) {
|
||||||
@ -429,7 +429,7 @@ void MainMenu::aboutToShowToolbarsMenu()
|
|||||||
|
|
||||||
void MainMenu::aboutToShowSidebarsMenu()
|
void MainMenu::aboutToShowSidebarsMenu()
|
||||||
{
|
{
|
||||||
QMenu* menu = qobject_cast<QMenu*>(sender());
|
auto* menu = qobject_cast<QMenu*>(sender());
|
||||||
Q_ASSERT(menu);
|
Q_ASSERT(menu);
|
||||||
|
|
||||||
if (m_window) {
|
if (m_window) {
|
||||||
@ -439,7 +439,7 @@ void MainMenu::aboutToShowSidebarsMenu()
|
|||||||
|
|
||||||
void MainMenu::aboutToShowEncodingMenu()
|
void MainMenu::aboutToShowEncodingMenu()
|
||||||
{
|
{
|
||||||
QMenu* menu = qobject_cast<QMenu*>(sender());
|
auto* menu = qobject_cast<QMenu*>(sender());
|
||||||
Q_ASSERT(menu);
|
Q_ASSERT(menu);
|
||||||
|
|
||||||
if (m_window) {
|
if (m_window) {
|
||||||
@ -464,7 +464,7 @@ void MainMenu::init()
|
|||||||
m_actions[QSL(name)] = action
|
m_actions[QSL(name)] = action
|
||||||
|
|
||||||
// Standard actions - needed on Mac to be placed correctly in "application" menu
|
// Standard actions - needed on Mac to be placed correctly in "application" menu
|
||||||
QAction* action = new QAction(QIcon::fromTheme(QSL("help-about")), tr("&About Falkon"), this);
|
auto* action = new QAction(QIcon::fromTheme(QSL("help-about")), tr("&About Falkon"), this);
|
||||||
action->setMenuRole(QAction::AboutRole);
|
action->setMenuRole(QAction::AboutRole);
|
||||||
connect(action, &QAction::triggered, this, &MainMenu::showAboutDialog);
|
connect(action, &QAction::triggered, this, &MainMenu::showAboutDialog);
|
||||||
m_actions[QSL("Standard/About")] = action;
|
m_actions[QSL("Standard/About")] = action;
|
||||||
@ -494,7 +494,7 @@ void MainMenu::init()
|
|||||||
m_menuFile->addSeparator();
|
m_menuFile->addSeparator();
|
||||||
|
|
||||||
if (mApp->sessionManager()) {
|
if (mApp->sessionManager()) {
|
||||||
QMenu* sessionsSubmenu = new QMenu(tr("Sessions"));
|
auto* sessionsSubmenu = new QMenu(tr("Sessions"));
|
||||||
connect(sessionsSubmenu, SIGNAL(aboutToShow()), mApp->sessionManager(), SLOT(aboutToShowSessionsMenu()));
|
connect(sessionsSubmenu, SIGNAL(aboutToShow()), mApp->sessionManager(), SLOT(aboutToShowSessionsMenu()));
|
||||||
m_menuFile->addMenu(sessionsSubmenu);
|
m_menuFile->addMenu(sessionsSubmenu);
|
||||||
action = new QAction(tr("Session Manager"), this);
|
action = new QAction(tr("Session Manager"), this);
|
||||||
@ -536,11 +536,11 @@ void MainMenu::init()
|
|||||||
m_menuView = new QMenu(tr("&View"));
|
m_menuView = new QMenu(tr("&View"));
|
||||||
connect(m_menuView, &QMenu::aboutToShow, this, &MainMenu::aboutToShowViewMenu);
|
connect(m_menuView, &QMenu::aboutToShow, this, &MainMenu::aboutToShowViewMenu);
|
||||||
|
|
||||||
QMenu* toolbarsMenu = new QMenu(tr("Toolbars"));
|
auto* toolbarsMenu = new QMenu(tr("Toolbars"));
|
||||||
connect(toolbarsMenu, &QMenu::aboutToShow, this, &MainMenu::aboutToShowToolbarsMenu);
|
connect(toolbarsMenu, &QMenu::aboutToShow, this, &MainMenu::aboutToShowToolbarsMenu);
|
||||||
QMenu* sidebarMenu = new QMenu(tr("Sidebar"));
|
auto* sidebarMenu = new QMenu(tr("Sidebar"));
|
||||||
connect(sidebarMenu, &QMenu::aboutToShow, this, &MainMenu::aboutToShowSidebarsMenu);
|
connect(sidebarMenu, &QMenu::aboutToShow, this, &MainMenu::aboutToShowSidebarsMenu);
|
||||||
QMenu* encodingMenu = new QMenu(tr("Character &Encoding"));
|
auto* encodingMenu = new QMenu(tr("Character &Encoding"));
|
||||||
connect(encodingMenu, &QMenu::aboutToShow, this, &MainMenu::aboutToShowEncodingMenu);
|
connect(encodingMenu, &QMenu::aboutToShow, this, &MainMenu::aboutToShowEncodingMenu);
|
||||||
|
|
||||||
// Create menus to make shortcuts available even before first showing the menu
|
// Create menus to make shortcuts available even before first showing the menu
|
||||||
|
@ -33,8 +33,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
ProfileManager::ProfileManager()
|
ProfileManager::ProfileManager()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
void ProfileManager::initConfigDir()
|
void ProfileManager::initConfigDir()
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ int ProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption* option, cons
|
|||||||
void ProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
|
void ProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
|
||||||
{
|
{
|
||||||
if (element == PE_FrameTabBarBase) {
|
if (element == PE_FrameTabBarBase) {
|
||||||
TabBarHelper *tabBar = qobject_cast<TabBarHelper*>(option->styleObject);
|
auto *tabBar = qobject_cast<TabBarHelper*>(option->styleObject);
|
||||||
if (tabBar && tabBar->baseColor().isValid()) {
|
if (tabBar && tabBar->baseColor().isValid()) {
|
||||||
painter->setPen(QPen(tabBar->baseColor(), 0));
|
painter->setPen(QPen(tabBar->baseColor(), 0));
|
||||||
painter->drawLine(option->rect.topLeft(), option->rect.topRight());
|
painter->drawLine(option->rect.topLeft(), option->rect.topRight());
|
||||||
|
@ -210,7 +210,7 @@ void AutoFill::saveForm(WebPage *page, const QUrl &frameUrl, const PageFormData
|
|||||||
m_lastNotification->close();
|
m_lastNotification->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoFillNotification* aWidget = new AutoFillNotification(frameUrl, formData, updateData);
|
auto* aWidget = new AutoFillNotification(frameUrl, formData, updateData);
|
||||||
page->view()->addNotification(aWidget);
|
page->view()->addNotification(aWidget);
|
||||||
|
|
||||||
m_lastNotification = aWidget;
|
m_lastNotification = aWidget;
|
||||||
|
@ -48,7 +48,7 @@ void AutoFillIcon::iconClicked()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoFillWidget* widget = new AutoFillWidget(m_view, this);
|
auto* widget = new AutoFillWidget(m_view, this);
|
||||||
widget->setUsernames(m_usernames);
|
widget->setUsernames(m_usernames);
|
||||||
widget->showAt(parentWidget());
|
widget->showAt(parentWidget());
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ void AutoFillWidget::setUsernames(const QStringList &usernames)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPushButton* button = new QPushButton(this);
|
auto* button = new QPushButton(this);
|
||||||
button->setIcon(QIcon(QSL(":icons/other/login.png")));
|
button->setIcon(QIcon(QSL(":icons/other/login.png")));
|
||||||
button->setStyleSheet(QSL("text-align:left;font-weight:bold;"));
|
button->setStyleSheet(QSL("text-align:left;font-weight:bold;"));
|
||||||
button->setText(username);
|
button->setText(username);
|
||||||
|
@ -44,8 +44,7 @@ DatabaseEncryptedPasswordBackend::DatabaseEncryptedPasswordBackend()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatabaseEncryptedPasswordBackend::~DatabaseEncryptedPasswordBackend()
|
DatabaseEncryptedPasswordBackend::~DatabaseEncryptedPasswordBackend()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
QStringList DatabaseEncryptedPasswordBackend::getUsernames(const QUrl &url)
|
QStringList DatabaseEncryptedPasswordBackend::getUsernames(const QUrl &url)
|
||||||
{
|
{
|
||||||
@ -265,7 +264,7 @@ bool DatabaseEncryptedPasswordBackend::hasSettings() const
|
|||||||
|
|
||||||
void DatabaseEncryptedPasswordBackend::showSettings(QWidget* parent)
|
void DatabaseEncryptedPasswordBackend::showSettings(QWidget* parent)
|
||||||
{
|
{
|
||||||
MasterPasswordDialog* masterPasswordDialog = new MasterPasswordDialog(this, parent);
|
auto* masterPasswordDialog = new MasterPasswordDialog(this, parent);
|
||||||
masterPasswordDialog->showSettingPage();
|
masterPasswordDialog->showSettingPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +294,7 @@ bool DatabaseEncryptedPasswordBackend::hasPermission()
|
|||||||
|
|
||||||
m_askPasswordDialogVisible = true;
|
m_askPasswordDialogVisible = true;
|
||||||
|
|
||||||
AskMasterPassword* dialog = new AskMasterPassword(this);
|
auto* dialog = new AskMasterPassword(this);
|
||||||
|
|
||||||
bool authorized = dialog->exec() == QDialog::Accepted;
|
bool authorized = dialog->exec() == QDialog::Accepted;
|
||||||
|
|
||||||
@ -349,7 +348,7 @@ bool DatabaseEncryptedPasswordBackend::encryptPasswordEntry(PasswordEntry &entry
|
|||||||
|
|
||||||
void DatabaseEncryptedPasswordBackend::showMasterPasswordDialog()
|
void DatabaseEncryptedPasswordBackend::showMasterPasswordDialog()
|
||||||
{
|
{
|
||||||
MasterPasswordDialog* masterPasswordDialog = new MasterPasswordDialog(this, mApp->getWindow());
|
auto* masterPasswordDialog = new MasterPasswordDialog(this, mApp->getWindow());
|
||||||
masterPasswordDialog->showSetMasterPasswordPage();
|
masterPasswordDialog->showSetMasterPasswordPage();
|
||||||
masterPasswordDialog->delayedExec();
|
masterPasswordDialog->delayedExec();
|
||||||
}
|
}
|
||||||
@ -669,8 +668,8 @@ AskMasterPassword::AskMasterPassword(DatabaseEncryptedPasswordBackend* backend,
|
|||||||
setWindowModality(Qt::ApplicationModal);
|
setWindowModality(Qt::ApplicationModal);
|
||||||
setWindowTitle(AutoFill::tr("Enter Master Password"));
|
setWindowTitle(AutoFill::tr("Enter Master Password"));
|
||||||
|
|
||||||
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
|
auto* verticalLayout = new QVBoxLayout(this);
|
||||||
QLabel* label = new QLabel(this);
|
auto* label = new QLabel(this);
|
||||||
label->setText(AutoFill::tr("Permission is required, please enter Master Password:"));
|
label->setText(AutoFill::tr("Permission is required, please enter Master Password:"));
|
||||||
m_lineEdit = new QLineEdit(this);
|
m_lineEdit = new QLineEdit(this);
|
||||||
m_lineEdit->setEchoMode(QLineEdit::Password);
|
m_lineEdit->setEchoMode(QLineEdit::Password);
|
||||||
|
@ -27,7 +27,7 @@ class FALKON_EXPORT PasswordBackend
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PasswordBackend();
|
explicit PasswordBackend();
|
||||||
virtual ~PasswordBackend() { }
|
virtual ~PasswordBackend() = default;
|
||||||
|
|
||||||
virtual QString name() const = 0;
|
virtual QString name() const = 0;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ QIcon BookmarkItem::icon()
|
|||||||
case Folder:
|
case Folder:
|
||||||
return IconProvider::standardIcon(QStyle::SP_DirIcon);
|
return IconProvider::standardIcon(QStyle::SP_DirIcon);
|
||||||
default:
|
default:
|
||||||
return QIcon();
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ void Bookmarks::readBookmarks(const QVariantList &list, BookmarkItem* parent)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarkItem* item = new BookmarkItem(type, parent);
|
auto* item = new BookmarkItem(type, parent);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BookmarkItem::Url:
|
case BookmarkItem::Url:
|
||||||
|
@ -23,8 +23,7 @@ BookmarksExporter::BookmarksExporter(QObject* parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BookmarksExporter::~BookmarksExporter()
|
BookmarksExporter::~BookmarksExporter()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
bool BookmarksExporter::error() const
|
bool BookmarksExporter::error() const
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ bool HtmlExporter::exportBookmarks(BookmarkItem* root)
|
|||||||
stream << "<!-- This is an automatically generated file." << endl;
|
stream << "<!-- This is an automatically generated file." << endl;
|
||||||
stream << " It will be read and overwritten." << endl;
|
stream << " It will be read and overwritten." << endl;
|
||||||
stream << " DO NOT EDIT! -->" << endl;
|
stream << " DO NOT EDIT! -->" << endl;
|
||||||
stream << "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">" << endl;
|
stream << R"(<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">)" << endl;
|
||||||
stream << "<TITLE>Bookmarks</TITLE>" << endl;
|
stream << "<TITLE>Bookmarks</TITLE>" << endl;
|
||||||
stream << "<H1>Bookmarks</H1>" << endl;
|
stream << "<H1>Bookmarks</H1>" << endl;
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ void BookmarksIcon::iconClicked()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarksWidget* widget = new BookmarksWidget(m_view, m_bookmark, parentWidget());
|
auto* widget = new BookmarksWidget(m_view, m_bookmark, parentWidget());
|
||||||
widget->showAt(parentWidget());
|
widget->showAt(parentWidget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,8 +23,7 @@ BookmarksImporter::BookmarksImporter(QObject* parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BookmarksImporter::~BookmarksImporter()
|
BookmarksImporter::~BookmarksImporter()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
bool BookmarksImporter::error() const
|
bool BookmarksImporter::error() const
|
||||||
{
|
{
|
||||||
|
@ -79,18 +79,18 @@ BookmarkItem* ChromeImporter::importBookmarks()
|
|||||||
|
|
||||||
QVariantMap rootMap = res.toMap().value(QSL("roots")).toMap();
|
QVariantMap rootMap = res.toMap().value(QSL("roots")).toMap();
|
||||||
|
|
||||||
BookmarkItem* root = new BookmarkItem(BookmarkItem::Folder);
|
auto* root = new BookmarkItem(BookmarkItem::Folder);
|
||||||
root->setTitle(QSL("Chrome Import"));
|
root->setTitle(QSL("Chrome Import"));
|
||||||
|
|
||||||
BookmarkItem* toolbar = new BookmarkItem(BookmarkItem::Folder, root);
|
auto* toolbar = new BookmarkItem(BookmarkItem::Folder, root);
|
||||||
toolbar->setTitle(rootMap.value(QSL("bookmark_bar")).toMap().value(QSL("name")).toString());
|
toolbar->setTitle(rootMap.value(QSL("bookmark_bar")).toMap().value(QSL("name")).toString());
|
||||||
readBookmarks(rootMap.value(QSL("bookmark_bar")).toMap().value(QSL("children")).toList(), toolbar);
|
readBookmarks(rootMap.value(QSL("bookmark_bar")).toMap().value(QSL("children")).toList(), toolbar);
|
||||||
|
|
||||||
BookmarkItem* other = new BookmarkItem(BookmarkItem::Folder, root);
|
auto* other = new BookmarkItem(BookmarkItem::Folder, root);
|
||||||
other->setTitle(rootMap.value(QSL("other")).toMap().value(QSL("name")).toString());
|
other->setTitle(rootMap.value(QSL("other")).toMap().value(QSL("name")).toString());
|
||||||
readBookmarks(rootMap.value(QSL("other")).toMap().value(QSL("children")).toList(), other);
|
readBookmarks(rootMap.value(QSL("other")).toMap().value(QSL("children")).toList(), other);
|
||||||
|
|
||||||
BookmarkItem* synced = new BookmarkItem(BookmarkItem::Folder, root);
|
auto* synced = new BookmarkItem(BookmarkItem::Folder, root);
|
||||||
synced->setTitle(rootMap.value(QSL("synced")).toMap().value(QSL("name")).toString());
|
synced->setTitle(rootMap.value(QSL("synced")).toMap().value(QSL("name")).toString());
|
||||||
readBookmarks(rootMap.value(QSL("synced")).toMap().value(QSL("synced")).toList(), other);
|
readBookmarks(rootMap.value(QSL("synced")).toMap().value(QSL("synced")).toList(), other);
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ void ChromeImporter::readBookmarks(const QVariantList &list, BookmarkItem* paren
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarkItem* item = new BookmarkItem(type, parent);
|
auto* item = new BookmarkItem(type, parent);
|
||||||
item->setTitle(map.value(QSL("name")).toString());
|
item->setTitle(map.value(QSL("name")).toString());
|
||||||
|
|
||||||
if (item->isUrl()) {
|
if (item->isUrl()) {
|
||||||
|
@ -85,7 +85,7 @@ BookmarkItem* FirefoxImporter::importBookmarks()
|
|||||||
{
|
{
|
||||||
QList<Item> items;
|
QList<Item> items;
|
||||||
|
|
||||||
BookmarkItem* root = new BookmarkItem(BookmarkItem::Folder);
|
auto* root = new BookmarkItem(BookmarkItem::Folder);
|
||||||
root->setTitle(QStringLiteral("Firefox Import"));
|
root->setTitle(QStringLiteral("Firefox Import"));
|
||||||
|
|
||||||
QSqlQuery query(QSqlDatabase::database(CONNECTION));
|
QSqlQuery query(QSqlDatabase::database(CONNECTION));
|
||||||
@ -128,7 +128,7 @@ BookmarkItem* FirefoxImporter::importBookmarks()
|
|||||||
|
|
||||||
for (const Item &item : qAsConst(items)) {
|
for (const Item &item : qAsConst(items)) {
|
||||||
BookmarkItem* parent = hash.value(item.parent);
|
BookmarkItem* parent = hash.value(item.parent);
|
||||||
BookmarkItem* bookmark = new BookmarkItem(item.type, parent ? parent : root);
|
auto* bookmark = new BookmarkItem(item.type, parent ? parent : root);
|
||||||
bookmark->setTitle(item.title.isEmpty() ? item.url.toString() : item.title);
|
bookmark->setTitle(item.title.isEmpty() ? item.url.toString() : item.title);
|
||||||
bookmark->setUrl(item.url);
|
bookmark->setUrl(item.url);
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ BookmarkItem* HtmlImporter::importBookmarks()
|
|||||||
bookmarks = bookmarks.left(bookmarks.lastIndexOf(QLatin1String("</dl><p>")));
|
bookmarks = bookmarks.left(bookmarks.lastIndexOf(QLatin1String("</dl><p>")));
|
||||||
int start = bookmarks.indexOf(QLatin1String("<dl><p>"));
|
int start = bookmarks.indexOf(QLatin1String("<dl><p>"));
|
||||||
|
|
||||||
BookmarkItem* root = new BookmarkItem(BookmarkItem::Folder);
|
auto* root = new BookmarkItem(BookmarkItem::Folder);
|
||||||
root->setTitle(QStringLiteral("HTML Import"));
|
root->setTitle(QStringLiteral("HTML Import"));
|
||||||
|
|
||||||
QList<BookmarkItem*> folders;
|
QList<BookmarkItem*> folders;
|
||||||
@ -118,7 +118,7 @@ BookmarkItem* HtmlImporter::importBookmarks()
|
|||||||
QRegularExpressionMatch match = rx.match(string);
|
QRegularExpressionMatch match = rx.match(string);
|
||||||
QString folderName = match.captured(2).trimmed();
|
QString folderName = match.captured(2).trimmed();
|
||||||
|
|
||||||
BookmarkItem* folder = new BookmarkItem(BookmarkItem::Folder, folders.isEmpty() ? root : folders.last());
|
auto* folder = new BookmarkItem(BookmarkItem::Folder, folders.isEmpty() ? root : folders.last());
|
||||||
folder->setTitle(folderName);
|
folder->setTitle(folderName);
|
||||||
folders.append(folder);
|
folders.append(folder);
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ BookmarkItem* HtmlImporter::importBookmarks()
|
|||||||
if (url.isEmpty() || url.scheme() == QL1S("place") || url.scheme() == QL1S("about"))
|
if (url.isEmpty() || url.scheme() == QL1S("place") || url.scheme() == QL1S("about"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BookmarkItem* b = new BookmarkItem(BookmarkItem::Url, folders.isEmpty() ? root : folders.last());
|
auto* b = new BookmarkItem(BookmarkItem::Url, folders.isEmpty() ? root : folders.last());
|
||||||
b->setTitle(linkName.isEmpty() ? url.toString() : linkName);
|
b->setTitle(linkName.isEmpty() ? url.toString() : linkName);
|
||||||
b->setUrl(url);
|
b->setUrl(url);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ bool IeImporter::prepareImport()
|
|||||||
|
|
||||||
BookmarkItem* IeImporter::importBookmarks()
|
BookmarkItem* IeImporter::importBookmarks()
|
||||||
{
|
{
|
||||||
BookmarkItem* root = new BookmarkItem(BookmarkItem::Folder);
|
auto* root = new BookmarkItem(BookmarkItem::Folder);
|
||||||
root->setTitle(QStringLiteral("Internet Explorer Import"));
|
root->setTitle(QStringLiteral("Internet Explorer Import"));
|
||||||
|
|
||||||
readDir(QDir(m_path), root);
|
readDir(QDir(m_path), root);
|
||||||
@ -70,7 +70,7 @@ void IeImporter::readDir(const QDir &dir, BookmarkItem *parent)
|
|||||||
const auto files = dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
const auto files = dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||||
for (const QFileInfo &file : files) {
|
for (const QFileInfo &file : files) {
|
||||||
if (file.isDir()) {
|
if (file.isDir()) {
|
||||||
BookmarkItem* folder = new BookmarkItem(BookmarkItem::Folder, parent);
|
auto* folder = new BookmarkItem(BookmarkItem::Folder, parent);
|
||||||
folder->setTitle(file.baseName());
|
folder->setTitle(file.baseName());
|
||||||
|
|
||||||
QDir folderDir = dir;
|
QDir folderDir = dir;
|
||||||
@ -81,7 +81,7 @@ void IeImporter::readDir(const QDir &dir, BookmarkItem *parent)
|
|||||||
QSettings urlFile(file.absoluteFilePath(), QSettings::IniFormat);
|
QSettings urlFile(file.absoluteFilePath(), QSettings::IniFormat);
|
||||||
const QUrl url = urlFile.value(QStringLiteral("InternetShortcut/URL")).toUrl();
|
const QUrl url = urlFile.value(QStringLiteral("InternetShortcut/URL")).toUrl();
|
||||||
|
|
||||||
BookmarkItem* item = new BookmarkItem(BookmarkItem::Url, parent);
|
auto* item = new BookmarkItem(BookmarkItem::Url, parent);
|
||||||
item->setTitle(file.baseName());
|
item->setTitle(file.baseName());
|
||||||
item->setUrl(url);
|
item->setUrl(url);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ bool OperaImporter::prepareImport()
|
|||||||
|
|
||||||
BookmarkItem* OperaImporter::importBookmarks()
|
BookmarkItem* OperaImporter::importBookmarks()
|
||||||
{
|
{
|
||||||
BookmarkItem* root = new BookmarkItem(BookmarkItem::Folder);
|
auto* root = new BookmarkItem(BookmarkItem::Folder);
|
||||||
root->setTitle(QSL("Opera Import"));
|
root->setTitle(QSL("Opera Import"));
|
||||||
|
|
||||||
QList<BookmarkItem*> folders;
|
QList<BookmarkItem*> folders;
|
||||||
|
@ -173,7 +173,7 @@ void BookmarksManager::openBookmarkInNewPrivateWindow(BookmarkItem* item)
|
|||||||
|
|
||||||
void BookmarksManager::addBookmark()
|
void BookmarksManager::addBookmark()
|
||||||
{
|
{
|
||||||
BookmarkItem* item = new BookmarkItem(BookmarkItem::Url);
|
auto* item = new BookmarkItem(BookmarkItem::Url);
|
||||||
item->setTitle(tr("New Bookmark"));
|
item->setTitle(tr("New Bookmark"));
|
||||||
item->setUrl(QUrl(QSL("http://")));
|
item->setUrl(QUrl(QSL("http://")));
|
||||||
addBookmark(item);
|
addBookmark(item);
|
||||||
@ -181,14 +181,14 @@ void BookmarksManager::addBookmark()
|
|||||||
|
|
||||||
void BookmarksManager::addFolder()
|
void BookmarksManager::addFolder()
|
||||||
{
|
{
|
||||||
BookmarkItem* item = new BookmarkItem(BookmarkItem::Folder);
|
auto* item = new BookmarkItem(BookmarkItem::Folder);
|
||||||
item->setTitle(tr("New Folder"));
|
item->setTitle(tr("New Folder"));
|
||||||
addBookmark(item);
|
addBookmark(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookmarksManager::addSeparator()
|
void BookmarksManager::addSeparator()
|
||||||
{
|
{
|
||||||
BookmarkItem* item = new BookmarkItem(BookmarkItem::Separator);
|
auto* item = new BookmarkItem(BookmarkItem::Separator);
|
||||||
addBookmark(item);
|
addBookmark(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ void BookmarksManager::updateEditBox(BookmarkItem* item)
|
|||||||
ui->keyword->setVisible(showAddressAndKeyword);
|
ui->keyword->setVisible(showAddressAndKeyword);
|
||||||
|
|
||||||
// Without removing widgets from layout, there is unwanted extra spacing
|
// Without removing widgets from layout, there is unwanted extra spacing
|
||||||
QFormLayout* l = static_cast<QFormLayout*>(ui->editBox->layout());
|
auto* l = static_cast<QFormLayout*>(ui->editBox->layout());
|
||||||
|
|
||||||
if (showAddressAndKeyword) {
|
if (showAddressAndKeyword) {
|
||||||
// Show Address + Keyword
|
// Show Address + Keyword
|
||||||
|
@ -102,7 +102,7 @@ void BookmarksMenu::menuMiddleClicked(Menu* menu)
|
|||||||
|
|
||||||
void BookmarksMenu::bookmarkActivated()
|
void BookmarksMenu::bookmarkActivated()
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
BookmarkItem* item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
BookmarkItem* item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
||||||
Q_ASSERT(item);
|
Q_ASSERT(item);
|
||||||
openBookmark(item);
|
openBookmark(item);
|
||||||
@ -111,7 +111,7 @@ void BookmarksMenu::bookmarkActivated()
|
|||||||
|
|
||||||
void BookmarksMenu::bookmarkCtrlActivated()
|
void BookmarksMenu::bookmarkCtrlActivated()
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
BookmarkItem* item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
BookmarkItem* item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
||||||
Q_ASSERT(item);
|
Q_ASSERT(item);
|
||||||
openBookmarkInNewTab(item);
|
openBookmarkInNewTab(item);
|
||||||
@ -120,7 +120,7 @@ void BookmarksMenu::bookmarkCtrlActivated()
|
|||||||
|
|
||||||
void BookmarksMenu::bookmarkShiftActivated()
|
void BookmarksMenu::bookmarkShiftActivated()
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
BookmarkItem* item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
BookmarkItem* item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
||||||
Q_ASSERT(item);
|
Q_ASSERT(item);
|
||||||
openBookmarkInNewWindow(item);
|
openBookmarkInNewWindow(item);
|
||||||
|
@ -94,7 +94,7 @@ QVariant BookmarksModel::data(const QModelIndex &index, int role) const
|
|||||||
BookmarkItem* itm = item(index);
|
BookmarkItem* itm = item(index);
|
||||||
|
|
||||||
if (!itm) {
|
if (!itm) {
|
||||||
return QVariant();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
@ -128,15 +128,15 @@ QVariant BookmarksModel::data(const QModelIndex &index, int role) const
|
|||||||
case 1:
|
case 1:
|
||||||
return itm->url().toEncoded();
|
return itm->url().toEncoded();
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return {};
|
||||||
}
|
}
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
if (index.column() == 0) {
|
if (index.column() == 0) {
|
||||||
return itm->icon();
|
return itm->icon();
|
||||||
}
|
}
|
||||||
return QVariant();
|
return {};
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ QStringList BookmarksModel::mimeTypes() const
|
|||||||
|
|
||||||
QMimeData* BookmarksModel::mimeData(const QModelIndexList &indexes) const
|
QMimeData* BookmarksModel::mimeData(const QModelIndexList &indexes) const
|
||||||
{
|
{
|
||||||
QMimeData* mimeData = new QMimeData();
|
auto* mimeData = new QMimeData();
|
||||||
QByteArray encodedData;
|
QByteArray encodedData;
|
||||||
|
|
||||||
QDataStream stream(&encodedData, QIODevice::WriteOnly);
|
QDataStream stream(&encodedData, QIODevice::WriteOnly);
|
||||||
@ -269,7 +269,7 @@ bool BookmarksModel::dropMimeData(const QMimeData* data, Qt::DropAction action,
|
|||||||
QModelIndex BookmarksModel::parent(const QModelIndex &child) const
|
QModelIndex BookmarksModel::parent(const QModelIndex &child) const
|
||||||
{
|
{
|
||||||
if (!child.isValid()) {
|
if (!child.isValid()) {
|
||||||
return QModelIndex();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarkItem* itm = item(child);
|
BookmarkItem* itm = item(child);
|
||||||
@ -279,7 +279,7 @@ QModelIndex BookmarksModel::parent(const QModelIndex &child) const
|
|||||||
QModelIndex BookmarksModel::index(int row, int column, const QModelIndex &parent) const
|
QModelIndex BookmarksModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if (!hasIndex(row, column, parent)) {
|
if (!hasIndex(row, column, parent)) {
|
||||||
return QModelIndex();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarkItem* parentItem = item(parent);
|
BookmarkItem* parentItem = item(parent);
|
||||||
@ -291,7 +291,7 @@ QModelIndex BookmarksModel::index(BookmarkItem* item, int column) const
|
|||||||
BookmarkItem* parent = item->parent();
|
BookmarkItem* parent = item->parent();
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
return QModelIndex();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return createIndex(parent->children().indexOf(item), column, item);
|
return createIndex(parent->children().indexOf(item), column, item);
|
||||||
@ -299,7 +299,7 @@ QModelIndex BookmarksModel::index(BookmarkItem* item, int column) const
|
|||||||
|
|
||||||
BookmarkItem* BookmarksModel::item(const QModelIndex &index) const
|
BookmarkItem* BookmarksModel::item(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
BookmarkItem* itm = static_cast<BookmarkItem*>(index.internalPointer());
|
auto* itm = static_cast<BookmarkItem*>(index.internalPointer());
|
||||||
return itm ? itm : m_root;
|
return itm ? itm : m_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ void BookmarksToolbar::showOnlyIconsChanged(bool state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < m_layout->count(); ++i) {
|
for (int i = 0; i < m_layout->count(); ++i) {
|
||||||
BookmarksToolbarButton* b = qobject_cast<BookmarksToolbarButton*>(m_layout->itemAt(i)->widget());
|
auto* b = qobject_cast<BookmarksToolbarButton*>(m_layout->itemAt(i)->widget());
|
||||||
if (b) {
|
if (b) {
|
||||||
b->setShowOnlyIcon(state);
|
b->setShowOnlyIcon(state);
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ void BookmarksToolbar::showOnlyTextChanged(bool state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < m_layout->count(); ++i) {
|
for (int i = 0; i < m_layout->count(); ++i) {
|
||||||
BookmarksToolbarButton* b = qobject_cast<BookmarksToolbarButton*>(m_layout->itemAt(i)->widget());
|
auto* b = qobject_cast<BookmarksToolbarButton*>(m_layout->itemAt(i)->widget());
|
||||||
if (b) {
|
if (b) {
|
||||||
b->setShowOnlyText(state);
|
b->setShowOnlyText(state);
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ void BookmarksToolbar::addItem(BookmarkItem* item)
|
|||||||
{
|
{
|
||||||
Q_ASSERT(item);
|
Q_ASSERT(item);
|
||||||
|
|
||||||
BookmarksToolbarButton* button = new BookmarksToolbarButton(item, this);
|
auto* button = new BookmarksToolbarButton(item, this);
|
||||||
button->setMainWindow(m_window);
|
button->setMainWindow(m_window);
|
||||||
button->setShowOnlyIcon(m_bookmarks->showOnlyIconsInToolbar());
|
button->setShowOnlyIcon(m_bookmarks->showOnlyIconsInToolbar());
|
||||||
button->setShowOnlyText(m_bookmarks->showOnlyTextInToolbar());
|
button->setShowOnlyText(m_bookmarks->showOnlyTextInToolbar());
|
||||||
@ -266,7 +266,7 @@ void BookmarksToolbar::dropEvent(QDropEvent* e)
|
|||||||
BookmarkItem* bookmark = nullptr;
|
BookmarkItem* bookmark = nullptr;
|
||||||
|
|
||||||
if (mime->hasFormat(BookmarksButtonMimeData::mimeType())) {
|
if (mime->hasFormat(BookmarksButtonMimeData::mimeType())) {
|
||||||
const BookmarksButtonMimeData* bookmarkMime = static_cast<const BookmarksButtonMimeData*>(mime);
|
const auto* bookmarkMime = static_cast<const BookmarksButtonMimeData*>(mime);
|
||||||
bookmark = bookmarkMime->item();
|
bookmark = bookmarkMime->item();
|
||||||
const int initialIndex = bookmark->parent()->children().indexOf(bookmark);
|
const int initialIndex = bookmark->parent()->children().indexOf(bookmark);
|
||||||
BookmarksToolbarButton* current = buttonAt(m_dropPos);
|
BookmarksToolbarButton* current = buttonAt(m_dropPos);
|
||||||
|
@ -159,7 +159,7 @@ void BookmarksToolbarButton::menuMiddleClicked(Menu* menu)
|
|||||||
|
|
||||||
void BookmarksToolbarButton::bookmarkActivated(BookmarkItem* item)
|
void BookmarksToolbarButton::bookmarkActivated(BookmarkItem* item)
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ void BookmarksToolbarButton::bookmarkActivated(BookmarkItem* item)
|
|||||||
|
|
||||||
void BookmarksToolbarButton::bookmarkCtrlActivated(BookmarkItem* item)
|
void BookmarksToolbarButton::bookmarkCtrlActivated(BookmarkItem* item)
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ void BookmarksToolbarButton::bookmarkCtrlActivated(BookmarkItem* item)
|
|||||||
|
|
||||||
void BookmarksToolbarButton::bookmarkShiftActivated(BookmarkItem* item)
|
void BookmarksToolbarButton::bookmarkShiftActivated(BookmarkItem* item)
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
item = static_cast<BookmarkItem*>(action->data().value<void*>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,8 +318,8 @@ void BookmarksToolbarButton::mouseMoveEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
setDown(false);
|
setDown(false);
|
||||||
|
|
||||||
QDrag *drag = new QDrag(this);
|
auto *drag = new QDrag(this);
|
||||||
BookmarksButtonMimeData* mime = new BookmarksButtonMimeData;
|
auto* mime = new BookmarksButtonMimeData;
|
||||||
mime->setBookmarkItem(m_bookmark);
|
mime->setBookmarkItem(m_bookmark);
|
||||||
drag->setMimeData(mime);
|
drag->setMimeData(mime);
|
||||||
drag->setPixmap(grab());
|
drag->setPixmap(grab());
|
||||||
@ -426,7 +426,7 @@ void BookmarksToolbarButton::dropEvent(QDropEvent *event)
|
|||||||
BookmarkItem* bookmark = nullptr;
|
BookmarkItem* bookmark = nullptr;
|
||||||
|
|
||||||
if (mime->hasFormat(BookmarksButtonMimeData::mimeType())) {
|
if (mime->hasFormat(BookmarksButtonMimeData::mimeType())) {
|
||||||
const BookmarksButtonMimeData* bookmarkMime = static_cast<const BookmarksButtonMimeData*>(mime);
|
const auto* bookmarkMime = static_cast<const BookmarksButtonMimeData*>(mime);
|
||||||
bookmark = bookmarkMime->item();
|
bookmark = bookmarkMime->item();
|
||||||
} else {
|
} else {
|
||||||
const QUrl url = mime->urls().at(0);
|
const QUrl url = mime->urls().at(0);
|
||||||
|
@ -52,7 +52,7 @@ BookmarkItem* BookmarksFoldersMenu::selectedFolder() const
|
|||||||
|
|
||||||
void BookmarksFoldersMenu::folderChoosed()
|
void BookmarksFoldersMenu::folderChoosed()
|
||||||
{
|
{
|
||||||
if (QAction* act = qobject_cast<QAction*>(sender())) {
|
if (auto* act = qobject_cast<QAction*>(sender())) {
|
||||||
BookmarkItem* folder = static_cast<BookmarkItem*>(act->data().value<void*>());
|
BookmarkItem* folder = static_cast<BookmarkItem*>(act->data().value<void*>());
|
||||||
emit folderSelected(folder);
|
emit folderSelected(folder);
|
||||||
}
|
}
|
||||||
@ -133,13 +133,13 @@ bool BookmarksTools::addBookmarkDialog(QWidget* parent, const QUrl &url, const Q
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDialog* dialog = new QDialog(parent);
|
auto* dialog = new QDialog(parent);
|
||||||
QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, dialog);
|
auto* layout = new QBoxLayout(QBoxLayout::TopToBottom, dialog);
|
||||||
QLabel* label = new QLabel(dialog);
|
auto* label = new QLabel(dialog);
|
||||||
QLineEdit* edit = new QLineEdit(dialog);
|
auto* edit = new QLineEdit(dialog);
|
||||||
BookmarksFoldersButton* folderButton = new BookmarksFoldersButton(dialog, folder);
|
auto* folderButton = new BookmarksFoldersButton(dialog, folder);
|
||||||
|
|
||||||
QDialogButtonBox* box = new QDialogButtonBox(dialog);
|
auto* box = new QDialogButtonBox(dialog);
|
||||||
box->addButton(QDialogButtonBox::Ok);
|
box->addButton(QDialogButtonBox::Ok);
|
||||||
box->addButton(QDialogButtonBox::Cancel);
|
box->addButton(QDialogButtonBox::Cancel);
|
||||||
QObject::connect(box, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
QObject::connect(box, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
||||||
@ -166,7 +166,7 @@ bool BookmarksTools::addBookmarkDialog(QWidget* parent, const QUrl &url, const Q
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url);
|
auto* bookmark = new BookmarkItem(BookmarkItem::Url);
|
||||||
bookmark->setTitle(edit->text());
|
bookmark->setTitle(edit->text());
|
||||||
bookmark->setUrl(url);
|
bookmark->setUrl(url);
|
||||||
mApp->bookmarks()->addBookmark(folderButton->selectedFolder(), bookmark);
|
mApp->bookmarks()->addBookmark(folderButton->selectedFolder(), bookmark);
|
||||||
@ -179,12 +179,12 @@ bool BookmarksTools::bookmarkAllTabsDialog(QWidget* parent, TabWidget* tabWidget
|
|||||||
{
|
{
|
||||||
Q_ASSERT(tabWidget);
|
Q_ASSERT(tabWidget);
|
||||||
|
|
||||||
QDialog* dialog = new QDialog(parent);
|
auto* dialog = new QDialog(parent);
|
||||||
QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, dialog);
|
auto* layout = new QBoxLayout(QBoxLayout::TopToBottom, dialog);
|
||||||
QLabel* label = new QLabel(dialog);
|
auto* label = new QLabel(dialog);
|
||||||
BookmarksFoldersButton* folderButton = new BookmarksFoldersButton(dialog, folder);
|
auto* folderButton = new BookmarksFoldersButton(dialog, folder);
|
||||||
|
|
||||||
QDialogButtonBox* box = new QDialogButtonBox(dialog);
|
auto* box = new QDialogButtonBox(dialog);
|
||||||
box->addButton(QDialogButtonBox::Ok);
|
box->addButton(QDialogButtonBox::Ok);
|
||||||
box->addButton(QDialogButtonBox::Cancel);
|
box->addButton(QDialogButtonBox::Cancel);
|
||||||
QObject::connect(box, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
QObject::connect(box, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
||||||
@ -209,7 +209,7 @@ bool BookmarksTools::bookmarkAllTabsDialog(QWidget* parent, TabWidget* tabWidget
|
|||||||
const auto allTabs = tabWidget->allTabs(false);
|
const auto allTabs = tabWidget->allTabs(false);
|
||||||
for (WebTab* tab : allTabs) {
|
for (WebTab* tab : allTabs) {
|
||||||
if (!tab->url().isEmpty()) {
|
if (!tab->url().isEmpty()) {
|
||||||
BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url);
|
auto* bookmark = new BookmarkItem(BookmarkItem::Url);
|
||||||
bookmark->setTitle(tab->title());
|
bookmark->setTitle(tab->title());
|
||||||
bookmark->setUrl(tab->url());
|
bookmark->setUrl(tab->url());
|
||||||
mApp->bookmarks()->addBookmark(folderButton->selectedFolder(), bookmark);
|
mApp->bookmarks()->addBookmark(folderButton->selectedFolder(), bookmark);
|
||||||
@ -222,15 +222,15 @@ bool BookmarksTools::bookmarkAllTabsDialog(QWidget* parent, TabWidget* tabWidget
|
|||||||
|
|
||||||
bool BookmarksTools::editBookmarkDialog(QWidget* parent, BookmarkItem *item)
|
bool BookmarksTools::editBookmarkDialog(QWidget* parent, BookmarkItem *item)
|
||||||
{
|
{
|
||||||
QDialog* dialog = new QDialog(parent);
|
auto* dialog = new QDialog(parent);
|
||||||
QFormLayout* layout = new QFormLayout(dialog);
|
auto* layout = new QFormLayout(dialog);
|
||||||
|
|
||||||
QLineEdit* title = new QLineEdit;
|
auto* title = new QLineEdit;
|
||||||
QLineEdit* address = new QLineEdit;
|
auto* address = new QLineEdit;
|
||||||
QLineEdit* keyword = new QLineEdit;
|
auto* keyword = new QLineEdit;
|
||||||
QPlainTextEdit* description = new QPlainTextEdit;
|
auto* description = new QPlainTextEdit;
|
||||||
|
|
||||||
QDialogButtonBox* box = new QDialogButtonBox(dialog);
|
auto* box = new QDialogButtonBox(dialog);
|
||||||
box->addButton(QDialogButtonBox::Ok);
|
box->addButton(QDialogButtonBox::Ok);
|
||||||
box->addButton(QDialogButtonBox::Cancel);
|
box->addButton(QDialogButtonBox::Cancel);
|
||||||
QObject::connect(box, &QDialogButtonBox::accepted, dialog, &QDialog::accept);
|
QObject::connect(box, &QDialogButtonBox::accepted, dialog, &QDialog::accept);
|
||||||
@ -403,7 +403,7 @@ void BookmarksTools::addUrlToMenu(QObject* receiver, Menu* menu, BookmarkItem* b
|
|||||||
Q_ASSERT(bookmark);
|
Q_ASSERT(bookmark);
|
||||||
Q_ASSERT(bookmark->isUrl());
|
Q_ASSERT(bookmark->isUrl());
|
||||||
|
|
||||||
Action* act = new Action(menu);
|
auto* act = new Action(menu);
|
||||||
QString title = QFontMetrics(act->font()).elidedText(bookmark->title(), Qt::ElideRight, 250);
|
QString title = QFontMetrics(act->font()).elidedText(bookmark->title(), Qt::ElideRight, 250);
|
||||||
act->setText(title);
|
act->setText(title);
|
||||||
act->setData(QVariant::fromValue<void*>(static_cast<void*>(bookmark)));
|
act->setData(QVariant::fromValue<void*>(static_cast<void*>(bookmark)));
|
||||||
@ -463,7 +463,7 @@ bool BookmarksTools::migrateBookmarksIfNecessary(Bookmarks* bookmarks)
|
|||||||
bool subfolder = query.value(1).toString() == QLatin1String("yes");
|
bool subfolder = query.value(1).toString() == QLatin1String("yes");
|
||||||
|
|
||||||
BookmarkItem* parent = subfolder ? bookmarks->toolbarFolder() : bookmarks->unsortedFolder();
|
BookmarkItem* parent = subfolder ? bookmarks->toolbarFolder() : bookmarks->unsortedFolder();
|
||||||
BookmarkItem* folder = new BookmarkItem(BookmarkItem::Folder, parent);
|
auto* folder = new BookmarkItem(BookmarkItem::Folder, parent);
|
||||||
folder->setTitle(title);
|
folder->setTitle(title);
|
||||||
folders.insert(folder->title(), folder);
|
folders.insert(folder->title(), folder);
|
||||||
}
|
}
|
||||||
@ -480,7 +480,7 @@ bool BookmarksTools::migrateBookmarksIfNecessary(Bookmarks* bookmarks)
|
|||||||
}
|
}
|
||||||
Q_ASSERT(parent);
|
Q_ASSERT(parent);
|
||||||
|
|
||||||
BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url, parent);
|
auto* bookmark = new BookmarkItem(BookmarkItem::Url, parent);
|
||||||
bookmark->setTitle(title);
|
bookmark->setTitle(title);
|
||||||
bookmark->setUrl(url);
|
bookmark->setUrl(url);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ void BookmarksWidget::toggleBookmark()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Save bookmark
|
// Save bookmark
|
||||||
BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url);
|
auto* bookmark = new BookmarkItem(BookmarkItem::Url);
|
||||||
bookmark->setTitle(m_view->title());
|
bookmark->setTitle(m_view->title());
|
||||||
bookmark->setUrl(m_view->url());
|
bookmark->setUrl(m_view->url());
|
||||||
m_bookmarks->addBookmark(ui->folderButton->selectedFolder(), bookmark);
|
m_bookmarks->addBookmark(ui->folderButton->selectedFolder(), bookmark);
|
||||||
|
@ -84,7 +84,7 @@ CookieManager::CookieManager(QWidget *parent)
|
|||||||
ui->whiteList->sortItems(Qt::AscendingOrder);
|
ui->whiteList->sortItems(Qt::AscendingOrder);
|
||||||
ui->blackList->sortItems(Qt::AscendingOrder);
|
ui->blackList->sortItems(Qt::AscendingOrder);
|
||||||
|
|
||||||
QShortcut* removeShortcut = new QShortcut(QKeySequence("Del"), this);
|
auto* removeShortcut = new QShortcut(QKeySequence("Del"), this);
|
||||||
connect(removeShortcut, &QShortcut::activated, this, &CookieManager::deletePressed);
|
connect(removeShortcut, &QShortcut::activated, this, &CookieManager::deletePressed);
|
||||||
|
|
||||||
connect(ui->search, &QLineEdit::textChanged, this, &CookieManager::filterString);
|
connect(ui->search, &QLineEdit::textChanged, this, &CookieManager::filterString);
|
||||||
@ -291,7 +291,7 @@ void CookieManager::addCookie(const QNetworkCookie &cookie)
|
|||||||
item = new QTreeWidgetItem(findParent);
|
item = new QTreeWidgetItem(findParent);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QTreeWidgetItem* newParent = new QTreeWidgetItem(ui->cookieTree);
|
auto* newParent = new QTreeWidgetItem(ui->cookieTree);
|
||||||
newParent->setText(0, domain);
|
newParent->setText(0, domain);
|
||||||
newParent->setIcon(0, IconProvider::standardIcon(QStyle::SP_DirIcon));
|
newParent->setIcon(0, IconProvider::standardIcon(QStyle::SP_DirIcon));
|
||||||
newParent->setData(0, Qt::UserRole + 10, cookie.domain());
|
newParent->setData(0, Qt::UserRole + 10, cookie.domain());
|
||||||
|
@ -67,7 +67,7 @@ DownloadManager::DownloadManager(QWidget* parent)
|
|||||||
|
|
||||||
connect(ui->clearButton, &QAbstractButton::clicked, this, &DownloadManager::clearList);
|
connect(ui->clearButton, &QAbstractButton::clicked, this, &DownloadManager::clearList);
|
||||||
|
|
||||||
QShortcut* clearShortcut = new QShortcut(QKeySequence("CTRL+L"), this);
|
auto* clearShortcut = new QShortcut(QKeySequence("CTRL+L"), this);
|
||||||
connect(clearShortcut, &QShortcut::activated, this, &DownloadManager::clearList);
|
connect(clearShortcut, &QShortcut::activated, this, &DownloadManager::clearList);
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
@ -140,11 +140,11 @@ void DownloadManager::closeDownloadTab(QWebEngineDownloadItem *item) const
|
|||||||
if (!item->page()) {
|
if (!item->page()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WebPage *page = qobject_cast<WebPage*>(item->page());
|
auto *page = qobject_cast<WebPage*>(item->page());
|
||||||
if (!page) {
|
if (!page) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TabbedWebView *view = qobject_cast<TabbedWebView*>(page->view());
|
auto *view = qobject_cast<TabbedWebView*>(page->view());
|
||||||
if (!view) {
|
if (!view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ void DownloadManager::timerEvent(QTimerEvent* e)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < ui->list->count(); i++) {
|
for (int i = 0; i < ui->list->count(); i++) {
|
||||||
DownloadItem* downItem = qobject_cast<DownloadItem*>(ui->list->itemWidget(ui->list->item(i)));
|
auto* downItem = qobject_cast<DownloadItem*>(ui->list->itemWidget(ui->list->item(i)));
|
||||||
if (!downItem || downItem->isCancelled() || !downItem->isDownloading()) {
|
if (!downItem || downItem->isCancelled() || !downItem->isDownloading()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ void DownloadManager::clearList()
|
|||||||
{
|
{
|
||||||
QList<DownloadItem*> items;
|
QList<DownloadItem*> items;
|
||||||
for (int i = 0; i < ui->list->count(); i++) {
|
for (int i = 0; i < ui->list->count(); i++) {
|
||||||
DownloadItem* downItem = qobject_cast<DownloadItem*>(ui->list->itemWidget(ui->list->item(i)));
|
auto* downItem = qobject_cast<DownloadItem*>(ui->list->itemWidget(ui->list->item(i)));
|
||||||
if (!downItem) {
|
if (!downItem) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -361,8 +361,8 @@ void DownloadManager::download(QWebEngineDownloadItem *downloadItem)
|
|||||||
downloadItem->accept();
|
downloadItem->accept();
|
||||||
|
|
||||||
// Create download item
|
// Create download item
|
||||||
QListWidgetItem* listItem = new QListWidgetItem(ui->list);
|
auto* listItem = new QListWidgetItem(ui->list);
|
||||||
DownloadItem* downItem = new DownloadItem(listItem, downloadItem, QFileInfo(downloadPath).absolutePath(), QFileInfo(downloadPath).fileName(), openFile, this);
|
auto* downItem = new DownloadItem(listItem, downloadItem, QFileInfo(downloadPath).absolutePath(), QFileInfo(downloadPath).fileName(), openFile, this);
|
||||||
downItem->setDownTimer(downloadTimer);
|
downItem->setDownTimer(downloadTimer);
|
||||||
downItem->startDownloading();
|
downItem->startDownloading();
|
||||||
connect(downItem, &DownloadItem::deleteItem, this, &DownloadManager::deleteItem);
|
connect(downItem, &DownloadItem::deleteItem, this, &DownloadManager::deleteItem);
|
||||||
@ -390,7 +390,7 @@ void DownloadManager::downloadFinished(bool success)
|
|||||||
m_activeDownloadsCount = 0;
|
m_activeDownloadsCount = 0;
|
||||||
bool downloadingAllFilesFinished = true;
|
bool downloadingAllFilesFinished = true;
|
||||||
for (int i = 0; i < ui->list->count(); i++) {
|
for (int i = 0; i < ui->list->count(); i++) {
|
||||||
DownloadItem* downItem = qobject_cast<DownloadItem*>(ui->list->itemWidget(ui->list->item(i)));
|
auto* downItem = qobject_cast<DownloadItem*>(ui->list->itemWidget(ui->list->item(i)));
|
||||||
if (!downItem) {
|
if (!downItem) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -439,7 +439,7 @@ bool DownloadManager::canClose()
|
|||||||
|
|
||||||
bool isDownloading = false;
|
bool isDownloading = false;
|
||||||
for (int i = 0; i < ui->list->count(); i++) {
|
for (int i = 0; i < ui->list->count(); i++) {
|
||||||
DownloadItem* downItem = qobject_cast<DownloadItem*>(ui->list->itemWidget(ui->list->item(i)));
|
auto* downItem = qobject_cast<DownloadItem*>(ui->list->itemWidget(ui->list->item(i)));
|
||||||
if (!downItem) {
|
if (!downItem) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ QString History::titleCaseLocalizedMonth(int month)
|
|||||||
return tr("December");
|
return tr("December");
|
||||||
default:
|
default:
|
||||||
qWarning("Month number out of range!");
|
qWarning("Month number out of range!");
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ private:
|
|||||||
HistoryModel* m_model;
|
HistoryModel* m_model;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef History::HistoryEntry HistoryEntry;
|
using HistoryEntry = History::HistoryEntry;
|
||||||
|
|
||||||
// Hint to QVector to use std::realloc on item moving
|
// Hint to QVector to use std::realloc on item moving
|
||||||
Q_DECLARE_TYPEINFO(HistoryEntry, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(HistoryEntry, Q_MOVABLE_TYPE);
|
||||||
|
@ -98,7 +98,7 @@ void HistoryMenu::aboutToShow()
|
|||||||
const QUrl url = query.value(1).toUrl();
|
const QUrl url = query.value(1).toUrl();
|
||||||
const QString title = QzTools::truncatedText(query.value(0).toString(), 40);
|
const QString title = QzTools::truncatedText(query.value(0).toString(), 40);
|
||||||
|
|
||||||
Action* act = new Action(title);
|
auto* act = new Action(title);
|
||||||
act->setData(url);
|
act->setData(url);
|
||||||
act->setIcon(IconProvider::iconForUrl(url));
|
act->setIcon(IconProvider::iconForUrl(url));
|
||||||
connect(act, &QAction::triggered, this, &HistoryMenu::historyEntryActivated);
|
connect(act, &QAction::triggered, this, &HistoryMenu::historyEntryActivated);
|
||||||
@ -122,7 +122,7 @@ void HistoryMenu::aboutToShowMostVisited()
|
|||||||
const QVector<HistoryEntry> mostVisited = mApp->history()->mostVisited(10);
|
const QVector<HistoryEntry> mostVisited = mApp->history()->mostVisited(10);
|
||||||
|
|
||||||
for (const HistoryEntry &entry : mostVisited) {
|
for (const HistoryEntry &entry : mostVisited) {
|
||||||
Action* act = new Action(QzTools::truncatedText(entry.title, 40));
|
auto* act = new Action(QzTools::truncatedText(entry.title, 40));
|
||||||
act->setData(entry.url);
|
act->setData(entry.url);
|
||||||
act->setIcon(IconProvider::iconForUrl(entry.url));
|
act->setIcon(IconProvider::iconForUrl(entry.url));
|
||||||
connect(act, &QAction::triggered, this, &HistoryMenu::historyEntryActivated);
|
connect(act, &QAction::triggered, this, &HistoryMenu::historyEntryActivated);
|
||||||
@ -193,21 +193,21 @@ void HistoryMenu::aboutToShowClosedWindows()
|
|||||||
|
|
||||||
void HistoryMenu::historyEntryActivated()
|
void HistoryMenu::historyEntryActivated()
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
openUrl(action->data().toUrl());
|
openUrl(action->data().toUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryMenu::historyEntryCtrlActivated()
|
void HistoryMenu::historyEntryCtrlActivated()
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
openUrlInNewTab(action->data().toUrl());
|
openUrlInNewTab(action->data().toUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryMenu::historyEntryShiftActivated()
|
void HistoryMenu::historyEntryShiftActivated()
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
openUrlInNewWindow(action->data().toUrl());
|
openUrlInNewWindow(action->data().toUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
|
|||||||
HistoryItem* item = itemFromIndex(index);
|
HistoryItem* item = itemFromIndex(index);
|
||||||
|
|
||||||
if (index.row() < 0 || !item) {
|
if (index.row() < 0 || !item) {
|
||||||
return QVariant();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->isTopLevel()) {
|
if (item->isTopLevel()) {
|
||||||
@ -89,7 +89,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
|
|||||||
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(":/icons/menu/history_entry.svg")) : QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const HistoryEntry entry = item->historyEntry;
|
const HistoryEntry entry = item->historyEntry;
|
||||||
@ -135,7 +135,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HistoryModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
bool HistoryModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
@ -158,7 +158,7 @@ bool HistoryModel::setData(const QModelIndex &index, const QVariant &value, int
|
|||||||
QModelIndex HistoryModel::index(int row, int column, const QModelIndex &parent) const
|
QModelIndex HistoryModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if (!hasIndex(row, column, parent)) {
|
if (!hasIndex(row, column, parent)) {
|
||||||
return QModelIndex();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryItem* parentItem = itemFromIndex(parent);
|
HistoryItem* parentItem = itemFromIndex(parent);
|
||||||
@ -170,14 +170,14 @@ QModelIndex HistoryModel::index(int row, int column, const QModelIndex &parent)
|
|||||||
QModelIndex HistoryModel::parent(const QModelIndex &index) const
|
QModelIndex HistoryModel::parent(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid()) {
|
if (!index.isValid()) {
|
||||||
return QModelIndex();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryItem* childItem = itemFromIndex(index);
|
HistoryItem* childItem = itemFromIndex(index);
|
||||||
HistoryItem* parentItem = childItem->parent();
|
HistoryItem* parentItem = childItem->parent();
|
||||||
|
|
||||||
if (!parentItem || parentItem == m_rootItem) {
|
if (!parentItem || parentItem == m_rootItem) {
|
||||||
return QModelIndex();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return createIndex(parentItem->row(), 0, parentItem);
|
return createIndex(parentItem->row(), 0, parentItem);
|
||||||
@ -224,7 +224,7 @@ bool HistoryModel::hasChildren(const QModelIndex &parent) const
|
|||||||
HistoryItem* HistoryModel::itemFromIndex(const QModelIndex &index) const
|
HistoryItem* HistoryModel::itemFromIndex(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
HistoryItem* item = static_cast<HistoryItem*>(index.internalPointer());
|
auto* item = static_cast<HistoryItem*>(index.internalPointer());
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
return item;
|
return item;
|
||||||
@ -322,7 +322,7 @@ void HistoryModel::fetchMore(const QModelIndex &parent)
|
|||||||
beginInsertRows(parent, 0, list.size() - 1);
|
beginInsertRows(parent, 0, list.size() - 1);
|
||||||
|
|
||||||
for (const HistoryEntry &entry : qAsConst(list)) {
|
for (const HistoryEntry &entry : qAsConst(list)) {
|
||||||
HistoryItem* newItem = new HistoryItem(parentItem);
|
auto* newItem = new HistoryItem(parentItem);
|
||||||
newItem->historyEntry = entry;
|
newItem->historyEntry = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ void HistoryModel::historyEntryAdded(const HistoryEntry &entry)
|
|||||||
|
|
||||||
beginInsertRows(createIndex(0, 0, m_todayItem), 0, 0);
|
beginInsertRows(createIndex(0, 0, m_todayItem), 0, 0);
|
||||||
|
|
||||||
HistoryItem* item = new HistoryItem();
|
auto* item = new HistoryItem();
|
||||||
item->historyEntry = entry;
|
item->historyEntry = entry;
|
||||||
|
|
||||||
m_todayItem->prependChild(item);
|
m_todayItem->prependChild(item);
|
||||||
@ -496,7 +496,7 @@ void HistoryModel::init()
|
|||||||
query.exec();
|
query.exec();
|
||||||
|
|
||||||
if (query.next()) {
|
if (query.next()) {
|
||||||
HistoryItem* item = new HistoryItem(m_rootItem);
|
auto* item = new HistoryItem(m_rootItem);
|
||||||
item->setStartTimestamp(timestamp == currentTimestamp ? -1 : timestamp);
|
item->setStartTimestamp(timestamp == currentTimestamp ? -1 : timestamp);
|
||||||
item->setEndTimestamp(endTimestamp);
|
item->setEndTimestamp(endTimestamp);
|
||||||
item->title = itemName;
|
item->title = itemName;
|
||||||
|
@ -82,7 +82,7 @@ QUrl HistoryTreeView::selectedUrl() const
|
|||||||
const QList<QModelIndex> indexes = selectionModel()->selectedRows();
|
const QList<QModelIndex> indexes = selectionModel()->selectedRows();
|
||||||
|
|
||||||
if (indexes.count() != 1)
|
if (indexes.count() != 1)
|
||||||
return QUrl();
|
return {};
|
||||||
|
|
||||||
// TopLevelItems have invalid (empty) UrlRole data
|
// TopLevelItems have invalid (empty) UrlRole data
|
||||||
return indexes.at(0).data(HistoryModel::UrlRole).toUrl();
|
return indexes.at(0).data(HistoryModel::UrlRole).toUrl();
|
||||||
|
@ -81,7 +81,7 @@ void LocationCompleter::complete(const QString &string)
|
|||||||
|
|
||||||
emit cancelRefreshJob();
|
emit cancelRefreshJob();
|
||||||
|
|
||||||
LocationCompleterRefreshJob* job = new LocationCompleterRefreshJob(trimmedStr);
|
auto* job = new LocationCompleterRefreshJob(trimmedStr);
|
||||||
connect(job, &LocationCompleterRefreshJob::finished, this, &LocationCompleter::refreshJobFinished);
|
connect(job, &LocationCompleterRefreshJob::finished, this, &LocationCompleter::refreshJobFinished);
|
||||||
connect(this, SIGNAL(cancelRefreshJob()), job, SLOT(jobCancelled()));
|
connect(this, SIGNAL(cancelRefreshJob()), job, SLOT(jobCancelled()));
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ void LocationCompleter::complete(const QString &string)
|
|||||||
s_model->setData(index, trimmedStr, LocationCompleterModel::UrlRole);
|
s_model->setData(index, trimmedStr, LocationCompleterModel::UrlRole);
|
||||||
s_model->setData(index, m_locationBar->text(), LocationCompleterModel::SearchStringRole);
|
s_model->setData(index, m_locationBar->text(), LocationCompleterModel::SearchStringRole);
|
||||||
} else {
|
} else {
|
||||||
QStandardItem *item = new QStandardItem();
|
auto *item = new QStandardItem();
|
||||||
item->setText(trimmedStr);
|
item->setText(trimmedStr);
|
||||||
item->setData(trimmedStr, LocationCompleterModel::UrlRole);
|
item->setData(trimmedStr, LocationCompleterModel::UrlRole);
|
||||||
item->setData(m_locationBar->text(), LocationCompleterModel::SearchStringRole);
|
item->setData(m_locationBar->text(), LocationCompleterModel::SearchStringRole);
|
||||||
@ -132,7 +132,7 @@ void LocationCompleter::showMostVisited()
|
|||||||
|
|
||||||
void LocationCompleter::refreshJobFinished()
|
void LocationCompleter::refreshJobFinished()
|
||||||
{
|
{
|
||||||
LocationCompleterRefreshJob* job = qobject_cast<LocationCompleterRefreshJob*>(sender());
|
auto* job = qobject_cast<LocationCompleterRefreshJob*>(sender());
|
||||||
Q_ASSERT(job);
|
Q_ASSERT(job);
|
||||||
|
|
||||||
// Don't show results of older jobs
|
// Don't show results of older jobs
|
||||||
@ -190,7 +190,7 @@ void LocationCompleter::addSuggestions(const QStringList &suggestions)
|
|||||||
// Add new suggestions
|
// Add new suggestions
|
||||||
QList<QStandardItem*> items;
|
QList<QStandardItem*> items;
|
||||||
for (const QString &suggestion : suggestions) {
|
for (const QString &suggestion : suggestions) {
|
||||||
QStandardItem* item = new QStandardItem();
|
auto* item = new QStandardItem();
|
||||||
item->setText(suggestion);
|
item->setText(suggestion);
|
||||||
item->setData(suggestion, LocationCompleterModel::TitleRole);
|
item->setData(suggestion, LocationCompleterModel::TitleRole);
|
||||||
item->setData(suggestion, LocationCompleterModel::UrlRole);
|
item->setData(suggestion, LocationCompleterModel::UrlRole);
|
||||||
@ -378,7 +378,7 @@ void LocationCompleter::openSearchEnginesDialog()
|
|||||||
// Clear locationbar
|
// Clear locationbar
|
||||||
emit clearCompletion();
|
emit clearCompletion();
|
||||||
|
|
||||||
SearchEnginesDialog *dialog = new SearchEnginesDialog(m_window);
|
auto *dialog = new SearchEnginesDialog(m_window);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ void LocationCompleterRefreshJob::runJob()
|
|||||||
|
|
||||||
// Add search/visit item
|
// Add search/visit item
|
||||||
if (!m_searchString.isEmpty()) {
|
if (!m_searchString.isEmpty()) {
|
||||||
QStandardItem* item = new QStandardItem();
|
auto* item = new QStandardItem();
|
||||||
item->setText(m_searchString);
|
item->setText(m_searchString);
|
||||||
item->setData(m_searchString, LocationCompleterModel::UrlRole);
|
item->setData(m_searchString, LocationCompleterModel::UrlRole);
|
||||||
item->setData(m_searchString, LocationCompleterModel::SearchStringRole);
|
item->setData(m_searchString, LocationCompleterModel::SearchStringRole);
|
||||||
@ -161,7 +161,7 @@ void LocationCompleterRefreshJob::completeFromHistory()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStandardItem* item = new QStandardItem();
|
auto* item = new QStandardItem();
|
||||||
item->setText(bookmark->url().toEncoded());
|
item->setText(bookmark->url().toEncoded());
|
||||||
item->setData(-1, LocationCompleterModel::IdRole);
|
item->setData(-1, LocationCompleterModel::IdRole);
|
||||||
item->setData(bookmark->title(), LocationCompleterModel::TitleRole);
|
item->setData(bookmark->title(), LocationCompleterModel::TitleRole);
|
||||||
@ -192,7 +192,7 @@ void LocationCompleterRefreshJob::completeFromHistory()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStandardItem* item = new QStandardItem();
|
auto* item = new QStandardItem();
|
||||||
item->setText(url.toEncoded());
|
item->setText(url.toEncoded());
|
||||||
item->setData(query.value(0), LocationCompleterModel::IdRole);
|
item->setData(query.value(0), LocationCompleterModel::IdRole);
|
||||||
item->setData(query.value(2), LocationCompleterModel::TitleRole);
|
item->setData(query.value(2), LocationCompleterModel::TitleRole);
|
||||||
@ -212,7 +212,7 @@ void LocationCompleterRefreshJob::completeMostVisited()
|
|||||||
query.exec(QSL("SELECT id, url, title FROM history ORDER BY count DESC LIMIT 15"));
|
query.exec(QSL("SELECT id, url, title FROM history ORDER BY count DESC LIMIT 15"));
|
||||||
|
|
||||||
while (query.next()) {
|
while (query.next()) {
|
||||||
QStandardItem* item = new QStandardItem();
|
auto* item = new QStandardItem();
|
||||||
const QUrl url = query.value(1).toUrl();
|
const QUrl url = query.value(1).toUrl();
|
||||||
|
|
||||||
item->setText(url.toEncoded());
|
item->setText(url.toEncoded());
|
||||||
|
@ -43,7 +43,7 @@ LocationCompleterView::LocationCompleterView()
|
|||||||
setWindowFlags(Qt::Popup);
|
setWindowFlags(Qt::Popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto *layout = new QVBoxLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
|
|
||||||
@ -63,19 +63,19 @@ LocationCompleterView::LocationCompleterView()
|
|||||||
m_delegate = new LocationCompleterDelegate(this);
|
m_delegate = new LocationCompleterDelegate(this);
|
||||||
m_view->setItemDelegate(m_delegate);
|
m_view->setItemDelegate(m_delegate);
|
||||||
|
|
||||||
QFrame *searchFrame = new QFrame(this);
|
auto *searchFrame = new QFrame(this);
|
||||||
searchFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
|
searchFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
|
||||||
QHBoxLayout *searchLayout = new QHBoxLayout(searchFrame);
|
auto *searchLayout = new QHBoxLayout(searchFrame);
|
||||||
searchLayout->setContentsMargins(10, 4, 4, 4);
|
searchLayout->setContentsMargins(10, 4, 4, 4);
|
||||||
|
|
||||||
ToolButton *searchSettingsButton = new ToolButton(this);
|
auto *searchSettingsButton = new ToolButton(this);
|
||||||
searchSettingsButton->setIcon(IconProvider::settingsIcon());
|
searchSettingsButton->setIcon(IconProvider::settingsIcon());
|
||||||
searchSettingsButton->setToolTip(tr("Manage Search Engines"));
|
searchSettingsButton->setToolTip(tr("Manage Search Engines"));
|
||||||
searchSettingsButton->setAutoRaise(true);
|
searchSettingsButton->setAutoRaise(true);
|
||||||
searchSettingsButton->setIconSize(QSize(16, 16));
|
searchSettingsButton->setIconSize(QSize(16, 16));
|
||||||
connect(searchSettingsButton, &ToolButton::clicked, this, &LocationCompleterView::searchEnginesDialogRequested);
|
connect(searchSettingsButton, &ToolButton::clicked, this, &LocationCompleterView::searchEnginesDialogRequested);
|
||||||
|
|
||||||
QLabel *searchLabel = new QLabel(tr("Search with:"));
|
auto *searchLabel = new QLabel(tr("Search with:"));
|
||||||
m_searchEnginesLayout = new QHBoxLayout();
|
m_searchEnginesLayout = new QHBoxLayout();
|
||||||
|
|
||||||
setupSearchEngines();
|
setupSearchEngines();
|
||||||
@ -160,7 +160,7 @@ bool LocationCompleterView::eventFilter(QObject* object, QEvent* event)
|
|||||||
|
|
||||||
if (object == m_view->viewport()) {
|
if (object == m_view->viewport()) {
|
||||||
if (event->type() == QEvent::MouseButtonRelease) {
|
if (event->type() == QEvent::MouseButtonRelease) {
|
||||||
QMouseEvent *e = static_cast<QMouseEvent*>(event);
|
auto *e = static_cast<QMouseEvent*>(event);
|
||||||
QModelIndex idx = m_view->indexAt(e->pos());
|
QModelIndex idx = m_view->indexAt(e->pos());
|
||||||
if (!idx.isValid()) {
|
if (!idx.isValid()) {
|
||||||
return false;
|
return false;
|
||||||
@ -189,7 +189,7 @@ bool LocationCompleterView::eventFilter(QObject* object, QEvent* event)
|
|||||||
|
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::KeyPress: {
|
case QEvent::KeyPress: {
|
||||||
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
auto* keyEvent = static_cast<QKeyEvent*>(event);
|
||||||
Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
|
Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
|
||||||
const QModelIndex idx = m_view->currentIndex();
|
const QModelIndex idx = m_view->currentIndex();
|
||||||
const QModelIndex visitSearchIdx = model()->index(0, 0).data(LocationCompleterModel::VisitSearchItemRole).toBool() ? model()->index(0, 0) : QModelIndex();
|
const QModelIndex visitSearchIdx = model()->index(0, 0).data(LocationCompleterModel::VisitSearchItemRole).toBool() ? model()->index(0, 0) : QModelIndex();
|
||||||
@ -322,7 +322,7 @@ bool LocationCompleterView::eventFilter(QObject* object, QEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case QEvent::KeyRelease: {
|
case QEvent::KeyRelease: {
|
||||||
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
auto* keyEvent = static_cast<QKeyEvent*>(event);
|
||||||
|
|
||||||
switch (keyEvent->key()) {
|
switch (keyEvent->key()) {
|
||||||
case Qt::Key_Shift:
|
case Qt::Key_Shift:
|
||||||
@ -342,7 +342,7 @@ bool LocationCompleterView::eventFilter(QObject* object, QEvent* event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case QEvent::FocusOut: {
|
case QEvent::FocusOut: {
|
||||||
QFocusEvent *focusEvent = static_cast<QFocusEvent*>(event);
|
auto *focusEvent = static_cast<QFocusEvent*>(event);
|
||||||
if (focusEvent->reason() != Qt::PopupFocusReason && focusEvent->reason() != Qt::MouseFocusReason) {
|
if (focusEvent->reason() != Qt::PopupFocusReason && focusEvent->reason() != Qt::MouseFocusReason) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
@ -383,7 +383,7 @@ void LocationCompleterView::setupSearchEngines()
|
|||||||
|
|
||||||
const auto engines = mApp->searchEnginesManager()->allEngines();
|
const auto engines = mApp->searchEnginesManager()->allEngines();
|
||||||
for (const SearchEngine &engine : engines) {
|
for (const SearchEngine &engine : engines) {
|
||||||
ToolButton *button = new ToolButton(this);
|
auto *button = new ToolButton(this);
|
||||||
button->setIcon(engine.icon);
|
button->setIcon(engine.icon);
|
||||||
button->setToolTip(engine.name);
|
button->setToolTip(engine.name);
|
||||||
button->setAutoRaise(true);
|
button->setAutoRaise(true);
|
||||||
|
@ -62,7 +62,7 @@ LocationBar::LocationBar(QWidget *parent)
|
|||||||
m_goIcon = new GoIcon(this);
|
m_goIcon = new GoIcon(this);
|
||||||
m_siteIcon = new SiteIcon(this);
|
m_siteIcon = new SiteIcon(this);
|
||||||
m_autofillIcon = new AutoFillIcon(this);
|
m_autofillIcon = new AutoFillIcon(this);
|
||||||
DownIcon* down = new DownIcon(this);
|
auto* down = new DownIcon(this);
|
||||||
|
|
||||||
addWidget(m_siteIcon, LineEdit::LeftSide);
|
addWidget(m_siteIcon, LineEdit::LeftSide);
|
||||||
addWidget(m_autofillIcon, LineEdit::RightSide);
|
addWidget(m_autofillIcon, LineEdit::RightSide);
|
||||||
@ -79,7 +79,7 @@ LocationBar::LocationBar(QWidget *parent)
|
|||||||
connect(m_completer, &LocationCompleter::popupClosed, this, &LocationBar::updateSiteIcon);
|
connect(m_completer, &LocationCompleter::popupClosed, this, &LocationBar::updateSiteIcon);
|
||||||
|
|
||||||
m_domainCompleterModel = new QStringListModel(this);
|
m_domainCompleterModel = new QStringListModel(this);
|
||||||
QCompleter* domainCompleter = new QCompleter(this);
|
auto* domainCompleter = new QCompleter(this);
|
||||||
domainCompleter->setCompletionMode(QCompleter::InlineCompletion);
|
domainCompleter->setCompletionMode(QCompleter::InlineCompletion);
|
||||||
domainCompleter->setModel(m_domainCompleterModel);
|
domainCompleter->setModel(m_domainCompleterModel);
|
||||||
setCompleter(domainCompleter);
|
setCompleter(domainCompleter);
|
||||||
@ -211,7 +211,7 @@ QString LocationBar::convertUrlToText(const QUrl &url)
|
|||||||
SearchEnginesManager::Engine LocationBar::searchEngine()
|
SearchEnginesManager::Engine LocationBar::searchEngine()
|
||||||
{
|
{
|
||||||
if (!qzSettings->searchFromAddressBar) {
|
if (!qzSettings->searchFromAddressBar) {
|
||||||
return SearchEngine();
|
return {};
|
||||||
} else if (qzSettings->searchWithDefaultEngine) {
|
} else if (qzSettings->searchWithDefaultEngine) {
|
||||||
return mApp->searchEnginesManager()->defaultEngine();
|
return mApp->searchEnginesManager()->defaultEngine();
|
||||||
} else {
|
} else {
|
||||||
@ -643,7 +643,7 @@ void LocationBar::loadFinished()
|
|||||||
m_progressTimer->start();
|
m_progressTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
WebPage* page = qobject_cast<WebPage*>(m_webView->page());
|
auto* page = qobject_cast<WebPage*>(m_webView->page());
|
||||||
|
|
||||||
if (page && !page->autoFillUsernames().isEmpty()) {
|
if (page && !page->autoFillUsernames().isEmpty()) {
|
||||||
m_autofillIcon->setUsernames(page->autoFillUsernames());
|
m_autofillIcon->setUsernames(page->autoFillUsernames());
|
||||||
|
@ -91,17 +91,17 @@ NavigationBar::NavigationBar(BrowserWindow* window)
|
|||||||
m_buttonForward->setEnabled(false);
|
m_buttonForward->setEnabled(false);
|
||||||
m_buttonForward->setFocusPolicy(Qt::NoFocus);
|
m_buttonForward->setFocusPolicy(Qt::NoFocus);
|
||||||
|
|
||||||
QHBoxLayout* backNextLayout = new QHBoxLayout();
|
auto* backNextLayout = new QHBoxLayout();
|
||||||
backNextLayout->setContentsMargins(0, 0, 0, 0);
|
backNextLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
backNextLayout->setSpacing(0);
|
backNextLayout->setSpacing(0);
|
||||||
backNextLayout->addWidget(m_buttonBack);
|
backNextLayout->addWidget(m_buttonBack);
|
||||||
backNextLayout->addWidget(m_buttonForward);
|
backNextLayout->addWidget(m_buttonForward);
|
||||||
QWidget *backNextWidget = new QWidget(this);
|
auto *backNextWidget = new QWidget(this);
|
||||||
backNextWidget->setLayout(backNextLayout);
|
backNextWidget->setLayout(backNextLayout);
|
||||||
|
|
||||||
m_reloadStop = new ReloadStopButton(this);
|
m_reloadStop = new ReloadStopButton(this);
|
||||||
|
|
||||||
ToolButton *buttonHome = new ToolButton(this);
|
auto *buttonHome = new ToolButton(this);
|
||||||
buttonHome->setObjectName("navigation-button-home");
|
buttonHome->setObjectName("navigation-button-home");
|
||||||
buttonHome->setToolTip(tr("Home"));
|
buttonHome->setToolTip(tr("Home"));
|
||||||
buttonHome->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
buttonHome->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||||
@ -109,7 +109,7 @@ NavigationBar::NavigationBar(BrowserWindow* window)
|
|||||||
buttonHome->setAutoRaise(true);
|
buttonHome->setAutoRaise(true);
|
||||||
buttonHome->setFocusPolicy(Qt::NoFocus);
|
buttonHome->setFocusPolicy(Qt::NoFocus);
|
||||||
|
|
||||||
ToolButton *buttonAddTab = new ToolButton(this);
|
auto *buttonAddTab = new ToolButton(this);
|
||||||
buttonAddTab->setObjectName("navigation-button-addtab");
|
buttonAddTab->setObjectName("navigation-button-addtab");
|
||||||
buttonAddTab->setToolTip(tr("New Tab"));
|
buttonAddTab->setToolTip(tr("New Tab"));
|
||||||
buttonAddTab->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
buttonAddTab->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||||
@ -127,7 +127,7 @@ NavigationBar::NavigationBar(BrowserWindow* window)
|
|||||||
m_buttonForward->setMenu(m_menuForward);
|
m_buttonForward->setMenu(m_menuForward);
|
||||||
connect(m_buttonForward, &ToolButton::aboutToShowMenu, this, &NavigationBar::aboutToShowHistoryNextMenu);
|
connect(m_buttonForward, &ToolButton::aboutToShowMenu, this, &NavigationBar::aboutToShowHistoryNextMenu);
|
||||||
|
|
||||||
ToolButton *buttonTools = new ToolButton(this);
|
auto *buttonTools = new ToolButton(this);
|
||||||
buttonTools->setObjectName("navigation-button-tools");
|
buttonTools->setObjectName("navigation-button-tools");
|
||||||
buttonTools->setPopupMode(QToolButton::InstantPopup);
|
buttonTools->setPopupMode(QToolButton::InstantPopup);
|
||||||
buttonTools->setToolbarButtonLook(true);
|
buttonTools->setToolbarButtonLook(true);
|
||||||
@ -330,7 +330,7 @@ void NavigationBar::addToolButton(AbstractButtonInterface *button)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationBarToolButton *toolButton = new NavigationBarToolButton(button, this);
|
auto *toolButton = new NavigationBarToolButton(button, this);
|
||||||
toolButton->setProperty("button-id", button->id());
|
toolButton->setProperty("button-id", button->id());
|
||||||
connect(toolButton, &NavigationBarToolButton::visibilityChangeRequested, this, [=]() {
|
connect(toolButton, &NavigationBarToolButton::visibilityChangeRequested, this, [=]() {
|
||||||
if (m_layout->indexOf(toolButton) != -1) {
|
if (m_layout->indexOf(toolButton) != -1) {
|
||||||
@ -376,7 +376,7 @@ void NavigationBar::aboutToShowHistoryBackMenu()
|
|||||||
QString title = titleForUrl(item.title(), item.url());
|
QString title = titleForUrl(item.title(), item.url());
|
||||||
|
|
||||||
const QIcon icon = iconForPage(item.url(), IconProvider::standardIcon(QStyle::SP_ArrowBack));
|
const QIcon icon = iconForPage(item.url(), IconProvider::standardIcon(QStyle::SP_ArrowBack));
|
||||||
Action* act = new Action(icon, title);
|
auto* act = new Action(icon, title);
|
||||||
act->setData(i);
|
act->setData(i);
|
||||||
connect(act, &QAction::triggered, this, &NavigationBar::loadHistoryIndex);
|
connect(act, &QAction::triggered, this, &NavigationBar::loadHistoryIndex);
|
||||||
connect(act, SIGNAL(ctrlTriggered()), this, SLOT(loadHistoryIndexInNewTab()));
|
connect(act, SIGNAL(ctrlTriggered()), this, SLOT(loadHistoryIndexInNewTab()));
|
||||||
@ -410,7 +410,7 @@ void NavigationBar::aboutToShowHistoryNextMenu()
|
|||||||
QString title = titleForUrl(item.title(), item.url());
|
QString title = titleForUrl(item.title(), item.url());
|
||||||
|
|
||||||
const QIcon icon = iconForPage(item.url(), IconProvider::standardIcon(QStyle::SP_ArrowForward));
|
const QIcon icon = iconForPage(item.url(), IconProvider::standardIcon(QStyle::SP_ArrowForward));
|
||||||
Action* act = new Action(icon, title);
|
auto* act = new Action(icon, title);
|
||||||
act->setData(i);
|
act->setData(i);
|
||||||
connect(act, &QAction::triggered, this, &NavigationBar::loadHistoryIndex);
|
connect(act, &QAction::triggered, this, &NavigationBar::loadHistoryIndex);
|
||||||
connect(act, SIGNAL(ctrlTriggered()), this, SLOT(loadHistoryIndexInNewTab()));
|
connect(act, SIGNAL(ctrlTriggered()), this, SLOT(loadHistoryIndexInNewTab()));
|
||||||
@ -467,13 +467,13 @@ void NavigationBar::contextMenuRequested(const QPoint &pos)
|
|||||||
|
|
||||||
void NavigationBar::openConfigurationDialog()
|
void NavigationBar::openConfigurationDialog()
|
||||||
{
|
{
|
||||||
NavigationBarConfigDialog *dialog = new NavigationBarConfigDialog(this);
|
auto *dialog = new NavigationBarConfigDialog(this);
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationBar::toolActionActivated()
|
void NavigationBar::toolActionActivated()
|
||||||
{
|
{
|
||||||
QAction *act = qobject_cast<QAction*>(sender());
|
auto *act = qobject_cast<QAction*>(sender());
|
||||||
if (!act) {
|
if (!act) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -485,12 +485,12 @@ void NavigationBar::toolActionActivated()
|
|||||||
if (!data.button) {
|
if (!data.button) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ToolButton *buttonTools = qobject_cast<ToolButton*>(m_widgets.value(QSL("button-tools")).widget);
|
auto *buttonTools = qobject_cast<ToolButton*>(m_widgets.value(QSL("button-tools")).widget);
|
||||||
if (!buttonTools) {
|
if (!buttonTools) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractButtonInterface::ClickController *c = new AbstractButtonInterface::ClickController;
|
auto *c = new AbstractButtonInterface::ClickController;
|
||||||
c->visualParent = buttonTools;
|
c->visualParent = buttonTools;
|
||||||
c->popupPosition = [=](const QSize &size) {
|
c->popupPosition = [=](const QSize &size) {
|
||||||
QPoint pos = buttonTools->mapToGlobal(buttonTools->rect().bottomRight());
|
QPoint pos = buttonTools->mapToGlobal(buttonTools->rect().bottomRight());
|
||||||
@ -572,7 +572,7 @@ void NavigationBar::reloadLayout()
|
|||||||
const WidgetData data = m_widgets.value(id);
|
const WidgetData data = m_widgets.value(id);
|
||||||
if (data.widget) {
|
if (data.widget) {
|
||||||
m_layout->addWidget(data.widget);
|
m_layout->addWidget(data.widget);
|
||||||
NavigationBarToolButton *button = qobject_cast<NavigationBarToolButton*>(data.widget);
|
auto *button = qobject_cast<NavigationBarToolButton*>(data.widget);
|
||||||
if (button) {
|
if (button) {
|
||||||
button->updateVisibility();
|
button->updateVisibility();
|
||||||
} else {
|
} else {
|
||||||
@ -602,14 +602,14 @@ void NavigationBar::loadHistoryIndex()
|
|||||||
{
|
{
|
||||||
QWebEngineHistory* history = m_window->weView()->page()->history();
|
QWebEngineHistory* history = m_window->weView()->page()->history();
|
||||||
|
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
loadHistoryItem(history->itemAt(action->data().toInt()));
|
loadHistoryItem(history->itemAt(action->data().toInt()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationBar::loadHistoryIndexInNewTab(int index)
|
void NavigationBar::loadHistoryIndexInNewTab(int index)
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
index = action->data().toInt();
|
index = action->data().toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ NavigationBarConfigDialog::NavigationBarConfigDialog(NavigationBar *navigationBa
|
|||||||
void NavigationBarConfigDialog::loadSettings()
|
void NavigationBarConfigDialog::loadSettings()
|
||||||
{
|
{
|
||||||
auto createItem = [this](const NavigationBar::WidgetData &data) {
|
auto createItem = [this](const NavigationBar::WidgetData &data) {
|
||||||
QListWidgetItem *item = new QListWidgetItem();
|
auto *item = new QListWidgetItem();
|
||||||
item->setText(data.name);
|
item->setText(data.name);
|
||||||
item->setData(Qt::UserRole + 10, data.id);
|
item->setData(Qt::UserRole + 10, data.id);
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -55,7 +55,7 @@ void NavigationBarToolButton::updateVisibility()
|
|||||||
|
|
||||||
void NavigationBarToolButton::clicked()
|
void NavigationBarToolButton::clicked()
|
||||||
{
|
{
|
||||||
AbstractButtonInterface::ClickController *c = new AbstractButtonInterface::ClickController;
|
auto *c = new AbstractButtonInterface::ClickController;
|
||||||
c->visualParent = this;
|
c->visualParent = this;
|
||||||
c->popupPosition = [=](const QSize &size) {
|
c->popupPosition = [=](const QSize &size) {
|
||||||
QPoint pos = mapToGlobal(rect().bottomRight());
|
QPoint pos = mapToGlobal(rect().bottomRight());
|
||||||
|
@ -143,8 +143,8 @@ void SiteIcon::mouseMoveEvent(QMouseEvent* e)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDrag* drag = new QDrag(this);
|
auto* drag = new QDrag(this);
|
||||||
QMimeData* mime = new QMimeData;
|
auto* mime = new QMimeData;
|
||||||
mime->setUrls(QList<QUrl>() << url);
|
mime->setUrls(QList<QUrl>() << url);
|
||||||
mime->setText(title);
|
mime->setText(title);
|
||||||
mime->setImageData(icon().pixmap(16).toImage());
|
mime->setImageData(icon().pixmap(16).toImage());
|
||||||
@ -170,7 +170,7 @@ bool SiteIcon::showPopup()
|
|||||||
|
|
||||||
setDown(true);
|
setDown(true);
|
||||||
|
|
||||||
SiteInfoWidget* info = new SiteInfoWidget(m_window);
|
auto* info = new SiteInfoWidget(m_window);
|
||||||
info->showAt(parentWidget());
|
info->showAt(parentWidget());
|
||||||
|
|
||||||
connect(info, &QObject::destroyed, this, &SiteIcon::popupClosed);
|
connect(info, &QObject::destroyed, this, &SiteIcon::popupClosed);
|
||||||
|
@ -237,7 +237,7 @@ void WebSearchBar::searchInNewTab()
|
|||||||
|
|
||||||
void WebSearchBar::addEngineFromAction()
|
void WebSearchBar::addEngineFromAction()
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (auto* action = qobject_cast<QAction*>(sender())) {
|
||||||
m_searchManager->addEngine(action->data().toUrl());
|
m_searchManager->addEngine(action->data().toUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,24 +110,24 @@ bool NetworkManager::certificateError(const QWebEngineCertificateError &error, Q
|
|||||||
|
|
||||||
void NetworkManager::authentication(const QUrl &url, QAuthenticator *auth, QWidget *parent)
|
void NetworkManager::authentication(const QUrl &url, QAuthenticator *auth, QWidget *parent)
|
||||||
{
|
{
|
||||||
QDialog* dialog = new QDialog(parent);
|
auto* dialog = new QDialog(parent);
|
||||||
dialog->setWindowTitle(tr("Authorization required"));
|
dialog->setWindowTitle(tr("Authorization required"));
|
||||||
|
|
||||||
QFormLayout* formLa = new QFormLayout(dialog);
|
auto* formLa = new QFormLayout(dialog);
|
||||||
|
|
||||||
QLabel* label = new QLabel(dialog);
|
auto* label = new QLabel(dialog);
|
||||||
QLabel* userLab = new QLabel(dialog);
|
auto* userLab = new QLabel(dialog);
|
||||||
QLabel* passLab = new QLabel(dialog);
|
auto* passLab = new QLabel(dialog);
|
||||||
userLab->setText(tr("Username: "));
|
userLab->setText(tr("Username: "));
|
||||||
passLab->setText(tr("Password: "));
|
passLab->setText(tr("Password: "));
|
||||||
|
|
||||||
QLineEdit* user = new QLineEdit(dialog);
|
auto* user = new QLineEdit(dialog);
|
||||||
QLineEdit* pass = new QLineEdit(dialog);
|
auto* pass = new QLineEdit(dialog);
|
||||||
pass->setEchoMode(QLineEdit::Password);
|
pass->setEchoMode(QLineEdit::Password);
|
||||||
QCheckBox* save = new QCheckBox(dialog);
|
auto* save = new QCheckBox(dialog);
|
||||||
save->setText(tr("Save username and password for this site"));
|
save->setText(tr("Save username and password for this site"));
|
||||||
|
|
||||||
QDialogButtonBox* box = new QDialogButtonBox(dialog);
|
auto* box = new QDialogButtonBox(dialog);
|
||||||
box->addButton(QDialogButtonBox::Ok);
|
box->addButton(QDialogButtonBox::Ok);
|
||||||
box->addButton(QDialogButtonBox::Cancel);
|
box->addButton(QDialogButtonBox::Cancel);
|
||||||
connect(box, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
connect(box, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
||||||
@ -196,22 +196,22 @@ void NetworkManager::proxyAuthentication(const QString &proxyHost, QAuthenticato
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDialog* dialog = new QDialog(parent);
|
auto* dialog = new QDialog(parent);
|
||||||
dialog->setWindowTitle(tr("Proxy authorization required"));
|
dialog->setWindowTitle(tr("Proxy authorization required"));
|
||||||
|
|
||||||
QFormLayout* formLa = new QFormLayout(dialog);
|
auto* formLa = new QFormLayout(dialog);
|
||||||
|
|
||||||
QLabel* label = new QLabel(dialog);
|
auto* label = new QLabel(dialog);
|
||||||
QLabel* userLab = new QLabel(dialog);
|
auto* userLab = new QLabel(dialog);
|
||||||
QLabel* passLab = new QLabel(dialog);
|
auto* passLab = new QLabel(dialog);
|
||||||
userLab->setText(tr("Username: "));
|
userLab->setText(tr("Username: "));
|
||||||
passLab->setText(tr("Password: "));
|
passLab->setText(tr("Password: "));
|
||||||
|
|
||||||
QLineEdit* user = new QLineEdit(dialog);
|
auto* user = new QLineEdit(dialog);
|
||||||
QLineEdit* pass = new QLineEdit(dialog);
|
auto* pass = new QLineEdit(dialog);
|
||||||
pass->setEchoMode(QLineEdit::Password);
|
pass->setEchoMode(QLineEdit::Password);
|
||||||
|
|
||||||
QDialogButtonBox* box = new QDialogButtonBox(dialog);
|
auto* box = new QDialogButtonBox(dialog);
|
||||||
box->addButton(QDialogButtonBox::Ok);
|
box->addButton(QDialogButtonBox::Ok);
|
||||||
box->addButton(QDialogButtonBox::Cancel);
|
box->addButton(QDialogButtonBox::Cancel);
|
||||||
connect(box, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
connect(box, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
// ExtensionSchemeHandler
|
// ExtensionSchemeHandler
|
||||||
void ExtensionSchemeHandler::setReply(QWebEngineUrlRequestJob *job, const QByteArray &contentType, const QByteArray &content)
|
void ExtensionSchemeHandler::setReply(QWebEngineUrlRequestJob *job, const QByteArray &contentType, const QByteArray &content)
|
||||||
{
|
{
|
||||||
QBuffer *buffer = new QBuffer(job);
|
auto *buffer = new QBuffer(job);
|
||||||
buffer->open(QIODevice::ReadWrite);
|
buffer->open(QIODevice::ReadWrite);
|
||||||
buffer->write(content);
|
buffer->write(content);
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
|
@ -115,8 +115,7 @@ OpenSearchEngine::OpenSearchEngine(QObject* parent)
|
|||||||
A destructor.
|
A destructor.
|
||||||
*/
|
*/
|
||||||
OpenSearchEngine::~OpenSearchEngine()
|
OpenSearchEngine::~OpenSearchEngine()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
QString OpenSearchEngine::parseTemplate(const QString &searchTerm, const QString &searchTemplate)
|
QString OpenSearchEngine::parseTemplate(const QString &searchTerm, const QString &searchTemplate)
|
||||||
{
|
{
|
||||||
@ -222,7 +221,7 @@ void OpenSearchEngine::setSearchUrlTemplate(const QString &searchUrlTemplate)
|
|||||||
QUrl OpenSearchEngine::searchUrl(const QString &searchTerm) const
|
QUrl OpenSearchEngine::searchUrl(const QString &searchTerm) const
|
||||||
{
|
{
|
||||||
if (m_searchUrlTemplate.isEmpty()) {
|
if (m_searchUrlTemplate.isEmpty()) {
|
||||||
return QUrl();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl retVal = QUrl::fromEncoded(parseTemplate(searchTerm, m_searchUrlTemplate).toUtf8());
|
QUrl retVal = QUrl::fromEncoded(parseTemplate(searchTerm, m_searchUrlTemplate).toUtf8());
|
||||||
@ -243,7 +242,7 @@ QUrl OpenSearchEngine::searchUrl(const QString &searchTerm) const
|
|||||||
QByteArray OpenSearchEngine::getPostData(const QString &searchTerm) const
|
QByteArray OpenSearchEngine::getPostData(const QString &searchTerm) const
|
||||||
{
|
{
|
||||||
if (m_searchMethod != QLatin1String("post")) {
|
if (m_searchMethod != QLatin1String("post")) {
|
||||||
return QByteArray();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl retVal = QUrl("http://foo.bar");
|
QUrl retVal = QUrl("http://foo.bar");
|
||||||
@ -308,7 +307,7 @@ QUrl OpenSearchEngine::suggestionsUrl(const QString &searchTerm) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_suggestionsUrlTemplate.isEmpty()) {
|
if (m_suggestionsUrlTemplate.isEmpty()) {
|
||||||
return QUrl();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl retVal = QUrl::fromEncoded(parseTemplate(searchTerm, m_suggestionsUrlTemplate).toUtf8());
|
QUrl retVal = QUrl::fromEncoded(parseTemplate(searchTerm, m_suggestionsUrlTemplate).toUtf8());
|
||||||
@ -432,7 +431,7 @@ void OpenSearchEngine::loadImage() const
|
|||||||
|
|
||||||
void OpenSearchEngine::imageObtained()
|
void OpenSearchEngine::imageObtained()
|
||||||
{
|
{
|
||||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
auto* reply = qobject_cast<QNetworkReply*>(sender());
|
||||||
|
|
||||||
if (!reply) {
|
if (!reply) {
|
||||||
return;
|
return;
|
||||||
|
@ -58,8 +58,8 @@ Q_SIGNALS:
|
|||||||
void suggestions(const QStringList &suggestions);
|
void suggestions(const QStringList &suggestions);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef QPair<QString, QString> Parameter;
|
using Parameter = QPair<QString, QString>;
|
||||||
typedef QList<Parameter> Parameters;
|
using Parameters = QList<Parameter>;
|
||||||
|
|
||||||
Q_PROPERTY(QString name READ name WRITE setName)
|
Q_PROPERTY(QString name READ name WRITE setName)
|
||||||
Q_PROPERTY(QString description READ description WRITE setDescription)
|
Q_PROPERTY(QString description READ description WRITE setDescription)
|
||||||
|
@ -37,15 +37,13 @@
|
|||||||
Constructs the delegate.
|
Constructs the delegate.
|
||||||
*/
|
*/
|
||||||
OpenSearchEngineDelegate::OpenSearchEngineDelegate()
|
OpenSearchEngineDelegate::OpenSearchEngineDelegate()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Destructs the delegate.
|
Destructs the delegate.
|
||||||
*/
|
*/
|
||||||
OpenSearchEngineDelegate::~OpenSearchEngineDelegate()
|
OpenSearchEngineDelegate::~OpenSearchEngineDelegate()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void performSearchRequest(const QNetworkRequest &request,
|
\fn void performSearchRequest(const QNetworkRequest &request,
|
||||||
|
@ -96,7 +96,7 @@ OpenSearchEngine* OpenSearchReader::read(QIODevice* device)
|
|||||||
|
|
||||||
OpenSearchEngine* OpenSearchReader::read()
|
OpenSearchEngine* OpenSearchReader::read()
|
||||||
{
|
{
|
||||||
OpenSearchEngine* engine = new OpenSearchEngine();
|
auto* engine = new OpenSearchEngine();
|
||||||
m_searchXml = device()->peek(1024 * 5);
|
m_searchXml = device()->peek(1024 * 5);
|
||||||
|
|
||||||
if (!m_searchXml.contains(QLatin1String("http://a9.com/-/spec/opensearch/1.1/")) &&
|
if (!m_searchXml.contains(QLatin1String("http://a9.com/-/spec/opensearch/1.1/")) &&
|
||||||
|
@ -67,7 +67,7 @@ void SearchEnginesDialog::addEngine()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
auto* item = new QTreeWidgetItem();
|
||||||
setEngine(item, engine);
|
setEngine(item, engine);
|
||||||
|
|
||||||
changeItemToDefault(item, false);
|
changeItemToDefault(item, false);
|
||||||
@ -223,7 +223,7 @@ void SearchEnginesDialog::reloadEngines()
|
|||||||
|
|
||||||
const auto engines = m_manager->allEngines();
|
const auto engines = m_manager->allEngines();
|
||||||
for (const SearchEngine &en : engines) {
|
for (const SearchEngine &en : engines) {
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
auto* item = new QTreeWidgetItem();
|
||||||
setEngine(item, en);
|
setEngine(item, en);
|
||||||
changeItemToDefault(item, en == defaultEngine);
|
changeItemToDefault(item, en == defaultEngine);
|
||||||
item->setIcon(0, en.icon);
|
item->setIcon(0, en.icon);
|
||||||
|
@ -211,7 +211,7 @@ QIcon SearchEnginesManager::iconForSearchEngine(const QUrl &url)
|
|||||||
|
|
||||||
void SearchEnginesManager::engineChangedImage()
|
void SearchEnginesManager::engineChangedImage()
|
||||||
{
|
{
|
||||||
OpenSearchEngine* engine = qobject_cast<OpenSearchEngine*>(sender());
|
auto* engine = qobject_cast<OpenSearchEngine*>(sender());
|
||||||
|
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
return;
|
return;
|
||||||
@ -379,7 +379,7 @@ void SearchEnginesManager::replyFinished()
|
|||||||
{
|
{
|
||||||
qApp->restoreOverrideCursor();
|
qApp->restoreOverrideCursor();
|
||||||
|
|
||||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
auto* reply = qobject_cast<QNetworkReply*>(sender());
|
||||||
if (!reply) {
|
if (!reply) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ private:
|
|||||||
Engine m_defaultEngine;
|
Engine m_defaultEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SearchEnginesManager::Engine SearchEngine;
|
using SearchEngine = SearchEnginesManager::Engine;
|
||||||
|
|
||||||
// Hint to QVector to use std::realloc on item moving
|
// Hint to QVector to use std::realloc on item moving
|
||||||
Q_DECLARE_TYPEINFO(SearchEngine, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(SearchEngine, Q_MOVABLE_TYPE);
|
||||||
|
@ -57,7 +57,7 @@ BrowsingLibrary::BrowsingLibrary(BrowserWindow* window, QWidget* parent)
|
|||||||
ui->tabs->SetMode(FancyTabWidget::Mode_LargeSidebar);
|
ui->tabs->SetMode(FancyTabWidget::Mode_LargeSidebar);
|
||||||
ui->tabs->setFocus();
|
ui->tabs->setFocus();
|
||||||
|
|
||||||
QMenu* m = new QMenu(this);
|
auto* m = new QMenu(this);
|
||||||
m->addAction(tr("Import Bookmarks..."), this, &BrowsingLibrary::importBookmarks);
|
m->addAction(tr("Import Bookmarks..."), this, &BrowsingLibrary::importBookmarks);
|
||||||
m->addAction(tr("Export Bookmarks..."), this, &BrowsingLibrary::exportBookmarks);
|
m->addAction(tr("Export Bookmarks..."), this, &BrowsingLibrary::exportBookmarks);
|
||||||
ui->importExport->setMenu(m);
|
ui->importExport->setMenu(m);
|
||||||
@ -80,13 +80,13 @@ void BrowsingLibrary::search()
|
|||||||
|
|
||||||
void BrowsingLibrary::importBookmarks()
|
void BrowsingLibrary::importBookmarks()
|
||||||
{
|
{
|
||||||
BookmarksImportDialog* d = new BookmarksImportDialog(this);
|
auto* d = new BookmarksImportDialog(this);
|
||||||
d->open();
|
d->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowsingLibrary::exportBookmarks()
|
void BrowsingLibrary::exportBookmarks()
|
||||||
{
|
{
|
||||||
BookmarksExportDialog* d = new BookmarksExportDialog(this);
|
auto* d = new BookmarksExportDialog(this);
|
||||||
d->open();
|
d->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ void ClearPrivateData::optimizeDb()
|
|||||||
|
|
||||||
void ClearPrivateData::showCookieManager()
|
void ClearPrivateData::showCookieManager()
|
||||||
{
|
{
|
||||||
CookieManager* dialog = new CookieManager(this);
|
auto* dialog = new CookieManager(this);
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ void IconChooser::chooseFile()
|
|||||||
QIcon icon(path);
|
QIcon icon(path);
|
||||||
|
|
||||||
if (!icon.isNull()) {
|
if (!icon.isNull()) {
|
||||||
QListWidgetItem* item = new QListWidgetItem(ui->iconList);
|
auto* item = new QListWidgetItem(ui->iconList);
|
||||||
item->setIcon(icon);
|
item->setIcon(icon);
|
||||||
|
|
||||||
ui->iconList->setCurrentItem(item);
|
ui->iconList->setCurrentItem(item);
|
||||||
@ -72,7 +72,7 @@ void IconChooser::searchIcon(const QString &string)
|
|||||||
while (query.next()) {
|
while (query.next()) {
|
||||||
QImage image = QImage::fromData(query.value(0).toByteArray());
|
QImage image = QImage::fromData(query.value(0).toByteArray());
|
||||||
if (!image.isNull()) {
|
if (!image.isNull()) {
|
||||||
QListWidgetItem* item = new QListWidgetItem(ui->iconList);
|
auto* item = new QListWidgetItem(ui->iconList);
|
||||||
item->setIcon(QPixmap::fromImage(image));
|
item->setIcon(QPixmap::fromImage(image));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,11 @@ LicenseViewer::LicenseViewer(QWidget* parent)
|
|||||||
serifFont.setFamily("Courier");
|
serifFont.setFamily("Courier");
|
||||||
m_textBrowser->setFont(serifFont);
|
m_textBrowser->setFont(serifFont);
|
||||||
|
|
||||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
|
auto* buttonBox = new QDialogButtonBox(this);
|
||||||
buttonBox->setStandardButtons(QDialogButtonBox::Close);
|
buttonBox->setStandardButtons(QDialogButtonBox::Close);
|
||||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
|
||||||
|
|
||||||
QVBoxLayout* l = new QVBoxLayout(this);
|
auto* l = new QVBoxLayout(this);
|
||||||
l->addWidget(m_textBrowser);
|
l->addWidget(m_textBrowser);
|
||||||
l->addWidget(buttonBox);
|
l->addWidget(buttonBox);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void ProtocolHandlerDialog::init()
|
|||||||
{
|
{
|
||||||
const auto handlers = mApp->protocolHandlerManager()->protocolHandlers();
|
const auto handlers = mApp->protocolHandlerManager()->protocolHandlers();
|
||||||
for (auto it = handlers.cbegin(); it != handlers.cend(); ++it) {
|
for (auto it = handlers.cbegin(); it != handlers.cend(); ++it) {
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeWidget);
|
auto *item = new QTreeWidgetItem(ui->treeWidget);
|
||||||
item->setText(0, it.key());
|
item->setText(0, it.key());
|
||||||
item->setText(1, it.value().host());
|
item->setText(1, it.value().host());
|
||||||
ui->treeWidget->addTopLevelItem(item);
|
ui->treeWidget->addTopLevelItem(item);
|
||||||
|
@ -79,7 +79,7 @@ void ProtocolHandlerManager::registerHandler(const QString &scheme, const QUrl &
|
|||||||
QString urlString = url.toString();
|
QString urlString = url.toString();
|
||||||
urlString.replace(QL1S("%25s"), QL1S("%s"));
|
urlString.replace(QL1S("%25s"), QL1S("%s"));
|
||||||
|
|
||||||
QWebEnginePage *page = new QWebEnginePage(this);
|
auto *page = new QWebEnginePage(this);
|
||||||
connect(page, &QWebEnginePage::loadFinished, page, &QObject::deleteLater);
|
connect(page, &QWebEnginePage::loadFinished, page, &QObject::deleteLater);
|
||||||
connect(page, &QWebEnginePage::registerProtocolHandlerRequested, this, [](QWebEngineRegisterProtocolHandlerRequest request) {
|
connect(page, &QWebEnginePage::registerProtocolHandlerRequested, this, [](QWebEngineRegisterProtocolHandlerRequest request) {
|
||||||
request.accept();
|
request.accept();
|
||||||
|
@ -51,7 +51,7 @@ SiteInfo::SiteInfo(WebView *view)
|
|||||||
ui->treeTags->setLayoutDirection(Qt::LeftToRight);
|
ui->treeTags->setLayoutDirection(Qt::LeftToRight);
|
||||||
QzTools::centerWidgetOnScreen(this);
|
QzTools::centerWidgetOnScreen(this);
|
||||||
|
|
||||||
ListItemDelegate* delegate = new ListItemDelegate(24, ui->listWidget);
|
auto* delegate = new ListItemDelegate(24, ui->listWidget);
|
||||||
delegate->setUpdateParentHeight(true);
|
delegate->setUpdateParentHeight(true);
|
||||||
delegate->setUniformItemSizes(true);
|
delegate->setUniformItemSizes(true);
|
||||||
ui->listWidget->setItemDelegate(delegate);
|
ui->listWidget->setItemDelegate(delegate);
|
||||||
@ -87,7 +87,7 @@ SiteInfo::SiteInfo(WebView *view)
|
|||||||
if (content.isEmpty() || name.isEmpty())
|
if (content.isEmpty() || name.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeTags);
|
auto* item = new QTreeWidgetItem(ui->treeTags);
|
||||||
item->setText(0, name);
|
item->setText(0, name);
|
||||||
item->setText(1, content);
|
item->setText(1, content);
|
||||||
ui->treeTags->addTopLevelItem(item);
|
ui->treeTags->addTopLevelItem(item);
|
||||||
@ -115,7 +115,7 @@ SiteInfo::SiteInfo(WebView *view)
|
|||||||
if (src.isEmpty() || alt.isEmpty())
|
if (src.isEmpty() || alt.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeImages);
|
auto* item = new QTreeWidgetItem(ui->treeImages);
|
||||||
item->setText(0, alt);
|
item->setText(0, alt);
|
||||||
item->setText(1, src);
|
item->setText(1, src);
|
||||||
ui->treeImages->addTopLevelItem(item);
|
ui->treeImages->addTopLevelItem(item);
|
||||||
@ -128,19 +128,19 @@ SiteInfo::SiteInfo(WebView *view)
|
|||||||
connect(ui->treeImages, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(imagesCustomContextMenuRequested(QPoint)));
|
connect(ui->treeImages, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(imagesCustomContextMenuRequested(QPoint)));
|
||||||
connect(ui->treeTags, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(tagsCustomContextMenuRequested(QPoint)));
|
connect(ui->treeTags, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(tagsCustomContextMenuRequested(QPoint)));
|
||||||
|
|
||||||
QShortcut *shortcutTagsCopyAll = new QShortcut(QKeySequence("Ctrl+C"), ui->treeTags);
|
auto *shortcutTagsCopyAll = new QShortcut(QKeySequence("Ctrl+C"), ui->treeTags);
|
||||||
shortcutTagsCopyAll->setContext(Qt::WidgetShortcut);
|
shortcutTagsCopyAll->setContext(Qt::WidgetShortcut);
|
||||||
connect(shortcutTagsCopyAll, &QShortcut::activated, [=]{copySelectedItems(ui->treeTags, false);});
|
connect(shortcutTagsCopyAll, &QShortcut::activated, [=]{copySelectedItems(ui->treeTags, false);});
|
||||||
|
|
||||||
QShortcut *shortcutTagsCopyValues = new QShortcut(QKeySequence("Ctrl+Shift+C"), ui->treeTags);
|
auto *shortcutTagsCopyValues = new QShortcut(QKeySequence("Ctrl+Shift+C"), ui->treeTags);
|
||||||
shortcutTagsCopyValues->setContext(Qt::WidgetShortcut);
|
shortcutTagsCopyValues->setContext(Qt::WidgetShortcut);
|
||||||
connect(shortcutTagsCopyValues, &QShortcut::activated, [=]{copySelectedItems(ui->treeTags, true);});
|
connect(shortcutTagsCopyValues, &QShortcut::activated, [=]{copySelectedItems(ui->treeTags, true);});
|
||||||
|
|
||||||
QShortcut *shortcutImagesCopyAll = new QShortcut(QKeySequence("Ctrl+C"), ui->treeImages);
|
auto *shortcutImagesCopyAll = new QShortcut(QKeySequence("Ctrl+C"), ui->treeImages);
|
||||||
shortcutImagesCopyAll->setContext(Qt::WidgetShortcut);
|
shortcutImagesCopyAll->setContext(Qt::WidgetShortcut);
|
||||||
connect(shortcutImagesCopyAll, &QShortcut::activated, [=]{copySelectedItems(ui->treeImages, false);});
|
connect(shortcutImagesCopyAll, &QShortcut::activated, [=]{copySelectedItems(ui->treeImages, false);});
|
||||||
|
|
||||||
QShortcut *shortcutImagesCopyValues = new QShortcut(QKeySequence("Ctrl+Shift+C"), ui->treeImages);
|
auto *shortcutImagesCopyValues = new QShortcut(QKeySequence("Ctrl+Shift+C"), ui->treeImages);
|
||||||
shortcutImagesCopyValues->setContext(Qt::WidgetShortcut);
|
shortcutImagesCopyValues->setContext(Qt::WidgetShortcut);
|
||||||
connect(shortcutImagesCopyValues, &QShortcut::activated, [=]{copySelectedItems(ui->treeImages, true);});
|
connect(shortcutImagesCopyValues, &QShortcut::activated, [=]{copySelectedItems(ui->treeImages, true);});
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ void SiteInfo::saveImage()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QGraphicsItem *graphicsItem = ui->mediaPreview->scene()->items().at(0);
|
QGraphicsItem *graphicsItem = ui->mediaPreview->scene()->items().at(0);
|
||||||
QGraphicsPixmapItem *pixmapItem = static_cast<QGraphicsPixmapItem*>(graphicsItem);
|
auto *pixmapItem = static_cast<QGraphicsPixmapItem*>(graphicsItem);
|
||||||
if (graphicsItem->type() != QGraphicsPixmapItem::Type || !pixmapItem)
|
if (graphicsItem->type() != QGraphicsPixmapItem::Type || !pixmapItem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ void SiteInfo::saveImage()
|
|||||||
void SiteInfo::showLoadingText()
|
void SiteInfo::showLoadingText()
|
||||||
{
|
{
|
||||||
delete ui->mediaPreview->scene();
|
delete ui->mediaPreview->scene();
|
||||||
QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview);
|
auto* scene = new QGraphicsScene(ui->mediaPreview);
|
||||||
|
|
||||||
scene->addText(tr("Loading..."));
|
scene->addText(tr("Loading..."));
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ void SiteInfo::showPixmap(QPixmap pixmap)
|
|||||||
pixmap.setDevicePixelRatio(devicePixelRatioF());
|
pixmap.setDevicePixelRatio(devicePixelRatioF());
|
||||||
|
|
||||||
delete ui->mediaPreview->scene();
|
delete ui->mediaPreview->scene();
|
||||||
QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview);
|
auto* scene = new QGraphicsScene(ui->mediaPreview);
|
||||||
|
|
||||||
if (pixmap.isNull())
|
if (pixmap.isNull())
|
||||||
scene->addText(tr("Preview not available"));
|
scene->addText(tr("Preview not available"));
|
||||||
|
@ -68,7 +68,7 @@ StatusBarButton::StatusBarButton(AbstractButtonInterface *button, QWidget *paren
|
|||||||
|
|
||||||
void StatusBarButton::clicked()
|
void StatusBarButton::clicked()
|
||||||
{
|
{
|
||||||
AbstractButtonInterface::ClickController *c = new AbstractButtonInterface::ClickController;
|
auto *c = new AbstractButtonInterface::ClickController;
|
||||||
c->visualParent = this;
|
c->visualParent = this;
|
||||||
c->popupPosition = [=](const QSize &size) {
|
c->popupPosition = [=](const QSize &size) {
|
||||||
QPoint pos = mapToGlobal(rect().topRight());
|
QPoint pos = mapToGlobal(rect().topRight());
|
||||||
@ -222,7 +222,7 @@ void StatusBar::addButton(AbstractButtonInterface *button)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusBarButton *widget = new StatusBarButton(button, this);
|
auto *widget = new StatusBarButton(button, this);
|
||||||
widget->setProperty("button-id", button->id());
|
widget->setProperty("button-id", button->id());
|
||||||
|
|
||||||
WidgetData data;
|
WidgetData data;
|
||||||
|
@ -136,7 +136,7 @@ void Updater::startDownloadingUpdateInfo(const QUrl &url)
|
|||||||
|
|
||||||
void Updater::downCompleted()
|
void Updater::downCompleted()
|
||||||
{
|
{
|
||||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
auto* reply = qobject_cast<QNetworkReply*>(sender());
|
||||||
if (!reply)
|
if (!reply)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ static DesktopFile readMetaData(const KArchiveDirectory *directory)
|
|||||||
const KArchiveEntry *entry = directory->entry(QSL("metadata.desktop"));
|
const KArchiveEntry *entry = directory->entry(QSL("metadata.desktop"));
|
||||||
if (!entry || !entry->isFile()) {
|
if (!entry || !entry->isFile()) {
|
||||||
qWarning() << "No metadata.desktop found";
|
qWarning() << "No metadata.desktop found";
|
||||||
return DesktopFile();
|
return {};
|
||||||
}
|
}
|
||||||
const QString tempDir = DataPaths::path(DataPaths::Temp);
|
const QString tempDir = DataPaths::path(DataPaths::Temp);
|
||||||
static_cast<const KArchiveFile*>(entry)->copyTo(tempDir);
|
static_cast<const KArchiveFile*>(entry)->copyTo(tempDir);
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
LateInitState
|
LateInitState
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~PluginInterface() { }
|
virtual ~PluginInterface() = default;
|
||||||
|
|
||||||
virtual void init(InitState state, const QString &settingsPath) = 0;
|
virtual void init(InitState state, const QString &settingsPath) = 0;
|
||||||
virtual void unload() = 0;
|
virtual void unload() = 0;
|
||||||
|
@ -373,7 +373,7 @@ Plugins::Plugin Plugins::loadPlugin(const QString &id)
|
|||||||
return QmlPlugin::loadPlugin(name);
|
return QmlPlugin::loadPlugin(name);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return Plugin();
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ Plugins::Plugin Plugins::loadInternalPlugin(const QString &name)
|
|||||||
plugin.pluginSpec = createSpec(DesktopFile(QSL(":adblock/metadata.desktop")));
|
plugin.pluginSpec = createSpec(DesktopFile(QSL(":adblock/metadata.desktop")));
|
||||||
return plugin;
|
return plugin;
|
||||||
} else {
|
} else {
|
||||||
return Plugin();
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,7 +400,7 @@ Plugins::Plugin Plugins::loadSharedLibraryPlugin(const QString &name)
|
|||||||
fullPath = DataPaths::locate(DataPaths::Plugins, name);
|
fullPath = DataPaths::locate(DataPaths::Plugins, name);
|
||||||
if (fullPath.isEmpty()) {
|
if (fullPath.isEmpty()) {
|
||||||
qWarning() << "Library plugin" << name << "not found";
|
qWarning() << "Library plugin" << name << "not found";
|
||||||
return Plugin();
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ QList<QObject*> QmlBookmarks::search(const QVariantMap &map) const
|
|||||||
{
|
{
|
||||||
if (!map.contains(QSL("query")) && !map.contains(QSL("url"))) {
|
if (!map.contains(QSL("query")) && !map.contains(QSL("url"))) {
|
||||||
qWarning() << "Unable to search bookmarks";
|
qWarning() << "Unable to search bookmarks";
|
||||||
return QList<QObject*>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString query = map.value(QSL("query")).toString();
|
const QString query = map.value(QSL("query")).toString();
|
||||||
|
@ -61,7 +61,7 @@ QmlBookmarkTreeNode::Type QmlBookmarkTreeNode::type() const
|
|||||||
QString QmlBookmarkTreeNode::title() const
|
QString QmlBookmarkTreeNode::title() const
|
||||||
{
|
{
|
||||||
if (!m_item) {
|
if (!m_item) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_item->title();
|
return m_item->title();
|
||||||
@ -70,7 +70,7 @@ QString QmlBookmarkTreeNode::title() const
|
|||||||
QString QmlBookmarkTreeNode::url() const
|
QString QmlBookmarkTreeNode::url() const
|
||||||
{
|
{
|
||||||
if (!m_item) {
|
if (!m_item) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_item->urlString();
|
return m_item->urlString();
|
||||||
@ -79,7 +79,7 @@ QString QmlBookmarkTreeNode::url() const
|
|||||||
QString QmlBookmarkTreeNode::description() const
|
QString QmlBookmarkTreeNode::description() const
|
||||||
{
|
{
|
||||||
if (!m_item) {
|
if (!m_item) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_item->description();
|
return m_item->description();
|
||||||
@ -88,7 +88,7 @@ QString QmlBookmarkTreeNode::description() const
|
|||||||
QString QmlBookmarkTreeNode::keyword() const
|
QString QmlBookmarkTreeNode::keyword() const
|
||||||
{
|
{
|
||||||
if (!m_item) {
|
if (!m_item) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_item->keyword();
|
return m_item->keyword();
|
||||||
|
@ -243,10 +243,10 @@ void QmlBrowserActionButton::positionPopup(ClickController *clickController)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickWidget *quickWidget = new QQuickWidget();
|
auto *quickWidget = new QQuickWidget();
|
||||||
quickWidget->setContent(m_popup->url(), m_popup, m_popup->create(m_popup->creationContext()));
|
quickWidget->setContent(m_popup->url(), m_popup, m_popup->create(m_popup->creationContext()));
|
||||||
|
|
||||||
QWidget *widget = new QWidget();
|
auto *widget = new QWidget();
|
||||||
quickWidget->setParent(widget);
|
quickWidget->setParent(widget);
|
||||||
|
|
||||||
widget->setWindowFlag(Qt::Popup);
|
widget->setWindowFlag(Qt::Popup);
|
||||||
|
@ -28,7 +28,7 @@ QmlCookie::QmlCookie(QNetworkCookie *cookie, QObject *parent)
|
|||||||
QString QmlCookie::domain() const
|
QString QmlCookie::domain() const
|
||||||
{
|
{
|
||||||
if (!m_cookie) {
|
if (!m_cookie) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
return m_cookie->domain();
|
return m_cookie->domain();
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ QString QmlCookie::domain() const
|
|||||||
QDateTime QmlCookie::expirationDate() const
|
QDateTime QmlCookie::expirationDate() const
|
||||||
{
|
{
|
||||||
if (!m_cookie) {
|
if (!m_cookie) {
|
||||||
return QDateTime();
|
return {};
|
||||||
}
|
}
|
||||||
return m_cookie->expirationDate();
|
return m_cookie->expirationDate();
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ QDateTime QmlCookie::expirationDate() const
|
|||||||
QString QmlCookie::name() const
|
QString QmlCookie::name() const
|
||||||
{
|
{
|
||||||
if (!m_cookie) {
|
if (!m_cookie) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
return QString(m_cookie->name());
|
return QString(m_cookie->name());
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ QString QmlCookie::name() const
|
|||||||
QString QmlCookie::path() const
|
QString QmlCookie::path() const
|
||||||
{
|
{
|
||||||
if (!m_cookie) {
|
if (!m_cookie) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
return m_cookie->path();
|
return m_cookie->path();
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ bool QmlCookie::session() const
|
|||||||
QString QmlCookie::value() const
|
QString QmlCookie::value() const
|
||||||
{
|
{
|
||||||
if (!m_cookie) {
|
if (!m_cookie) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
return QString(m_cookie->value());
|
return QString(m_cookie->value());
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ quint32 QmlKeyEvent::nativeVirtualKey() const
|
|||||||
QString QmlKeyEvent::text() const
|
QString QmlKeyEvent::text() const
|
||||||
{
|
{
|
||||||
if (!m_keyEvent) {
|
if (!m_keyEvent) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
return m_keyEvent->text();
|
return m_keyEvent->text();
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ QmlExtensionScheme::QmlExtensionScheme(QObject *parent)
|
|||||||
{
|
{
|
||||||
m_schemeHandler = new QmlExtensionSchemeHandler;
|
m_schemeHandler = new QmlExtensionSchemeHandler;
|
||||||
connect(m_schemeHandler, &QmlExtensionSchemeHandler::_requestStarted, this, [this](QWebEngineUrlRequestJob *job) {
|
connect(m_schemeHandler, &QmlExtensionSchemeHandler::_requestStarted, this, [this](QWebEngineUrlRequestJob *job) {
|
||||||
QmlWebEngineUrlRequestJob *qmlRequest = new QmlWebEngineUrlRequestJob(job);
|
auto *qmlRequest = new QmlWebEngineUrlRequestJob(job);
|
||||||
const QJSValue request = qmlEngine(this)->newQObject(qmlRequest);
|
const QJSValue request = qmlEngine(this)->newQObject(qmlRequest);
|
||||||
emit requestStarted(request);
|
emit requestStarted(request);
|
||||||
});
|
});
|
||||||
|
@ -55,7 +55,7 @@ void QmlWebEngineUrlRequestJob::reply(const QVariantMap &map)
|
|||||||
}
|
}
|
||||||
QByteArray content = map.value(QSL("content")).toString().toUtf8();
|
QByteArray content = map.value(QSL("content")).toString().toUtf8();
|
||||||
QByteArray contentType = map.value(QSL("contentType")).toString().toUtf8();
|
QByteArray contentType = map.value(QSL("contentType")).toString().toUtf8();
|
||||||
QBuffer *buffer = new QBuffer();
|
auto *buffer = new QBuffer();
|
||||||
buffer->open(QIODevice::ReadWrite);
|
buffer->open(QIODevice::ReadWrite);
|
||||||
buffer->write(content);
|
buffer->write(content);
|
||||||
buffer->seek(0);
|
buffer->seek(0);
|
||||||
@ -64,7 +64,7 @@ void QmlWebEngineUrlRequestJob::reply(const QVariantMap &map)
|
|||||||
QString QmlWebEngineUrlRequestJob::initiator() const
|
QString QmlWebEngineUrlRequestJob::initiator() const
|
||||||
{
|
{
|
||||||
if (!m_job) {
|
if (!m_job) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
QString initiatorString;
|
QString initiatorString;
|
||||||
initiatorString = QString::fromUtf8(m_job->initiator().toEncoded());
|
initiatorString = QString::fromUtf8(m_job->initiator().toEncoded());
|
||||||
@ -74,7 +74,7 @@ QString QmlWebEngineUrlRequestJob::initiator() const
|
|||||||
QString QmlWebEngineUrlRequestJob::requestUrl() const
|
QString QmlWebEngineUrlRequestJob::requestUrl() const
|
||||||
{
|
{
|
||||||
if (!m_job) {
|
if (!m_job) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
return QString::fromUtf8(m_job->requestUrl().toEncoded());
|
return QString::fromUtf8(m_job->requestUrl().toEncoded());
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ QString QmlWebEngineUrlRequestJob::requestUrl() const
|
|||||||
QString QmlWebEngineUrlRequestJob::requestMethod() const
|
QString QmlWebEngineUrlRequestJob::requestMethod() const
|
||||||
{
|
{
|
||||||
if (!m_job) {
|
if (!m_job) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
return QString::fromUtf8(m_job->requestMethod());
|
return QString::fromUtf8(m_job->requestMethod());
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ QString QmlFileUtils::resolve(const QString &filePath)
|
|||||||
if (resolvedPath.contains(m_path)) {
|
if (resolvedPath.contains(m_path)) {
|
||||||
return resolvedPath;
|
return resolvedPath;
|
||||||
}
|
}
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray QmlFileUtils::readAllFileContents(const QString &fileName)
|
QByteArray QmlFileUtils::readAllFileContents(const QString &fileName)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user