VirtualBox

Changeset 95069 in vbox


Ignore:
Timestamp:
May 24, 2022 9:40:04 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Make changes so that we attempt to open external links in the default browser.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r95068 r95069  
    19511951void UIHelpBrowserWidget::sltLinkHighlighted(const QUrl &url)
    19521952{
    1953     emit sigStatusBarMessage(url.url(), 0); /** @todo qt6: ??? */
     1953    QString strMessage = url.url();
     1954    if (url.scheme() != "qthelp")
     1955        strMessage = QString("%1: %2").arg(tr("Click to open this link in an external browser")).arg(url.url());
     1956
     1957    emit sigStatusBarMessage(strMessage, 0); /** @todo qt6: ??? */
    19541958}
    19551959#else
    19561960void UIHelpBrowserWidget::sltLinkHighlighted(const QString &strLink)
    19571961{
    1958     emit sigStatusBarMessage(strLink, 0);
     1962    QString strMessage = strLink;
     1963    if (QUrl(strLink).scheme() != "qthelp")
     1964        strMessage = QString("%1: %2").arg(tr("Click to open this link in an external browser")).arg(strLink);
     1965
     1966    emit sigStatusBarMessage(strMessage, 0);
    19591967}
    19601968#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r94064 r95069  
    6464    void sigAddBookmark();
    6565    void sigStatusBarMessage(const QString &strMessage, int iTimeOut);
     66
    6667public:
    6768
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r95068 r95069  
    463463{
    464464    clearOverlay();
     465    if (url.scheme() != "qthelp")
     466        return;
    465467#ifdef VBOX_IS_QT6_OR_LATER
    466468    QTextBrowser::doSetSource(url, type);
     
    699701
    700702    QString strAnchor = anchorAt(pEvent->pos());
     703
    701704    if (!strAnchor.isEmpty())
    702705    {
     706
     707        QString strLink = source().resolved(strAnchor).toString();
     708
     709        if (source().resolved(strAnchor).scheme() != "qthelp" && pEvent->button() == Qt::LeftButton)
     710        {
     711            uiCommon().openURL(strLink);
     712            return;
     713        }
     714
    703715        if ((pEvent->modifiers() & Qt::ControlModifier) ||
    704716            pEvent->button() == Qt::MiddleButton)
    705717        {
    706             QString strLink = source().resolved(strAnchor).toString();
     718
    707719            emit sigOpenLinkInNewTab(strLink, true);
    708720            return;
     
    907919    QUrl url = pSender->data().toUrl();
    908920    if (url.isValid())
    909         QTextBrowser::setSource(url);
     921        setSource(url);
    910922}
    911923
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette