VirtualBox

Ignore:
Timestamp:
Feb 19, 2007 6:19:17 PM (18 years ago)
Author:
vboxsync
Message:

Made kchmviewer available from the Linux GUI

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h

    r548 r989  
    3434
    3535#include <qvaluelist.h>
     36
     37#include <iprt/param.h>
     38#include <iprt/err.h>
     39#include <iprt/path.h>
     40#include <iprt/process.h>
     41#include <iprt/thread.h>
    3642
    3743class VBoxVMListBox;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp

    r879 r989  
    747747}
    748748
     749#if defined (Q_WS_X11)
     750DECLCALLBACK(int) showHelpContentsThread(RTTHREAD  /* ThreadSelf */, void *pvUser)
     751{
     752    char **papszArgs = reinterpret_cast<char **>(pvUser);
     753    int rc;
     754    RTPROCESS hProcess;
     755
     756    rc = RTProcCreate(papszArgs[0], papszArgs, 0, 0, &hProcess);
     757    if (rc == VINF_SUCCESS)
     758    {
     759        RTPROCSTATUS ProcStatus;
     760
     761        return RTProcWait(hProcess, RTPROCWAIT_FLAGS_BLOCK, &ProcStatus);
     762    }
     763    return rc;
     764}
     765#endif
     766
    749767void VBoxSelectorWnd::showHelpContents()
    750768{
     
    754772    HtmlHelp (GetDesktopWindow(), fullHelpFilePath.ucs2(),
    755773              HH_DISPLAY_TOPIC, NULL);
     774#elif defined (Q_WS_X11)
     775# ifndef VBOX_OSE
     776    char szPathProg[RTPATH_MAX];
     777    if (RTPathProgram(szPathProg, sizeof(szPathProg)) == VINF_SUCCESS)
     778    {
     779        const char szViewer[] = "/kchmviewer";
     780        const char szHelpFile[] = "/VirtualBox.chm";
     781        char szViewerPath[RTPATH_MAX], szFilePath[RTPATH_MAX];
     782        char *papszArgs[3] = { szViewerPath, szFilePath, 0 };
     783        RTTHREAD hThread;
     784        int cPathLen;
     785
     786        cPathLen = strlen(szPathProg);
     787        AssertReturn(cPathLen + sizeof(szHelpFile) < RTPATH_MAX, (void) 0);  /* is there a cleaner way? */
     788        strcpy(szViewerPath, szPathProg);
     789        strncpy(szViewerPath + cPathLen, szViewer, sizeof(szViewerPath) - cPathLen);
     790        szViewerPath[sizeof(szViewerPath) - 1] = 0;
     791        strcpy(szFilePath, szPathProg);
     792        strncpy(szFilePath + cPathLen, szHelpFile, sizeof(szFilePath) - cPathLen);
     793        szFilePath[sizeof(szFilePath) - 1] = 0;
     794        /* For now we just start the process and do not worry about anything else. */
     795        RTThreadCreate(&hThread, showHelpContentsThread, papszArgs, 0,
     796                       RTTHREADTYPE_INFREQUENT_POLLER, 0, "HelpViewer");
     797    }
     798# endif
    756799#endif
    757800}
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