From 35c551f7ff6a3dbb00b209d7388eaccde448dd2b Mon Sep 17 00:00:00 2001 From: aqua Date: Sun, 18 Sep 2022 22:42:52 +0300 Subject: RekonqWindow: rename loadUrl slots --- src/rekonqwindow.cpp | 10 +++++----- src/rekonqwindow.hpp | 6 ++++-- src/rekonqwindow_class.cpp | 17 ++++++----------- src/test/rekonqwindow_mock.hpp | 4 ++-- src/test/test_rekonqwindow.cpp | 4 ++-- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/rekonqwindow.cpp b/src/rekonqwindow.cpp index 2295cd50..d700cc34 100644 --- a/src/rekonqwindow.cpp +++ b/src/rekonqwindow.cpp @@ -22,23 +22,23 @@ int RekonqWindow::addView(RekonqView *view) return ui->tabToolBar->addView(view); } -void RekonqWindow::loadUrl(rekonq::DefaultUrl url, rekonq::OpenType type) +void RekonqWindow::loadDefaultUrl(rekonq::DefaultUrl url, rekonq::OpenType type) { auto *settings = Application::instance()->settings(); switch (url) { case rekonq::NewTabPage: - loadUrl(settings->value("newtab").toUrl(), type); + loadRequestedUrl(settings->value("newtab").toUrl(), type); break; case rekonq::HomePage: - loadUrl(settings->value("homepage").toUrl(), type); + loadRequestedUrl(settings->value("homepage").toUrl(), type); break; case rekonq::AboutBlank: - loadUrl(QUrl("about:blank"), type); + loadRequestedUrl(QUrl("about:blank"), type); break; } } -void RekonqWindow::loadUrl(const QUrl &url, rekonq::OpenType type) +void RekonqWindow::loadRequestedUrl(const QUrl &url, rekonq::OpenType type) { switch (type) { case rekonq::CurrentTab: diff --git a/src/rekonqwindow.hpp b/src/rekonqwindow.hpp index 82542274..e24aa317 100644 --- a/src/rekonqwindow.hpp +++ b/src/rekonqwindow.hpp @@ -33,8 +33,10 @@ public: public slots: REKONQ_TEST_VIRTUAL int addView(RekonqView *view) REKONQ_TEST_PURE; - REKONQ_TEST_VIRTUAL void loadUrl(rekonq::DefaultUrl url, rekonq::OpenType type = rekonq::CurrentTab) REKONQ_TEST_PURE; - REKONQ_TEST_VIRTUAL void loadUrl(const QUrl &url, rekonq::OpenType type = rekonq::CurrentTab) REKONQ_TEST_PURE; + REKONQ_TEST_VIRTUAL void loadDefaultUrl(rekonq::DefaultUrl url, + rekonq::OpenType type = rekonq::CurrentTab) REKONQ_TEST_PURE; + REKONQ_TEST_VIRTUAL void loadRequestedUrl(const QUrl &url, + rekonq::OpenType type = rekonq::CurrentTab) REKONQ_TEST_PURE; // void loadUrl(const KUrl &, Rekonq::OpenType type = Rekonq::CurrentTab, TabHistory *history = 0); private slots: diff --git a/src/rekonqwindow_class.cpp b/src/rekonqwindow_class.cpp index 66da5ff5..2509fee2 100644 --- a/src/rekonqwindow_class.cpp +++ b/src/rekonqwindow_class.cpp @@ -34,16 +34,11 @@ RekonqWindow::RekonqWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::Re ui->bookmarksToolBar->setModel(Application::instance()->bookmarks()); ui->menuBookmarks->setModel(Application::instance()->bookmarks()); #endif - connect(ui->navigationToolBar, &NavigationToolBar::loadUrl, this, - qOverload(&RekonqWindow::loadUrl)); - connect(ui->navigationToolBar, &NavigationToolBar::loadRequestedUrl, this, - qOverload(&RekonqWindow::loadUrl)); - connect(ui->bookmarksPanel, &BookmarksPanel::loadUrl, this, - qOverload(&RekonqWindow::loadUrl)); - connect(ui->bookmarksToolBar, &BookmarkToolBar::loadUrl, this, - qOverload(&RekonqWindow::loadUrl)); - connect(ui->menuBookmarks, &BookmarksMenu::loadUrl, this, - qOverload(&RekonqWindow::loadUrl)); + connect(ui->navigationToolBar, &NavigationToolBar::loadUrl, this, &RekonqWindow::loadDefaultUrl); + connect(ui->navigationToolBar, &NavigationToolBar::loadRequestedUrl, this, &RekonqWindow::loadRequestedUrl); + connect(ui->bookmarksPanel, &BookmarksPanel::loadUrl, this, &RekonqWindow::loadRequestedUrl); + connect(ui->bookmarksToolBar, &BookmarkToolBar::loadUrl, this, &RekonqWindow::loadRequestedUrl); + connect(ui->menuBookmarks, &BookmarksMenu::loadUrl, this, &RekonqWindow::loadRequestedUrl); // ::setCurrentView connect(ui->tabToolBar, &TabToolBar::currentViewChanged, this, [this](RekonqView *view) { @@ -67,7 +62,7 @@ RekonqWindow::RekonqWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::Re } #endif connect(ui->actionNewTab, &QAction::triggered, this, - [this]() { loadUrl(rekonq::NewTabPage, rekonq::NewFocusedTab); }); + [this]() { loadDefaultUrl(rekonq::NewTabPage, rekonq::NewFocusedTab); }); connect(ui->actionCloseTab, &QAction::triggered, ui->tabToolBar, &TabToolBar::closeCurrentTab); connect(ui->actionQuit, &QAction::triggered, qApp, &QApplication::quit); // edit menu diff --git a/src/test/rekonqwindow_mock.hpp b/src/test/rekonqwindow_mock.hpp index 7ec30d88..27b7711a 100644 --- a/src/test/rekonqwindow_mock.hpp +++ b/src/test/rekonqwindow_mock.hpp @@ -11,6 +11,6 @@ public: ~FakeWindow() override = default; MOCK_METHOD(int, addView, (RekonqView *), (override)); - MOCK_METHOD(void, loadUrl, (rekonq::DefaultUrl, rekonq::OpenType), (override)); - MOCK_METHOD(void, loadUrl, (const QUrl &, rekonq::OpenType), (override)); + MOCK_METHOD(void, loadDefaultUrl, (rekonq::DefaultUrl, rekonq::OpenType), (override)); + MOCK_METHOD(void, loadRequestedUrl, (const QUrl &, rekonq::OpenType), (override)); }; diff --git a/src/test/test_rekonqwindow.cpp b/src/test/test_rekonqwindow.cpp index 46c63e53..b4db0256 100644 --- a/src/test/test_rekonqwindow.cpp +++ b/src/test/test_rekonqwindow.cpp @@ -12,8 +12,8 @@ TEST(RekonqWindow, mock_shortcuts) { FakeWindow window; EXPECT_CALL(window, addView).Times(0); - EXPECT_CALL(window, loadUrl(Matcher(_), _)).Times(0); - EXPECT_CALL(window, loadUrl(Matcher(_), _)).Times(0); + EXPECT_CALL(window, loadDefaultUrl).Times(0); + EXPECT_CALL(window, loadRequestedUrl).Times(0); for (auto *action : window.findChildren(QRegularExpression("^action.*"))) { EXPECT_TRUE(action->shortcut().isEmpty()) << qUtf8Printable(action->objectName()); -- cgit v1.2.1