VirtualBox

Changeset 71067 in vbox


Ignore:
Timestamp:
Feb 20, 2018 9:50:35 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699 Start adding mkdir subcommand to guest control interface

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.cpp

    r71051 r71067  
    9393{
    9494public:
     95    CommandData()
     96        : m_bSessionIdGiven(false)
     97        , m_bSessionNameGiven(false){}
    9598    QString m_strUserName;
    9699    QString m_strPassword;
     
    99102    ULONG   m_uSessionId;
    100103    QString m_strDomain;
     104    bool    m_bSessionIdGiven;
     105    bool    m_bSessionNameGiven;
    101106    QVector<QString> m_arguments;
    102107    QVector<QString> m_environmentChanges;
     
    106111    :QObject(parent)
    107112    , m_comGuest(comGuest)
    108     , m_strHelp("[common-options]      [--verbose|-v] [--quiet|-q]\n"
    109                 "                                   [--username <name>] [--domain <domain>]\n"
     113    , m_strHelp("[common-options]               [--username <name>] [--domain <domain>]\n"
    110114                "                                   [--passwordfile <file> | --password <password>]\n"
    111115                "start                           [common-options]\n"
     
    115119                "                                   [--ignore-operhaned-processes] [--profile]\n"
    116120                "                                   -- <program/arg0> [argument1] ... [argumentN]]\n"
    117                 "create                           [common-options]  [--sessionname <name>]\n"
     121                "createsession                      [common-options]  [--sessionname <name>]\n"
     122                "mkdir                           [common-options]\n"
     123                "                                   [--path <path>]\n"
     124                "                                   [--sessionid <id> |  [sessionname <name>]]\n"
    118125                )
    119126{
    120127    prepareSubCommandHandlers();
     128}
     129
     130bool UIGuestControlInterface::handleMkdir(int, char**)
     131{
     132    return true;
    121133}
    122134
     
    153165    };
    154166
    155     bool sessionNameGiven = false;
    156     bool sessionIdGiven = false;
    157 
    158167    int ch;
    159168    RTGETOPTUNION ValueUnion;
     
    166175            HANDLE_COMMON_OPTION_DEFS()
    167176            case GCTLCMD_COMMON_OPT_SESSION_NAME:
    168                 sessionNameGiven = true;
     177                commandData.m_bSessionNameGiven = true;
    169178                commandData.m_strSessionName  = ValueUnion.psz;
    170179                break;
    171180            case GCTLCMD_COMMON_OPT_SESSION_ID:
    172                 sessionIdGiven = true;
     181                commandData.m_bSessionIdGiven = true;
    173182                commandData.m_uSessionId  = ValueUnion.i32;
    174183                break;
     
    183192        }
    184193    }
    185 
    186     if (sessionNameGiven && commandData.m_strSessionName.isEmpty())
     194    if (commandData.m_strExePath.isEmpty())
     195    {
     196        emit sigOutputString(QString(m_strHelp).append("Syntax error! No executable is given\n"));
     197        return false;
     198    }
     199
     200    if (commandData.m_bSessionNameGiven && commandData.m_strSessionName.isEmpty())
    187201    {
    188202        emit sigOutputString(QString(m_strHelp).append("'Session Name' is not name valid\n"));
     
    192206    CGuestSession guestSession;
    193207    /* Check if sessionname and sessionid are both supplied */
    194     if (sessionIdGiven && sessionNameGiven)
     208    if (commandData.m_bSessionIdGiven && commandData.m_bSessionNameGiven)
    195209    {
    196210        emit sigOutputString(QString(m_strHelp).append("Both 'Session Name' and 'Session Id' are supplied\n"));
     
    198212    }
    199213    /* If sessionid is given then look for the session. if not found return without starting the process: */
    200     else if (sessionIdGiven && !sessionNameGiven)
     214    else if (commandData.m_bSessionIdGiven && !commandData.m_bSessionNameGiven)
    201215    {
    202216        if (!findSession(commandData.m_uSessionId, guestSession))
     
    207221    }
    208222    /* If sessionname is given then look for the session. if not try to create a session with the provided name: */
    209     else if (!sessionIdGiven && sessionNameGiven)
     223    else if (!commandData.m_bSessionIdGiven && commandData.m_bSessionNameGiven)
    210224    {
    211225        if (!findSession(commandData.m_strSessionName, guestSession))
     
    240254}
    241255
    242 bool UIGuestControlInterface::handleCreate(int argc, char** argv)
     256bool UIGuestControlInterface::handleCreateSession(int argc, char** argv)
    243257{
    244258    CommandData commandData;
     
    298312void UIGuestControlInterface::prepareSubCommandHandlers()
    299313{
    300     m_subCommandHandlers.insert("create" , &UIGuestControlInterface::handleCreate);
     314    m_subCommandHandlers.insert("createsession" , &UIGuestControlInterface::handleCreateSession);
    301315    m_subCommandHandlers.insert("start", &UIGuestControlInterface::handleStart);
    302316    m_subCommandHandlers.insert("help" , &UIGuestControlInterface::handleHelp);
     317    m_subCommandHandlers.insert("mkdir" , &UIGuestControlInterface::handleMkdir);
    303318}
    304319
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.h

    r71025 r71067  
    3030class UIGuestControlSubCommandBase;
    3131class CommandData;
     32
     33/** UIGuestControlInterface parses a command string and  issues API calls
     34    accordingly to achive guest control related operations */
    3235class UIGuestControlInterface : public QObject
    3336{
     
    6568    bool handleHelp(int, char**);
    6669    /* Handles the 'create' session command */
    67     bool handleCreate(int, char**);
    68 
     70    bool handleCreateSession(int, char**);
     71    /* Handles the 'mkdir' session command to create guest directories */
     72    bool handleMkdir(int, char**);
    6973
    7074    CGuest        m_comGuest;
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