From: Soren Stoutner Date: Tue, 24 Jun 2025 18:42:17 +0000 (-0700) Subject: Don't focus the URL line edit when switching tabs if it is blank but a new page is... X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=bb66773a6b374b075ff7ee1fbf7e028bdd51d2db;p=PrivacyBrowserPC.git Don't focus the URL line edit when switching tabs if it is blank but a new page is loading. https://redmine.stoutner.com/issues/1281 --- diff --git a/src/dialogs/SettingsDialog.cpp b/src/dialogs/SettingsDialog.cpp index 0e4d5f7..154fc7f 100644 --- a/src/dialogs/SettingsDialog.cpp +++ b/src/dialogs/SettingsDialog.cpp @@ -71,8 +71,8 @@ SettingsDialog::SettingsDialog(QWidget *parentWidgetPointer, KCoreConfigSkeleton }; // Update the status of the DOM storage check box when either JavaScript or local storage are changed. - connect(javaScriptCheckBoxPointer, &QCheckBox::stateChanged, this, updateCheckBoxes); - connect(localStorageCheckBoxPointer, &QCheckBox::stateChanged, this, updateCheckBoxes); + connect(javaScriptCheckBoxPointer, &QCheckBox::checkStateChanged, this, updateCheckBoxes); + connect(localStorageCheckBoxPointer, &QCheckBox::checkStateChanged, this, updateCheckBoxes); // Populate the combo box labels. updateUserAgentLabel(userAgentComboBoxPointer->currentText()); diff --git a/src/widgets/TabWidget.cpp b/src/widgets/TabWidget.cpp index 4ce9b82..ce8978b 100644 --- a/src/widgets/TabWidget.cpp +++ b/src/widgets/TabWidget.cpp @@ -1356,11 +1356,6 @@ void TabWidget::updateUiWithTabSettings() Q_EMIT updateUserAgentActions(currentWebEngineProfilePointer->httpUserAgent(), true); Q_EMIT updateZoomActions(currentPrivacyWebEngineViewPointer->zoomFactor()); - // Update the URL. - Q_EMIT updateWindowTitle(currentPrivacyWebEngineViewPointer->title()); - Q_EMIT updateDomainSettingsIndicator(currentPrivacyWebEngineViewPointer->domainSettingsName != QLatin1String("")); - Q_EMIT updateUrlLineEdit(QUrl(currentPrivacyWebEngineViewPointer->currentUrlText)); - // Update the find text. Q_EMIT updateFindText(currentPrivacyWebEngineViewPointer->findString, currentPrivacyWebEngineViewPointer->findCaseSensitive); Q_EMIT updateFindTextResults(currentPrivacyWebEngineViewPointer->findTextResult); @@ -1370,6 +1365,11 @@ void TabWidget::updateUiWithTabSettings() Q_EMIT showProgressBar(currentPrivacyWebEngineViewPointer->loadProgressInt); else Q_EMIT hideProgressBar(); + + // Update the URL. + Q_EMIT updateWindowTitle(currentPrivacyWebEngineViewPointer->title()); + Q_EMIT updateDomainSettingsIndicator(currentPrivacyWebEngineViewPointer->domainSettingsName != QLatin1String("")); + Q_EMIT updateUrlLineEdit(QUrl(currentPrivacyWebEngineViewPointer->currentUrlText)); } void TabWidget::useNativeKdeDownloader(QUrl &downloadUrl, QString &suggestedFileName) diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index dcc884d..2ff9a11 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -2130,8 +2130,8 @@ void BrowserWindow::updateUrlLineEdit(const QUrl &newUrl) // Update the bookmarked action. updateBookmarkedAction(); - // Set the focus if the new URL is blank. - if (newUrlString == QStringLiteral("")) + // Set the focus if the new URL is blank and a website is not currently loading. + if (newUrlString == QStringLiteral("") && progressBarPointer->isHidden()) urlLineEditPointer->setFocus(); }