VirtualBox

Ignore:
Timestamp:
Feb 20, 2007 11:15:18 AM (18 years ago)
Author:
vboxsync
Message:

HEAD: kchmviewer fix

File:
1 edited

Legend:

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

    r992 r999  
    4242#include <qwidgetstack.h>
    4343#include <qbutton.h>
     44#include <qprocess.h>
    4445
    4546#include <qlayout.h>
     
    747748}
    748749
    749 #if defined (Q_WS_X11)
    750 /**
    751  * Start the kchmviewer application with the VBox help file.
    752  *
    753  * @param pvUser an array of strings which are the path to and the arguments for kchmviewer
    754  */
    755 DECLCALLBACK(int) showHelpContentsThread(RTTHREAD  /* ThreadSelf */, void *pvUser)
    756 {
    757     char **papszArgs = reinterpret_cast<char **>(pvUser);
    758     int rc;
    759     RTPROCESS hProcess;
    760 
    761     rc = RTProcCreate(papszArgs[0], papszArgs, 0, 0, &hProcess);
    762     if (rc == VINF_SUCCESS)
    763     {
    764         RTPROCSTATUS ProcStatus;
    765 
    766         return RTProcWait(hProcess, RTPROCWAIT_FLAGS_BLOCK, &ProcStatus);
    767     }
    768     return rc;
    769 }
    770 #endif
    771 
    772750void VBoxSelectorWnd::showHelpContents()
    773751{
     
    782760    if (RTPathProgram(szPathProg, sizeof(szPathProg)) == VINF_SUCCESS)
    783761    {
    784         const char szViewer[] = "/kchmviewer";
    785         const char szHelpFile[] = "/VirtualBox.chm";
    786         char szViewerPath[RTPATH_MAX], szFilePath[RTPATH_MAX];
    787         char *papszArgs[3] = { szViewerPath, szFilePath, 0 };
    788         RTTHREAD hThread;
    789         int cPathLen;
    790 
    791         cPathLen = strlen(szPathProg);
    792         AssertReturn(cPathLen + sizeof(szHelpFile) < RTPATH_MAX, (void) 0);  /* is there a cleaner way? */
    793         strcpy(szViewerPath, szPathProg);
    794         strncpy(szViewerPath + cPathLen, szViewer, sizeof(szViewerPath) - cPathLen);
    795         szViewerPath[sizeof(szViewerPath) - 1] = 0;
    796         strcpy(szFilePath, szPathProg);
    797         strncpy(szFilePath + cPathLen, szHelpFile, sizeof(szFilePath) - cPathLen);
    798         szFilePath[sizeof(szFilePath) - 1] = 0;
    799         /* For now we just start the process and do not worry about anything else. */
    800         RTThreadCreate(&hThread, showHelpContentsThread, papszArgs, 0,
    801                        RTTHREADTYPE_INFREQUENT_POLLER, 0, "HelpViewer");
     762        QString kchmViewerName(QString (szPathProg) + "/kchmviewer");
     763        QString kchmViewerArg (QString (szPathProg) + "/VirtualBox.chm");
     764        QProcess kchmViewer(kchmViewerName);
     765        kchmViewer.addArgument(kchmViewerArg);
     766        kchmViewer.launch("");
    802767    }
    803768# endif
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