X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=src%2Fwidgets%2FTabWidget.cpp;h=efd677d73e636d37f9018839a019edaf54c1feb8;hb=a2737fd8ee243b19080acdda891efb44674808e3;hp=a8f59b4800e6671ad167a3319574773c80c6c094;hpb=37e86f9f1e43c3cf67d4d6a5f0f21a66e1df23fc;p=PrivacyBrowserPC.git diff --git a/src/widgets/TabWidget.cpp b/src/widgets/TabWidget.cpp index a8f59b4..efd677d 100644 --- a/src/widgets/TabWidget.cpp +++ b/src/widgets/TabWidget.cpp @@ -178,7 +178,7 @@ void TabWidget::addFirstTab() qTabWidgetPointer->currentWidget()->setFocus(); } -PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const bool backgroundTab, const QString urlString) +PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const bool adjacent, const bool backgroundTab, const QString urlString) { // Create a splitter widget. QSplitter *splitterPointer = new QSplitter(); @@ -197,8 +197,14 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const splitterPointer->addWidget(privacyWebEngineViewPointer); splitterPointer->addWidget(devToolsWebEngineViewPointer); + // Initialize the new tab index. + int newTabIndex = 0; + // Add a new tab. - int newTabIndex = qTabWidgetPointer->addTab(splitterPointer, i18nc("New tab label.", "New Tab")); + if (adjacent) // Add the new tab adjacent to the current tab. + newTabIndex = qTabWidgetPointer->insertTab((qTabWidgetPointer->currentIndex() + 1), splitterPointer, i18nc("New tab label.", "New Tab")); + else // Add the new tab at the end of the list. + newTabIndex = qTabWidgetPointer->addTab(splitterPointer, i18nc("New tab label.", "New Tab")); // Set the default tab icon. qTabWidgetPointer->setTabIcon(newTabIndex, defaultFavoriteIcon); @@ -907,7 +913,7 @@ void TabWidget::reloadAndBypassCache() const void TabWidget::saveArchive() { // Get the suggested file name. - QString suggestedFileName = currentPrivacyWebEngineViewPointer->url().host() + ".mht"; + QString suggestedFileName = currentPrivacyWebEngineViewPointer->title() + ".mht"; // Get the download directory. QString downloadDirectory = Settings::downloadLocation();