+void TabWidget::findPrevious(const QString &text) const
+{
+ // Store the current text.
+ currentPrivacyWebEngineViewPointer->findString = text;
+
+ // Find the previous text in the current privacy WebEngine.
+ if (currentPrivacyWebEngineViewPointer->findCaseSensitive)
+ currentPrivacyWebEngineViewPointer->findText(text, QWebEnginePage::FindCaseSensitively|QWebEnginePage::FindBackward);
+ else
+ currentPrivacyWebEngineViewPointer->findText(text, QWebEnginePage::FindBackward);
+}
+
+void TabWidget::findText(const QString &text) const
+{
+ // Store the current text.
+ currentPrivacyWebEngineViewPointer->findString = text;
+
+ // Find the text in the current privacy WebEngine.
+ if (currentPrivacyWebEngineViewPointer->findCaseSensitive)
+ currentPrivacyWebEngineViewPointer->findText(text, QWebEnginePage::FindCaseSensitively);
+ else
+ currentPrivacyWebEngineViewPointer->findText(text);
+
+ // Clear the currently selected text in the WebEngine page if the find text is empty.
+ if (text.isEmpty())
+ currentWebEnginePagePointer->action(QWebEnginePage::Unselect)->activate(QAction::Trigger);
+}
+
+void TabWidget::findTextFinished(const QWebEngineFindTextResult &findTextResult)
+{
+ // Update the find text UI if it wasn't simply wiping the current find text selection. Otherwise the UI temporarially flashes `0/0`.
+ if (wipingCurrentFindTextSelection) // The current selection is being wiped.
+ {
+ // Reset the flag.
+ wipingCurrentFindTextSelection = false;
+ }
+ else // A new search has been performed.
+ {
+ // Store the result.
+ currentPrivacyWebEngineViewPointer->findTextResult = findTextResult;
+
+ // Update the UI.
+ emit updateFindTextResults(findTextResult);
+ }
+}
+