diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-29 11:45:18 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-29 11:45:18 +0530 |
| commit | bcecbced7e1af9d99443a7e823f18328c7943f09 (patch) | |
| tree | 612fac477acfa38358e15916bd4a44f386dc9206 /src/widgets/WebViewStack.cpp | |
| parent | f7392096d2d84be7143947d386528bf4f487ee83 (diff) | |
| download | null-browser-bcecbced7e1af9d99443a7e823f18328c7943f09.tar.gz null-browser-bcecbced7e1af9d99443a7e823f18328c7943f09.zip | |
Add window action router for multi-window
Diffstat (limited to 'src/widgets/WebViewStack.cpp')
| -rw-r--r-- | src/widgets/WebViewStack.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/widgets/WebViewStack.cpp b/src/widgets/WebViewStack.cpp index aee4af9..f1c799f 100644 --- a/src/widgets/WebViewStack.cpp +++ b/src/widgets/WebViewStack.cpp @@ -36,7 +36,7 @@ void WebViewStack::open_url(const QUrl &url, OpenType open_type) { } WebView *WebViewStack::create_new_webview(const QUrl &url, bool focus) { - auto *webview = new WebView(next_id++, profile); + auto *webview = new WebView(next_webview_id++, profile); webview->setUrl(url); layout->addWidget(webview); webview_list.append(webview); @@ -77,6 +77,9 @@ void WebViewStack::on_new_webview_request( } int32_t WebViewStack::get_webview_index(WebViewId webview_id) { + if (webview_id == 0 && window()->isActiveWindow()) + webview_id = current_webview_id(); + int index = 0; for (auto &webview : webview_list) { if (webview->get_id() == webview_id) @@ -177,6 +180,10 @@ WebView *WebViewStack::get_webview(WebViewId webview_id) { return webview_list.at(webview_index); } +bool WebViewStack::has_webview(WebViewId webview_id) { + return get_webview(webview_id) != nullptr; +} + QUrl WebViewStack::current_url() { auto *webview = current_webview(); if (webview == nullptr) { |
