aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow/window.cpp')
-rw-r--r--src/mainwindow/window.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mainwindow/window.cpp b/src/mainwindow/window.cpp
index a5ab90b..47f8489 100644
--- a/src/mainwindow/window.cpp
+++ b/src/mainwindow/window.cpp
@@ -10,7 +10,6 @@
#include "webengine/webprofile.h"
#include "webengine/webview.h"
#include "widgets/tabwidget.h"
-#include <QUrl>
#include <QToolButton>
#include <QStyle>
#include <QAction>
@@ -30,9 +29,16 @@ Window::Window(const QHash<QString, QString> &config, QWidget *parent, Qt::Windo
resize(800, 600);
setWidget(tabWidget);
+ profile = WebProfile::defaultProfile();
+
#ifdef QT_DEBUG
{
auto *menu = systemMenu();
+
+ menu->addSeparator();
+ menu->addAction(tr("Debug menu"))->setEnabled(false);
+ menu->addAction(tr("Profile: %1").arg(profile->isOffTheRecord() ? tr("off-the-record") : profile->storageName()))->setEnabled(false);
+
menu->addSeparator();
auto *saveSession_action = menu->addAction(tr("Save session"));
menu->addAction(tr("Load session"))->setEnabled(false);
@@ -106,16 +112,16 @@ WebView *Window::currentView()
return qobject_cast<WebView *>(tabWidget->currentWidget());
}
-int Window::addTab(WebView *view)
+WebView *Window::view(int index) const
{
- Q_CHECK_PTR(view);
- return tabWidget->addTab(view);
+ return qobject_cast<WebView *>(tabWidget->widget(index));
}
int Window::addTab(const QUrl &url)
{
- auto *view = new WebView(WebProfile::defaultProfile(), this);
- view->load(url);
+ auto *view = new WebView(profile, this);
+ if(!url.isEmpty())
+ view->load(url);
return tabWidget->addTab(view);
}