Commit 3fa1e811 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 4543c744
Pipeline #192760 passed with stage
in 2 minutes and 17 seconds
......@@ -25,7 +25,7 @@
void DatabaseEncryptedPasswordBackendTest::reloadBackend()
{
delete m_backend;
DatabaseEncryptedPasswordBackend* backend = new DatabaseEncryptedPasswordBackend;
auto* backend = new DatabaseEncryptedPasswordBackend;
if (m_testMasterPassword.isEmpty()) {
m_testMasterPassword = AesInterface::passwordToHash(QString::fromUtf8(AesInterface::createRandomData(8)));
......
......@@ -82,7 +82,7 @@ void LocationBarTest::loadActionBasicTest()
void LocationBarTest::loadActionBookmarksTest()
{
BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url);
auto* bookmark = new BookmarkItem(BookmarkItem::Url);
bookmark->setTitle("KDE Bookmark title");
bookmark->setUrl(QUrl("http://kde.org"));
bookmark->setKeyword("kde-bookmark");
......
......@@ -49,7 +49,7 @@ void QmlBookmarksApiTest::testBookmarkTreeNode()
QCOMPARE(toolbarFolder->urlString(), bookmark->property("url").toString());
QCOMPARE(toolbarFolder->description(), bookmark->property("description").toString());
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);
QCOMPARE(mApp->bookmarks()->rootItem()->title(), parent->property("title").toString());
}
......@@ -69,7 +69,7 @@ void QmlBookmarksApiTest::testBookmarksCreation()
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);
QCOMPARE(item->title(), created->property("title").toString());
......@@ -84,7 +84,7 @@ void QmlBookmarksApiTest::testBookmarksCreation()
QVERIFY(out.toBool());
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);
QCOMPARE(createdItem->title(), QString("Example Plugin"));
}
......@@ -112,7 +112,7 @@ void QmlBookmarksApiTest::testBookmarksModification()
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);
QCOMPARE(modified->property("title").toString(), QString("Modified Example Domain"));
......@@ -125,7 +125,7 @@ void QmlBookmarksApiTest::testBookmarksModification()
QVERIFY(out.toBool());
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);
QCOMPARE(modifiedItem->title(), QString("Modified Example Plugin"));
}
......@@ -143,7 +143,7 @@ void QmlBookmarksApiTest::testBookmarksRemoval()
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);
QCOMPARE(removed->property("title").toString(), QString("Modified Example Domain"));
......@@ -154,7 +154,7 @@ void QmlBookmarksApiTest::testBookmarksRemoval()
QVERIFY(out.toBool());
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);
QCOMPARE(removedItem->title(), QString("Modified Example Plugin"));
}
......
......@@ -52,7 +52,7 @@ void QmlCookiesApiTest::testCookieAdditionRemoval()
mApp->webProfile()->cookieStore()->setCookie(anotherNetCookie);
QTRY_COMPARE(qmlCookieSpy.count(), 1);
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();
QCOMPARE(addedQmlCookie->property("name").toString(), QSL("Hello"));
QCOMPARE(removed, false);
......@@ -60,7 +60,7 @@ void QmlCookiesApiTest::testCookieAdditionRemoval()
mApp->webProfile()->cookieStore()->deleteCookie(netCookie);
QTRY_COMPARE(qmlCookieSpy.count(), 2);
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();
QCOMPARE(removedQmlCookie->property("name").toString(), QSL("Example"));
QCOMPARE(removed, true);
......
......@@ -37,7 +37,7 @@ void QmlTopSitesApiTest::testTopSites()
qDebug() << "Top sites list size=" << list.length();
for( const auto& site : list )
{
QObject* object = qvariant_cast<QObject*>(site);
auto* object = qvariant_cast<QObject*>(site);
if (object)
{
qDebug() << ".." << object->property("title") << object->property("url");
......@@ -48,7 +48,7 @@ void QmlTopSitesApiTest::testTopSites()
}
}
QCOMPARE(list.length(), 1);
QObject* object = qvariant_cast<QObject*>(list.at(0));
auto* object = qvariant_cast<QObject*>(list.at(0));
QVERIFY(object);
QCOMPARE(object->property("title").toString(), QSL("Example Domain"));
QCOMPARE(object->property("url").toString(), QSL("https://example.com"));
......
......@@ -55,9 +55,9 @@ void QmlUserScriptApiTest::testContains()
{
QWebEngineScript script = mApp->webProfile()->scripts()->toList().at(0);
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
QmlUserScripts *userScripts = dynamic_cast<QmlUserScripts*>(object);
auto *userScripts = dynamic_cast<QmlUserScripts*>(object);
QVERIFY(userScripts);
QmlUserScript *userScript = new QmlUserScript();
auto *userScript = new QmlUserScript();
userScript->setWebEngineScript(script);
bool contains = userScripts->contains(userScript);
QCOMPARE(contains, true);
......@@ -67,7 +67,7 @@ void QmlUserScriptApiTest::testFind()
{
QWebEngineScript script = mApp->webProfile()->scripts()->toList().at(0);
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
QmlUserScripts *userScripts = dynamic_cast<QmlUserScripts*>(object);
auto *userScripts = dynamic_cast<QmlUserScripts*>(object);
QVERIFY(userScripts);
QObject *scriptFound = userScripts->findScript(script.name());
QVERIFY(scriptFound);
......@@ -78,9 +78,9 @@ void QmlUserScriptApiTest::testInsertRemove()
{
int initialCount = m_testHelper.evaluate("Falkon.UserScripts.count").toInt();
QObject *object = m_testHelper.evaluateQObject("Falkon.UserScripts");
QmlUserScripts *userScripts = dynamic_cast<QmlUserScripts*>(object);
auto *userScripts = dynamic_cast<QmlUserScripts*>(object);
QVERIFY(userScripts);
QmlUserScript *userScript = new QmlUserScript();
auto *userScript = new QmlUserScript();
userScript->setProperty("name", "Hello World");
userScript->setProperty("sourceCode", "(function() {"
" alert('Hello World')"
......
......@@ -57,7 +57,7 @@ void QmlWindowsApiTest::testWindowsAPI()
QTRY_COMPARE(qmlWindowCreatedSignal.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);
QCOMPARE(newQmlWindow->property("id").toInt(), newQmlSignalWindow->property("id").toInt());
......
......@@ -95,13 +95,13 @@ void QzToolsTest::splitCommandArguments_data()
<< QStringList();
QTest::newRow("OnlySpaces") << QString(" ")
<< QStringList();
QTest::newRow("OnlyQuotes") << QString("\"\" \"\"")
QTest::newRow("OnlyQuotes") << QString(R"("" "")")
<< QStringList();
QTest::newRow("EmptyQuotesAndSpace") << QString("\"\" \"\" \" \"")
QTest::newRow("EmptyQuotesAndSpace") << QString(R"("" "" " ")")
<< QStringList(" ");
QTest::newRow("MultipleSpaces") << " /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");
QTest::newRow("SingleQuotes") << "'/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");
QTest::newRow("DoubleInSingleQuotes") << "/usr/foo -o 'foo\" d \".out' "
<< (QStringList() << "/usr/foo" << "-o" << "foo\" d \".out");
QTest::newRow("SpacesWithQuotes") << QString(" \" \" \" \" ")
QTest::newRow("SpacesWithQuotes") << QString(R"( " " " " )")
<< (QStringList() << " " << " ");
QTest::newRow("QuotesAndSpaces") << "/usr/foo -o \"foo - out\""
<< (QStringList() << "/usr/foo" << "-o" << "foo - out");
......
......@@ -50,7 +50,7 @@ void SqlDatabaseTest::sqlQueryJobTest()
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->start();
QVERIFY(waitForFinished(job));
......
......@@ -67,7 +67,7 @@ void WebViewTest::cleanupTestCase()
void WebViewTest::loadSignalsChangePageTest()
{
TestWebView view;
WebPage *page1 = new WebPage;
auto *page1 = new WebPage;
view.setPage(page1);
QSignalSpy loadStartedSpy(&view, &WebView::loadStarted);
......@@ -78,7 +78,7 @@ void WebViewTest::loadSignalsChangePageTest()
QTRY_COMPARE(loadStartedSpy.count(), 1);
loadStartedSpy.clear();
WebPage *page2 = new WebPage;
auto *page2 = new WebPage;
view.setPage(page2);
// WebPage: Workaround for broken load started/finished signals in QtWebEngine 5.10
......@@ -89,7 +89,7 @@ void WebViewTest::loadSignalsChangePageTest()
loadFinishedSpy.clear();
QWebEngineView view2;
WebPage *page3 = new WebPage;
auto *page3 = new WebPage;
view2.setPage(page3);
QSignalSpy page3LoadStart(page3, &WebPage::loadStarted);
......
......@@ -56,7 +56,7 @@ void FancyTabProxyStyle::drawControl(
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) {
QProxyStyle::drawControl(element, option, p, widget);
......@@ -127,10 +127,10 @@ void FancyTabProxyStyle::drawControl(
const QString tab_hover = widget->property("tab_hover").toString();
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) {
QWidget* mut_widget = const_cast<QWidget*>(widget);
auto* mut_widget = const_cast<QWidget*>(widget);
fader = 0;
mut_widget->setProperty(fader_key.toUtf8().constData(), fader);
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)
{
QTabBar* bar = qobject_cast<QTabBar*>(o);
auto* bar = qobject_cast<QTabBar*>(o);
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 hovered_tab = e->type() == QEvent::Leave ? QString() : bar->tabText(bar->tabAt(event->pos()));
bar->setProperty("tab_hover", hovered_tab);
......@@ -250,7 +250,7 @@ FancyTabBar::FancyTabBar(QWidget* parent)
setMouseTracking(true); // Needed for hover events
m_triggerTimer.setSingleShot(true);
QVBoxLayout* layout = new QVBoxLayout;
auto* layout = new QVBoxLayout;
layout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding));
layout->setSpacing(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)
{
FancyTab* tab = new FancyTab(this);
auto* tab = new FancyTab(this);
tab->icon = icon;
tab->text = label;
m_tabs.append(tab);
......@@ -512,7 +512,7 @@ FancyTabWidget::FancyTabWidget(QWidget* parent)
top_layout_->setSpacing(0);
top_layout_->addLayout(stack_);
QHBoxLayout* main_layout = new QHBoxLayout;
auto* main_layout = new QHBoxLayout;
main_layout->setContentsMargins(0, 0, 0, 0);
main_layout->setSpacing(1);
main_layout->addWidget(side_widget_);
......@@ -576,10 +576,10 @@ int FancyTabWidget::current_index() const
void FancyTabWidget::SetCurrentIndex(int index)
{
if (FancyTabBar* bar = qobject_cast<FancyTabBar*>(tab_bar_)) {
if (auto* bar = qobject_cast<FancyTabBar*>(tab_bar_)) {
bar->setCurrentIndex(index);
}
else if (QTabBar* bar = qobject_cast<QTabBar*>(tab_bar_)) {
else if (auto* bar = qobject_cast<QTabBar*>(tab_bar_)) {
bar->setCurrentIndex(index);
}
else {
......@@ -614,7 +614,7 @@ void FancyTabWidget::SetMode(Mode mode)
// fallthrough
case Mode_LargeSidebar: {
FancyTabBar* bar = new FancyTabBar(this);
auto* bar = new FancyTabBar(this);
side_layout_->insertWidget(0, 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,
bool fancy)
{
QTabBar* bar = new QTabBar(this);
auto* bar = new QTabBar(this);
bar->setShape(shape);
bar->setDocumentMode(true);
bar->setUsesScrollButtons(true);
......
......@@ -99,42 +99,42 @@ void LineEdit::init()
connect(m_leftWidget, &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->setShortcutContext(Qt::WidgetWithChildrenShortcut);
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->setShortcutContext(Qt::WidgetWithChildrenShortcut);
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->setShortcutContext(Qt::WidgetWithChildrenShortcut);
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->setShortcutContext(Qt::WidgetWithChildrenShortcut);
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->setShortcutContext(Qt::WidgetWithChildrenShortcut);
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->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);
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);
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->setShortcutContext(Qt::WidgetWithChildrenShortcut);
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
QMenu* LineEdit::createContextMenu()
{
QMenu* popup = new QMenu(this);
auto* popup = new QMenu(this);
popup->setObjectName(QSL("qt_edit_menu"));
if (!isReadOnly()) {
......
......@@ -73,7 +73,7 @@ class FALKON_EXPORT LineEdit : public QLineEdit
Q_PROPERTY(int minHeight READ minHeight WRITE setMinHeight)
public:
typedef QList<QTextLayout::FormatRange> TextFormat;
using TextFormat = QList<QTextLayout::FormatRange>;
enum WidgetPosition {
LeftSide,
......
......@@ -56,8 +56,8 @@ typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*);
static PProcessIdToSessionId pProcessIdToSessionId = 0;
#endif
#if defined(Q_OS_UNIX)
#include <ctime>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#endif
......@@ -138,7 +138,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
}
m_dbusRegistered = QDBusConnection::sessionBus().registerService(id);
if (m_dbusRegistered) {
QtSingleAppDBusInterface *iface = new QtSingleAppDBusInterface(this);
auto *iface = new QtSingleAppDBusInterface(this);
connect(iface, &QtSingleAppDBusInterface::messageReceived, this, &QtLocalPeer::messageReceived);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/"), this);
}
......
......@@ -38,10 +38,10 @@
**
****************************************************************************/
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <cerrno>
#include <cstring>
#include <fcntl.h>
#include <unistd.h>
#include "qtlockedfile.h"
......
......@@ -109,8 +109,8 @@ void SqueezeLabelV2::mouseMoveEvent(QMouseEvent* event)
return;
}
QDrag* drag = new QDrag(this);
QMimeData* mime = new QMimeData;
auto* drag = new QDrag(this);
auto* mime = new QMimeData;
mime->setText(m_originalText);
drag->setMimeData(mime);
......
......@@ -64,8 +64,8 @@ public:
static QColor shadowColor(bool lightColored = false);
static QColor borderColor(bool lightColored = false);
static QColor sidebarHighlight() { return QColor(255, 255, 255, 40); }
static QColor sidebarShadow() { return QColor(0, 0, 0, 40); }
static QColor sidebarHighlight() { return {255, 255, 255, 40}; }
static QColor sidebarShadow() { return {0, 0, 0, 40}; }
// Sets the base color and makes sure all top level widgets are updated
static void setBaseColor(const QColor &color);
......
......@@ -49,7 +49,7 @@ private:
QString title;
QString url;
Subscription() {}
Subscription() = default;
Subscription(const QString &t, const QString &u) {
title = t;
......
......@@ -45,7 +45,7 @@ AdBlockDialog::AdBlockDialog(QWidget* parent)
#endif
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_actionRemoveRule = menu->addAction(tr("Remove Rule"), this, &AdBlockDialog::removeRule);
menu->addSeparator();
......@@ -76,7 +76,7 @@ void AdBlockDialog::showRule(const AdBlockRule* rule) const
}
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()) {
treeWidget->showRule(rule);
......@@ -107,7 +107,7 @@ void AdBlockDialog::addSubscription()
QString url = dialog.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());
tabWidget->setCurrentIndex(index);
......@@ -163,7 +163,7 @@ void AdBlockDialog::learnAboutRules()
void AdBlockDialog::loadSubscriptions()
{
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();
}
}
......@@ -176,7 +176,7 @@ void AdBlockDialog::load()
const auto subscriptions = m_manager->subscriptions();
for (AdBlockSubscription* subscription : subscriptions) {
AdBlockTreeWidget* tree = new AdBlockTreeWidget(subscription, tabWidget);
auto* tree = new AdBlockTreeWidget(subscription, tabWidget);
tabWidget->addTab(tree, subscription->title());
}
......
......@@ -54,7 +54,7 @@ QString AdBlockIcon::name() const
void AdBlockIcon::toggleCustomFilter()
{
QAction* action = qobject_cast<QAction*>(sender());
auto* action = qobject_cast<QAction*>(sender());
if (!action) {
return;
}
......@@ -67,7 +67,7 @@ void AdBlockIcon::toggleCustomFilter()
customList->removeFilter(filter);
}
else {
AdBlockRule* rule = new AdBlockRule(filter, customList);
auto* rule = new AdBlockRule(filter, customList);
customList->addRule(rule);
}
}
......@@ -140,7 +140,7 @@ void AdBlockIcon::clicked(ClickController *controller)
const QUrl pageUrl = view->url();
QMenu *menu = new QMenu();
auto *menu = new QMenu();
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(tr("Show AdBlock &Settings"), manager, SLOT(showDialog()));
menu->addSeparator();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment