VirtualBox

Ignore:
Timestamp:
Oct 26, 2020 5:54:33 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Saving/loading last visited url

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp

    r86541 r86716  
    237237const char *UIExtraDataDefs::GUI_LogViewerNoFontStyleName = "noFontStyleName";
    238238const char *UIExtraDataDefs::GUI_GuestControl_LogViewerVisiblePanels = "GUI/LogViewerVisiblePanels";
     239
     240/* Help Browser */
     241const char *UIExtraDataDefs::GUI_HelpBrowserLastURL = "GUI/HelpBrowserLastURL";
    239242
    240243/* VM Resource Monitor: */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r86541 r86716  
    436436    /** @} */
    437437
     438    /** @name Help Browser
     439      * @{ */
     440        SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserLastURL;
     441    /** @} */
     442
    438443    /** @name Manager UI: VM Resource Monitor Related stuff
    439444      * @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r86541 r86716  
    45924592}
    45934593
     4594void UIExtraDataManager::setHelpBrowserLastUrl(const QString &url)
     4595{
     4596    setExtraDataString(GUI_HelpBrowserLastURL, url);
     4597}
     4598
     4599QString UIExtraDataManager::helpBrowserLastUrl()
     4600{
     4601    return extraDataString(GUI_HelpBrowserLastURL);
     4602}
     4603
    45944604void UIExtraDataManager::setVMResourceMonitorHiddenColumnList(const QStringList &hiddenColumnList)
    45954605{
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r86541 r86716  
    783783        void setLogViewerVisiblePanels(const QStringList &panelNameList);
    784784        QStringList logViewerVisiblePanels();
     785    /** @} */
     786
     787    /** @name Help Browser
     788      * @{ */
     789        void setHelpBrowserLastUrl(const QString &url);
     790        QString helpBrowserLastUrl();
    785791    /** @} */
    786792
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r86715 r86716  
    128128    qRegisterMetaType<HelpBrowserTabs>("HelpBrowserTabs");
    129129    prepare();
     130    loadOptions();
    130131}
    131132
     
    149150void UIHelpBrowserWidget::prepare()
    150151{
    151     loadOptions();
    152 
    153152    prepareActions();
    154153    prepareWidgets();
     
    197196    m_pContentViewer = new UIHelpBrowserViewer(m_pHelpEngine);
    198197    AssertReturnVoid(m_pContentViewer);
     198
     199
     200    connect(m_pContentViewer, &UIHelpBrowserViewer::sourceChanged,
     201        this, &UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange);
    199202    m_pSplitter->addWidget(m_pContentViewer);
    200203
     
    205208    connect(m_pHelpEngine, &QHelpEngine::setupFinished,
    206209            this, &UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished);
    207 
    208210    connect(m_pContentWidget, &QHelpContentWidget::linkActivated,
    209211            m_pContentViewer, &UIHelpBrowserViewer::setSource);
    210212    connect(m_pContentWidget, &QHelpContentWidget::clicked,
    211213            this, &UIHelpBrowserWidget::sltHandleContentWidgetItemClicked);
    212 
    213 
    214214    connect(m_pIndexWidget, &QHelpIndexWidget::linkActivated,
    215215            m_pContentViewer, &UIHelpBrowserViewer::setSource);
     
    256256void UIHelpBrowserWidget::loadOptions()
    257257{
     258    if (m_pContentViewer)
     259    {
     260        QUrl url(gEDataManager->helpBrowserLastUrl());
     261        if (url.isValid())
     262            m_pContentViewer->setSource(url);
     263    }
    258264}
    259265
    260266void UIHelpBrowserWidget::saveOptions()
    261267{
     268    if (m_pContentViewer)
     269    {
     270        gEDataManager->setHelpBrowserLastUrl(m_pContentViewer->source().toString());
     271    }
    262272}
    263273
     
    357367}
    358368
     369void UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange(const QUrl &source)
     370{
     371    printf("%s\n", qPrintable(source.toString()));
     372}
     373
    359374
    360375#include "UIHelpBrowserWidget.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r86715 r86716  
    8080    void sltHandleContentWidgetItemClicked(const QModelIndex &index);
    8181    void sltHandleTabVisibility(bool togggled);
     82    void sltHandleHelpBrowserViewerSourceChange(const QUrl &source);
    8283
    8384private:
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