diff options
Diffstat (limited to 'src/rekonqwindow.cpp')
-rw-r--r-- | src/rekonqwindow.cpp | 69 |
1 files changed, 31 insertions, 38 deletions
diff --git a/src/rekonqwindow.cpp b/src/rekonqwindow.cpp index 094dc1ff..ef772936 100644 --- a/src/rekonqwindow.cpp +++ b/src/rekonqwindow.cpp @@ -15,6 +15,10 @@ #include <rsettings.hpp> #include <rview.hpp> +#ifdef QT_DEBUG +#include "test/rview_fake.h" +#endif + RekonqWindow::RekonqWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::RekonqWindow) { ui->setupUi(this); @@ -31,16 +35,19 @@ RekonqWindow::RekonqWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::Re connect(ui->back, &QToolButton::clicked, this, [this]() { currentView()->back(); }); connect(ui->forward, &QToolButton::clicked, this, [this]() { currentView()->forward(); }); connect(ui->refresh, &QToolButton::clicked, this, [this]() { currentView()->refresh(); }); - connect(ui->home, &QToolButton::clicked, this, [this]() { loadUrl(QUrl()); }); + connect(ui->home, &QToolButton::clicked, this, [this]() { loadUrl(rekonq::HomePage, rekonq::CurrentTab); }); // connect menu actions // file menu - connect(ui->actionNewTab, &QAction::triggered, this, [this]() { - auto *app = Application::instance(); - Q_CHECK_PTR(app); - auto newTabUrl = app->settings()->value("newtab").toUrl(); - loadUrl(newTabUrl, rekonq::NewFocusedTab); - }); +#ifdef QT_DEBUG + { + auto *actionNewDebugTab = new QAction(tr("New Debug Tab"), ui->menuFile); + connect(actionNewDebugTab, &QAction::triggered, this, [this]() { addView(new RekonqView_fake(this)); }); + ui->menuFile->insertAction(ui->actionNewTab, actionNewDebugTab); + } +#endif + connect(ui->actionNewTab, &QAction::triggered, this, + [this]() { loadUrl(rekonq::NewTabPage, rekonq::NewFocusedTab); }); connect(ui->actionCloseTab, &QAction::triggered, this, [this]() { emit ui->tabs->tabCloseRequested(ui->tabs->currentIndex()); }); connect(ui->actionQuit, &QAction::triggered, qApp, &QApplication::quit); @@ -55,8 +62,7 @@ RekonqWindow::RekonqWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::Re // help menu connect(ui->actionAboutQt, &QAction::triggered, qApp, &QApplication::aboutQt); - connect(ui->newTab, &QToolButton::clicked, this, - [this]() { Application::instance()->newView(QUrl("about:blank"), this); }); + connect(ui->newTab, &QToolButton::clicked, ui->actionNewTab, &QAction::trigger); } RekonqWindow::~RekonqWindow() { delete ui; } @@ -95,6 +101,22 @@ int RekonqWindow::addView(RekonqView *view) return index; } +void RekonqWindow::loadUrl(rekonq::DefaultUrl url, rekonq::OpenType type) +{ + auto *settings = Application::instance()->settings(); + switch (url) { + case rekonq::NewTabPage: + loadUrl(settings->value("newtab").toUrl(), type); + break; + case rekonq::HomePage: + loadUrl(settings->value("homepage").toUrl(), type); + break; + case rekonq::AboutBlank: + loadUrl(QUrl("about:blank"), type); + break; + } +} + void RekonqWindow::loadUrl(const QUrl &url, rekonq::OpenType type) { switch (type) { @@ -122,35 +144,6 @@ void RekonqWindow::loadUrl(const QUrl &url, rekonq::OpenType type) // -------------------------------------------------------------------------------------------------- /* -bool RekonqWindow::isPrivateBrowsingMode() -{ - return _tabWidget->isPrivateBrowsingWindowMode(); -} - - - - -void RekonqWindow::loadUrl(const KUrl &url, Rekonq::OpenType type, TabHistory *history) -{ - switch (type) - { - case Rekonq::NewWindow: - case Rekonq::NewPrivateWindow: - case Rekonq::WebApp: - rApp->loadUrl(url, type); - return; - - case Rekonq::NewTab: - case Rekonq::NewBackGroundTab: - case Rekonq::NewFocusedTab: - case Rekonq::CurrentTab: - default: - _tabWidget->loadUrl(url, type, history); - break; - }; -} - - void RekonqWindow::showBookmarksPanel(bool on) { if (on) |