Changeset 71067 in vbox
- Timestamp:
- Feb 20, 2018 9:50:35 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl
- Files:
-
- 2 edited
-
UIGuestControlInterface.cpp (modified) (12 diffs)
-
UIGuestControlInterface.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.cpp
r71051 r71067 93 93 { 94 94 public: 95 CommandData() 96 : m_bSessionIdGiven(false) 97 , m_bSessionNameGiven(false){} 95 98 QString m_strUserName; 96 99 QString m_strPassword; … … 99 102 ULONG m_uSessionId; 100 103 QString m_strDomain; 104 bool m_bSessionIdGiven; 105 bool m_bSessionNameGiven; 101 106 QVector<QString> m_arguments; 102 107 QVector<QString> m_environmentChanges; … … 106 111 :QObject(parent) 107 112 , 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" 110 114 " [--passwordfile <file> | --password <password>]\n" 111 115 "start [common-options]\n" … … 115 119 " [--ignore-operhaned-processes] [--profile]\n" 116 120 " -- <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" 118 125 ) 119 126 { 120 127 prepareSubCommandHandlers(); 128 } 129 130 bool UIGuestControlInterface::handleMkdir(int, char**) 131 { 132 return true; 121 133 } 122 134 … … 153 165 }; 154 166 155 bool sessionNameGiven = false;156 bool sessionIdGiven = false;157 158 167 int ch; 159 168 RTGETOPTUNION ValueUnion; … … 166 175 HANDLE_COMMON_OPTION_DEFS() 167 176 case GCTLCMD_COMMON_OPT_SESSION_NAME: 168 sessionNameGiven = true;177 commandData.m_bSessionNameGiven = true; 169 178 commandData.m_strSessionName = ValueUnion.psz; 170 179 break; 171 180 case GCTLCMD_COMMON_OPT_SESSION_ID: 172 sessionIdGiven = true;181 commandData.m_bSessionIdGiven = true; 173 182 commandData.m_uSessionId = ValueUnion.i32; 174 183 break; … … 183 192 } 184 193 } 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()) 187 201 { 188 202 emit sigOutputString(QString(m_strHelp).append("'Session Name' is not name valid\n")); … … 192 206 CGuestSession guestSession; 193 207 /* Check if sessionname and sessionid are both supplied */ 194 if ( sessionIdGiven && sessionNameGiven)208 if (commandData.m_bSessionIdGiven && commandData.m_bSessionNameGiven) 195 209 { 196 210 emit sigOutputString(QString(m_strHelp).append("Both 'Session Name' and 'Session Id' are supplied\n")); … … 198 212 } 199 213 /* 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) 201 215 { 202 216 if (!findSession(commandData.m_uSessionId, guestSession)) … … 207 221 } 208 222 /* 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) 210 224 { 211 225 if (!findSession(commandData.m_strSessionName, guestSession)) … … 240 254 } 241 255 242 bool UIGuestControlInterface::handleCreate (int argc, char** argv)256 bool UIGuestControlInterface::handleCreateSession(int argc, char** argv) 243 257 { 244 258 CommandData commandData; … … 298 312 void UIGuestControlInterface::prepareSubCommandHandlers() 299 313 { 300 m_subCommandHandlers.insert("create " , &UIGuestControlInterface::handleCreate);314 m_subCommandHandlers.insert("createsession" , &UIGuestControlInterface::handleCreateSession); 301 315 m_subCommandHandlers.insert("start", &UIGuestControlInterface::handleStart); 302 316 m_subCommandHandlers.insert("help" , &UIGuestControlInterface::handleHelp); 317 m_subCommandHandlers.insert("mkdir" , &UIGuestControlInterface::handleMkdir); 303 318 } 304 319 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.h
r71025 r71067 30 30 class UIGuestControlSubCommandBase; 31 31 class CommandData; 32 33 /** UIGuestControlInterface parses a command string and issues API calls 34 accordingly to achive guest control related operations */ 32 35 class UIGuestControlInterface : public QObject 33 36 { … … 65 68 bool handleHelp(int, char**); 66 69 /* 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**); 69 73 70 74 CGuest m_comGuest;
Note:
See TracChangeset
for help on using the changeset viewer.

