From 1b1e327cb73491c17972a33a07c3c9beafe7f938 Mon Sep 17 00:00:00 2001
From: aqua <aqua@iserlohn-fortress.net>
Date: Sun, 18 Sep 2022 09:57:29 +0300
Subject: Add Navigation and Tab toolbars

---
 src/rekonqwindow.cpp | 31 +++----------------------------
 1 file changed, 3 insertions(+), 28 deletions(-)

(limited to 'src/rekonqwindow.cpp')

diff --git a/src/rekonqwindow.cpp b/src/rekonqwindow.cpp
index 461de12e..2295cd50 100644
--- a/src/rekonqwindow.cpp
+++ b/src/rekonqwindow.cpp
@@ -15,36 +15,11 @@
 
 // --------------------------------------------------------------------------------------------------
 
-RekonqView *RekonqWindow::currentView()
-{
-  auto *view = ui->tabs->view(ui->tabs->currentIndex());
-  Q_CHECK_PTR(view);
-  return view;
-}
-
 int RekonqWindow::addView(RekonqView *view)
 {
   Q_CHECK_PTR(view);
-
   ui->views->addWidget(view);
-  const auto index = ui->tabs->addTab(view);
-  connect(view, &RekonqView::urlChanged, [this, view](const QUrl &url) {
-    if (view == currentView()) ui->urlBar->setUrl(url);
-  });
-  connect(view, &RekonqView::titleChanged, [this, view](const QString &title) {
-    const auto idx = ui->views->indexOf(view);
-    ui->tabs->setTabText(idx, title);
-  });
-  connect(view, &RekonqView::iconChanged, [this, view](const QIcon &icon) {
-    const auto idx = ui->views->indexOf(view);
-    ui->tabs->setTabIcon(idx, icon);
-  });
-
-  connect(view, &RekonqView::loadStarted, ui->urlBar, &UrlBar::loadStarted);
-  connect(view, &RekonqView::loadProgress, ui->urlBar, &UrlBar::loadProgress);
-  connect(view, &RekonqView::loadFinished, ui->urlBar, &UrlBar::loadFinished);
-
-  return index;
+  return ui->tabToolBar->addView(view);
 }
 
 void RekonqWindow::loadUrl(rekonq::DefaultUrl url, rekonq::OpenType type)
@@ -67,13 +42,13 @@ void RekonqWindow::loadUrl(const QUrl &url, rekonq::OpenType type)
 {
   switch (type) {
   case rekonq::CurrentTab:
-    currentView()->load(url);
+    ui->tabToolBar->currentView()->load(url);
     break;
   case rekonq::NewTab:
     Application::instance()->newView(url, this);
     break;
   case rekonq::NewFocusedTab:
-    ui->tabs->setCurrentView(Application::instance()->newView(url, this));
+    ui->tabToolBar->setCurrentView(Application::instance()->newView(url, this));
     break;
   case rekonq::NewBackGroundTab:
     break;
-- 
cgit v1.2.1