aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow')
-rw-r--r--src/mainwindow/widgets/tabwidget.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mainwindow/widgets/tabwidget.cpp b/src/mainwindow/widgets/tabwidget.cpp
index 9608efc..48a1cfb 100644
--- a/src/mainwindow/widgets/tabwidget.cpp
+++ b/src/mainwindow/widgets/tabwidget.cpp
@@ -12,6 +12,7 @@
#include <QContextMenuEvent>
#include <QMenu>
#include <QTabBar>
+#include "browser.h"
TabWidget::TabWidget(QWidget *parent)
: QTabWidget(parent)
@@ -19,7 +20,7 @@ TabWidget::TabWidget(QWidget *parent)
setStyleSheet("QTabBar::tab { width: 200px; }");
setTabsClosable(true);
- setTabBarAutoHide(true);
+ //setTabBarAutoHide(true);
setElideMode(Qt::ElideRight);
setMovable(true);
@@ -54,6 +55,24 @@ TabWidget::TabWidget(QWidget *parent)
deleteTab(i);
}
});
+
+ auto *loadProfile_menu = tabContextMenu->addMenu(tr("Load Profile"));
+ {
+ auto *browser = qobject_cast<Browser *>(qApp);
+ Q_CHECK_PTR(browser);
+
+ for(const QString &name : browser->profiles()) {
+ auto *profileAction = loadProfile_menu->addAction(name);
+ auto *profile = browser->profile(name);
+ Q_CHECK_PTR(profile);
+
+ connect(profileAction, &QAction::triggered, this, [this, profile]() {
+ int index = this->tabBar()->tabAt(mapFromGlobal(tabContextMenu->pos()));
+ auto *view = qobject_cast<WebView *>(this->widget(index));
+ view->setProfile(profile);
+ });
+ }
+ }
}
TabWidget::~TabWidget()